From e9e01081c7ae2f3213403b8a3d2d91ad19eb4a9e Mon Sep 17 00:00:00 2001 From: Rumble Date: Thu, 28 Dec 2006 02:20:41 +0000 Subject: [PATCH] removed redundant olc.c, olc.h and tedit.h files from the build. Added prototypes for the new variable save functions to players.c --- src/Makefile.in | 6 +- src/olc.c | 351 ------------------------------------------------ src/olc.h | 19 --- src/players.c | 2 + src/tedit.h | 3 - 5 files changed, 5 insertions(+), 376 deletions(-) delete mode 100644 src/olc.c delete mode 100644 src/olc.h delete mode 100644 src/tedit.h diff --git a/src/Makefile.in b/src/Makefile.in index 8e38869..7aed56d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -29,8 +29,8 @@ OBJFILES = act.comm.o act.informative.o act.item.o act.movement.o \ fight.o genmob.o genobj.o genolc.o genshp.o genwld.o genzon.o graph.o \ handler.o house.o improved-edit.o interpreter.o limits.o magic.o mail.o \ medit.o mobact.o modify.o oasis.o oasis_copy.o oasis_delete.o \ - oasis_list.o objsave.o oedit.o random.o redit.o sedit.o \ - shop.o spec_assign.o spec_procs.o spell_parser.o spells.o tedit.o \ + oasis_list.o objsave.o oedit.o random.o redit.o sedit.o tedit.o \ + shop.o spec_assign.o spec_procs.o spell_parser.o spells.o \ utils.o weather.o zedit.o bsd-snprintf.o \ dg_comm.o dg_db_scripts.o dg_event.o dg_handler.o dg_mobcmd.o \ dg_misc.o dg_objcmd.o dg_scripts.o dg_triggers.o dg_wldcmd.o dg_olc.o \ @@ -44,7 +44,7 @@ CXREF_FILES = act.comm.c act.informative.c act.item.c act.movement.c \ handler.c house.c improved-edit.c interpreter.c limits.c magic.c mail.c \ medit.c mobact.c modify.c oasis.c oasis_copy.o oasis_delete.c \ oasis_list.o objsave.c oedit.c random.c redit.c sedit.c \ - shop.c spec_assign.c spec_procs.c spell_parser.c spells.c tedit.c \ + shop.c spec_assign.c spec_procs.c spell_parser.c spells.c \ utils.c weather.c zedit.c hedit.c bsd-snprintf.c players.c default: all diff --git a/src/olc.c b/src/olc.c deleted file mode 100644 index af25f27..0000000 --- a/src/olc.c +++ /dev/null @@ -1,351 +0,0 @@ -/* ************************************************************************ -* File: olc.c Part of CircleMUD * -* Usage: online creation * -* * -* All rights reserved. See license.doc for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -************************************************************************ */ - -/* - * PLEASE, FOR THE LOVE OF GOD, DON'T TRY TO USE THIS YET!!! - * *** DO *** NOT *** SEND ME MAIL ASKING WHY IT DOESN'T WORK -- IT'S - * NOT DONE!! - */ - -#include "conf.h" -#include "sysdep.h" - -#include "structs.h" -#include "utils.h" -#include "comm.h" -#include "interpreter.h" -#include "handler.h" -#include "db.h" -#include "olc.h" - -/* OLC command format: - * - * olc {"." | {<"room"|"mobile"|"object"> }} - * olc {"set"|"show"} - */ - -#define OLC_USAGE "Usage: olc { . | set | show | obj | mob | room} [args]\r\n" - -/* local globals */ -struct char_data *olc_ch; - -/* local functions */ -void olc_interpreter(void *targ, int mode, char *arg); -void olc_set_show(struct char_data *ch, int olc_mode, char *arg); -void olc_string(char **string, size_t maxlen, char *arg); -int can_modify(struct char_data *ch, int vnum); -ACMD(do_olc); -void olc_bitvector(int *bv, const char **names, char *arg); - -const char *olc_modes[] = { - "set", /* set OLC characteristics */ - "show", /* show OLC characteristics */ - ".", /* repeat last modification command */ - "room", /* modify a room */ - "mobile", /* modify a mobile */ - "object", /* modify an object */ - "\n" -}; - -const char *olc_commands[] = { - "copy", - "name", - "description", - "aliases", - "\n", /* many more to be added */ -}; - - -/* The actual do_olc command for the interpreter. Determines the target - entity, checks permissions, and passes control to olc_interpreter */ -ACMD(do_olc) -{ - void *olc_targ = NULL; - char mode_arg[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH]; - room_rnum rnum; - room_vnum vnum = NOWHERE; - int olc_mode; - - /* WARNING! **DO NOT** under any circumstances remove the code below!!!! */ - if (strcmp(GET_NAME(ch), "Ras")) { - send_to_char(ch, "OLC is not yet complete. Sorry.\r\n"); - return; - } - /* WARNING! **DO NOT** under any circumstances remove the code above!!!! */ - - /* first, figure out the first (mode) argument */ - half_chop(argument, mode_arg, argument); - if ((olc_mode = search_block(mode_arg, olc_modes, FALSE)) < 0) { - send_to_char(ch, "Invalid mode '%s'.\r\n%s", mode_arg, OLC_USAGE); - return; - } - switch (olc_mode) { - case OLC_SET: - case OLC_SHOW: - olc_set_show(ch, olc_mode, argument); - return; - case OLC_REPEAT: - if (!(olc_mode = GET_LAST_OLC_MODE(ch)) || - ((olc_targ = GET_LAST_OLC_TARG(ch)) == NULL)) { - send_to_char(ch, "No last OLC operation!\r\n"); - return; - } - break; - case OLC_ROOM: - if (isdigit(*argument)) { - /* room specified. take the numeric argument off */ - argument = one_argument(argument, arg); - if (!is_number(arg)) { - send_to_char(ch, "Invalid room vnum '%s'.\r\n", arg); - return; - } - vnum = atoi(arg); - if ((rnum = real_room(vnum)) == NOWHERE) { - send_to_char(ch, "No such room!\r\n"); - return; - } - } else { - rnum = IN_ROOM(ch); - vnum = GET_ROOM_VNUM(IN_ROOM(ch)); - send_to_char(ch, "(Using current room %d)\r\n", vnum); - } - -/* if (!ROOM_FLAGGED(rnum, ROOM_OLC)) - send_to_char(ch, "That room is not modifyable.\r\n"); - else -*/ - olc_targ = (void *) &(world[rnum]); - break; - case OLC_MOB: - argument = one_argument(argument, arg); - if (!is_number(arg)) { - send_to_char(ch, "Invalid mob vnum '%s'.\r\n", arg); - return; - } - vnum = atoi(arg); - if ((rnum = real_mobile(vnum)) == NOBODY) - send_to_char(ch, "No such mobile vnum.\r\n"); - else - olc_targ = (void *) &(mob_proto[rnum]); - break; - case OLC_OBJ: - argument = one_argument(argument, arg); - if (!is_number(arg)) { - send_to_char(ch, "Invalid obj vnum '%s'\r\n", arg); - return; - } - vnum = atoi(arg); - if ((rnum = real_object(vnum)) == NOTHING) - send_to_char(ch, "No object with vnum %d.\r\n", vnum); - else - olc_targ = (void *) &(obj_proto[rnum]); - break; - default: - send_to_char(ch, "Usage: olc {.|set|show|obj|mob|room} [args]\r\n"); - return; - } - - if (olc_targ == NULL) - return; - - if (!can_modify(ch, vnum)) { - send_to_char(ch, "You can't modify that.\r\n"); - return; - } - GET_LAST_OLC_MODE(ch) = olc_mode; - GET_LAST_OLC_TARG(ch) = olc_targ; - - olc_ch = ch; - olc_interpreter(olc_targ, olc_mode, argument); - /* freshen? */ -} - - -/* OLC interpreter command; called by do_olc */ -void olc_interpreter(void *targ, int mode, char *arg) -{ - int error = 0, command; - char command_string[MAX_INPUT_LENGTH]; - struct char_data *olc_mob = NULL; - struct room_data *olc_room = NULL; - struct obj_data *olc_obj = NULL; - - half_chop(arg, command_string, arg); - if ((command = search_block(command_string, olc_commands, FALSE)) < 0) { - send_to_char(olc_ch, "Invalid OLC command '%s'.\r\n", command_string); - return; - } - switch (mode) { - case OLC_ROOM: - olc_room = (struct room_data *) targ; - break; - case OLC_MOB: - olc_mob = (struct char_data *) targ; - break; - case OLC_OBJ: - olc_obj = (struct obj_data *) targ; - break; - default: - log("SYSERR: Invalid OLC mode %d passed to interp.", mode); - return; - } - - - switch (command) { - case OLC_COPY: - switch (mode) { - case OLC_ROOM: - break; - case OLC_MOB: - break; - case OLC_OBJ: - break; - default: - error = 1; - break; - } - break; - case OLC_NAME: - switch (mode) { - case OLC_ROOM: - olc_string(&(olc_room->name), MAX_ROOM_NAME, arg); - break; - case OLC_MOB: - olc_string(&olc_mob->player.short_descr, MAX_MOB_NAME, arg); - break; - case OLC_OBJ: - olc_string(&olc_obj->short_description, MAX_OBJ_NAME, arg); - break; - default: - error = 1; - break; - } - break; - - case OLC_DESC: - switch (mode) { - case OLC_ROOM: - olc_string(&olc_room->description, MAX_ROOM_DESC, arg); - break; - case OLC_MOB: - olc_string(&olc_mob->player.long_descr, MAX_MOB_DESC, arg); - break; - case OLC_OBJ: - olc_string(&olc_obj->description, MAX_OBJ_DESC, arg); - break; - default: - error = 1; - break; - } - break; - - case OLC_ALIASES: - switch (mode) { - case OLC_ROOM: - break; - case OLC_MOB: - break; - case OLC_OBJ: - break; - default: - error = 1; - break; - } - - } -} - - -/* can_modify: determine if a particular char can modify a vnum */ -int can_modify(struct char_data *ch, int vnum) -{ - return (1); -} - - -/* generic fn for modifying a string */ -void olc_string(char **string, size_t maxlen, char *arg) -{ - skip_spaces(&arg); - - if (!*arg) { - send_to_char(olc_ch, "Enter new string (max of %d characters); use '@' on a new line when done.\r\n", (int) maxlen); - **string = '\0'; - string_write(olc_ch->desc, string, maxlen, 0, NULL); - } else { - if (strlen(arg) > maxlen) { - send_to_char(olc_ch, "String too long (cannot be more than %d chars).\r\n", (int) maxlen); - } else { - if (*string != NULL) - free(*string); - *string = strdup(arg); - send_to_char(olc_ch, "%s", CONFIG_OK); - } - } -} - - -/* generic fn for modifying a bitvector */ -void olc_bitvector(int *bv, const char **names, char *arg) -{ - int newbv, flagnum, doremove = 0; - char *this_name; - char buf[MAX_STRING_LENGTH]; - - skip_spaces(&arg); - - if (!*arg) { - send_to_char(olc_ch, "Flag list or flag modifiers required.\r\n"); - return; - } - /* determine if this is 'absolute' or 'relative' mode */ - if (*arg == '+' || *arg == '-') - newbv = *bv; - else - newbv = 0; - - while (*arg) { - arg = one_argument(arg, buf); /* get next argument */ - - /* change to upper-case */ - for (this_name = buf; *this_name; this_name++) - CAP(this_name); - - /* determine if this is an add or a subtract */ - if (*buf == '+' || *buf == '-') { - this_name = buf + 1; - if (*buf == '-') - doremove = TRUE; - else - doremove = FALSE; - } else { - this_name = buf; - doremove = FALSE; - } - - /* figure out which one we're dealing with */ - if ((flagnum = search_block(this_name, names, TRUE)) < 0) - send_to_char(olc_ch, "Unknown flag: %s\r\n", this_name); - else { - if (doremove) - REMOVE_BIT(newbv, (1 << flagnum)); - else - SET_BIT(newbv, (1 << flagnum)); - } - } - - *bv = newbv; - sprintbit(newbv, names, buf, sizeof(buf)); - send_to_char(olc_ch, "Flags now set to: %s\r\n", buf); -} - -void olc_set_show(struct char_data *ch, int olc_mode, char *arg) -{ -} diff --git a/src/olc.h b/src/olc.h deleted file mode 100644 index 1da08d3..0000000 --- a/src/olc.h +++ /dev/null @@ -1,19 +0,0 @@ -#define OLC_SET 0 -#define OLC_SHOW 1 -#define OLC_REPEAT 2 -#define OLC_ROOM 3 -#define OLC_MOB 4 -#define OLC_OBJ 5 - -#define OLC_COPY 0 -#define OLC_NAME 1 -#define OLC_DESC 2 -#define OLC_ALIASES 3 - - -#define MAX_ROOM_NAME 75 -#define MAX_MOB_NAME 50 -#define MAX_OBJ_NAME 50 -#define MAX_ROOM_DESC 1024 -#define MAX_MOB_DESC 512 -#define MAX_OBJ_DESC 512 diff --git a/src/players.c b/src/players.c index 1e4ab5b..cbdfa3a 100644 --- a/src/players.c +++ b/src/players.c @@ -37,6 +37,8 @@ bitvector_t asciiflag_conv(char *flag); void save_char_vars(struct char_data *ch); void write_aliases_ascii(FILE *file, struct char_data *ch); void read_aliases_ascii(FILE *file, struct char_data *ch, int count); +void save_char_vars_ascii(FILE *file, struct char_data *ch); +void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count); /* 'global' vars */ struct player_index_element *player_table = NULL; /* index to plr file */ diff --git a/src/tedit.h b/src/tedit.h deleted file mode 100644 index 08214e2..0000000 --- a/src/tedit.h +++ /dev/null @@ -1,3 +0,0 @@ -ACMD(do_tedit); -void tedit_string_cleanup(struct descriptor_data *d, int terminator); -