diff --git a/lib/world/qst/0.qst b/lib/world/qst/0.qst new file mode 100644 index 0000000..1dec3de --- /dev/null +++ b/lib/world/qst/0.qst @@ -0,0 +1,14 @@ +#0 +Undefined~ +Quest definition is incomplete.~ +There is no information on this quest. +~ +You have completed the quest. +~ +You have abandoned the quest. +~ +-1 -1 0 -1 -1 -1 -1 +0 0 0 34 -1 -1 1 +0 0 65535 +S +$~ diff --git a/lib/world/qst/index b/lib/world/qst/index new file mode 100644 index 0000000..b6b68da --- /dev/null +++ b/lib/world/qst/index @@ -0,0 +1,2 @@ +0.qst +$ diff --git a/lib/world/qst/index.mini b/lib/world/qst/index.mini new file mode 100644 index 0000000..b6b68da --- /dev/null +++ b/lib/world/qst/index.mini @@ -0,0 +1,2 @@ +0.qst +$ diff --git a/src/Makefile.amiga b/src/Makefile.amiga index 483332a..d4fe8f5 100644 --- a/src/Makefile.amiga +++ b/src/Makefile.amiga @@ -24,7 +24,7 @@ OBJFILES = comm.o act.comm.o act.informative.o act.movement.o act.item.o \ castle.o class.o config.o constants.o db.o fight.o graph.o handler.o \ house.o interpreter.o limits.o magic.o mail.o mobact.o modify.o \ objsave.o shop.o spec_assign.o spec_procs.o spell_parser.o \ - spells.o utils.o weather.o players.o + spells.o utils.o weather.o players.o quest.o qedit.o genqst.o default: .accepted $(MAKE) ../bin/circle @@ -192,3 +192,12 @@ utils.o: utils.c conf.h sysdep.h structs.h utils.h comm.h screen.h spells.h \ weather.o: weather.c conf.h sysdep.h structs.h utils.h comm.h handler.h \ interpreter.h db.h $(CC) -c $(CFLAGS) weather.c +quest.o: quest.c conf.h sysdep.h structs.h utils.h interpreter.h handler.h \ + comm.h db.h screen.h quest.h + $(CC) -c $(CFLAGS) quest.c +qedit.o: qedit.c conf.h sysdep.h structs.h utils.h comm.h db.h oasis.h \ + improved-edit.h screen.h genolc.h genzon.h interpreter.h quest.h + $(CC) -c $(CFLAGS) qedit.c +genqst.o: genqst.c conf.h sysdep.h structs.h utils.h db.h quest.h \ + genolc.h genzon.h + $(CC) -c $(CFLAGS) genqst.c diff --git a/src/Makefile.arc b/src/Makefile.arc index 01d2cda..29c1c61 100644 --- a/src/Makefile.arc +++ b/src/Makefile.arc @@ -26,7 +26,7 @@ OBJFILES = o.comm act.o.comm act.o.informative act.o.movement act.o.item \ o.castle o.class o.config o.constants o.db o.fight o.graph o.handler \ o.house o.interpreter o.limits o.magic o.mail o.mobact o.modify \ o.objsave o.random o.shop o.spec_assign o.spec_procs \ - o.spell_parser o.spells o.utils o.weather o.players + o.spell_parser o.spells o.utils o.weather o.players o.quest o.qedit o.genqst default: all @@ -153,3 +153,15 @@ o.utils: c.utils h.conf h.sysdep h.structs h.utils h.comm h.screen h.spells \ o.weather: c.weather h.conf h.sysdep h.structs h.utils h.comm h.handler \ h.interpreter h.db $(CC) -c $(CFLAGS) c.weather +o.players: c.players h.conf h.sysdep h.structs h.utils h.db h.handler \ + h.pfdefaults h.dg_scripts h.comm h.interpreter h.genolc h.config h.spells + $(CC) -c $(CFLAGS) c.players +o.quest: c.quest h.conf h.sysdep h.structs h.utils h.interpreter h.handler \ + h.comm h.db h.screen h.quest + $(CC) -c $(CFLAGS) quest.c +o.qedit: c.qedit h.conf h.sysdep h.structs h.utils h.comm h.db h.oasis \ + h.improved-edit h.screen h.genolc h.genzon h.interpreter h.quest + $(CC) -c $(CFLAGS) qedit.c +o.genqst: c.genqst h.conf h.sysdep h.structs h.utils h.db h.quest \ + h.genolc h.genzon + $(CC) -c $(CFLAGS) genqst.c diff --git a/src/Makefile.bcc b/src/Makefile.bcc index 7486e24..d5b6493 100644 --- a/src/Makefile.bcc +++ b/src/Makefile.bcc @@ -78,7 +78,10 @@ Dep_circledexe = \ spec_procs.obj\ spec_assign.obj\ utils.obj\ - weather.obj + weather.obj\ + quest.obj\ + qedit.obj\ + genqst.obj circle.exe : $(Dep_circledexe) $(TLINK32) @&&| @@ -119,7 +122,10 @@ spell_parser.obj+ spec_procs.obj+ spec_assign.obj+ utils.obj+ -weather.obj +weather.obj+ +quest.obj+ +qedit.obj+ +genqst.obj $<,$* C:\BC5\LIB\bidsfi.lib+ C:\BC5\LIB\import32.lib+ @@ -306,6 +312,21 @@ weather.obj : weather.c $(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ weather.c | +quest.obj : quest.c + $(BCC32) -P- -c @&&| + $(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ quest.c +| + +qedit.obj : qedit.c + $(BCC32) -P- -c @&&| + $(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ qedit.c +| + +genqst.obj : genqst.c + $(BCC32) -P- -c @&&| + $(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ genqst.c +| + # Compiler configuration file BccW32.cfg : Copy &&| diff --git a/src/Makefile.bcc55 b/src/Makefile.bcc55 index f5cca7e..9d16c19 100644 --- a/src/Makefile.bcc55 +++ b/src/Makefile.bcc55 @@ -79,7 +79,10 @@ Dep_circledexe = \ spec_procs.obj\ spec_assign.obj\ utils.obj\ - weather.obj + weather.obj\ + quest.obj\ + qedit.obj\ + genqst.obj circle.exe : $(Dep_circledexe) $(TLINK32) @&&| @@ -120,7 +123,10 @@ spell_parser.obj+ spec_procs.obj+ spec_assign.obj+ utils.obj+ -weather.obj +weather.obj+ +quest.obj+ +qedit.obj+ +genqst.obj $<,$* C:\BORLAND\BCC55\LIB\import32.lib+ C:\BORLAND\BCC55\LIB\cw32i.lib @@ -306,6 +312,21 @@ weather.obj : weather.c $(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ weather.c | +quest.obj : quest.c + $(BCC32) -P- -c @&&| + $(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ quest.c +| + +qedit.obj : qedit.c + $(BCC32) -P- -c @&&| + $(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ qedit.c +| + +genqst.obj : genqst.c + $(BCC32) -P- -c @&&| + $(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ genqst.c +| + # Compiler configuration file BccW32.cfg : Copy &&| diff --git a/src/Makefile.in b/src/Makefile.in index 4b8e1f5..de4f225 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,12 +1,9 @@ -# CircleMUD Makefile.in - Makefile template used by 'configure' -# +# tbaMUD Makefile.in - Makefile template used by 'configure' +# Clean-up provided by seqwith. # C compiler to use CC = @CC@ -# Path to cxref utility -CXREF = cxref - # Any special flags you want to pass to the compiler MYFLAGS = @MYFLAGS@ @@ -23,31 +20,8 @@ CFLAGS = @CFLAGS@ $(MYFLAGS) $(PROFILE) LIBS = @LIBS@ @CRYPTLIB@ @NETLIB@ -OBJFILES = act.comm.o act.informative.o act.item.o act.movement.o \ - act.offensive.o act.other.o act.social.o act.wizard.o aedit.o \ - ban.o boards.o bsd-snprintf.o castle.o cedit.o class.o comm.o config.o \ - constants.o db.o dg_comm.o dg_db_scripts.o dg_event.o \ - dg_handler.o dg_misc.o dg_mobcmd.o dg_objcmd.o dg_olc.o dg_scripts.o \ - dg_triggers.o dg_variables.o dg_wldcmd.o fight.o genmob.o \ - genobj.o genolc.o genshp.o genwld.o genzon.o graph.o handler.o hedit.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 players.o random.o redit.o sedit.o shop.o \ - spec_assign.o spec_procs.o spell_parser.o spells.o tedit.o utils.o \ - weather.o zedit.o zmalloc.o - -CXREF_FILES = act.comm.c act.informative.c act.item.c act.movement.c \ - act.offensive.c act.other.c act.social.c act.wizard.c aedit.c \ - ban.c boards.c bsd-snprintf.c castle.c cedit.c class.c comm.c config.c \ - constants.c db.c dg_comm.c dg_db_scripts.c dg_event.c \ - dg_handler.c dg_misc.c dg_mobcmd.c dg_objcmd.c dg_olc.c dg_scripts.c \ - dg_triggers.c dg_variables.c dg_wldcmd.c fight.c genmob.c \ - genobj.c genolc.c genshp.c genwld.c genzon.c graph.c handler.c hedit.c \ - house.c improved-edit.c interpreter.c limits.c magic.c mail.c medit.c \ - mobact.c modify.c oasis.c oasis_copy.c oasis_delete.c oasis_list.c \ - objsave.c oedit.c players.c random.c redit.c sedit.c shop.c \ - spec_assign.c spec_procs.c spell_parser.c spells.c tedit.c utils.c \ - weather.c zedit.c zmalloc.c +SRCFILES := $(wildcard *.c) +OBJFILES := $(patsubst %.c,%.o,$(SRCFILES)) default: all @@ -60,48 +34,18 @@ all: .accepted utils: .accepted (cd util; $(MAKE) all) + circle: $(MAKE) $(BINDIR)/circle $(BINDIR)/circle : $(OBJFILES) $(CC) -o $(BINDIR)/circle $(PROFILE) $(OBJFILES) $(LIBS) +$%.o: %.c + $(CC) $< $(CFLAGS) -c -o $@ + clean: - rm -f *.o -ref: -# -# Create the cross reference files -# Note, this is not meant to be used unless you've installed cxref... -# - @for file in $(CXREF_FILES) ; do \ - echo Cross referencing $$file ; \ - $(CXREF) -D__CXREF__ -xref -Odoc -Ncircle $$file ; \ - done -# -# Create the source files using cxref -# - @for file in $(CXREF_FILES) ; do \ - echo Documenting $$file ; \ - ( cd . ; $(CXREF) -D__CXREF__ -warn-xref -xref -Odoc -Ncircle -html $$file ) ; \ - rm -f $(DOCS) ; \ - done -# -# Create the index using cxref -# - @echo Indexing - @( cd . ; $(CXREF) -D__CXREF__ -index-all -Odoc -Ncircle -html ) - @rm -f $(DOCS) -# -# Make html files for the .h files -# - @echo Creating .h.html files... - @for file in *.h ; do \ - echo $$file ; \ - cat htmlh-head $$file htmlh-tail > doc/$$file.html ; \ - done -# Copy over to the html directory - #cp doc/*.html $(HOME)/www/cxref - #chmod 644 $(HOME)/www/cxref/*.html + rm -f *.o depend # Dependencies for the object files (automagically generated with # gcc -MM) diff --git a/src/Makefile.lcc b/src/Makefile.lcc index 64eb015..f2d4df8 100644 --- a/src/Makefile.lcc +++ b/src/Makefile.lcc @@ -16,6 +16,9 @@ DISTDIR=c:\circle CFLAGS=-c -I$(LCCDIR)\include -DLCC_WIN32 CC=lcc OBJS=\ + genqst.obj \ + qedit.obj \ + quest.obj \ weather.obj \ utils.obj \ spells.obj \ @@ -58,6 +61,52 @@ LIBS=$(LCCDIR)\lib\wsock32.lib circle.exe: $(OBJS) lcclnk -subsystem console -o $(DISTDIR)\bin\circle.exe $(OBJS) $(LIBS) +# Build GENQST.C +GENQST_C=\ + $(DISTDIR)\src\sysdep.h\ + $(DISTDIR)\src\structs.h\ + $(DISTDIR)\src\utils.h\ + $(DISTDIR)\src\genolc.h\ + $(DISTDIR)\src\genzon.h\ + $(DISTDIR)\src\quest.h\ + $(DISTDIR)\src\db.h\ + +genqst.obj: $(GENQST_C) $(DISTDIR)\src\genqst.c + $(CC) $(CFLAGS) $(DISTDIR)\src\genqst.c + +# Build QEDIT.C +QEDIT_C=\ + $(DISTDIR)\src\sysdep.h\ + $(DISTDIR)\src\structs.h\ + $(DISTDIR)\src\utils.h\ + $(DISTDIR)\src\comm.h\ + $(DISTDIR)\src\db.h\ + $(DISTDIR)\src\oasis.h\ + $(DISTDIR)\src\improved-edit.h\ + $(DISTDIR)\src\screen.h\ + $(DISTDIR)\src\genolc.h\ + $(DISTDIR)\src\genzon.h\ + $(DISTDIR)\src\interpreter.h\ + $(DISTDIR)\src\quest.h\ + +qedit.obj: $(QEDIT_C) $(DISTDIR)\src\qedit.c + $(CC) $(CFLAGS) $(DISTDIR)\src\qedit.c + +# Build QUEST.C +QUEST_C=\ + $(DISTDIR)\src\sysdep.h\ + $(DISTDIR)\src\structs.h\ + $(DISTDIR)\src\utils.h\ + $(DISTDIR)\src\comm.h\ + $(DISTDIR)\src\handler.h\ + $(DISTDIR)\src\interpreter.h\ + $(DISTDIR)\src\db.h\ + $(DISTDIR)\src\screen.h\ + $(DISTDIR)\src\quest.h\ + +quest.obj: $(QUEST_C) $(DISTDIR)\src\quest.c + $(CC) $(CFLAGS) $(DISTDIR)\src\quest.c + # Build WEATHER.C WEATHER_C=\ $(DISTDIR)\src\sysdep.h\ diff --git a/src/Makefile.msvc b/src/Makefile.msvc index 9cc38e2..cc48b2b 100644 --- a/src/Makefile.msvc +++ b/src/Makefile.msvc @@ -40,7 +40,7 @@ OBJFILES = comm.obj act.comm.obj act.informative.obj act.movement.obj act.item.o castle.obj class.obj config.obj constants.obj db.obj fight.obj graph.obj handler.obj \ house.obj interpreter.obj limits.obj magic.obj mail.obj mobact.obj modify.obj \ objsave.obj shop.obj spec_assign.obj spec_procs.obj spell_parser.obj \ - spells.obj utils.obj weather.obj random.obj players.obj + spells.obj utils.obj weather.obj random.obj players.obj quest.obj qedit.obj genqst.obj default: circle.exe $(MAKE) circle.exe @@ -153,3 +153,12 @@ utils.obj: utils.c conf.h sysdep.h structs.h utils.h comm.h screen.h spells.h \ weather.obj: weather.c conf.h sysdep.h structs.h utils.h comm.h handler.h \ interpreter.h db.h $(CC) -c $(CFLAGS) weather.c +quest.obj: quest.c conf.h sysdep.h structs.h utils.h interpreter.h handler.h \ + comm.h db.h screen.h quest.h + $(CC) -c $(CFLAGS) quest.c +qedit.obj: qedit.c conf.h sysdep.h structs.h utils.h comm.h db.h oasis.h \ + improved-edit.h screen.h genolc.h genzon.h interpreter.h quest.h + $(CC) -c $(CFLAGS) qedit.c +genqst.obj: genqst.c conf.h sysdep.h structs.h utils.h db.h quest.h \ + genolc.h genzon.h + $(CC) -c $(CFLAGS) genqst.c diff --git a/src/Makefile.os2 b/src/Makefile.os2 index 88ebcf7..765d057 100644 --- a/src/Makefile.os2 +++ b/src/Makefile.os2 @@ -26,7 +26,7 @@ OBJFILES = comm.o act.comm.o act.informative.o act.movement.o act.item.o \ castle.o class.o config.o constants.o db.o fight.o graph.o handler.o \ house.o interpreter.o limits.o magic.o mail.o mobact.o modify.o \ objsave.o shop.o spec_assign.o spec_procs.o spell_parser.o \ - spells.o utils.o weather.o random.o players.o + spells.o utils.o weather.o random.o players.o quest.o qedit.o genqst.o default: .accepted $(MAKE) ../bin/circle @@ -194,3 +194,12 @@ utils.o: utils.c conf.h sysdep.h structs.h utils.h comm.h screen.h spells.h \ weather.o: weather.c conf.h sysdep.h structs.h utils.h comm.h handler.h \ interpreter.h db.h $(CC) -c $(CFLAGS) weather.c +quest.obj: quest.c conf.h sysdep.h structs.h utils.h interpreter.h handler.h \ + comm.h db.h screen.h quest.h + $(CC) -c $(CFLAGS) quest.c +qedit.obj: qedit.c conf.h sysdep.h structs.h utils.h comm.h db.h oasis.h \ + improved-edit.h screen.h genolc.h genzon.h interpreter.h quest.h + $(CC) -c $(CFLAGS) qedit.c +genqst.obj: genqst.c conf.h sysdep.h structs.h utils.h db.h quest.h \ + genolc.h genzon.h + $(CC) -c $(CFLAGS) genqst.c diff --git a/src/act.comm.c b/src/act.comm.c index d7b1150..48b2e6c 100644 --- a/src/act.comm.c +++ b/src/act.comm.c @@ -19,22 +19,13 @@ #include "screen.h" #include "improved-edit.h" #include "dg_scripts.h" +#include "act.h" +#include "modify.h" -/* local functions */ -void perform_tell(struct char_data *ch, struct char_data *vict, char *arg); -int is_tell_ok(struct char_data *ch, struct char_data *vict); -ACMD(do_say); -ACMD(do_gsay); -ACMD(do_tell); -ACMD(do_reply); -ACMD(do_spec_comm); -ACMD(do_write); -ACMD(do_page); -ACMD(do_gen_comm); -ACMD(do_qcomm); -void handle_webster_file(void); - -static long last_webster_teller = -1L; +/* prototypes of local functions */ +/* do_tell utility functions */ +static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg); +static int is_tell_ok(struct char_data *ch, struct char_data *vict); ACMD(do_say) { @@ -102,7 +93,7 @@ ACMD(do_gsay) } } -void perform_tell(struct char_data *ch, struct char_data *vict, char *arg) +static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg) { char buf[MAX_STRING_LENGTH], *msg; @@ -122,7 +113,7 @@ void perform_tell(struct char_data *ch, struct char_data *vict, char *arg) GET_LAST_TELL(vict) = GET_IDNUM(ch); } -int is_tell_ok(struct char_data *ch, struct char_data *vict) +static int is_tell_ok(struct char_data *ch, struct char_data *vict) { if (ch == vict) send_to_char(ch, "You try to tell yourself something.\r\n"); @@ -471,7 +462,6 @@ ACMD(do_gen_comm) } if (subcmd == SCMD_GEMOTE) { - ACMD(do_gmote); if (*argument == '*') do_gmote(ch, argument + 1, 0, 1); else @@ -580,40 +570,3 @@ ACMD(do_qcomm) } } -void handle_webster_file(void) { - FILE *fl; - struct char_data *ch = find_char(last_webster_teller); - char info[MAX_STRING_LENGTH], line[READ_SIZE]; - size_t len = 0, nlen = 0; - - last_webster_teller = -1L; - - if (!ch) /* they quit ? */ - return; - - fl = fopen("websterinfo", "r"); - if (!fl) { - send_to_char(ch, "It seems Merriam-Webster is offline..\r\n"); - return; - } - - unlink("websterinfo"); - - get_line(fl, line); - while (!feof(fl)) { - nlen = snprintf(info + len, sizeof(info) - len, "%s\r\n", line); - if (len + nlen >= sizeof(info) || nlen < 0) - break; - len += nlen; - get_line(fl, line); - } - - if (len >= sizeof(info)) { - const char *overflow = "\r\n**OVERFLOW**\r\n"; - strcpy(info + sizeof(info) - strlen(overflow) - 1, overflow); /* strcpy: OK */ - } - fclose(fl); - - send_to_char(ch, "You get this feedback from Merriam-Webster:\r\n"); - page_string(ch->desc, info, 1); -} diff --git a/src/act.informative.c b/src/act.informative.c index 5858731..88aa22f 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -20,83 +20,41 @@ #include "screen.h" #include "constants.h" #include "dg_scripts.h" +#include "mail.h" /**< For the has_mail function */ +#include "act.h" +#include "class.h" +#include "fight.h" +#include "modify.h" +#include "asciimap.h" -/* extern variables */ -extern int top_of_helpt; -extern struct help_index_element *help_table; -extern char *help; -extern char *ihelp; -extern struct time_info_data time_info; -extern char *credits; -extern char *news; -extern char *info; -extern char *motd; -extern char *imotd; -extern char *wizlist; -extern char *immlist; -extern char *policies; -extern char *handbook; -extern char *class_abbrevs[]; - -/* extern functions */ -ACMD(do_action); -bitvector_t find_class_bitvector(const char *arg); -int level_exp(int chclass, int level); -char *title_male(int chclass, int level); -char *title_female(int chclass, int level); -struct time_info_data *real_time_passed(time_t t2, time_t t1); -int compute_armor_class(struct char_data *ch); -int has_mail(long id); - -/* local functions */ -int sort_commands_helper(const void *a, const void *b); -void print_object_location(int num, struct obj_data *obj, struct char_data *ch, int recur); -void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode); -void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show); -void show_obj_modifiers(struct obj_data *obj, struct char_data *ch); -ACMD(do_look); -ACMD(do_examine); -ACMD(do_gold); -ACMD(do_score); -ACMD(do_inventory); -ACMD(do_equipment); -ACMD(do_time); -ACMD(do_weather); -void space_to_minus(char *str); -ACMD(do_help); -ACMD(do_who); -ACMD(do_users); -ACMD(do_gen_ps); -void perform_mortal_where(struct char_data *ch, char *arg); -void perform_immort_where(struct char_data *ch, char *arg); -ACMD(do_where); -ACMD(do_levels); -ACMD(do_consider); -ACMD(do_diagnose); -ACMD(do_color); -ACMD(do_toggle); -void sort_commands(void); -ACMD(do_commands); -void diag_char_to_char(struct char_data *i, struct char_data *ch); -void look_at_char(struct char_data *i, struct char_data *ch); -void list_one_char(struct char_data *i, struct char_data *ch); -void list_char_to_char(struct char_data *list, struct char_data *ch); -void do_auto_exits(struct char_data *ch); -ACMD(do_exits); -void look_in_direction(struct char_data *ch, int dir); -void look_in_obj(struct char_data *ch, char *arg); -char *find_exdesc(char *word, struct extra_descr_data *list); -void look_at_target(struct char_data *ch, char *arg); - -/* local globals */ -int *cmd_sort_info; +/* prototypes of local functions */ +/* do_diagnose utility functions */ +static void diag_char_to_char(struct char_data *i, struct char_data *ch); +/* do_look and do_examine utility functions */ +static void do_auto_exits(struct char_data *ch); +static void list_char_to_char(struct char_data *list, struct char_data *ch); +static void list_one_char(struct char_data *i, struct char_data *ch); +static void look_at_char(struct char_data *i, struct char_data *ch); +static void look_at_target(struct char_data *ch, char *arg); +static void look_in_direction(struct char_data *ch, int dir); +static void look_in_obj(struct char_data *ch, char *arg); +/* do_look, do_inventory utility functions */ +static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show); +/* do_look, do_equipment, do_examine, do_inventory */ +static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode); +static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch); +/* do_where utility functions */ +static void perform_immort_where(struct char_data *ch, char *arg); +static void perform_mortal_where(struct char_data *ch, char *arg); +static void print_object_location(int num, struct obj_data *obj, struct char_data *ch, int recur); +/* Subcommands */ /* For show_obj_to_char 'mode'. /-- arbitrary */ -#define SHOW_OBJ_LONG 0 -#define SHOW_OBJ_SHORT 1 -#define SHOW_OBJ_ACTION 2 +#define SHOW_OBJ_LONG 0 +#define SHOW_OBJ_SHORT 1 +#define SHOW_OBJ_ACTION 2 -void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode) +static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode) { int found = 0; struct char_data *temp; @@ -194,7 +152,7 @@ void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode) send_to_char(ch, "\r\n"); } -void show_obj_modifiers(struct obj_data *obj, struct char_data *ch) +static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch) { if (OBJ_FLAGGED(obj, ITEM_INVISIBLE)) send_to_char(ch, " (invisible)"); @@ -212,7 +170,7 @@ void show_obj_modifiers(struct obj_data *obj, struct char_data *ch) send_to_char(ch, " ..It emits a faint humming sound!"); } -void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show) +static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show) { struct obj_data *i, *j; bool found; @@ -244,7 +202,7 @@ void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int send_to_char(ch, " Nothing.\r\n"); } -void diag_char_to_char(struct char_data *i, struct char_data *ch) +static void diag_char_to_char(struct char_data *i, struct char_data *ch) { struct { byte percent; @@ -274,7 +232,7 @@ void diag_char_to_char(struct char_data *i, struct char_data *ch) send_to_char(ch, "%c%s %s\r\n", UPPER(*pers), pers + 1, diagnosis[ar_index].text); } -void look_at_char(struct char_data *i, struct char_data *ch) +static void look_at_char(struct char_data *i, struct char_data *ch) { int j, found; struct obj_data *tmp_obj; @@ -318,7 +276,7 @@ void look_at_char(struct char_data *i, struct char_data *ch) } } -void list_one_char(struct char_data *i, struct char_data *ch) +static void list_one_char(struct char_data *i, struct char_data *ch) { struct obj_data *furniture; const char *positions[] = { @@ -417,7 +375,7 @@ void list_one_char(struct char_data *i, struct char_data *ch) act("...$e glows with a bright light!", FALSE, i, 0, ch, TO_VICT); } -void list_char_to_char(struct char_data *list, struct char_data *ch) +static void list_char_to_char(struct char_data *list, struct char_data *ch) { struct char_data *i; @@ -437,7 +395,7 @@ void list_char_to_char(struct char_data *list, struct char_data *ch) } } -void do_auto_exits(struct char_data *ch) +static void do_auto_exits(struct char_data *ch) { int door, slen = 0; @@ -529,7 +487,16 @@ void look_at_room(struct char_data *ch, int ignore_brief) if ((!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_BRIEF)) || ignore_brief || ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH)) + { + if(!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOMAP) && can_see_map(ch)) + { + str_and_map(world[IN_ROOM(ch)].description, ch); + } + else + { send_to_char(ch, "%s", world[IN_ROOM(ch)].description); + } + } /* autoexits */ if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOEXIT)) @@ -540,7 +507,7 @@ void look_at_room(struct char_data *ch, int ignore_brief) list_char_to_char(world[IN_ROOM(ch)].people, ch); } -void look_in_direction(struct char_data *ch, int dir) +static void look_in_direction(struct char_data *ch, int dir) { if (EXIT(ch, dir)) { if (EXIT(ch, dir)->general_description) @@ -556,7 +523,7 @@ void look_in_direction(struct char_data *ch, int dir) send_to_char(ch, "Nothing special there...\r\n"); } -void look_in_obj(struct char_data *ch, char *arg) +static void look_in_obj(struct char_data *ch, char *arg) { struct obj_data *obj = NULL; struct char_data *dummy = NULL; @@ -629,7 +596,7 @@ char *find_exdesc(char *word, struct extra_descr_data *list) * matches the target. First, see if there is another char in the room with * the name. Then check local objs for exdescs. Thanks to Angus Mezick for * the suggested fix to this problem. */ -void look_at_target(struct char_data *ch, char *arg) +static void look_at_target(struct char_data *ch, char *arg) { int bits, found = FALSE, j, fnum, i = 0; struct char_data *found_char = NULL; @@ -827,6 +794,16 @@ ACMD(do_score) send_to_char(ch, "You need %d exp to reach your next level.\r\n", level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1) - GET_EXP(ch)); + send_to_char(ch, "You have earned %d quest points.\r\n", GET_QUESTPOINTS(ch)); + send_to_char(ch, "You have completed %d quest%s, ", + GET_NUM_QUESTS(ch), + GET_NUM_QUESTS(ch) == 1 ? "" : "s"); + if (GET_QUEST(ch) == NOTHING) + send_to_char(ch, "and you are not on a quest at the moment.\r\n"); + else + send_to_char(ch, "and your current quest is %d.\r\n", + GET_QUEST(ch) == NOTHING ? -1 : GET_QUEST(ch)); + playing_time = *real_time_passed((time(0) - ch->player.time.logon) + ch->player.time.played, 0); send_to_char(ch, "You have been playing for %d day%s and %d hour%s.\r\n", @@ -1040,7 +1017,7 @@ int search_help(char *argument, int level) while (level < help_table[mid].min_level && mid < (bot + top) / 2) mid++; -//to allow morts access to helpfiles on TBA, delete next line. if (strn_cmp(argument, help_table[mid].keywords, minlen) || level < help_table[mid].min_level) +// if (strn_cmp(argument, help_table[mid].keywords, minlen) || level < help_table[mid].min_level) if (strn_cmp(argument, help_table[mid].keywords, minlen)) break; @@ -1057,7 +1034,8 @@ int search_help(char *argument, int level) ACMD(do_help) { int mid = 0; - + int i, found = 0; + if (!ch->desc) return; @@ -1079,7 +1057,6 @@ ACMD(do_help) space_to_minus(argument); if ((mid = search_help(argument, GET_LEVEL(ch))) == NOWHERE) { - int i, found = 0; send_to_char(ch, "There is no help on that word.\r\n"); mudlog(NRM, MAX(LVL_IMPL, GET_INVIS_LEV(ch)), TRUE, "%s tried to get help on %s", GET_NAME(ch), argument); @@ -1543,7 +1520,7 @@ ACMD(do_gen_ps) } } -void perform_mortal_where(struct char_data *ch, char *arg) +static void perform_mortal_where(struct char_data *ch, char *arg) { struct char_data *i; struct descriptor_data *d; @@ -1576,7 +1553,7 @@ void perform_mortal_where(struct char_data *ch, char *arg) } } -void print_object_location(int num, struct obj_data *obj, struct char_data *ch, +static void print_object_location(int num, struct obj_data *obj, struct char_data *ch, int recur) { if (num > 0) @@ -1605,7 +1582,7 @@ void print_object_location(int num, struct obj_data *obj, struct char_data *ch, send_to_char(ch, "in an unknown location\r\n"); } -void perform_immort_where(struct char_data *ch, char *arg) +static void perform_immort_where(struct char_data *ch, char *arg) { struct char_data *i; struct obj_data *k; @@ -1664,17 +1641,50 @@ ACMD(do_where) ACMD(do_levels) { - char buf[MAX_STRING_LENGTH]; + char buf[MAX_STRING_LENGTH], arg[MAX_STRING_LENGTH]; size_t i, len = 0, nlen; + int ret, min_lev=1, max_lev=LVL_IMMORT, val; if (IS_NPC(ch)) { send_to_char(ch, "You ain't nothin' but a hound-dog.\r\n"); return; } + one_argument(argument, arg); - for (i = 1; i < LVL_IMMORT; i++) { - nlen = snprintf(buf + len, sizeof(buf) - len, "[%2d] %8d-%-8d : ", i, - level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i + 1) - 1); + if (arg && *arg) { + if (isdigit(*arg)) { + ret = sscanf(arg, "%d-%d", &min_lev, &max_lev); + if (ret == 0) { + /* No valid args found */ + min_lev = 1; + max_lev = LVL_IMMORT; + } + else if (ret == 1) { + /* One arg = range is (num) either side of current level */ + val = min_lev; + max_lev = MIN(GET_LEVEL(ch) + val, LVL_IMMORT); + min_lev = MAX(GET_LEVEL(ch) - val, 1); + } + else if (ret == 2) { + /* Two args = min-max range limit - just do sanity checks */ + min_lev = MAX(min_lev, 1); + max_lev = MIN(max_lev + 1, LVL_IMMORT); + } + } + else + { + send_to_char(ch, "Usage: %slevels [- | ]%s\r\n\r\n", QYEL, QNRM); + send_to_char(ch, "Displays exp required for levels.\r\n"); + send_to_char(ch, "%slevels %s- shows all levels (1-%d)\r\n", QCYN, QNRM, (LVL_IMMORT-1)); + send_to_char(ch, "%slevels 5 %s- shows 5 levels either side of your current level\r\n", QCYN, QNRM); + send_to_char(ch, "%slevels 10-40 %s- shows level 10 to level 40\r\n",QCYN, QNRM); + return; + } + } + + for (i = min_lev; i < max_lev; i++) { + nlen = snprintf(buf + len, sizeof(buf) - len, "[%2d] %8d-%-8d : ", (int)i, + level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i + 1) - 1); if (len + nlen >= sizeof(buf) || nlen < 0) break; len += nlen; @@ -1860,6 +1870,10 @@ ACMD(do_toggle) {"autoassist", PRF_AUTOASSIST, 0, "Autoassist disabled.\r\n", "Autoassist enabled.\r\n"}, + {"screenwidth", 0, 0, "\n", "\n"}, + {"automap", PRF_AUTOMAP, 0, + "You will no longer see the mini-map.\r\n", + "You will now see a mini-map at the side of room descriptions.\r\n"}, {"\n", 0, -1, "\n", "\n"} /* must be last */ }; @@ -1931,9 +1945,12 @@ ACMD(do_toggle) " AutoSac: %-3s " " AutoAssist: %-3s " - " AFK: %-3s\r\n" + " AutoMap: %-3s\r\n" " Pagelength: %-3d " + " Screenwidth: %-3d " + " AFK: %-3s\r\n" + " Color: %s \r\n ", ONOFF(PRF_FLAGGED(ch, PRF_DISPHP)), @@ -1962,9 +1979,12 @@ ACMD(do_toggle) ONOFF(PRF_FLAGGED(ch, PRF_AUTOSAC)), ONOFF(PRF_FLAGGED(ch, PRF_AUTOASSIST)), - ONOFF(PRF_FLAGGED(ch, PRF_AFK)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTOMAP)), GET_PAGE_LENGTH(ch), + GET_SCREEN_WIDTH(ch), + ONOFF(PRF_FLAGGED(ch, PRF_AFK)), + types[COLOR_LEV(ch)]); return; } @@ -2080,6 +2100,33 @@ ACMD(do_toggle) } else send_to_char(ch, "Please specify a number of lines (5 - 255)."); break; + case SCMD_SCREENWIDTH: + if (!*arg2) + send_to_char(ch, "You current screen width is set to %d characters.", GET_SCREEN_WIDTH(ch)); + else if (is_number(arg2)) { + GET_SCREEN_WIDTH(ch) = MIN(MAX(atoi(arg2), 40), 200); + send_to_char(ch, "Okay, your screen width is now set to %d characters.", GET_SCREEN_WIDTH(ch)); + } else + send_to_char(ch, "Please specify a number of characters (40 - 200)."); + break; + case SCMD_AUTOMAP: + if (can_see_map(ch)) { + if (!*arg2) { + TOGGLE_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); + result = (PRF_FLAGGED(ch, tog_messages[toggle].toggle)); + } else if (!strcmp(arg2, "on")) { + SET_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); + result = 1; + } else if (!strcmp(arg2, "off")) { + REMOVE_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); + } else { + send_to_char(ch, "Value for %s must either be 'on' or 'off'.\r\n", tog_messages[toggle].command); + return; + } + } else { + send_to_char(ch, "Sorry, automap is currently disabled.\r\n"); + return; + } default: if (!*arg2) { TOGGLE_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); @@ -2100,35 +2147,18 @@ ACMD(do_toggle) send_to_char(ch, "%s", tog_messages[toggle].disable_msg); } -int sort_commands_helper(const void *a, const void *b) -{ - return strcmp(complete_cmd_info[*(const int *)a].sort_as, - complete_cmd_info[*(const int *)b].sort_as); -} - -void sort_commands(void) -{ - int a, num_of_cmds = 0; - - while (complete_cmd_info[num_of_cmds].command[0] != '\n') - num_of_cmds++; - num_of_cmds++; /* \n */ - - CREATE(cmd_sort_info, int, num_of_cmds); - - for (a = 0; a < num_of_cmds; a++) - cmd_sort_info[a] = a; - - /* Don't sort the RESERVED or \n entries. */ - qsort(cmd_sort_info + 1, num_of_cmds - 2, sizeof(int), sort_commands_helper); -} - ACMD(do_commands) { int no, i, cmd_num; int wizhelp = 0, socials = 0; struct char_data *vict; char arg[MAX_INPUT_LENGTH]; + char buf[MAX_STRING_LENGTH]; + const char *commands[1000]; + int overflow = sizeof(commands) / sizeof(commands[0]); + + if (!ch->desc) + return; one_argument(argument, arg); @@ -2145,13 +2175,15 @@ ACMD(do_commands) else if (subcmd == SCMD_WIZHELP) wizhelp = 1; - send_to_char(ch, "The following %s%s are available to %s:\r\n", - wizhelp ? "privileged " : "", - socials ? "socials" : "commands", - vict == ch ? "you" : GET_NAME(vict)); + sprintf(buf, "The following %s%s are available to %s:\r\n", + wizhelp ? "privileged " : "", + socials ? "socials" : "commands", + vict == ch ? "you" : GET_NAME(vict)); /* cmd_num starts at 1, not 0, to remove 'RESERVED' */ - for (no = 1, cmd_num = 1; complete_cmd_info[cmd_sort_info[cmd_num]].command[0] != '\n'; cmd_num++) { + for (no = 0, cmd_num = 1; + complete_cmd_info[cmd_sort_info[cmd_num]].command[0] != '\n'; + ++cmd_num) { i = cmd_sort_info[cmd_num]; @@ -2167,11 +2199,27 @@ ACMD(do_commands) if (wizhelp && complete_cmd_info[i].command_pointer == do_action) continue; - send_to_char(ch, "%-11s%s", complete_cmd_info[i].command, no++ % 7 == 0 ? "\r\n" : ""); + if (--overflow < 0) + continue; + + /* matching command: copy to commands list */ + commands[no++] = complete_cmd_info[i].command; } - if (no % 7 != 1) - send_to_char(ch, "\r\n"); + /* display commands list in a nice columnized format */ + column_list(buf + strlen(buf), sizeof(buf) - strlen(buf), + /* subtract 1 or 2 lines (the pager adds 1 or 2) */ + /* also "skip" a line since we printed a header above */ + GET_PAGE_LENGTH(ch) - (PRF_FLAGGED(ch, PRF_COMPACT) ? 1 : 2), 1, + /* 7 columns; no == how many elements, 0 offset */ + 7, commands, no, 0, "$11l"); + + if (overflow < 0) { + log("SYSERR: Too many commands for do_commands; increase size of *commands array."); + strncat(buf, "\r\n** OVERFLOW **\r\n", sizeof(buf) - strlen(buf)); + } + + page_string(ch->desc, buf, TRUE); } void free_history(struct char_data *ch, int type) diff --git a/src/act.item.c b/src/act.item.c index e9355a8..6af32be 100644 --- a/src/act.item.c +++ b/src/act.item.c @@ -20,40 +20,37 @@ #include "constants.h" #include "dg_scripts.h" #include "oasis.h" +#include "act.h" +#include "quest.h" -/* local functions */ -int can_take_obj(struct char_data *ch, struct obj_data *obj); -void get_check_money(struct char_data *ch, struct obj_data *obj); -int perform_get_from_room(struct char_data *ch, struct obj_data *obj); -void get_from_room(struct char_data *ch, char *arg, int amount); -void perform_give_gold(struct char_data *ch, struct char_data *vict, int amount); -void perform_give(struct char_data *ch, struct char_data *vict, struct obj_data *obj); -int perform_drop(struct char_data *ch, struct obj_data *obj, byte mode, const char *sname, room_rnum RDR); -void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_rnum RDR); -struct char_data *give_find_vict(struct char_data *ch, char *arg); -void weight_change_object(struct obj_data *obj, int weight); -void perform_put(struct char_data *ch, struct obj_data *obj, struct obj_data *cont); -void name_from_drinkcon(struct obj_data *obj); -void get_from_container(struct char_data *ch, struct obj_data *cont, char *arg, int mode, int amount); -void name_to_drinkcon(struct obj_data *obj, int type); -void wear_message(struct char_data *ch, struct obj_data *obj, int where); -void perform_wear(struct char_data *ch, struct obj_data *obj, int where); -int find_eq_pos(struct char_data *ch, struct obj_data *obj, char *arg); -void perform_get_from_container(struct char_data *ch, struct obj_data *obj, struct obj_data *cont, int mode); -void perform_remove(struct char_data *ch, int pos); -ACMD(do_remove); -ACMD(do_put); -ACMD(do_get); -ACMD(do_drop); -ACMD(do_give); -ACMD(do_drink); -ACMD(do_eat); -ACMD(do_pour); -ACMD(do_wear); -ACMD(do_wield); -ACMD(do_grab); -void perform_put(struct char_data *ch, struct obj_data *obj, struct obj_data *cont) +/* local function prototypes */ +/* do_get utility functions */ +static int can_take_obj(struct char_data *ch, struct obj_data *obj); +static void get_check_money(struct char_data *ch, struct obj_data *obj); +static void get_from_container(struct char_data *ch, struct obj_data *cont, char *arg, int mode, int amount); +static void get_from_room(struct char_data *ch, char *arg, int amount); +static void perform_get_from_container(struct char_data *ch, struct obj_data *obj, struct obj_data *cont, int mode); +static int perform_get_from_room(struct char_data *ch, struct obj_data *obj); +/* do_give utility functions */ +static struct char_data *give_find_vict(struct char_data *ch, char *arg); +static void perform_give(struct char_data *ch, struct char_data *vict, struct obj_data *obj); +static void perform_give_gold(struct char_data *ch, struct char_data *vict, int amount); +/* do_drop utility functions */ +static int perform_drop(struct char_data *ch, struct obj_data *obj, byte mode, const char *sname, room_rnum RDR); +static void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_rnum RDR); +/* do_put utility functions */ +static void perform_put(struct char_data *ch, struct obj_data *obj, struct obj_data *cont); +/* do_remove utility functions */ +static void perform_remove(struct char_data *ch, int pos); +/* do_wear utility functions */ +static void perform_wear(struct char_data *ch, struct obj_data *obj, int where); +static void wear_message(struct char_data *ch, struct obj_data *obj, int where); + + + + +static void perform_put(struct char_data *ch, struct obj_data *obj, struct obj_data *cont) { if (!drop_otrigger(obj, ch)) @@ -162,7 +159,7 @@ ACMD(do_put) } } -int can_take_obj(struct char_data *ch, struct obj_data *obj) +static int can_take_obj(struct char_data *ch, struct obj_data *obj) { if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)) { act("$p: you can't carry that many items.", FALSE, ch, obj, 0, TO_CHAR); @@ -177,7 +174,7 @@ int can_take_obj(struct char_data *ch, struct obj_data *obj) return (1); } -void get_check_money(struct char_data *ch, struct obj_data *obj) +static void get_check_money(struct char_data *ch, struct obj_data *obj) { int value = GET_OBJ_VAL(obj, 0); @@ -194,7 +191,7 @@ void get_check_money(struct char_data *ch, struct obj_data *obj) send_to_char(ch, "There were %d coins.\r\n", value); } -void perform_get_from_container(struct char_data *ch, struct obj_data *obj, +static void perform_get_from_container(struct char_data *ch, struct obj_data *obj, struct obj_data *cont, int mode) { if (mode == FIND_OBJ_INV || can_take_obj(ch, obj)) { @@ -260,7 +257,7 @@ void get_from_container(struct char_data *ch, struct obj_data *cont, } } -int perform_get_from_room(struct char_data *ch, struct obj_data *obj) +static int perform_get_from_room(struct char_data *ch, struct obj_data *obj) { if (can_take_obj(ch, obj) && get_otrigger(obj, ch)) { obj_from_room(obj); @@ -273,7 +270,7 @@ int perform_get_from_room(struct char_data *ch, struct obj_data *obj) return (0); } -void get_from_room(struct char_data *ch, char *arg, int howmany) +static void get_from_room(struct char_data *ch, char *arg, int howmany) { struct obj_data *obj, *next_obj; int dotmode, found = 0; @@ -384,7 +381,7 @@ ACMD(do_get) } } -void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_rnum RDR) +static void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_rnum RDR) { struct obj_data *obj; @@ -430,7 +427,7 @@ void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_rnum RD #define VANISH(mode) ((mode == SCMD_DONATE || mode == SCMD_JUNK) ? \ " It vanishes in a puff of smoke!" : "") -int perform_drop(struct char_data *ch, struct obj_data *obj, +static int perform_drop(struct char_data *ch, struct obj_data *obj, byte mode, const char *sname, room_rnum RDR) { char buf[MAX_STRING_LENGTH]; @@ -594,7 +591,7 @@ ACMD(do_drop) } } -void perform_give(struct char_data *ch, struct char_data *vict, +static void perform_give(struct char_data *ch, struct char_data *vict, struct obj_data *obj) { if (!give_otrigger(obj, ch, vict)) @@ -619,10 +616,12 @@ void perform_give(struct char_data *ch, struct char_data *vict, act("You give $p to $N.", FALSE, ch, obj, vict, TO_CHAR); act("$n gives you $p.", FALSE, ch, obj, vict, TO_VICT); act("$n gives $p to $N.", TRUE, ch, obj, vict, TO_NOTVICT); + + autoquest_trigger_check( ch, vict, obj, AQ_OBJ_RETURN); } /* utility function for give */ -struct char_data *give_find_vict(struct char_data *ch, char *arg) +static struct char_data *give_find_vict(struct char_data *ch, char *arg) { struct char_data *vict; @@ -639,7 +638,7 @@ struct char_data *give_find_vict(struct char_data *ch, char *arg) return (NULL); } -void perform_give_gold(struct char_data *ch, struct char_data *vict, +static void perform_give_gold(struct char_data *ch, struct char_data *vict, int amount) { char buf[MAX_STRING_LENGTH]; @@ -871,7 +870,7 @@ ACMD(do_drink) send_to_char(ch, "Your stomach can't contain anymore!\r\n"); return; } - if ((GET_OBJ_VAL(temp, 1) == 0) && (!GET_OBJ_VAL(temp, 0) == 1)) { + if ((GET_OBJ_VAL(temp, 1) == 0) || (!GET_OBJ_VAL(temp, 0) == 1)) { send_to_char(ch, "It is empty.\r\n"); return; } @@ -1156,7 +1155,7 @@ ACMD(do_pour) weight_change_object(to_obj, amount); /* Add weight */ } -void wear_message(struct char_data *ch, struct obj_data *obj, int where) +static void wear_message(struct char_data *ch, struct obj_data *obj, int where) { const char *wear_messages[][2] = { {"$n lights $p and holds it.", @@ -1218,7 +1217,7 @@ void wear_message(struct char_data *ch, struct obj_data *obj, int where) act(wear_messages[where][1], FALSE, ch, obj, 0, TO_CHAR); } -void perform_wear(struct char_data *ch, struct obj_data *obj, int where) +static void perform_wear(struct char_data *ch, struct obj_data *obj, int where) { /* * ITEM_WEAR_TAKE is used for objects that do not require special bits @@ -1439,7 +1438,7 @@ ACMD(do_grab) } } -void perform_remove(struct char_data *ch, int pos) +static void perform_remove(struct char_data *ch, int pos) { struct obj_data *obj; diff --git a/src/act.movement.c b/src/act.movement.c index 9ec8476..215983a 100644 --- a/src/act.movement.c +++ b/src/act.movement.c @@ -20,31 +20,23 @@ #include "house.h" #include "constants.h" #include "dg_scripts.h" +#include "act.h" +#include "fight.h" +#include "oasis.h" /* for buildwalk */ -/* external functions */ -int special(struct char_data *ch, int cmd, char *arg); -void death_cry(struct char_data *ch); -int find_eq_pos(struct char_data *ch, struct obj_data *obj, char *arg); -int buildwalk(struct char_data *ch, int dir); -/* local functions */ -int has_boat(struct char_data *ch); -int find_door(struct char_data *ch, const char *type, char *dir, const char *cmdname); -int has_key(struct char_data *ch, obj_vnum key); -void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int scmd); -int ok_pick(struct char_data *ch, obj_vnum keynum, int pickproof, int scmd); -ACMD(do_gen_door); -ACMD(do_enter); -ACMD(do_leave); -ACMD(do_stand); -ACMD(do_sit); -ACMD(do_rest); -ACMD(do_sleep); -ACMD(do_wake); -ACMD(do_follow); +/* local only functions */ +/* do_simple_move utility functions */ +static int has_boat(struct char_data *ch); +/* do_gen_door utility functions */ +static int find_door(struct char_data *ch, const char *type, char *dir, const char *cmdname); +static int has_key(struct char_data *ch, obj_vnum key); +static void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int scmd); +static int ok_pick(struct char_data *ch, obj_vnum keynum, int pickproof, int scmd); + /* simple function to determine if char can walk on water */ -int has_boat(struct char_data *ch) +static int has_boat(struct char_data *ch) { struct obj_data *obj; int i; @@ -118,63 +110,136 @@ int has_scuba(struct char_data *ch) return (0); } -/* do_simple_move assumes that there is no master, no followers and that the - * direction exists. It returns 1 for success, 0 if failure. */ +/** Move a PC/NPC character from their current location to a new location. This + * is the standard movement locomotion function that all normal walking + * movement by characters should be sent through. This function also defines + * the move cost of normal locomotion as: + * ( (move cost for source room) + (move cost for destination) ) / 2 + * + * @pre Function assumes that ch has no master controlling character, that + * ch has no followers (in other words followers won't be moved by this + * function) and that the direction traveled in is one of the valid, enumerated + * direction. + * @param ch The character structure to attempt to move. + * @param dir The defined direction (NORTH, SOUTH, etc...) to attempt to + * move into. + * @param need_specials_check If TRUE will cause + * @retval int 1 for a successful move (ch is now in a new location) + * or 0 for a failed move (ch is still in the original location). */ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) { - char throwaway[MAX_INPUT_LENGTH] = ""; /* Functions assume writable. */ + /* Begin Local variable definitions */ + /*---------------------------------------------------------------------*/ + /* Used in our special proc check. By default, we pass a NULL argument + * when checking for specials */ + char spec_proc_args[MAX_INPUT_LENGTH] = ""; + /* The room the character is currently in and will move from... */ room_rnum was_in = IN_ROOM(ch); - int need_movement; + /* ... and the room the character will move into. */ + room_rnum going_to = EXIT(ch, dir)->to_room; + /* How many movement points are required to travel from was_in to going_to. + * We redefine this later when we need it. */ + int need_movement = 0; + /* Contains the "leave" message to display to the was_in room. */ + char leave_message[SMALL_BUFSIZE]; + /*---------------------------------------------------------------------*/ + /* End Local variable definitions */ + + + /* Begin checks that can prevent a character from leaving the was_in room. */ + /* Future checks should be implemented within this section and return 0. */ + /*---------------------------------------------------------------------*/ + /* Check for special routines that might activate because of the move and + * also might prevent the movement. Special requires commands, so we pass + * in the "command" equivalent of the direction (ie. North is '1' in the + * command list, but NORTH is defined as '0'). + * Note -- only check if following; this avoids 'double spec-proc' bug */ + if (need_specials_check && special(ch, dir + 1, spec_proc_args)) + return 0; - /* Check for special routines (North is 1 in command list, but 0 here) Note - * -- only check if following; this avoids 'double spec-proc' bug */ - if (need_specials_check && special(ch, dir + 1, throwaway)) - return (0); - - /* blocked by a leave trigger ? */ + /* Leave Trigger Checks: Does a leave trigger block exit from the room? */ if (!leave_mtrigger(ch, dir) || IN_ROOM(ch) != was_in) /* prevent teleport crashes */ return 0; if (!leave_wtrigger(&world[IN_ROOM(ch)], ch, dir) || IN_ROOM(ch) != was_in) /* prevent teleport crashes */ return 0; if (!leave_otrigger(&world[IN_ROOM(ch)], ch, dir) || IN_ROOM(ch) != was_in) /* prevent teleport crashes */ return 0; - /* charmed? */ - if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && IN_ROOM(ch) == IN_ROOM(ch->master)) { + + /* Charm effect: Does it override the movement? */ + if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && was_in == IN_ROOM(ch->master)) + { send_to_char(ch, "The thought of leaving your master makes you weep.\r\n"); act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM); return (0); } - /* if this room or the one we're going to needs a boat, check for one */ - if ((SECT(IN_ROOM(ch)) == SECT_WATER_NOSWIM) || - (SECT(EXIT(ch, dir)->to_room) == SECT_WATER_NOSWIM)) { - if (!has_boat(ch)) { + /* Water, No Swimming Rooms: Does the deep water prevent movement? */ + if ((SECT(was_in) == SECT_WATER_NOSWIM) || + (SECT(going_to) == SECT_WATER_NOSWIM)) + { + if (!has_boat(ch)) + { send_to_char(ch, "You need a boat to go there.\r\n"); return (0); } } - /* If this room or the one we're going to needs flight, check for it. */ - if ((SECT(IN_ROOM(ch)) == SECT_FLYING) || (SECT(EXIT(ch, dir)->to_room) == SECT_FLYING)) { - if (!has_flight(ch)) { + /* Flying Required: Does lack of flying prevent movement? */ + if ((SECT(was_in) == SECT_FLYING) || (SECT(going_to) == SECT_FLYING)) + { + if (!has_flight(ch)) + { send_to_char(ch, "You need to be flying to go there!\r\n"); return (0); } } - /* If this room or the one we're going to needs scuba, check for it. */ - if ((SECT(IN_ROOM(ch)) == SECT_UNDERWATER) || (SECT(EXIT(ch, dir)->to_room) == SECT_UNDERWATER)) { + /* Underwater Room: Does lack of underwater breathing prevent movement? */ + if ((SECT(was_in) == SECT_UNDERWATER) || (SECT(going_to) == SECT_UNDERWATER)) + { if (!has_scuba(ch)) { send_to_char(ch, "You need to be able to breathe water to go there!\r\n"); return (0); } } - /* move points needed is avg. move loss for src and destination sect type */ - need_movement = (movement_loss[SECT(IN_ROOM(ch))] + - movement_loss[SECT(EXIT(ch, dir)->to_room)]) / 2; + /* Houses: Can the player walk into the house? */ + if (ROOM_FLAGGED(was_in, ROOM_ATRIUM)) + { + if (!House_can_enter(ch, GET_ROOM_VNUM(going_to))) + { + send_to_char(ch, "That's private property -- no trespassing!\r\n"); + return (0); + } + } - if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) { + /* Room Size Capacity: Is the room full of people already? */ + if (ROOM_FLAGGED(going_to, ROOM_TUNNEL) && + num_pc_in_room(&(world[going_to])) >= CONFIG_TUNNEL_SIZE) + { + if (CONFIG_TUNNEL_SIZE > 1) + send_to_char(ch, "There isn't enough room for you to go there!\r\n"); + else + send_to_char(ch, "There isn't enough room there for more than one person!\r\n"); + return (0); + } + + /* Room Level Requirements: Is ch privileged enough to enter the room? */ + if (ROOM_FLAGGED(going_to, ROOM_GODROOM) && GET_LEVEL(ch) < LVL_GOD) + { + send_to_char(ch, "You aren't godly enough to use that room!\r\n"); + return (0); + } + + /* All checks passed, nothing will prevent movement now other than lack of + * move points. */ + /* move points needed is avg. move loss for src and destination sect type */ + need_movement = (movement_loss[SECT(was_in)] + + movement_loss[SECT(going_to)]) / 2; + + /* Move Point Requirement Check */ + if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) + { if (need_specials_check && ch->master) send_to_char(ch, "You are too exhausted to follow.\r\n"); else @@ -182,69 +247,78 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) return (0); } - if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_ATRIUM)) { - if (!House_can_enter(ch, GET_ROOM_VNUM(EXIT(ch, dir)->to_room))) { - send_to_char(ch, "That's private property -- no trespassing!\r\n"); - return (0); - } - } - if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_TUNNEL) && - num_pc_in_room(&(world[EXIT(ch, dir)->to_room])) >= CONFIG_TUNNEL_SIZE) { - if (CONFIG_TUNNEL_SIZE > 1) - send_to_char(ch, "There isn't enough room for you to go there!\r\n"); - else - send_to_char(ch, "There isn't enough room there for more than one person!\r\n"); - return (0); - } - /* Mortals and low level gods cannot enter greater god rooms. */ - if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_GODROOM) && - GET_LEVEL(ch) < LVL_GOD) { - send_to_char(ch, "You aren't godly enough to use that room!\r\n"); - return (0); - } - /* Now we know we're allowed to go into the room. */ + /*---------------------------------------------------------------------*/ + /* End checks that can prevent a character from leaving the was_in room. */ + + + /* Begin: the leave operation. */ + /*---------------------------------------------------------------------*/ + /* If applicable, subtract movement cost. */ if (GET_LEVEL(ch) < LVL_IMMORT && !IS_NPC(ch)) GET_MOVE(ch) -= need_movement; - if (!AFF_FLAGGED(ch, AFF_SNEAK)) { - char buf2[MAX_STRING_LENGTH]; - - snprintf(buf2, sizeof(buf2), "$n leaves %s.", dirs[dir]); - act(buf2, TRUE, ch, 0, 0, TO_ROOM); + /* Generate the leave message and display to others in the was_in room. */ + if (!AFF_FLAGGED(ch, AFF_SNEAK)) + { + snprintf(leave_message, sizeof(leave_message), "$n leaves %s.", dirs[dir]); + act(leave_message, TRUE, ch, 0, 0, TO_ROOM); } - was_in = IN_ROOM(ch); + char_from_room(ch); - char_to_room(ch, world[was_in].dir_option[dir]->to_room); + char_to_room(ch, going_to); + /*---------------------------------------------------------------------*/ + /* End: the leave operation. The character is now in the new room. */ - /* move them first, then move them back if they aren't allowed to go. Also, - * see if an entry trigger disallows the move */ - if (!entry_mtrigger(ch) || !enter_wtrigger(&world[IN_ROOM(ch)], ch, dir)) { + + /* Begin: Post-move operations. */ + /*---------------------------------------------------------------------*/ + /* Post Move Trigger Checks: Check the new room for triggers. + * Assumptions: The character has already truly left the was_in room. If + * the entry trigger "prevents" movement into the room, it is thr triggers + * job to provide a message to the original was_in room. */ + if (!entry_mtrigger(ch) || !enter_wtrigger(&world[going_to], ch, dir)) { char_from_room(ch); char_to_room(ch, was_in); return 0; } + /* Display arrival information to anyone in the destination room... */ if (!AFF_FLAGGED(ch, AFF_SNEAK)) act("$n has arrived.", TRUE, ch, 0, 0, TO_ROOM); + /* ... and the room description to the character. */ if (ch->desc != NULL) look_at_room(ch, 0); - if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) { - mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(IN_ROOM(ch)), world[IN_ROOM(ch)].name); + /* ... and Kill the player if the room is a death trap. */ + if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) + { + mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(going_to), world[going_to].name); death_cry(ch); extract_char(ch); return (0); } + /* At this point, the character is safe and in the room. */ + /* Fire memory and greet triggers, check and see if the greet trigger + * prevents movement, and if so, move the player back to the previous room. */ entry_memory_mtrigger(ch); - if (!greet_mtrigger(ch, dir)) { + if (!greet_mtrigger(ch, dir)) + { char_from_room(ch); char_to_room(ch, was_in); look_at_room(ch, 0); - } else greet_memory_mtrigger(ch); - + /* Failed move, return a failure */ + return (0); + } + else + greet_memory_mtrigger(ch); + /*---------------------------------------------------------------------*/ + /* End: Post-move operations. */ + + /* Only here is the move successful *and* complete. Return success for + * calling functions to handle post move operations. */ return (1); } @@ -285,13 +359,11 @@ int perform_move(struct char_data *ch, int dir, int need_specials_check) ACMD(do_move) { - /* This is basically a mapping of cmd numbers to perform_move indices. It - * cannot be done in perform_move because perform_move is called by other - * functions which do not require the remapping. */ - perform_move(ch, subcmd - 1, 0); + /* These subcmd defines are mapped precisely to the direction defines. */ + perform_move(ch, subcmd, 0); } -int find_door(struct char_data *ch, const char *type, char *dir, const char *cmdname) +static int find_door(struct char_data *ch, const char *type, char *dir, const char *cmdname) { int door; @@ -350,6 +422,7 @@ int has_key(struct char_data *ch, obj_vnum key) #define NEED_UNLOCKED (1 << 2) #define NEED_LOCKED (1 << 3) +/* cmd_door is required external from act.movement.c */ const char *cmd_door[] = { "open", @@ -359,7 +432,7 @@ const char *cmd_door[] = "pick" }; -const int flags_door[] = +static const int flags_door[] = { NEED_CLOSED | NEED_UNLOCKED, NEED_OPEN, @@ -385,7 +458,7 @@ const int flags_door[] = (TOGGLE_BIT(GET_OBJ_VAL(obj, 1), CONT_LOCKED)) :\ (TOGGLE_BIT(EXITN(room, door)->exit_info, EX_LOCKED))) -void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int scmd) +static void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int scmd) { char buf[MAX_STRING_LENGTH]; size_t len; @@ -456,7 +529,7 @@ void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int scmd) scmd == SCMD_CLOSE ? "d" : "ed"); } -int ok_pick(struct char_data *ch, obj_vnum keynum, int pickproof, int scmd) +static int ok_pick(struct char_data *ch, obj_vnum keynum, int pickproof, int scmd) { int percent, skill_lvl; diff --git a/src/act.offensive.c b/src/act.offensive.c index b6fd454..6f17479 100644 --- a/src/act.offensive.c +++ b/src/act.offensive.c @@ -17,22 +17,8 @@ #include "handler.h" #include "db.h" #include "spells.h" - -/* extern functions */ -void raw_kill(struct char_data *ch, struct char_data * killer); -void check_killer(struct char_data *ch, struct char_data *vict); -int compute_armor_class(struct char_data *ch); - -/* local functions */ -ACMD(do_assist); -ACMD(do_hit); -ACMD(do_kill); -ACMD(do_backstab); -ACMD(do_order); -ACMD(do_flee); -ACMD(do_bash); -ACMD(do_rescue); -ACMD(do_kick); +#include "act.h" +#include "fight.h" ACMD(do_assist) { diff --git a/src/act.other.c b/src/act.other.c index ef1ac6f..7a7b0bd 100644 --- a/src/act.other.c +++ b/src/act.other.c @@ -8,6 +8,7 @@ * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * **************************************************************************/ +/* needed by sysdep.h to allow for definition of */ #define __ACT_OTHER_C__ #include "conf.h" @@ -23,41 +24,19 @@ #include "house.h" #include "constants.h" #include "dg_scripts.h" +#include "act.h" +#include "spec_procs.h" +#include "class.h" +#include "fight.h" +#include "mail.h" /* for has_mail() */ +#include "shop.h" +#include "quest.h" -/* extern variables */ -extern struct spell_info_type spell_info[]; -extern const char *class_abbrevs[]; +/* Local defined utility functions */ +/* do_group utility functions */ +static int perform_group(struct char_data *ch, struct char_data *vict); +static void print_group(struct char_data *ch); -/* extern functions */ -void list_skills(struct char_data *ch); -void appear(struct char_data *ch); -void perform_immort_vis(struct char_data *ch); -SPECIAL(shop_keeper); -ACMD(do_gen_comm); -void die(struct char_data *ch, struct char_data * killer); -void Crash_rentsave(struct char_data *ch, int cost); -int has_mail(long id); - -/* local functions */ -ACMD(do_quit); -ACMD(do_save); -ACMD(do_not_here); -ACMD(do_sneak); -ACMD(do_hide); -ACMD(do_steal); -ACMD(do_practice); -ACMD(do_visible); -ACMD(do_title); -int perform_group(struct char_data *ch, struct char_data *vict); -void print_group(struct char_data *ch); -ACMD(do_group); -ACMD(do_ungroup); -ACMD(do_report); -ACMD(do_split); -ACMD(do_use); -ACMD(do_display); -ACMD(do_gen_tog); -ACMD(do_gen_write); ACMD(do_quit) { @@ -74,6 +53,10 @@ ACMD(do_quit) } else { act("$n has left the game.", TRUE, ch, 0, 0, TO_ROOM); mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s has quit the game.", GET_NAME(ch)); + + if (GET_QUEST_TIME(ch) != -1) + quest_timeout(ch); + send_to_char(ch, "Goodbye, friend.. Come back soon!\r\n"); /* We used to check here for duping attempts, but we may as well do it right @@ -335,7 +318,7 @@ ACMD(do_title) } } -int perform_group(struct char_data *ch, struct char_data *vict) +static int perform_group(struct char_data *ch, struct char_data *vict) { if (AFF_FLAGGED(vict, AFF_GROUP) || !CAN_SEE(ch, vict)) return (0); @@ -348,7 +331,7 @@ int perform_group(struct char_data *ch, struct char_data *vict) return (1); } -void print_group(struct char_data *ch) +static void print_group(struct char_data *ch) { struct char_data *k; struct follow_type *f; diff --git a/src/act.social.c b/src/act.social.c index 1468bed..46f0899 100644 --- a/src/act.social.c +++ b/src/act.social.c @@ -17,15 +17,12 @@ #include "handler.h" #include "db.h" #include "spells.h" +#include "act.h" + +/* local defined functions for local use */ +/* do_action and do_gmote utility function */ +static int find_action(int cmd); -/* local functions */ -int find_action(int cmd); -ACMD(do_action); -void free_social_messages(void); -void free_action(struct social_messg *mess); -void free_command_list(void); -void create_command_list(void); -ACMD(do_gmote); ACMD(do_action) { @@ -110,7 +107,6 @@ void create_command_list(void) { int i, j, k; struct social_messg temp; - extern struct command_info cmd_info[]; /* free up old command list */ if (complete_cmd_info) @@ -206,7 +202,7 @@ void free_action(struct social_messg *mess) { memset(mess, 0, sizeof(struct social_messg)); } -int find_action(int cmd) +static int find_action(int cmd) { int bot, top, mid; diff --git a/src/act.wizard.c b/src/act.wizard.c index f5d820b..4c876a3 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -23,101 +23,30 @@ #include "oasis.h" #include "dg_scripts.h" #include "shop.h" +#include "act.h" +#include "genzon.h" /* for real_zone_by_thing */ +#include "class.h" +#include "genolc.h" +#include "fight.h" +#include "house.h" +#include "modify.h" +#include "quest.h" -/* external vars */ -extern FILE *player_fl; -extern struct attack_hit_type attack_hit_text[]; -extern char *class_abbrevs[]; -extern time_t boot_time; -extern int circle_shutdown, circle_reboot; -extern int circle_restrict; -extern int buf_switches, buf_largecount, buf_overflows; -extern int top_of_p_table; -extern socket_t mother_desc; -extern ush_int port; -extern const char *pc_class_types[]; -extern int top_of_p_table; -extern struct player_index_element *player_table; +/* local utility functions with file scope */ +static int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg); +static void perform_immort_invis(struct char_data *ch, int level); +static void list_zone_commands_room(struct char_data *ch, room_vnum rvnum); +static void do_stat_room(struct char_data *ch, struct room_data *rm); +static void do_stat_object(struct char_data *ch, struct obj_data *j); +static void do_stat_character(struct char_data *ch, struct char_data *k); +static void stop_snooping(struct char_data *ch); +static size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall); +static struct char_data *is_in_game(long idnum); +static void mob_checkload(struct char_data *ch, mob_vnum mvnum); +static void obj_checkload(struct char_data *ch, obj_vnum ovnum); +static void trg_checkload(struct char_data *ch, trig_vnum tvnum); +static void mod_llog_entry(struct last_entry *llast,int type); -/* external functions */ -int level_exp(int chclass, int level); -void show_shops(struct char_data *ch, char *value); -void hcontrol_list_houses(struct char_data *ch, char *arg); -void do_start(struct char_data *ch); -void appear(struct char_data *ch); -void reset_zone(zone_rnum zone); -void roll_real_abils(struct char_data *ch); -int parse_class(char arg); -void run_autowiz(void); -int save_all(void); -zone_rnum real_zone_by_thing(room_vnum vznum); -SPECIAL(shop_keeper); -void Crash_rentsave(struct char_data * ch, int cost); -void new_hist_messg(struct descriptor_data *d, const char *msg); -void clearMemory(struct char_data *ch); -int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg); -struct time_info_data *real_time_passed(time_t t2, time_t t1); - -/* local functions */ -int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg); -void perform_immort_invis(struct char_data *ch, int level); -ACMD(do_echo); -ACMD(do_send); -room_rnum find_target_room(struct char_data *ch, char *rawroomstr); -ACMD(do_at); -ACMD(do_goto); -ACMD(do_trans); -ACMD(do_teleport); -ACMD(do_vnum); -void list_zone_commands_room(struct char_data *ch, room_vnum rvnum); -void do_stat_room(struct char_data *ch, struct room_data *rm); -void do_stat_object(struct char_data *ch, struct obj_data *j); -void do_stat_character(struct char_data *ch, struct char_data *k); -ACMD(do_stat); -ACMD(do_shutdown); -void stop_snooping(struct char_data *ch); -ACMD(do_snoop); -ACMD(do_switch); -ACMD(do_return); -ACMD(do_load); -ACMD(do_vstat); -ACMD(do_purge); -ACMD(do_syslog); -ACMD(do_advance); -ACMD(do_restore); -void perform_immort_vis(struct char_data *ch); -ACMD(do_invis); -ACMD(do_gecho); -ACMD(do_poofset); -ACMD(do_dc); -ACMD(do_wizlock); -ACMD(do_date); -ACMD(do_last); -ACMD(do_force); -ACMD(do_wiznet); -ACMD(do_zreset); -ACMD(do_wizutil); -size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall); -ACMD(do_show); -ACMD(do_set); -void snoop_check(struct char_data *ch); -ACMD(do_saveall); -ACMD(do_zpurge); -void clean_llog_entries(void); -ACMD(do_list_llog_entries); -struct char_data *is_in_game(long idnum); -ACMD(do_links); -void mob_checkload(struct char_data *ch, mob_vnum mvnum); -void obj_checkload(struct char_data *ch, obj_vnum ovnum); -void trg_checkload(struct char_data *ch, trig_vnum tvnum); -ACMD(do_zcheck); -ACMD(do_checkloadstatus); -ACMD(do_poofs); -ACMD(do_copyover); -ACMD(do_peace); -void mod_llog_entry(struct last_entry *llast,int type); -ACMD(do_plist); -ACMD(do_wizupdate); int purge_room(room_rnum room) { @@ -431,7 +360,7 @@ ACMD(do_vnum) #define ZOCMD zone_table[zrnum].cmd[subcmd] -void list_zone_commands_room(struct char_data *ch, room_vnum rvnum) +static void list_zone_commands_room(struct char_data *ch, room_vnum rvnum) { zone_rnum zrnum = real_zone_by_thing(rvnum); room_rnum rrnum = real_room(rvnum), cmd_room = NOWHERE; @@ -551,7 +480,7 @@ void list_zone_commands_room(struct char_data *ch, room_vnum rvnum) } #undef ZOCMD -void do_stat_room(struct char_data *ch, struct room_data *rm) +static void do_stat_room(struct char_data *ch, struct room_data *rm) { char buf2[MAX_STRING_LENGTH]; struct extra_descr_data *desc; @@ -638,7 +567,7 @@ void do_stat_room(struct char_data *ch, struct room_data *rm) list_zone_commands_room(ch, rm->number); } -void do_stat_object(struct char_data *ch, struct obj_data *j) +static void do_stat_object(struct char_data *ch, struct obj_data *j) { int i, found; obj_vnum vnum; @@ -789,7 +718,7 @@ void do_stat_object(struct char_data *ch, struct obj_data *j) do_sstat_object(ch, j); } -void do_stat_character(struct char_data *ch, struct char_data *k) +static void do_stat_character(struct char_data *ch, struct char_data *k) { char buf[MAX_STRING_LENGTH]; int i, i2, column, found = FALSE; @@ -862,7 +791,9 @@ void do_stat_character(struct char_data *ch, struct char_data *k) GET_GOLD(k), GET_BANK_GOLD(k), GET_GOLD(k) + GET_BANK_GOLD(k)); if (!IS_NPC(k)) - send_to_char(ch, "Questpoints: [%d]\r\n", GET_QUESTPOINTS(k)); + send_to_char(ch, "Questpoints: [%d] Screen %s[%s%d%sx%s%d%s]%s\r\n", GET_QUESTPOINTS(k), + CCCYN(ch, C_NRM), CCYEL(ch, C_NRM), GET_SCREEN_WIDTH(k), CCNRM(ch, C_NRM), + CCYEL(ch, C_NRM), GET_PAGE_LENGTH(k), CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); send_to_char(ch, "AC: [%d%+d/10], Hitroll: [%2d], Damroll: [%2d], Saving throws: [%d/%d/%d/%d/%d]\r\n", GET_AC(k), dex_app[GET_DEX(k)].defensive, k->points.hitroll, @@ -893,6 +824,12 @@ void do_stat_character(struct char_data *ch, struct char_data *k) sprintbitarray(PRF_FLAGS(k), preference_bits, PR_ARRAY_MAX, buf); send_to_char(ch, "PRF: %s%s%s\r\n", CCGRN(ch, C_NRM), buf, CCNRM(ch, C_NRM)); + + send_to_char(ch, "Quest Points: [%9d] Quests Completed: [%5d]\r\n", + GET_QUESTPOINTS(ch), GET_NUM_QUESTS(ch)); + if (GET_QUEST(ch) != NOTHING) + send_to_char(ch, "Current Quest: [%5d] Time Left: [%5d]\r\n", + GET_QUEST(ch), GET_QUEST_TIME(ch)); } if (IS_MOB(k)) @@ -1120,7 +1057,8 @@ ACMD(do_shutdown) log("(GC) Reboot by %s.", GET_NAME(ch)); send_to_all("Rebooting.. come back in a few minutes.\r\n"); touch(FASTBOOT_FILE); - circle_shutdown = circle_reboot = 1; + circle_shutdown = 1; + circle_reboot = 2; /* do not autosave olc */ } else if (!str_cmp(arg, "die")) { log("(GC) Shutdown by %s.", GET_NAME(ch)); send_to_all("Shutting down for maintenance.\r\n"); @@ -1160,7 +1098,7 @@ void snoop_check(struct char_data *ch) } } -void stop_snooping(struct char_data *ch) +static void stop_snooping(struct char_data *ch) { if (!ch->desc->snooping) send_to_char(ch, "You aren't snooping anyone.\r\n"); @@ -1624,7 +1562,7 @@ void perform_immort_vis(struct char_data *ch) send_to_char(ch, "You are now fully visible.\r\n"); } -void perform_immort_invis(struct char_data *ch, int level) +static void perform_immort_invis(struct char_data *ch, int level) { struct char_data *tch; @@ -1857,7 +1795,7 @@ struct last_entry *find_llog_entry(int punique, long idnum) { } /* mod_llog_entry assumes that llast is accurate */ -void mod_llog_entry(struct last_entry *llast,int type) { +static void mod_llog_entry(struct last_entry *llast,int type) { FILE *fp; struct last_entry mlast; int size,recs,tmp; @@ -1998,7 +1936,7 @@ ACMD(do_list_llog_entries) { } } -struct char_data *is_in_game(long idnum) { +static struct char_data *is_in_game(long idnum) { struct descriptor_data *i; for (i = descriptor_list; i; i = i->next) { @@ -2382,7 +2320,7 @@ ACMD(do_wizutil) /* single zone printing fn used by "show zone" so it's not repeated in the code 3 times ... -je, 4/6/93 FIXME: overflow possible */ -size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall) +static size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall) { size_t tmp; @@ -2592,8 +2530,8 @@ ACMD(do_show) " %5d mobiles %5d prototypes\r\n" " %5d objects %5d prototypes\r\n" " %5d rooms %5d zones\r\n" - " %5d triggers %5d shops\r\n" - " %5d large bufs\r\n" + " %5d triggers %5d shops\r\n" + " %5d large bufs %5d autoquests\r\n" " %5d buf switches %5d overflows\r\n", i, con, top_of_p_table + 1, @@ -2601,7 +2539,7 @@ ACMD(do_show) k, top_of_objt + 1, top_of_world + 1, top_of_zone_table + 1, top_of_trigt + 1, top_shop + 1, - buf_largecount, + buf_largecount, total_quests, buf_switches, buf_overflows ); break; @@ -2756,24 +2694,26 @@ ACMD(do_show) { "practices", LVL_GOD, PC, NUMBER }, /* 40 */ { "quest", LVL_GOD, PC, BINARY }, { "room", LVL_BUILDER, BOTH, NUMBER }, + { "screenwidth", LVL_GOD, PC, NUMBER }, { "sex", LVL_GOD, BOTH, MISC }, - { "showvnums", LVL_BUILDER, PC, BINARY }, - { "siteok", LVL_GOD, PC, BINARY }, /* 45 */ + { "showvnums", LVL_BUILDER, PC, BINARY }, /* 45 */ + { "siteok", LVL_GOD, PC, BINARY }, { "str", LVL_BUILDER, BOTH, NUMBER }, { "stradd", LVL_BUILDER, BOTH, NUMBER }, { "thief", LVL_GOD, PC, BINARY }, - { "thirst", LVL_BUILDER, BOTH, MISC }, - { "title", LVL_GOD, PC, MISC }, /* 50 */ + { "thirst", LVL_BUILDER, BOTH, MISC }, /* 50 */ + { "title", LVL_GOD, PC, MISC }, { "variable", LVL_GRGOD, PC, MISC }, { "weight", LVL_BUILDER, BOTH, NUMBER }, { "wis", LVL_BUILDER, BOTH, NUMBER }, - { "questpoints", LVL_GOD, PC, NUMBER }, + { "questpoints", LVL_GOD, PC, NUMBER }, /* 55 */ + { "questhistory", LVL_GOD, PC, NUMBER }, { "\n", 0, BOTH, MISC } }; -int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg) +static int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg) { - int i, on = 0, off = 0, value = 0; + int i, on = 0, off = 0, value = 0, qvnum; room_rnum rnum; room_vnum rvnum; @@ -2859,7 +2799,8 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *va GET_CLASS(vict) = i; break; case 8: /* color */ - SET_OR_REMOVE(PRF_FLAGS(vict), (PRF_COLOR_1 | PRF_COLOR_2)); + SET_OR_REMOVE(PRF_FLAGS(vict), (PRF_COLOR_1)); + SET_OR_REMOVE(PRF_FLAGS(vict), (PRF_COLOR_2)); break; case 9: /* con */ if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) @@ -3086,20 +3027,23 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *va char_from_room(vict); char_to_room(vict, rnum); break; - case 43: /* sex */ + case 43: /* screenwidth */ + GET_SCREEN_WIDTH(vict) = RANGE(40, 200); + break; + case 44: /* sex */ if ((i = search_block(val_arg, genders, FALSE)) < 0) { send_to_char(ch, "Must be 'male', 'female', or 'neutral'.\r\n"); return (0); } GET_SEX(vict) = i; break; - case 44: /* showvnums */ + case 45: /* showvnums */ SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SHOWVNUMS); break; - case 45: /* siteok */ + case 46: /* siteok */ SET_OR_REMOVE(PLR_FLAGS(vict), PLR_SITEOK); break; - case 46: /* str */ + case 47: /* str */ if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) RANGE(3, 25); else @@ -3108,16 +3052,16 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *va vict->real_abils.str_add = 0; affect_total(vict); break; - case 47: /* stradd */ + case 48: /* stradd */ vict->real_abils.str_add = RANGE(0, 100); if (value > 0) vict->real_abils.str = 18; affect_total(vict); break; - case 48: /* thief */ + case 49: /* thief */ SET_OR_REMOVE(PLR_FLAGS(vict), PLR_THIEF); break; - case 49: /* thirst */ + case 50: /* thirst */ if (!str_cmp(val_arg, "off")) { GET_COND(vict, THIRST) = -1; send_to_char(ch, "%s's thirst is now off.\r\n", GET_NAME(vict)); @@ -3131,18 +3075,18 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *va return (0); } break; - case 50: /* title */ + case 51: /* title */ set_title(vict, val_arg); send_to_char(ch, "%s's title is now: %s\r\n", GET_NAME(vict), GET_TITLE(vict)); break; - case 51: /* variable */ + case 52: /* variable */ return perform_set_dg_var(ch, vict, val_arg); break; - case 52: /* weight */ + case 53: /* weight */ GET_WEIGHT(vict) = value; affect_total(vict); break; - case 53: /* wis */ + case 54: /* wis */ if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) RANGE(3, 25); else @@ -3150,9 +3094,26 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *va vict->real_abils.wis = value; affect_total(vict); break; - case 54: /* questpoints */ + case 55: /* questpoints */ GET_QUESTPOINTS(vict) = RANGE(0, 100000000); break; + case 56: /* questhistory */ + qvnum = atoi(val_arg); + if (real_quest(qvnum) == NOTHING) { + send_to_char(ch, "That quest doesn't exist.\r\n"); + return FALSE; + } else { + if (is_complete(vict, qvnum)) { + remove_completed_quest(vict, qvnum); + send_to_char(ch, "Quest %d removed from history for player %s.\r\n", + qvnum, GET_NAME(vict)); + } else { + add_completed_quest(vict, qvnum); + send_to_char(ch, "Quest %d added to history for player %s.\r\n", + qvnum, GET_NAME(vict)); + } + break; + } default: send_to_char(ch, "Can't set that!\r\n"); return (0); @@ -3676,7 +3637,7 @@ ACMD (do_zcheck) } /* for (k.. */ } /* cycle directions */ - if (ROOM_FLAGGED(i, ROOM_ATRIUM | ROOM_HOUSE | ROOM_HOUSE_CRASH | ROOM_OLC | ROOM_BFS_MARK)) + if (ROOM_FLAGGED(i, ROOM_ATRIUM) || ROOM_FLAGGED(i, ROOM_HOUSE) || ROOM_FLAGGED(i, ROOM_HOUSE_CRASH) || ROOM_FLAGGED(i, ROOM_OLC) || ROOM_FLAGGED(i, ROOM_BFS_MARK)) len += snprintf(buf + len, sizeof(buf) - len, "- Has illegal affection bits set (%s %s %s %s %s)\r\n", ROOM_FLAGGED(i, ROOM_ATRIUM) ? "ATRIUM" : "", @@ -3687,8 +3648,8 @@ ACMD (do_zcheck) if ((MIN_ROOM_DESC_LENGTH) && strlen(world[i].description) \r\n\r\nFile options:\r\n"); + send_to_char(ch, "USAGE: file \r\n\r\nFile options:\r\n"); for (j = 0, i = 0; fields[i].level; i++) if (fields[i].level <= GET_LEVEL(ch)) send_to_char(ch, "%-15s%s\r\n", fields[i].cmd, fields[i].file); return; } - + + /* Begin validity checks. Is the file choice valid and accessible? */ + /**/ + /* There are some arguments, deal with them. */ two_arguments(argument, field, value); - + for (l = 0; *(fields[l].cmd) != '\n'; l++) + { if (!strncmp(field, fields[l].cmd, strlen(field))) - break; - - if(*(fields[l].cmd) == '\n') { - send_to_char(ch, "That is not a valid option!\r\n"); - return; + break; } - - if (GET_LEVEL(ch) < fields[l].level) { - send_to_char(ch, "You are not godly enough to view that file!\r\n"); + + if(*(fields[l].cmd) == '\n') { + send_to_char(ch, "'%s' is not a valid file.\r\n", field); return; } + if (GET_LEVEL(ch) < fields[l].level) { + send_to_char(ch, "You have not achieved a high enough level to view '%s'.\r\n", + fields[l].cmd); + return; + } + + /* Number of lines to view. Default is 15. */ if(!*value) - req_lines = 15; /* Default is the last 15 lines. */ + req_lines = def_lines_to_read; + else if (!isdigit(*value)) + { + /* This check forces the requisite positive digit and prevents negative + * numbers of lines from being read. */ + send_to_char(ch, "'%s' is not a valid number of lines to view.\r\n", value); + return; + } else + { req_lines = atoi(value); - + /* Limit the maximum number of lines */ + req_lines = MIN( req_lines, max_lines_to_read ); + } + + /* Must be able to access the file on disk. */ if (!(req_file=fopen(fields[l].file,"r"))) { + send_to_char(ch, "The file %s can not be opened.\r\n", fields[l].file); mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error opening file %s using 'file' command.", fields[l].file); return; } + /**/ + /* End validity checks. From here on, the file should be viewable. */ + + /* Diagnostic information about the file */ + req_file_size = file_sizeof(req_file); + req_file_lines = file_numlines(req_file); + + snprintf( buf, sizeof(buf), + "@gFile:@n %s@g; Min. Level to read:@n %d@g; File Location:@n %s@g\r\n" + "File size (bytes):@n %ld@g; Total num lines:@n %d\r\n", + fields[l].cmd, fields[l].level, fields[l].file, (long) req_file_size, + req_file_lines); - get_line(req_file, line); - while (!feof(req_file)) { - num_lines++; - get_line(req_file,line); + /* Should the file be 'headed' or 'tailed'? */ + if ( (fields[l].read_backwards == TRUE) && (req_lines < req_file_lines) ) + { + snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), + "@gReading from the tail of the file.@n\r\n\r\n" ); + lines_read = file_tail( req_file, buf, sizeof(buf), req_lines ); } - rewind(req_file); - - /* Limit the maximum number of lines to 300. */ - req_lines = MIN(MIN(req_lines, num_lines), 300); - - len = snprintf(buf, sizeof(buf), "Last %d lines of %s:\r\n", req_lines, fields[l].file); - - if (req_lines == num_lines) - len += snprintf(buf + len, sizeof(buf) - len, "Top of file.\r\n"); - get_line(req_file,line); - while (!feof(req_file)) { - cur_line++; - if(cur_line > (num_lines - req_lines)) { - nlen = snprintf(buf + len, sizeof(buf) - len, "%s\r\n", line); - if (len + nlen >= sizeof(buf) || nlen < 0) - break; - len += nlen; - } - get_line(req_file,line); + else + { + snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), + "@gReading from the head of the file.@n\r\n\r\n" ); + lines_read = file_head( req_file, buf, sizeof(buf), req_lines ); } + + /** Since file_head and file_tail will add the overflow message, we + * don't check for status here. */ + if ( lines_read == req_file_lines ) + { + /* We're reading the entire file */ + snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), + "\r\n@gEntire file returned (@n%d @glines).@n\r\n", + lines_read ); + } + else if ( lines_read == max_lines_to_read ) + { + snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), + "\r\n@gMaximum number of @n%d @glines returned.@n\r\n", + lines_read ); + } + else + { + snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), + "\r\n%d @glines returned.@n\r\n", + lines_read ); + } + + /* Clean up before return */ fclose(req_file); - if (len >= sizeof(buf)) { - const char *overflow = "\r\n**OVERFLOW**\r\n"; - strcpy(buf + sizeof(buf) - strlen(overflow) - 1, overflow); /* strcpy: OK */ - } page_string(ch->desc, buf, 1); } diff --git a/src/aedit.c b/src/aedit.c index 7a6b544..cdd5cb7 100644 --- a/src/aedit.c +++ b/src/aedit.c @@ -7,6 +7,7 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "interpreter.h" #include "handler.h" #include "comm.h" @@ -16,20 +17,19 @@ #include "screen.h" #include "constants.h" #include "genolc.h" +#include "act.h" + + +/* local utility functions */ +static int aedit_find_command(const char *txt); +static void aedit_disp_menu(struct descriptor_data * d); +static void aedit_save_to_disk(struct descriptor_data *d); +/* used in aedit parse */ +static void aedit_setup_new(struct descriptor_data *d); +static void aedit_setup_existing(struct descriptor_data *d, int real_num); +static void aedit_save_internally(struct descriptor_data *d); -/* external functions */ -int sort_command_helper(const void *a, const void *b); -void sort_commands(void); /* aedit patch -- M. Scott */ -void create_command_list(void); -/* local functions */ -ACMD(do_astat); -int aedit_find_command(const char *txt); -void aedit_disp_menu(struct descriptor_data * d); -void aedit_setup_new(struct descriptor_data *d); -void aedit_setup_existing(struct descriptor_data *d, int real_num); -void aedit_save_internally(struct descriptor_data *d); -void aedit_save_to_disk(struct descriptor_data *d); /* Utils and exported functions. */ ACMD(do_oasis_aedit) @@ -107,7 +107,7 @@ ACMD(do_oasis_aedit) mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing actions.", GET_NAME(ch)); } -void aedit_setup_new(struct descriptor_data *d) { +static void aedit_setup_new(struct descriptor_data *d) { CREATE(OLC_ACTION(d), struct social_messg, 1); OLC_ACTION(d)->command = strdup(OLC_STORAGE(d)); OLC_ACTION(d)->sort_as = strdup(OLC_STORAGE(d)); @@ -132,7 +132,7 @@ void aedit_setup_new(struct descriptor_data *d) { OLC_VAL(d) = 0; } -void aedit_setup_existing(struct descriptor_data *d, int real_num) { +static void aedit_setup_existing(struct descriptor_data *d, int real_num) { CREATE(OLC_ACTION(d), struct social_messg, 1); OLC_ACTION(d)->command = strdup(soc_mess_list[real_num].command); OLC_ACTION(d)->sort_as = strdup(soc_mess_list[real_num].sort_as); @@ -170,7 +170,7 @@ void aedit_setup_existing(struct descriptor_data *d, int real_num) { aedit_disp_menu(d); } -void aedit_save_internally(struct descriptor_data *d) { +static void aedit_save_internally(struct descriptor_data *d) { struct social_messg *new_soc_mess_list = NULL; int i; @@ -193,13 +193,14 @@ void aedit_save_internally(struct descriptor_data *d) { } create_command_list(); + /* aedit patch -- M. Scott */ sort_commands(); add_to_save_list(AEDIT_PERMISSION, SL_ACT); aedit_save_to_disk(d); /* autosave by Rumble */ } -void aedit_save_to_disk(struct descriptor_data *d) { +static void aedit_save_to_disk(struct descriptor_data *d) { FILE *fp; int i; if (!(fp = fopen(SOCMESS_FILE_NEW, "w+"))) { @@ -242,7 +243,7 @@ void aedit_save_to_disk(struct descriptor_data *d) { } /* The Main Menu. */ -void aedit_disp_menu(struct descriptor_data * d) { +static void aedit_disp_menu(struct descriptor_data * d) { struct social_messg *action = OLC_ACTION(d); struct char_data *ch = d->character; @@ -798,7 +799,7 @@ ACMD(do_astat) } -int aedit_find_command(const char *txt) +static int aedit_find_command(const char *txt) { int cmd; diff --git a/src/ban.c b/src/ban.c index c3039f7..b86acbf 100644 --- a/src/ban.c +++ b/src/ban.c @@ -8,6 +8,8 @@ * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * **************************************************************************/ +#define __BAN_C__ + #include "conf.h" #include "sysdep.h" #include "structs.h" @@ -16,22 +18,21 @@ #include "interpreter.h" #include "handler.h" #include "db.h" +#include "ban.h" -/* local globals */ +/* global variables locally defined, used externally */ struct ban_list_element *ban_list = NULL; +int num_invalid = 0; -/* local functions */ -void load_banned(void); -int isbanned(char *hostname); -void _write_one_node(FILE *fp, struct ban_list_element *node); -void write_ban_list(void); -ACMD(do_ban); -ACMD(do_unban); -int valid_name(char *newname); -void read_invalid_list(void); -void free_invalid_list(void); +/* Local (file) scope variables */ +#define MAX_INVALID_NAMES 200 +static char *invalid_list[MAX_INVALID_NAMES]; -const char *ban_types[] = { +/* local utility functions */ +static void write_ban_list(void); +static void _write_one_node(FILE *fp, struct ban_list_element *node); + +static const char *ban_types[] = { "no", "new", "select", @@ -95,7 +96,7 @@ int isbanned(char *hostname) return (i); } -void _write_one_node(FILE *fp, struct ban_list_element *node) +static void _write_one_node(FILE *fp, struct ban_list_element *node) { if (node) { _write_one_node(fp, node->next); @@ -104,7 +105,7 @@ void _write_one_node(FILE *fp, struct ban_list_element *node) } } -void write_ban_list(void) +static void write_ban_list(void) { FILE *fl; @@ -224,11 +225,9 @@ ACMD(do_unban) write_ban_list(); } -/* Check for invalid names (i.e., profanity, etc.) Written by Sharon P Garza. */ -#define MAX_INVALID_NAMES 200 -char *invalid_list[MAX_INVALID_NAMES]; -int num_invalid = 0; + +/* Check for invalid names (i.e., profanity, etc.) Written by Sharon P Garza. */ int valid_name(char *newname) { int i, vowels = 0; diff --git a/src/boards.c b/src/boards.c index e2d093f..ef8dee8 100644 --- a/src/boards.c +++ b/src/boards.c @@ -8,6 +8,8 @@ * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * **************************************************************************/ +#define __BOARDS_C__ + /* FEATURES & INSTALLATION INSTRUCTIONS * - Arbitrary number of boards handled by one set of generalized routines. * Adding a new board is as easy as adding another entry to an array. @@ -38,6 +40,7 @@ #include "interpreter.h" #include "handler.h" #include "improved-edit.h" +#include "modify.h" /* Board appearance order. */ #define NEWEST_AT_TOP FALSE @@ -54,20 +57,20 @@ struct board_info_type board_info[NUM_OF_BOARDS] = { {1228, 0, 0, LVL_IMPL, LIB_ETC "board.advertising", 0}, }; -/* local functions */ -SPECIAL(gen_board); -int find_slot(void); -int find_board(struct char_data *ch); -void init_boards(void); -char *msg_storage[INDEX_SIZE]; -int msg_storage_taken[INDEX_SIZE]; -int num_of_msgs[NUM_OF_BOARDS]; -int ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE; -struct board_msginfo msg_index[NUM_OF_BOARDS][MAX_BOARD_MESSAGES]; -void board_reset_board(int board_type); -void board_clear_board(int board_type); +/* local (file scope) global variables */ +static char *msg_storage[INDEX_SIZE]; +static int msg_storage_taken[INDEX_SIZE]; +static int num_of_msgs[NUM_OF_BOARDS]; +static struct board_msginfo msg_index[NUM_OF_BOARDS][MAX_BOARD_MESSAGES]; -int find_slot(void) +/* local static utility functions */ +static int find_slot(void); +static int find_board(struct char_data *ch); +static void init_boards(void); +static void board_reset_board(int board_type); +static void board_clear_board(int board_type); + +static int find_slot(void) { int i; @@ -80,7 +83,7 @@ int find_slot(void) } /* search the room ch is standing in to find which board he's looking at */ -int find_board(struct char_data *ch) +static int find_board(struct char_data *ch) { struct obj_data *obj; int i; @@ -99,7 +102,7 @@ int find_board(struct char_data *ch) return (-1); } -void init_boards(void) +static void init_boards(void) { int i, j, fatal_error = 0; @@ -132,6 +135,9 @@ SPECIAL(gen_board) static int loaded = 0; struct obj_data *board = (struct obj_data *)me; + /* These were originally globals for some unknown reason. */ + int ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE; + if (!loaded) { init_boards(); loaded = 1; @@ -514,7 +520,7 @@ void board_clear_board(int board_type) } /* Destroy the on-disk and in-memory board. */ -void board_reset_board(int board_type) +static void board_reset_board(int board_type) { board_clear_board(board_type); remove(FILENAME(board_type)); diff --git a/src/boards.h b/src/boards.h index 6f3e2e7..8394621 100644 --- a/src/boards.h +++ b/src/boards.h @@ -1,12 +1,17 @@ -/************************************************************************** -* File: boards.h Part of tbaMUD * -* Usage: header file for bulletin boards * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file boards.h +* Header file for the bulletin board system (boards.c). +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +*/ +#ifndef _BOARDS_H_ +#define _BOARDS_H_ #define NUM_OF_BOARDS 7 /* change if needed! */ #define MAX_BOARD_MESSAGES 60 /* arbitrary -- change if needed */ @@ -45,6 +50,7 @@ struct board_info_type { #define MSG_SLOTNUM(i, j) (msg_index[i][j].slot_num) #define MSG_LEVEL(i, j) (msg_index[i][j].level) +SPECIAL(gen_board); int board_display_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board); int board_show_board(int board_type, struct char_data *ch, char *arg, struct obj_data *board); int board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board); @@ -52,3 +58,12 @@ int board_write_message(int board_type, struct char_data *ch, char *arg, struct void board_save_board(int board_type); void board_load_board(int board_type); void board_clear_all(void); + +/* Global variables */ +#ifndef __BOARDS_C__ + +extern struct board_info_type board_info[NUM_OF_BOARDS]; + +#endif /* __BOARDS_C__ */ + +#endif /* _BOARDS_H_ */ diff --git a/src/bsd-snprintf.h b/src/bsd-snprintf.h index a184a42..d1a6399 100644 --- a/src/bsd-snprintf.h +++ b/src/bsd-snprintf.h @@ -1,7 +1,10 @@ -/************************************************************************** -* File: bsd-snprintf.h Part of tbaMUD * -* Usage: Used if your OS does not provide snprintf() or vsnprintf(). * -**************************************************************************/ +/** +* @file bsd-snprintf.h +* Used if your OS does not provide snprintf() or vsnprintf(). +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +*/ /* This file taken from openbsd-compat of OpenSSH 3.1: * @@ -39,10 +42,9 @@ * --- 8< --- OpenSSH LICENSE --- 8< --- */ -/* $Id: bsd-snprintf.h,v 1.1 2002/04/16 02:22:12 greerga Exp $ */ -#ifndef _BSD_SNPRINTF_H -#define _BSD_SNPRINTF_H +#ifndef _BSD_SNPRINTF_H_ +#define _BSD_SNPRINTF_H_ #ifndef HAVE_SNPRINTF int snprintf(char *str, size_t count, const char *fmt, ...); @@ -53,4 +55,4 @@ int vsnprintf(char *str, size_t count, const char *fmt, va_list args); #endif /* !HAVE_SNPRINTF */ -#endif /* _BSD_SNPRINTF_H */ +#endif /* _BSD_SNPRINTF_H_ */ diff --git a/src/castle.c b/src/castle.c index 3bd5fe7..15a4c33 100644 --- a/src/castle.c +++ b/src/castle.c @@ -17,34 +17,32 @@ #include "handler.h" #include "db.h" #include "spells.h" +#include "act.h" +#include "spec_procs.h" /**< castle.c is part of the spec_procs module */ +#include "fight.h" /* IMPORTANT! The below defined number is the zone number of the Kings Castle. * Change it to apply to your chosen zone number. The default zone number * is 80. */ #define Z_KINGS_C 150 -/* external variables */ -extern struct time_info_data time_info; -extern int mini_mud; - -/* local functions */ -mob_vnum castle_virtual(mob_vnum offset); -room_rnum castle_real_room(room_vnum roomoffset); -struct char_data *find_npc_by_name(struct char_data *chAtChar, const char *pszName, int iLen); -int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room, int iProhibited_direction); -void assign_kings_castle(void); -int member_of_staff(struct char_data *chChar); -int member_of_royal_guard(struct char_data *chChar); -struct char_data *find_guard(struct char_data *chAtChar); -struct char_data *get_victim(struct char_data *chAtChar); -int banzaii(struct char_data *ch); -int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim); -int is_trash(struct obj_data *i); -void fry_victim(struct char_data *ch); -int castle_cleaner(struct char_data *ch, int cmd, int gripe); -int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname); -void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc)); +/* local, file scope restricted functions */ +static mob_vnum castle_virtual(mob_vnum offset); +static room_rnum castle_real_room(room_vnum roomoffset); +static struct char_data *find_npc_by_name(struct char_data *chAtChar, const char *pszName, int iLen); +static int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room, int iProhibited_direction); +static int member_of_staff(struct char_data *chChar); +static int member_of_royal_guard(struct char_data *chChar); +static struct char_data *find_guard(struct char_data *chAtChar); +static struct char_data *get_victim(struct char_data *chAtChar); +static int banzaii(struct char_data *ch); +static int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim); +static int is_trash(struct obj_data *i); +static void fry_victim(struct char_data *ch); +static int castle_cleaner(struct char_data *ch, int cmd, int gripe); +static int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname); +static void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc)); /* Special procedures for Kings Castle by Pjotr. Coded by Sapowox. */ SPECIAL(CastleGuard); SPECIAL(James); @@ -56,13 +54,13 @@ SPECIAL(king_welmar); SPECIAL(training_master); SPECIAL(peter); SPECIAL(jerry); -SPECIAL(guild); -ACMD(do_gen_door); -ACMD(do_follow); + + + /* Assign castle special procedures. NOTE: The mobile number isn't fully * specified. It's only an offset from the zone's base. */ -void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc)) +static void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc)) { mob_vnum vmv = castle_virtual(mobnum); mob_rnum rmr = NOBODY; @@ -80,7 +78,7 @@ void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc)) mob_index[rmr].func = specproc; } -mob_vnum castle_virtual(mob_vnum offset) +static mob_vnum castle_virtual(mob_vnum offset) { zone_rnum zon; @@ -90,7 +88,7 @@ mob_vnum castle_virtual(mob_vnum offset) return zone_table[zon].bot + offset; } -room_rnum castle_real_room(room_vnum roomoffset) +static room_rnum castle_real_room(room_vnum roomoffset) { zone_rnum zon; @@ -131,7 +129,7 @@ void assign_kings_castle(void) /* Routine: member_of_staff. Used to see if a character is a member of the * castle staff. Used mainly by BANZAI:ng NPC:s. */ -int member_of_staff(struct char_data *chChar) +static int member_of_staff(struct char_data *chChar) { int ch_num; @@ -157,7 +155,7 @@ int member_of_staff(struct char_data *chChar) /* Function: member_of_royal_guard. Returns TRUE if the character is a guard on * duty, otherwise FALSE. Used by Peter the captain of the royal guard. */ -int member_of_royal_guard(struct char_data *chChar) +static int member_of_royal_guard(struct char_data *chChar) { int ch_num; @@ -180,7 +178,7 @@ int member_of_royal_guard(struct char_data *chChar) /* Function: find_npc_by_name. Returns a pointer to an npc by the given name. * Used by Tim and Tom. */ -struct char_data *find_npc_by_name(struct char_data *chAtChar, +static struct char_data *find_npc_by_name(struct char_data *chAtChar, const char *pszName, int iLen) { struct char_data *ch; @@ -194,7 +192,7 @@ struct char_data *find_npc_by_name(struct char_data *chAtChar, /* Function: find_guard. Returns the pointer to a guard on duty. Used by Peter * the Captain of the Royal Guard */ -struct char_data *find_guard(struct char_data *chAtChar) +static struct char_data *find_guard(struct char_data *chAtChar) { struct char_data *ch; @@ -208,7 +206,7 @@ struct char_data *find_guard(struct char_data *chAtChar) /* Function: get_victim. Returns a pointer to a randomly chosen character in * the same room, fighting someone in the castle staff. Used by BANZAII-ing * characters and King Welmar... */ -struct char_data *get_victim(struct char_data *chAtChar) +static struct char_data *get_victim(struct char_data *chAtChar) { struct char_data *ch; int iNum_bad_guys = 0, iVictim; @@ -244,7 +242,7 @@ struct char_data *get_victim(struct char_data *chAtChar) /* Banzaii. Makes a character banzaii on attackers of the castle staff. Used * by Guards, Tim, Tom, Dick, David, Peter, Master, and the King. */ -int banzaii(struct char_data *ch) +static int banzaii(struct char_data *ch) { struct char_data *chOpponent; @@ -258,7 +256,7 @@ int banzaii(struct char_data *ch) } /* Do_npc_rescue. Makes ch_hero rescue ch_victim. Used by Tim and Tom. */ -int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim) +static int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim) { struct char_data *ch_bad_guy; @@ -287,7 +285,7 @@ int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim) /* Procedure to block a person trying to enter a room. Used by Tim/Tom at Kings * bedroom and Dick/David at treasury. */ -int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room, +static int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room, int iProhibited_direction) { if (cmd != ++iProhibited_direction) @@ -308,7 +306,7 @@ int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room, /* Routine to check if an object is trash. Used by James the Butler and the * Cleaning Lady. */ -int is_trash(struct obj_data *i) +static int is_trash(struct obj_data *i) { if (!OBJWEAR_FLAGGED(i, ITEM_WEAR_TAKE)) return (FALSE); @@ -321,7 +319,7 @@ int is_trash(struct obj_data *i) /* Fry_victim. Finds a suitabe victim, and cast some _NASTY_ spell on him. Used * by King Welmar. */ -void fry_victim(struct char_data *ch) +static void fry_victim(struct char_data *ch) { struct char_data *tch; @@ -578,7 +576,7 @@ SPECIAL(tim) } /* Common routine for the Castle Twins. */ -int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname) +static int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname) { struct char_data *king, *twin; @@ -616,7 +614,7 @@ SPECIAL(James) } /* Common code for James and the Cleaning Woman. */ -int castle_cleaner(struct char_data *ch, int cmd, int gripe) +static int castle_cleaner(struct char_data *ch, int cmd, int gripe) { struct obj_data *i; diff --git a/src/cedit.c b/src/cedit.c index d8f8fea..da99622 100644 --- a/src/cedit.c +++ b/src/cedit.c @@ -8,34 +8,31 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "comm.h" #include "interpreter.h" -#include "utils.h" #include "db.h" #include "constants.h" #include "genolc.h" #include "oasis.h" #include "improved-edit.h" +#include "modify.h" -/* Local Macros */ -#define NO 0 -#define YES 1 #define CHECK_VAR(var) ((var == YES) ? "Yes" : "No") #define TOGGLE_VAR(var) if (var == YES) { var = NO; } else { var = YES; } -/* local functions */ -void cedit_disp_menu(struct descriptor_data *d); -void cedit_save_internally(struct descriptor_data *d); -void cedit_disp_game_play_options(struct descriptor_data *d); -void cedit_disp_crash_save_options(struct descriptor_data *d); -void cedit_disp_room_numbers(struct descriptor_data *d); -void cedit_disp_operation_options(struct descriptor_data *d); -void cedit_disp_autowiz_options(struct descriptor_data *d); -int save_config( IDXTYPE nowhere ); -void reassign_rooms(void); -void cedit_setup(struct descriptor_data *d); -void cedit_save_to_disk( void ); +/* local scope functions, not used externally */ +static void cedit_disp_menu(struct descriptor_data *d); +static void cedit_save_internally(struct descriptor_data *d); +static void cedit_disp_game_play_options(struct descriptor_data *d); +static void cedit_disp_crash_save_options(struct descriptor_data *d); +static void cedit_disp_room_numbers(struct descriptor_data *d); +static void cedit_disp_operation_options(struct descriptor_data *d); +static void cedit_disp_autowiz_options(struct descriptor_data *d); +static void reassign_rooms(void); +static void cedit_setup(struct descriptor_data *d); + ACMD(do_oasis_cedit) { @@ -79,7 +76,7 @@ ACMD(do_oasis_cedit) cedit_save_to_disk(); } -void cedit_setup(struct descriptor_data *d) +static void cedit_setup(struct descriptor_data *d) { /* Create the config_data struct. */ CREATE(OLC_CONFIG(d), struct config_data, 1); @@ -103,7 +100,10 @@ void cedit_setup(struct descriptor_data *d) OLC_CONFIG(d)->play.track_through_doors = CONFIG_TRACK_T_DOORS; OLC_CONFIG(d)->play.no_mort_to_immort = CONFIG_NO_MORT_TO_IMMORT; OLC_CONFIG(d)->play.disp_closed_doors = CONFIG_DISP_CLOSED_DOORS; - + OLC_CONFIG(d)->play.map_option = CONFIG_MAP; + OLC_CONFIG(d)->play.map_size = CONFIG_MAP_SIZE; + OLC_CONFIG(d)->play.minimap_size = CONFIG_MINIMAP_SIZE; + /* Crash Saves */ OLC_CONFIG(d)->csd.free_rent = CONFIG_FREE_RENT; OLC_CONFIG(d)->csd.max_obj_save = CONFIG_MAX_OBJ_SAVE; @@ -174,7 +174,7 @@ void cedit_setup(struct descriptor_data *d) cedit_disp_menu(d); } -void cedit_save_internally(struct descriptor_data *d) +static void cedit_save_internally(struct descriptor_data *d) { /* see if we need to reassign spec procs on rooms */ int reassign = (CONFIG_DTS_ARE_DUMPS != OLC_CONFIG(d)->play.dts_are_dumps); @@ -196,6 +196,9 @@ void cedit_save_internally(struct descriptor_data *d) CONFIG_TRACK_T_DOORS = OLC_CONFIG(d)->play.track_through_doors; CONFIG_NO_MORT_TO_IMMORT = OLC_CONFIG(d)->play.no_mort_to_immort; CONFIG_DISP_CLOSED_DOORS = OLC_CONFIG(d)->play.disp_closed_doors; + CONFIG_MAP = OLC_CONFIG(d)->play.map_option; + CONFIG_MAP_SIZE = OLC_CONFIG(d)->play.map_size; + CONFIG_MINIMAP_SIZE = OLC_CONFIG(d)->play.minimap_size; /* Crash Saves */ CONFIG_FREE_RENT = OLC_CONFIG(d)->csd.free_rent; @@ -354,7 +357,14 @@ int save_config( IDXTYPE nowhere ) "no_mort_to_immort = %d\n\n", CONFIG_NO_MORT_TO_IMMORT); fprintf(fl, "* Should closed doors be shown on autoexit / exit?\n" "disp_closed_doors = %d\n\n", CONFIG_DISP_CLOSED_DOORS); + fprintf(fl, "* Who can use the map functions? 0=off, 1=on, 2=imm_only\n" + "map_option = %d\n\n", CONFIG_MAP); + fprintf(fl, "* Default size of map shown by 'map' command\n" + "default_map_size = %d\n\n", CONFIG_MAP_SIZE); + fprintf(fl, "* Default minimap size shown to the right of room descriptions\n" + "default_minimap_size = %d\n\n", CONFIG_MINIMAP_SIZE); + strcpy(buf, CONFIG_OK); strip_cr(buf); @@ -524,8 +534,9 @@ int save_config( IDXTYPE nowhere ) } /* Menu functions - The main menu. */ -void cedit_disp_menu(struct descriptor_data *d) +static void cedit_disp_menu(struct descriptor_data *d) { + get_char_colors(d->character); clear_screen(d); @@ -551,11 +562,15 @@ void cedit_disp_menu(struct descriptor_data *d) OLC_MODE(d) = CEDIT_MAIN_MENU; } -void cedit_disp_game_play_options(struct descriptor_data *d) +static void cedit_disp_game_play_options(struct descriptor_data *d) { + int m_opt; + m_opt = OLC_CONFIG(d)->play.map_option; get_char_colors(d->character); clear_screen(d); + + write_to_output(d, "\r\n\r\n" "%sA%s) Player Killing Allowed : %s%s\r\n" "%sB%s) Player Thieving Allowed : %s%s\r\n" @@ -574,9 +589,12 @@ void cedit_disp_game_play_options(struct descriptor_data *d) "%sO%s) Track Through Doors : %s%s\r\n" "%sP%s) Display Closed Doors : %s%s\r\n" "%sR%s) Mortals Level To Immortal : %s%s\r\n" - "%s1%s) OK Message Text : %s%s" + "%s1%s) OK Message Text : %s%s" "%s2%s) NOPERSON Message Text : %s%s" "%s3%s) NOEFFECT Message Text : %s%s" + "%s4%s) Map/Automap Option : %s%s\r\n" + "%s5%s) Default map size : %s%d\r\n" + "%s6%s) Default minimap size : %s%d\r\n" "%sQ%s) Exit To The Main Menu\r\n" "Enter your choice : ", grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.pk_allowed), @@ -596,11 +614,14 @@ void cedit_disp_game_play_options(struct descriptor_data *d) grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.load_into_inventory), grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.track_through_doors), grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.disp_closed_doors), - grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.no_mort_to_immort), + grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.no_mort_to_immort), grn, nrm, cyn, OLC_CONFIG(d)->play.OK, grn, nrm, cyn, OLC_CONFIG(d)->play.NOPERSON, grn, nrm, cyn, OLC_CONFIG(d)->play.NOEFFECT, + grn, nrm, cyn, m_opt == 0 ? "Off" : (m_opt == 1 ? "On" : (m_opt == 2 ? "Imm-Only" : "Invalid!")), + grn, nrm, cyn, OLC_CONFIG(d)->play.map_size, + grn, nrm, cyn, OLC_CONFIG(d)->play.minimap_size, grn, nrm ); @@ -608,7 +629,7 @@ void cedit_disp_game_play_options(struct descriptor_data *d) OLC_MODE(d) = CEDIT_GAME_OPTIONS_MENU; } -void cedit_disp_crash_save_options(struct descriptor_data *d) +static void cedit_disp_crash_save_options(struct descriptor_data *d) { get_char_colors(d->character); clear_screen(d); @@ -636,7 +657,7 @@ void cedit_disp_crash_save_options(struct descriptor_data *d) OLC_MODE(d) = CEDIT_CRASHSAVE_OPTIONS_MENU; } -void cedit_disp_room_numbers(struct descriptor_data *d) +static void cedit_disp_room_numbers(struct descriptor_data *d) { get_char_colors(d->character); clear_screen(d); @@ -662,7 +683,7 @@ void cedit_disp_room_numbers(struct descriptor_data *d) OLC_MODE(d) = CEDIT_ROOM_NUMBERS_MENU; } -void cedit_disp_operation_options(struct descriptor_data *d) +static void cedit_disp_operation_options(struct descriptor_data *d) { get_char_colors(d->character); clear_screen(d); @@ -704,7 +725,7 @@ void cedit_disp_operation_options(struct descriptor_data *d) OLC_MODE(d) = CEDIT_OPERATION_OPTIONS_MENU; } -void cedit_disp_autowiz_options(struct descriptor_data *d) +static void cedit_disp_autowiz_options(struct descriptor_data *d) { get_char_colors(d->character); clear_screen(d); @@ -910,6 +931,24 @@ void cedit_parse(struct descriptor_data *d, char *arg) OLC_MODE(d) = CEDIT_NOEFFECT; return; + case '4': + write_to_output(d, "1) Disable maps\r\n"); + write_to_output(d, "2) Enable Maps\r\n"); + write_to_output(d, "3) Maps for Immortals only\r\n"); + write_to_output(d, "Enter choice: "); + OLC_MODE(d) = CEDIT_MAP_OPTION; + return; + + case '5': + write_to_output(d, "Enter default map size (1-12) : "); + OLC_MODE(d) = CEDIT_MAP_SIZE; + return; + + case '6': + write_to_output(d, "Enter default mini-map size (1-12) : "); + OLC_MODE(d) = CEDIT_MINIMAP_SIZE; + return; + case 'q': case 'Q': cedit_disp_menu(d); @@ -1281,8 +1320,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) if (OLC_CONFIG(d)->play.OK) free(OLC_CONFIG(d)->play.OK); - OLC_CONFIG(d)->play.OK = str_udup(arg); - strcat(OLC_CONFIG(d)->play.OK, "\r\n"); + OLC_CONFIG(d)->play.OK = str_udupnl(arg); cedit_disp_game_play_options(d); break; @@ -1294,8 +1332,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) if (OLC_CONFIG(d)->play.NOPERSON) free(OLC_CONFIG(d)->play.NOPERSON); - OLC_CONFIG(d)->play.NOPERSON = str_udup(arg); - strcat(OLC_CONFIG(d)->play.NOPERSON, "\r\n"); + OLC_CONFIG(d)->play.NOPERSON = str_udupnl(arg); cedit_disp_game_play_options(d); break; @@ -1307,8 +1344,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) if (OLC_CONFIG(d)->play.NOEFFECT) free(OLC_CONFIG(d)->play.NOEFFECT); - OLC_CONFIG(d)->play.NOEFFECT = str_udup(arg); - strcat(OLC_CONFIG(d)->play.NOEFFECT, "\r\n"); + OLC_CONFIG(d)->play.NOEFFECT = str_udupnl(arg); cedit_disp_game_play_options(d); break; @@ -1522,6 +1558,40 @@ void cedit_parse(struct descriptor_data *d, char *arg) } break; + case CEDIT_MAP_OPTION: + if (!*arg) { + write_to_output(d, + "That is an invalid choice!\r\n" + "Select 1, 2 or 3 (0 to cancel) :"); + } else { + if ((atoi(arg) >= 1) && (atoi(arg) <= 3)) + OLC_CONFIG(d)->play.map_option = (atoi(arg) - 1); + cedit_disp_game_play_options(d); + } + break; + + case CEDIT_MAP_SIZE: + if (!*arg) { + /* User just pressed return - restore to default */ + OLC_CONFIG(d)->play.map_size = 6; + cedit_disp_game_play_options(d); + } else { + OLC_CONFIG(d)->play.map_size = MIN(MAX((atoi(arg)), 1), 12); + cedit_disp_game_play_options(d); + } + break; + + case CEDIT_MINIMAP_SIZE: + if (!*arg) { + /* User just pressed return - restore to default */ + OLC_CONFIG(d)->play.minimap_size = 2; + cedit_disp_game_play_options(d); + } else { + OLC_CONFIG(d)->play.minimap_size = MIN(MAX((atoi(arg)), 1), 12); + cedit_disp_game_play_options(d); + } + break; + default: /* We should never get here, but just in case... */ cleanup_olc(d, CLEANUP_CONFIG); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: cedit_parse(): Reached default case!"); @@ -1530,7 +1600,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) } } /* End of parse_cedit() */ -void reassign_rooms(void) +static void reassign_rooms(void) { void assign_rooms(void); int i; diff --git a/src/class.c b/src/class.c index d8200a4..35d1145 100644 --- a/src/class.c +++ b/src/class.c @@ -8,6 +8,9 @@ * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * **************************************************************************/ +/** Help buffer the global variable definitions */ +#define __CLASS_C__ + /* This file attempts to concentrate most of the code which must be changed * in order for new classes to be added. If you're adding a new class, you * should go through this entire file from beginning to end and add the @@ -16,25 +19,13 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" -#include "db.h" #include "utils.h" +#include "db.h" #include "spells.h" #include "interpreter.h" #include "constants.h" +#include "act.h" -/* local functions */ -void snoop_check(struct char_data *ch); -int parse_class(char arg); -bitvector_t find_class_bitvector(const char *arg); -byte saving_throws(int class_num, int type, int level); -int thaco(int class_num, int level); -void roll_real_abils(struct char_data *ch); -void do_start(struct char_data *ch); -int backstab_mult(int level); -int invalid_class(struct char_data *ch, struct obj_data *obj); -int level_exp(int chclass, int level); -const char *title_male(int chclass, int level); -const char *title_female(int chclass, int level); /* Names first */ const char *class_abbrevs[] = { @@ -135,13 +126,13 @@ int prac_params[4][NUM_CLASSES] = { struct guild_info_type guild_info[] = { /* Midgaard */ - { CLASS_MAGIC_USER, 3017, SCMD_SOUTH }, - { CLASS_CLERIC, 3004, SCMD_NORTH }, - { CLASS_THIEF, 3027, SCMD_EAST }, - { CLASS_WARRIOR, 3021, SCMD_EAST }, + { CLASS_MAGIC_USER, 3017, SOUTH }, + { CLASS_CLERIC, 3004, NORTH }, + { CLASS_THIEF, 3027, EAST }, + { CLASS_WARRIOR, 3021, EAST }, /* Brass Dragon */ - { -999 /* all */ , 5065, SCMD_WEST }, + { -999 /* all */ , 5065, WEST }, /* this must go last -- add new guards above! */ { -1, NOWHERE, -1} diff --git a/src/comm.c b/src/comm.c index 4b0136e..83802f2 100644 --- a/src/comm.c +++ b/src/comm.c @@ -13,6 +13,8 @@ #include "conf.h" #include "sysdep.h" +/* Begin conf.h dependent includes */ + #if CIRCLE_GNU_LIBC_MEMORY_TRACK # include #endif @@ -47,6 +49,14 @@ # include #endif +#ifdef HAVE_ARPA_TELNET_H +#include +#else +#include "telnet.h" +#endif + +/* end conf.h dependent includes */ + /* Note, most includes for all platforms are in sysdep.h. The list of * files that is included is controlled by conf.h for that platform. */ @@ -61,121 +71,95 @@ #include "genolc.h" #include "dg_scripts.h" #include "dg_event.h" - -#ifdef HAVE_ARPA_TELNET_H -#include -#else -#include "telnet.h" -#endif +#include "screen.h" /* to support the gemote act type command */ +#include "constants.h" /* For mud versions */ +#include "boards.h" +#include "act.h" +#include "ban.h" +#include "fight.h" +#include "spells.h" /* for affect_update */ +#include "modify.h" +#include "quest.h" #ifndef INVALID_SOCKET #define INVALID_SOCKET (-1) #endif -/* externs */ -extern struct ban_list_element *ban_list; -extern int num_invalid; -extern char *GREETINGS; -extern const char *tbamud_version; -extern const char *oasisolc_version; -extern const char *ascii_pfiles_version; -extern int circle_restrict; -extern int mini_mud; -extern int no_rent_check; -extern int *cmd_sort_info; - -extern struct time_info_data time_info; /* In db.c */ -extern char *help; - -/* local globals */ -struct descriptor_data *descriptor_list = NULL; /* master desc list */ -struct txt_block *bufpool = 0; /* pool of large output buffers */ -int buf_largecount = 0; /* # of large buffers which exist */ -int buf_overflows = 0; /* # of overflows of output */ -int buf_switches = 0; /* # of switches from small to large buf */ -int circle_shutdown = 0; /* clean shutdown */ -int circle_reboot = 0; /* reboot the game after a shutdown */ -int no_specials = 0; /* Suppress ass. of special routines */ -int max_players = 0; /* max descriptors available */ -int tics_passed = 0; /* for extern checkpointing */ -int scheck = 0; /* for syntax checking mode */ -struct timeval null_time; /* zero-valued time structure */ -byte reread_wizlist; /* signal: SIGUSR1 */ -byte emergency_unban; /* signal: SIGUSR2 */ -FILE *logfile = NULL; /* Where to send the log messages. */ -int dg_act_check; /* toggle for act_trigger */ -unsigned long pulse = 0; /* number of pulses since game start */ -static bool fCopyOver; /* Are we booting in copyover mode? */ +/* locally defined globals, used externally */ +struct descriptor_data *descriptor_list = NULL; /* master desc list */ +int buf_largecount = 0; /* # of large buffers which exist */ +int buf_overflows = 0; /* # of overflows of output */ +int buf_switches = 0; /* # of switches from small to large buf */ +int circle_shutdown = 0; /* clean shutdown */ +int circle_reboot = 0; /* reboot the game after a shutdown */ +int no_specials = 0; /* Suppress ass. of special routines */ +int scheck = 0; /* for syntax checking mode */ +FILE *logfile = NULL; /* Where to send the log messages. */ +unsigned long pulse = 0; /* number of pulses since game start */ ush_int port; socket_t mother_desc; -int log_this_messg; -char *last_act_message = NULL; +/* used with do_tell and handle_webster_file utility */ +long last_webster_teller = -1L; -/* local functions */ -RETSIGTYPE reread_wizlists(int sig); -RETSIGTYPE unrestrict_game(int sig); -RETSIGTYPE reap(int sig); -RETSIGTYPE checkpointing(int sig); -RETSIGTYPE hupsig(int sig); -ssize_t perform_socket_read(socket_t desc, char *read_point,size_t space_left); -ssize_t perform_socket_write(socket_t desc, const char *txt,size_t length); -void echo_off(struct descriptor_data *d); -void echo_on(struct descriptor_data *d); -void circle_sleep(struct timeval *timeout); -int get_from_q(struct txt_q *queue, char *dest, int *aliased); -void init_game(ush_int port); -void signal_setup(void); -void game_loop(socket_t mother_desc); -socket_t init_socket(ush_int port); -int new_descriptor(socket_t s); -int get_max_players(void); -int process_output(struct descriptor_data *t); -int process_input(struct descriptor_data *t); -void timediff(struct timeval *diff, struct timeval *a, struct timeval *b); -void timeadd(struct timeval *sum, struct timeval *a, struct timeval *b); -void flush_queues(struct descriptor_data *d); -void nonblock(socket_t s); -int perform_subst(struct descriptor_data *t, char *orig, char *subst); -void record_usage(void); -char *make_prompt(struct descriptor_data *point); -void check_idle_passwords(void); -void heartbeat(int heart_pulse); -void init_descriptor (struct descriptor_data *newd, int desc); +/* static local global variable declarations (current file scope only) */ +static struct txt_block *bufpool = 0; /* pool of large output buffers */ +static int max_players = 0; /* max descriptors available */ +static int tics_passed = 0; /* for extern checkpointing */ +static struct timeval null_time; /* zero-valued time structure */ +static byte reread_wizlist; /* signal: SIGUSR1 */ +/* normally signal SIGUSR2, currently orphaned in favor of Webster dictionary + * lookup +static byte emergency_unban; +*/ +static int dg_act_check; /* toggle for act_trigger */ +static bool fCopyOver; /* Are we booting in copyover mode? */ +static char *last_act_message = NULL; +static byte webster_file_ready = FALSE;/* signal: SIGUSR2 */ -struct in_addr *get_bind_addr(void); -int parse_ip(const char *addr, struct in_addr *inaddr); -int set_sendbuf(socket_t s); -void free_bufpool(void); -void setup_log(const char *filename, int fd); -int open_logfile(const char *filename, FILE *stderr_fp); +/* static local function prototypes (current file scope only) */ +static RETSIGTYPE reread_wizlists(int sig); +/* Appears to be orphaned right now... +static RETSIGTYPE unrestrict_game(int sig); +*/ +static RETSIGTYPE reap(int sig); +static RETSIGTYPE checkpointing(int sig); +static RETSIGTYPE hupsig(int sig); +static ssize_t perform_socket_read(socket_t desc, char *read_point,size_t space_left); +static ssize_t perform_socket_write(socket_t desc, const char *txt,size_t length); +static void circle_sleep(struct timeval *timeout); +static int get_from_q(struct txt_q *queue, char *dest, int *aliased); +static void init_game(ush_int port); +static void signal_setup(void); +static socket_t init_socket(ush_int port); +static int new_descriptor(socket_t s); +static int get_max_players(void); +static int process_output(struct descriptor_data *t); +static int process_input(struct descriptor_data *t); +static void timediff(struct timeval *diff, struct timeval *a, struct timeval *b); +static void timeadd(struct timeval *sum, struct timeval *a, struct timeval *b); +static void flush_queues(struct descriptor_data *d); +static void nonblock(socket_t s); +static int perform_subst(struct descriptor_data *t, char *orig, char *subst); +static void record_usage(void); +static char *make_prompt(struct descriptor_data *point); +static void check_idle_passwords(void); +static void init_descriptor (struct descriptor_data *newd, int desc); + +static struct in_addr *get_bind_addr(void); +static int parse_ip(const char *addr, struct in_addr *inaddr); +static int set_sendbuf(socket_t s); +static void free_bufpool(void); +static void setup_log(const char *filename, int fd); +static int open_logfile(const char *filename, FILE *stderr_fp); #if defined(POSIX) -sigfunc *my_signal(int signo, sigfunc *func); +static sigfunc *my_signal(int signo, sigfunc *func); #endif +/* Webster Dictionary Lookup functions */ +static RETSIGTYPE websterlink(int sig); +static size_t proc_colors(char *txt, size_t maxlen, int parse); +static void handle_webster_file(); -byte webster_file_ready = FALSE;/* signal: SIGUSR2 */ -RETSIGTYPE websterlink(int sig); -extern void handle_webster_file(); -void copyover_recover(void); -size_t proc_colors(char *txt, size_t maxlen, int parse); - -/* extern functions */ -void reboot_wizlists(void); -void boot_world(void); -void affect_update(void); /* In magic.c */ -void mobile_activity(void); -void perform_violence(void); -void show_string(struct descriptor_data *d, char *input); -int isbanned(char *hostname); -void weather_and_time(int mode); -int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen); -void free_messages(void); -void board_clear_all(void); -void free_social_messages(void); -void free_invalid_list(void); -void free_command_list(void); -void free_save_list(void); -void load_config(void); -void new_hist_messg(struct descriptor_data *d, const char *msg); +/* externally defined functions, used locally */ #ifdef __CXREF__ #undef FD_ZERO #undef FD_SET @@ -369,17 +353,17 @@ int main(int argc, char **argv) if (!scheck) { log("Clearing other memory."); - free_bufpool(); /* comm.c */ - free_player_index(); /* players.c */ - free_messages(); /* fight.c */ - free_text_files(); /* db.c */ - board_clear_all(); /* boards.c */ - free(cmd_sort_info); /* act.informative.c */ - free_command_list(); /* act.informative.c */ - free_social_messages(); /* act.social.c */ - free_help_table(); /* db.c */ - free_invalid_list(); /* ban.c */ - free_save_list(); /* genolc.c */ + free_bufpool(); /* comm.c */ + free_player_index(); /* players.c */ + free_messages(); /* fight.c */ + free_text_files(); /* db.c */ + board_clear_all(); /* boards.c */ + free(cmd_sort_info); /* act.informative.c */ + free_command_list(); /* act.informative.c */ + free_social_messages(); /* act.social.c */ + free_help_table(); /* db.c */ + free_invalid_list(); /* ban.c */ + free_save_list(); /* genolc.c */ free_strings(&config_info, OASIS_CFG); /* oasis_delete.c */ } @@ -398,9 +382,6 @@ int main(int argc, char **argv) return (0); } -int enter_player_game(struct descriptor_data *d); -extern time_t boot_time; - /* Reload players after a copyover */ void copyover_recover() { @@ -426,7 +407,7 @@ void copyover_recover() unlink (COPYOVER_FILE); /* read boot_time - first line in file */ - fscanf(fp, "%ld\n", &boot_time); + fscanf(fp, "%ld\n", (long *)&boot_time); for (;;) { fOld = TRUE; @@ -484,7 +465,7 @@ void copyover_recover() } /* Init sockets, run game, and cleanup sockets */ -void init_game(ush_int port) +static void init_game(ush_int port) { /* We don't want to restart if we crash before we get up. */ touch(KILLSCRIPT_FILE); @@ -545,7 +526,7 @@ void init_game(ush_int port) /* init_socket sets up the mother descriptor - creates the socket, sets * its options up, binds it, and listens. */ -socket_t init_socket(ush_int port) +static socket_t init_socket(ush_int port) { socket_t s; struct sockaddr_in sa; @@ -633,7 +614,7 @@ socket_t init_socket(ush_int port) return (s); } -int get_max_players(void) +static int get_max_players(void) { #ifndef CIRCLE_UNIX return (CONFIG_MAX_PLAYING); @@ -929,6 +910,7 @@ void game_loop(socket_t mother_desc) mudlog(CMP, LVL_IMMORT, TRUE, "Signal received - rereading wizlists."); reboot_wizlists(); } +/* Orphaned right now as signal trapping is used for Webster lookup if (emergency_unban) { emergency_unban = FALSE; mudlog(BRF, LVL_IMMORT, TRUE, "Received SIGUSR2 - completely unrestricting game (emergent)"); @@ -936,6 +918,7 @@ void game_loop(socket_t mother_desc) circle_restrict = 0; num_invalid = 0; } +*/ if (webster_file_ready) { webster_file_ready = FALSE; handle_webster_file(); @@ -969,11 +952,12 @@ void heartbeat(int heart_pulse) if (!(heart_pulse % PULSE_VIOLENCE)) perform_violence(); - if (!(heart_pulse % (SECS_PER_MUD_HOUR * PASSES_PER_SEC))) { + if (!(heart_pulse % (SECS_PER_MUD_HOUR * PASSES_PER_SEC))) { /* Tick ! */ weather_and_time(1); check_time_triggers(); affect_update(); point_update(); + check_timed_quests(); } if (CONFIG_AUTO_SAVE && !(heart_pulse % PULSE_AUTOSAVE)) { /* 1 minute */ @@ -999,7 +983,7 @@ void heartbeat(int heart_pulse) * Based on code submitted by ss@sirocco.cup.hp.com. Code to return the time * difference between a and b (a-b). Always returns a nonnegative value * (floors at 0). */ -void timediff(struct timeval *rslt, struct timeval *a, struct timeval *b) +static void timediff(struct timeval *rslt, struct timeval *a, struct timeval *b) { if (a->tv_sec < b->tv_sec) *rslt = null_time; @@ -1021,7 +1005,7 @@ void timediff(struct timeval *rslt, struct timeval *a, struct timeval *b) } /* Add 2 time values. Patch sent by "d. hall" to fix 'static' usage. */ -void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b) +static void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b) { rslt->tv_sec = a->tv_sec + b->tv_sec; rslt->tv_usec = a->tv_usec + b->tv_usec; @@ -1032,7 +1016,7 @@ void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b) } } -void record_usage(void) +static void record_usage(void) { int sockets_connected = 0, sockets_playing = 0; struct descriptor_data *d; @@ -1097,7 +1081,7 @@ const char *ANSI[] = { "@", A"0m",A"0m",A"0;30m",A"0;34m",A"0;32m",A"0;36m",A"0; #undef A const char CCODE[] = "@nNdbgcrmywDBGCRMYW01234567luoe!"; -size_t proc_colors(char *txt, size_t maxlen, int parse) +static size_t proc_colors(char *txt, size_t maxlen, int parse) { char *d, *s, *c, *p; int i; @@ -1158,7 +1142,7 @@ size_t proc_colors(char *txt, size_t maxlen, int parse) return strlen(txt); } -char *make_prompt(struct descriptor_data *d) +static char *make_prompt(struct descriptor_data *d) { static char prompt[MAX_PROMPT_LENGTH]; @@ -1262,7 +1246,7 @@ void write_to_q(const char *txt, struct txt_q *queue, int aliased) } /* NOTE: 'dest' must be at least MAX_INPUT_LENGTH big. */ -int get_from_q(struct txt_q *queue, char *dest, int *aliased) +static int get_from_q(struct txt_q *queue, char *dest, int *aliased) { struct txt_block *tmp; @@ -1282,7 +1266,7 @@ int get_from_q(struct txt_q *queue, char *dest, int *aliased) } /* Empty the queues before closing connection */ -void flush_queues(struct descriptor_data *d) +static void flush_queues(struct descriptor_data *d) { if (d->large_outbuf) { d->large_outbuf->next = bufpool; @@ -1373,7 +1357,7 @@ size_t vwrite_to_output(struct descriptor_data *t, const char *format, va_list a return (t->bufspace); } -void free_bufpool(void) +static void free_bufpool(void) { struct txt_block *tmp; @@ -1392,7 +1376,7 @@ void free_bufpool(void) * address, we try to bind to it; otherwise, we bind to INADDR_ANY. * Note that inet_aton() is preferred over inet_addr() so we use it if * we can. If neither is available, we always bind to INADDR_ANY. */ -struct in_addr *get_bind_addr() +static struct in_addr *get_bind_addr() { static struct in_addr bind_addr; @@ -1423,7 +1407,7 @@ struct in_addr *get_bind_addr() #ifdef HAVE_INET_ATON /* inet_aton's interface is the same as parse_ip's: 0 on failure, non-0 if * successful. */ -int parse_ip(const char *addr, struct in_addr *inaddr) +static int parse_ip(const char *addr, struct in_addr *inaddr) { return (inet_aton(addr, inaddr)); } @@ -1454,7 +1438,7 @@ int parse_ip(const char *addr, struct in_addr *inaddr) #endif /* INET_ATON and INET_ADDR */ /* Sets the kernel's send buffer size for the descriptor */ -int set_sendbuf(socket_t s) +static int set_sendbuf(socket_t s) { #if defined(SO_SNDBUF) && !defined(CIRCLE_MACINTOSH) int opt = MAX_SOCK_BUF; @@ -1469,7 +1453,7 @@ int set_sendbuf(socket_t s) } /* Initialize a descriptor */ -void init_descriptor (struct descriptor_data *newd, int desc) +static void init_descriptor (struct descriptor_data *newd, int desc) { static int last_desc = 0; /* last descriptor number */ @@ -1488,7 +1472,7 @@ void init_descriptor (struct descriptor_data *newd, int desc) newd->desc_num = last_desc; } -int new_descriptor(socket_t s) +static int new_descriptor(socket_t s) { socket_t desc; int sockets_connected = 0; @@ -1496,6 +1480,7 @@ int new_descriptor(socket_t s) struct descriptor_data *newd; struct sockaddr_in peer; struct hostent *from; + char greet_copy[MAX_STRING_LENGTH]; /* accept the new connection */ i = sizeof(peer); @@ -1556,7 +1541,12 @@ int new_descriptor(socket_t s) newd->next = descriptor_list; descriptor_list = newd; - write_to_output(newd, "%s", GREETINGS); + /* This is where the greetings are actually sent to the new player */ + /* Adjusted by Jamdog to show color codes on the greetings page */ + *greet_copy = '\0'; + sprintf(greet_copy, "%s", GREETINGS); + proc_colors(greet_copy, MAX_STRING_LENGTH, TRUE); + write_to_output(newd, "%s", greet_copy); return (0); } @@ -1567,7 +1557,7 @@ int new_descriptor(socket_t s) * 14 bytes: overflow message * 2 bytes: extra \r\n for non-comapct * 14 bytes: unused */ -int process_output(struct descriptor_data *t) +static int process_output(struct descriptor_data *t) { char i[MAX_SOCK_BUF], *osb = i + 2; int result; @@ -1691,7 +1681,7 @@ ssize_t perform_socket_write(socket_t desc, const char *txt, size_t length) #endif /* perform_socket_write for all Non-Windows platforms */ -ssize_t perform_socket_write(socket_t desc, const char *txt, size_t length) +static ssize_t perform_socket_write(socket_t desc, const char *txt, size_t length) { ssize_t result; @@ -1763,7 +1753,7 @@ int write_to_descriptor(socket_t desc, const char *txt) /* Same information about perform_socket_write applies here. I like * standards, there are so many of them. -gg 6/30/98 */ -ssize_t perform_socket_read(socket_t desc, char *read_point, size_t space_left) +static ssize_t perform_socket_read(socket_t desc, char *read_point, size_t space_left) { ssize_t ret; @@ -1834,7 +1824,7 @@ ssize_t perform_socket_read(socket_t desc, char *read_point, size_t space_left) * above, 'tmp' lost the '+8' since it doesn't need it and the code has been * changed to reserve space by accepting one less character. (Do you really * need 256 characters on a line?) -gg 1/21/2000 */ -int process_input(struct descriptor_data *t) +static int process_input(struct descriptor_data *t) { int buf_length, failed_subst; ssize_t bytes_read; @@ -1985,7 +1975,7 @@ int process_input(struct descriptor_data *t) /* Perform substitution for the '^..^' csh-esque syntax orig is the orig string, * i.e. the one being modified. subst contains the substition string, i.e. * "^telm^tell" */ -int perform_subst(struct descriptor_data *t, char *orig, char *subst) +static int perform_subst(struct descriptor_data *t, char *orig, char *subst) { char newsub[MAX_INPUT_LENGTH + 5]; @@ -2115,7 +2105,7 @@ void close_socket(struct descriptor_data *d) free(d); } -void check_idle_passwords(void) +static void check_idle_passwords(void) { struct descriptor_data *d, *next_d; @@ -2182,7 +2172,7 @@ void nonblock(socket_t s) #define O_NONBLOCK O_NDELAY #endif -void nonblock(socket_t s) +static void nonblock(socket_t s) { int flags; @@ -2198,25 +2188,28 @@ void nonblock(socket_t s) /* signal-handling functions (formerly signals.c). UNIX only. */ #if defined(CIRCLE_UNIX) || defined(CIRCLE_MACINTOSH) -RETSIGTYPE reread_wizlists(int sig) +static RETSIGTYPE reread_wizlists(int sig) { reread_wizlist = TRUE; } -RETSIGTYPE unrestrict_game(int sig) +/* Orphaned right now in place of Webster ... +static RETSIGTYPE unrestrict_game(int sig) { emergency_unban = TRUE; } +*/ -RETSIGTYPE websterlink(int sig) +static RETSIGTYPE websterlink(int sig) { webster_file_ready = TRUE; } + #ifdef CIRCLE_UNIX /* clean up our zombie kids to avoid defunct processes */ -RETSIGTYPE reap(int sig) +static RETSIGTYPE reap(int sig) { while (waitpid(-1, NULL, WNOHANG) > 0); @@ -2224,7 +2217,7 @@ RETSIGTYPE reap(int sig) } /* Dying anyway... */ -RETSIGTYPE checkpointing(int sig) +static RETSIGTYPE checkpointing(int sig) { #ifndef MEMORY_DEBUG if (!tics_passed) { @@ -2236,7 +2229,7 @@ RETSIGTYPE checkpointing(int sig) } /* Dying anyway... */ -RETSIGTYPE hupsig(int sig) +static RETSIGTYPE hupsig(int sig) { log("SYSERR: Received SIGHUP, SIGINT, or SIGTERM. Shutting down..."); exit(1); /* perhaps something more elegant should substituted */ @@ -2257,7 +2250,7 @@ RETSIGTYPE hupsig(int sig) #ifndef POSIX #define my_signal(signo, func) signal(signo, func) #else -sigfunc *my_signal(int signo, sigfunc *func) +static sigfunc *my_signal(int signo, sigfunc *func) { struct sigaction sact, oact; @@ -2275,7 +2268,7 @@ sigfunc *my_signal(int signo, sigfunc *func) } #endif /* POSIX */ -void signal_setup(void) +static void signal_setup(void) { #ifndef CIRCLE_MACINTOSH struct itimerval itime; @@ -2582,7 +2575,6 @@ char *act(const char *str, int hide_invisible, struct char_data *ch, return NULL; } -#include "screen.h" if (type == TO_GMOTE && !IS_NPC(ch)) { struct descriptor_data *i; char buf[MAX_STRING_LENGTH]; @@ -2623,7 +2615,7 @@ char *act(const char *str, int hide_invisible, struct char_data *ch, } /* Prefer the file over the descriptor. */ -void setup_log(const char *filename, int fd) +static void setup_log(const char *filename, int fd) { FILE *s_fp; @@ -2667,7 +2659,7 @@ void setup_log(const char *filename, int fd) exit(1); } -int open_logfile(const char *filename, FILE *stderr_fp) +static int open_logfile(const char *filename, FILE *stderr_fp) { if (stderr_fp) /* freopen() the descriptor. */ logfile = freopen(filename, "w", stderr_fp); @@ -2692,7 +2684,7 @@ void circle_sleep(struct timeval *timeout) } #else -void circle_sleep(struct timeval *timeout) +static void circle_sleep(struct timeval *timeout) { if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, timeout) < 0) { if (errno != EINTR) { @@ -2703,3 +2695,41 @@ void circle_sleep(struct timeval *timeout) } #endif /* CIRCLE_WINDOWS */ + +static void handle_webster_file(void) { + FILE *fl; + struct char_data *ch = find_char(last_webster_teller); + char info[MAX_STRING_LENGTH], line[READ_SIZE]; + size_t len = 0, nlen = 0; + + last_webster_teller = -1L; + + if (!ch) /* they quit ? */ + return; + + fl = fopen("websterinfo", "r"); + if (!fl) { + send_to_char(ch, "It seems Merriam-Webster is offline..\r\n"); + return; + } + + unlink("websterinfo"); + + get_line(fl, line); + while (!feof(fl)) { + nlen = snprintf(info + len, sizeof(info) - len, "%s\r\n", line); + if (len + nlen >= sizeof(info) || nlen < 0) + break; + len += nlen; + get_line(fl, line); + } + + if (len >= sizeof(info)) { + const char *overflow = "\r\n**OVERFLOW**\r\n"; + strcpy(info + sizeof(info) - strlen(overflow) - 1, overflow); /* strcpy: OK */ + } + fclose(fl); + + send_to_char(ch, "You get this feedback from Merriam-Webster:\r\n"); + page_string(ch->desc, info, 1); +} diff --git a/src/comm.h b/src/comm.h index abdadd6..ba35200 100644 --- a/src/comm.h +++ b/src/comm.h @@ -1,17 +1,23 @@ -/************************************************************************** -* File: comm.h Part of tbaMUD * -* Usage: Header file, prototypes of public communication functions. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file comm.h +* Header file, prototypes of public communication functions. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +*/ +#ifndef _COMM_H_ +#define _COMM_H_ #define NUM_RESERVED_DESCS 8 #define COPYOVER_FILE "copyover.dat" /* comm.c */ +void close_socket(struct descriptor_data *d); size_t send_to_char(struct char_data *ch, const char *messg, ...) __attribute__ ((format (printf, 2, 3))); void send_to_all(const char *messg, ...) __attribute__ ((format (printf, 1, @@ -23,29 +29,53 @@ void send_to_outdoor(const char *messg, ...) __attribute__ ((format (printf, 1, void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...) __attribute__ ((format (printf, 3, 4))); -void close_socket(struct descriptor_data *d); +/* Act type settings and flags */ +#define TO_ROOM 1 /**< act() type: to everyone in room, except ch. */ +#define TO_VICT 2 /**< act() type: to vict_obj. */ +#define TO_NOTVICT 3 /**< act() type: to everyone in room, not ch or vict_obj. */ +#define TO_CHAR 4 /**< act() type: to ch. */ +#define TO_GMOTE 5 /**< act() type: to gemote channel (global emote) */ +#define TO_SLEEP 128 /**< act() flag: to char, even if sleeping */ +#define DG_NO_TRIG 256 /**< act() flag: don't check act trigger */ + + +/* act functions */ void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj, const void *vict_obj, const struct char_data *to); char * act(const char *str, int hide_invisible, struct char_data *ch, struct obj_data *obj, const void *vict_obj, int type); -#define TO_ROOM 1 -#define TO_VICT 2 -#define TO_NOTVICT 3 -#define TO_CHAR 4 -#define TO_GMOTE 5 -#define TO_SLEEP 128 /* to char, even if sleeping */ -#define DG_NO_TRIG 256 /* don't check act trigger */ - /* I/O functions */ void write_to_q(const char *txt, struct txt_q *queue, int aliased); int write_to_descriptor(socket_t desc, const char *txt); size_t write_to_output(struct descriptor_data *d, const char *txt, ...) __attribute__ ((format (printf, 2, 3))); size_t vwrite_to_output(struct descriptor_data *d, const char *format, va_list args); -void string_add(struct descriptor_data *d, char *str); -void string_write(struct descriptor_data *d, char **txt, size_t len, long mailto, void *data); - -#define PAGE_LENGTH 22 -#define PAGE_WIDTH 80 -void page_string(struct descriptor_data *d, char *str, int keep_internal); typedef RETSIGTYPE sigfunc(int); +void echo_off(struct descriptor_data *d); +void echo_on(struct descriptor_data *d); +void game_loop(socket_t mother_desc); +void heartbeat(int heart_pulse); +void copyover_recover(void); + +/* global buffering system - allow access to global variables within comm.c */ +#ifndef __COMM_C__ + +/** webster dictionary lookup */ +extern long last_webster_teller; + +extern struct descriptor_data *descriptor_list; +extern int buf_largecount; +extern int buf_overflows; +extern int buf_switches; +extern int circle_shutdown; +extern int circle_reboot; +extern int no_specials; +extern int scheck; +extern FILE *logfile; +extern unsigned long pulse; +extern ush_int port; +extern socket_t mother_desc; + +#endif /* __COMM_C__ */ + +#endif /* _COMM_H_ */ diff --git a/src/conf.h.amiga b/src/conf.h.amiga index 97cdd46..c96d525 100644 --- a/src/conf.h.amiga +++ b/src/conf.h.amiga @@ -2,6 +2,9 @@ /* src/conf.h.in. Generated automatically from configure.in by autoheader. */ +#ifndef _CONF_H_ +#define _CONF_H_ + #undef CIRCLE_WINDOWS #define AMIGA 1 @@ -102,3 +105,4 @@ /* Define if your compiler does not prototype strerror(). */ /* #undef NEED_STRERROR_PROTO */ +#endif /* _CONF_H_ */ diff --git a/src/conf.h.arc b/src/conf.h.arc index 3fa14cd..11df36a 100644 --- a/src/conf.h.arc +++ b/src/conf.h.arc @@ -1,5 +1,8 @@ /* CircleMUD for ACORN conf.h file - manually created (G. Duncan 13 June 98) +#ifndef _CONF_H_ +#define _CONF_H_ + #define CIRCLE_ACORN /* Define to empty if the keyword does not work. */ @@ -76,3 +79,4 @@ /* Define if your compiler does not prototype strerror(). */ /* #undef NEED_STRERROR_PROTO */ +#endif /* _CONF_H_ */ diff --git a/src/conf.h.in b/src/conf.h.in index dac209f..c899da1 100644 --- a/src/conf.h.in +++ b/src/conf.h.in @@ -1,5 +1,8 @@ /* src/conf.h.in. Generated automatically from configure.in by autoheader. */ +#ifndef _CONF_H_ +#define _CONF_H_ + /* Define to empty if the keyword does not work. */ #undef const @@ -330,3 +333,5 @@ /* Check for a prototype to write. */ #undef NEED_WRITE_PROTO + +#endif /* _CONF_H_ */ diff --git a/src/conf.h.mac b/src/conf.h.mac index def3973..35ab9ae 100644 --- a/src/conf.h.mac +++ b/src/conf.h.mac @@ -1,5 +1,8 @@ /* src/conf.h.in. Generated automatically from configure.in by autoheader. */ +#ifndef _CONF_H_ +#define _CONF_H_ + #define CIRCLE_MACINTOSH 1 #define HAVE_SYS_ERRNO_H 1 @@ -253,3 +256,4 @@ /* Define if your crypt isn't safe with only 10 characters. */ #undef HAVE_UNSAFE_CRYPT +#endif /* _CONF_H_ */ diff --git a/src/conf.h.os2 b/src/conf.h.os2 index ccf7611..c4ed574 100644 --- a/src/conf.h.os2 +++ b/src/conf.h.os2 @@ -1,5 +1,8 @@ /* src/conf.h.os2. Manually written by David Carver. */ +#ifndef _CONF_H_ +#define _CONF_H_ + /* Define if we are compiling under OS2 */ #define CIRCLE_OS2 @@ -102,3 +105,4 @@ /* Define if your crypt isn't safe with only 10 characters. */ #undef HAVE_UNSAFE_CRYPT +#endif /* _CONF_H_ */ diff --git a/src/conf.h.vms b/src/conf.h.vms index 40a8f02..e2f576e 100644 --- a/src/conf.h.vms +++ b/src/conf.h.vms @@ -1,5 +1,8 @@ /* src/conf.h.in. Generated automatically from cnf/configure.in by autoheader. */ +#ifndef _CONF_H_ +#define _CONF_H_ + /* Define to empty if the keyword does not work. */ /* #undef const */ @@ -293,3 +296,5 @@ /* Define if your compiler does not prototype write(). */ /* #undef NEED_WRITE_PROTO */ + +#endif /* _CONF_H_ */ diff --git a/src/conf.h.win b/src/conf.h.win index 822d26c..61a4ab0 100644 --- a/src/conf.h.win +++ b/src/conf.h.win @@ -3,6 +3,9 @@ * Created by Jeremy Elson, 1 July 1998 */ +#ifndef _CONF_H_ +#define _CONF_H_ + #define CIRCLE_WINDOWS /* Define to empty if the keyword does not work. */ @@ -334,3 +337,5 @@ /* Check for a prototype to write. */ #undef NEED_WRITE_PROTO + +#endif /* _CONF_H_ */ diff --git a/src/config.c b/src/config.c index a817ab8..bbe6ec7 100644 --- a/src/config.c +++ b/src/config.c @@ -13,7 +13,10 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "interpreter.h" /* alias_data definition for structs.h */ +#include "config.h" +#include "asciimap.h" /* Update: The following constants and variables are now the default values * for backwards compatibility with the new cedit game configurator. If you @@ -33,22 +36,7 @@ * I've decided the convenience of having all your options in this one file * outweighs the efficency of doing it the other way. */ -/* GAME PLAY OPTIONS */ -#if !defined(NO) -#define NO 0 -#endif - -#if !defined(YES) -#define YES 1 -#endif - -#if !defined(FALSE) -#define FALSE 0 -#endif - -#if !defined(TRUE) -#define TRUE (!FALSE) -#endif +/* YES / NO; TRUE / FALSE are all defined in utils.h */ /* pk_allowed sets the tone of the entire game. If pk_allowed is set to NO, * then players will not be allowed to kill, summon, charm, or sleep other @@ -302,3 +290,10 @@ int min_wizlist_lev = LVL_GOD; /* To mimic stock behavior set to NO. To allow mortals to see doors in exits * set to YES. */ int display_closed_doors = YES; + + +/* Automap and map options */ +/* Default is to have automap and map command only enabled for immortals */ +int map_option = MAP_IMM_ONLY; +int default_map_size = 6; +int default_minimap_size = 2; diff --git a/src/constants.c b/src/constants.c index 69d7fbc..e39c899 100644 --- a/src/constants.c +++ b/src/constants.c @@ -1,26 +1,41 @@ -/************************************************************************** -* File: constants.c Part of tbaMUD * -* Usage: Numeric and string contants used by the MUD. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file constants.c +* Numeric and string contants used by the MUD. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* @todo Come up with a standard for descriptive arrays. Either all end with +* newlines or all of them don not. +*/ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "interpreter.h" /* alias_data */ +/** Current tbaMUD version. + * @todo defined with _TBAMUD so we don't have multiple constants to change. + * @todo cpp_extern isn't needed here (or anywhere) as the extern reserved word + * works correctly with C compilers (at least in my Experience) + * Jeremy Osborne 1/28/2008 */ cpp_extern const char *tbamud_version = "tbaMUD, version 3.55"; +/** Current Oasis Online Creation version. */ cpp_extern const char *oasisolc_version = "OasisOLC 2.0.6"; +/** Current ASCII player files version. */ cpp_extern const char *ascii_pfiles_version = "ASCII Player Files 3.0.1"; /* strings corresponding to ordinals/bitvectors in structs.h */ /* (Note: strings for class definitions in class.c instead of here) */ -/* cardinal directions */ +/** Description of cardinal directions. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *dirs[] = { "north", @@ -29,10 +44,12 @@ const char *dirs[] = "west", "up", "down", - "\n" + "\n" }; -/* ROOM_x */ +/** Room flag descriptions. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *room_bits[] = { "DARK", "DEATH", @@ -49,11 +66,14 @@ const char *room_bits[] = { "HCRSH", "ATRIUM", "OLC", - "*", /* BFS MARK */ - "\n" + "*", /* The BFS Mark. */ + "WORLDMAP", + "\n" }; -/* EX_x */ +/** Exit bits for doors. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *exit_bits[] = { "DOOR", "CLOSED", @@ -62,7 +82,9 @@ const char *exit_bits[] = { "\n" }; -/* SECT_ */ +/** Description of the room sector type. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *sector_types[] = { "Inside", "City", @@ -77,7 +99,9 @@ const char *sector_types[] = { "\n" }; -/* SEX_x. Not used in sprinttype() so no \n. */ +/** PC and NPC sex. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *genders[] = { "neutral", @@ -86,7 +110,9 @@ const char *genders[] = "\n" }; -/* POS_x */ +/** Character positions. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *position_types[] = { "Dead", "Mortally wounded", @@ -100,7 +126,9 @@ const char *position_types[] = { "\n" }; -/* PLR_x */ +/** Player flags. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *player_bits[] = { "KILLER", "THIEF", @@ -118,7 +146,7 @@ const char *player_bits[] = { "NO_DEL", "INVST", "CRYO", - "DEAD", /* You should never see this. */ + "DEAD", /* You should never see this flag on a character in game. */ "UNUSED1", "UNUSED2", "UNUSED3", @@ -127,7 +155,9 @@ const char *player_bits[] = { "\n" }; -/* MOB_x */ +/** Mob action flags. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *action_bits[] = { "SPEC", "SENTINEL", @@ -151,7 +181,9 @@ const char *action_bits[] = { "\n" }; -/* PRF_x */ +/** PC Preference flags. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *preference_bits[] = { "BRIEF", "COMPACT", @@ -184,10 +216,13 @@ const char *preference_bits[] = { "AUTOSPLIT", "AUTOSAC", "AUTOASSIST", + "AUTOMAP", "\n" }; -/* AFF_x */ +/** Affected bits. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *affected_bits[] = { "\0", /* DO NOT REMOVE!! */ @@ -216,7 +251,9 @@ const char *affected_bits[] = "\n" }; -/* CON_x */ +/** Connection type descriptions. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *connected_types[] = { "Playing", "Disconnecting", @@ -249,7 +286,9 @@ const char *connected_types[] = { "\n" }; -/* WEAR_x - for eq list. Not used in sprinttype() so no \n. */ +/** Describes the position in the equipment listing. + * @pre Must be in the same order as the defines. + * Not used in sprinttype() so no \n. */ const char *wear_where[] = { " ", " ", @@ -271,7 +310,9 @@ const char *wear_where[] = { " " }; -/* WEAR_x - for stat */ +/* Describes where an item can be worn. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *equipment_types[] = { "Used as light", "Worn on right finger", @@ -294,7 +335,9 @@ const char *equipment_types[] = { "\n" }; -/* ITEM_x (ordinal object types) */ +/** Describes the type of object. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *item_types[] = { "UNDEFINED", "LIGHT", @@ -323,7 +366,9 @@ const char *item_types[] = { "\n" }; -/* ITEM_WEAR_ (wear bitvector) */ +/** Describes the wear flags set on an item. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *wear_bits[] = { "TAKE", "FINGER", @@ -343,7 +388,9 @@ const char *wear_bits[] = { "\n" }; -/* ITEM_x (extra bits) */ +/** Describes the extra flags applied to an item. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *extra_bits[] = { "GLOW", "HUM", @@ -362,10 +409,13 @@ const char *extra_bits[] = { "ANTI_THIEF", "ANTI_WARRIOR", "NO_SELL", + "QUEST_ITEM", "\n" }; -/* APPLY_x */ +/** Describes the apply types. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *apply_types[] = { "NONE", "STR", @@ -395,7 +445,9 @@ const char *apply_types[] = { "\n" }; -/* CONT_x */ +/** Describes the closure mechanism for a container. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *container_bits[] = { "CLOSEABLE", "PICKPROOF", @@ -404,7 +456,9 @@ const char *container_bits[] = { "\n", }; -/* LIQ_x */ +/** Describes the liquid description. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *drinks[] = { "water", @@ -426,7 +480,9 @@ const char *drinks[] = "\n" }; -/* Other constants for liquids, one-word alias for each drink. */ +/** Describes a one word alias for each type of liquid. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *drinknames[] = { "water", @@ -448,7 +504,9 @@ const char *drinknames[] = "\n" }; -/* effect of drinks on hunger, thirst, and drunkenness -- see values.doc */ +/** Define the effect of liquids on hunger, thirst, and drunkenness, in that + * order. See values.doc for more information. + * @pre Must be in the same order as the defines. */ int drink_aff[][3] = { {0, 1, 10}, {3, 2, 5}, @@ -468,7 +526,9 @@ int drink_aff[][3] = { {0, 0, 13} }; -/* color of the various drinks */ +/** Describes the color of the various drinks. + * @pre Must be in the same order as the defines. + * Must end array with a single newline. */ const char *color_liquid[] = { "clear", @@ -490,7 +550,8 @@ const char *color_liquid[] = "\n" }; -/* level of fullness for drink containers. Not used in sprinttype() so no \n. */ +/** Used to describe the level of fullness of a drink container. Not used in + * sprinttype() so no \n. */ const char *fullness[] = { "less than half ", @@ -499,7 +560,9 @@ const char *fullness[] = "" }; -/* str, int, wis, dex, con applies, [ch] strength apply (all) */ +/** Strength attribute affects. + * The fields are hit mod, damage mod, weight carried mod, and weight wielded + * mod. */ cpp_extern const struct str_app_type str_app[] = { {-5, -4, 0, 0}, /* str = 0 */ {-5, -4, 3, 1}, /* str = 1 */ @@ -534,7 +597,8 @@ cpp_extern const struct str_app_type str_app[] = { {3, 6, 480, 30} /* str = 18/100 */ }; -/* [dex] skill apply (thieves only) */ +/** Dexterity skill modifiers for thieves. + * The fields are for pick pockets, pick locks, find traps, sneak and hide. */ cpp_extern const struct dex_skill_type dex_app_skill[] = { {-99, -99, -90, -99, -60}, /* dex = 0 */ {-90, -90, -60, -90, -50}, /* dex = 1 */ @@ -564,7 +628,8 @@ cpp_extern const struct dex_skill_type dex_app_skill[] = { {25, 30, 15, 25, 25} /* dex = 25 */ }; -/* [dex] apply (all) */ +/** Dexterity attribute affects. + * The fields are reaction, missile attacks, and defensive (armor class). */ cpp_extern const struct dex_app_type dex_app[] = { {-7, -7, 6}, /* dex = 0 */ {-6, -6, 5}, /* dex = 1 */ @@ -594,7 +659,8 @@ cpp_extern const struct dex_app_type dex_app[] = { {5, 5, -6} /* dex = 25 */ }; -/* [con] apply (all) */ +/** Constitution attribute affects. + * The fields referenced are hit points and system shock survival. */ cpp_extern const struct con_app_type con_app[] = { {-4, 20}, /* con = 0 */ {-3, 25}, /* con = 1 */ @@ -624,7 +690,8 @@ cpp_extern const struct con_app_type con_app[] = { {6, 99} /* con = 25 */ }; -/* [int] apply (all) */ +/** Intelligence attribute affects. + * The field shows how much practicing affects a skill/spell. */ cpp_extern const struct int_app_type int_app[] = { {3}, /* int = 0 */ {5}, /* int = 1 */ @@ -654,7 +721,8 @@ cpp_extern const struct int_app_type int_app[] = { {60} /* int = 25 */ }; -/* [wis] apply (all) */ +/** Wisdom attribute affects. + * The field represents how many extra practice points are gained per level. */ cpp_extern const struct wis_app_type wis_app[] = { {0}, /* wis = 0 */ {0}, /* wis = 1 */ @@ -684,16 +752,18 @@ cpp_extern const struct wis_app_type wis_app[] = { {7} /* wis = 25 */ }; +/** Define a set of opposite directions from the cardinal directions. */ int rev_dir[] = { - 2, - 3, - 0, - 1, - 5, - 4 + SOUTH, + WEST, + NORTH, + EAST, + DOWN, + UP }; +/** How much movement is lost moving through a particular sector type. */ int movement_loss[] = { 1, /* Inside */ @@ -705,10 +775,10 @@ int movement_loss[] = 4, /* Swimming */ 1, /* Unswimable */ 1, /* Flying */ - 5 /* Underwater */ + 5 /* Underwater */ }; -/* Not used in sprinttype(). */ +/** The names of the days of the mud week. Not used in sprinttype(). */ const char *weekdays[] = { "the Day of the Moon", "the Day of the Bull", @@ -719,7 +789,7 @@ const char *weekdays[] = { "the Day of the Sun" }; -/* Not used in sprinttype(). */ +/** The names of the mud months. Not used in sprinttype(). */ const char *month_name[] = { "Month of Winter", /* 0 */ "Month of the Winter Wolf", @@ -740,7 +810,7 @@ const char *month_name[] = { "Month of the Great Evil" }; -/* mob trigger types */ +/** Names for mob trigger types. */ const char *trig_types[] = { "Global", "Random", @@ -765,7 +835,7 @@ const char *trig_types[] = { "\n" }; -/* obj trigger types */ +/** Names for object trigger types. */ const char *otrig_types[] = { "Global", "Random", @@ -790,7 +860,7 @@ const char *otrig_types[] = { "\n" }; -/* wld trigger types */ +/** Names for world (room) trigger types. */ const char *wtrig_types[] = { "Global", "Random", @@ -815,6 +885,9 @@ const char *wtrig_types[] = { "\n" }; +/** The names of the different channels that history is stored for. + * @todo Only referenced by do_history at the moment. Should be moved local + * to that function. */ const char *history_types[] = { "all", "say", @@ -831,9 +904,14 @@ const char *history_types[] = { /* Various arrays we count so we can check the world files. These * must be at the bottom of the file so they're pre-declared. */ -size_t room_bits_count = sizeof(room_bits) / sizeof(room_bits[0]) - 1, + /** Number of defined room bit descriptions. */ + size_t room_bits_count = sizeof(room_bits) / sizeof(room_bits[0]) - 1, + /** Number of defined action bit descriptions. */ action_bits_count = sizeof(action_bits) / sizeof(action_bits[0]) - 1, + /** Number of defined affected bit descriptions. */ affected_bits_count = sizeof(affected_bits) / sizeof(affected_bits[0]) - 1, + /** Number of defined extra bit descriptions. */ extra_bits_count = sizeof(extra_bits) / sizeof(extra_bits[0]) - 1, + /** Number of defined wear bit descriptions. */ wear_bits_count = sizeof(wear_bits) / sizeof(wear_bits[0]) - 1; diff --git a/src/constants.h b/src/constants.h index 70fa542..e67d806 100644 --- a/src/constants.h +++ b/src/constants.h @@ -1,12 +1,16 @@ -/************************************************************************** -* File: constants.h Part of tbaMUD * -* Usage: Header file for constants. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file constants.h +* Declares the global constants defined in constants.c. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ +#ifndef _CONSTANTS_H_ +#define _CONSTANTS_H_ extern const char *tbamud_version; extern const char *oasisolc_version; @@ -53,3 +57,5 @@ extern size_t action_bits_count; extern size_t affected_bits_count; extern size_t extra_bits_count; extern size_t wear_bits_count; + +#endif /* _CONSTANTS_H_ */ diff --git a/src/db.c b/src/db.c index 0d04baa..7d0e09d 100644 --- a/src/db.c +++ b/src/db.c @@ -25,6 +25,17 @@ #include "oasis.h" #include "dg_scripts.h" #include "dg_event.h" +#include "act.h" +#include "ban.h" +#include "spec_procs.h" +#include "genzon.h" +#include "genolc.h" +#include "genobj.h" /* for free_object_strings */ +#include "config.h" /* for the default config values. */ +#include "fight.h" +#include "modify.h" +#include "shop.h" +#include "quest.h" /* declarations of most of the 'global' variables */ struct config_data config_info; /* Game configuration list. */ @@ -42,8 +53,16 @@ struct index_data *obj_index; /* index table for object file */ struct obj_data *obj_proto; /* prototypes for objs */ obj_rnum top_of_objt = 0; /* top of object index table */ -struct zone_data *zone_table; /* zone table */ -zone_rnum top_of_zone_table = 0;/* top element of zone tab */ +struct zone_data *zone_table; /* zone table */ +zone_rnum top_of_zone_table = 0;/* top element of zone tab */ + +/* begin previously located in players.c */ +struct player_index_element *player_table = NULL; /* index to plr file */ +int top_of_p_table = 0; /* ref to top of table */ +int top_of_p_file = 0; /* ref of size of p file */ +long top_idnum = 0; /* highest idnum in use */ +/* end previously located in players.c */ + struct message_list fight_messages[MAX_MESSAGES]; /* fighting messages */ struct index_data **trig_index; /* index table for triggers */ @@ -53,18 +72,20 @@ long max_mob_id = MOB_ID_BASE; /* for unique mob id's */ long max_obj_id = OBJ_ID_BASE; /* for unique obj id's */ int dg_owner_purged; /* For control of scripts */ +struct aq_data *aquest_table; /* Autoquests table */ +qst_rnum total_quests = 0; /* top of autoquest table */ + struct shop_data *shop_index; /* index table for shops */ int top_shop = -1; /* top of shop table */ -int no_mail = 0; /* mail disabled? */ -int mini_mud = 0; /* mini-mud mode? */ -int no_rent_check = 0; /* skip rent check on boot? */ -time_t boot_time = 0; /* time of mud boot */ -int circle_restrict = 0; /* level of game restriction */ +int no_mail = 0; /* mail disabled? */ +int mini_mud = 0; /* mini-mud mode? */ +int no_rent_check = 0; /* skip rent check on boot? */ +time_t boot_time = 0; /* time of mud boot */ +int circle_restrict = 0; /* level of game restriction */ room_rnum r_mortal_start_room; /* rnum of mortal start room */ room_rnum r_immort_start_room; /* rnum of immort start room */ room_rnum r_frozen_start_room; /* rnum of frozen start room */ -int converting = FALSE; char *credits = NULL; /* game credits */ char *news = NULL; /* mud news */ @@ -86,93 +107,41 @@ struct help_index_element *help_table = NULL; struct social_messg *soc_mess_list = NULL; /* list of socials */ int top_of_socialt = -1; /* number of socials */ -struct time_info_data time_info;/* the infomation about the time */ +struct time_info_data time_info; /* the infomation about the time */ struct weather_data weather_info; /* the infomation about the weather */ struct player_special_data dummy_mob; /* dummy spec area for mobs */ -struct reset_q_type reset_q; /* queue of zones to be reset */ +struct reset_q_type reset_q; /* queue of zones to be reset */ -/* local functions */ -int check_bitvector_names(bitvector_t bits, size_t namecount, const char *whatami, const char *whatbits); -int check_object_spell_number(struct obj_data *obj, int val); -int check_object_level(struct obj_data *obj, int val); -void setup_dir(FILE *fl, int room, int dir); -void index_boot(int mode); -void discrete_load(FILE *fl, int mode, char *filename); -int check_object(struct obj_data *); -void parse_room(FILE *fl, int virtual_nr); -void parse_mobile(FILE *mob_f, int nr); -char *parse_object(FILE *obj_f, int nr); -void load_zones(FILE *fl, char *zonename); -void assign_mobiles(void); -void assign_objects(void); -void assign_rooms(void); -void assign_the_shopkeepers(void); -int is_empty(zone_rnum zone_nr); -void reset_zone(zone_rnum zone); -int file_to_string(const char *name, char *buf); -int file_to_string_alloc(const char *name, char **buf); -void reboot_wizlists(void); -ACMD(do_reboot); -void boot_world(void); -int count_alias_records(FILE *fl); -int count_hash_records(FILE *fl); -bitvector_t asciiflag_conv(char *flag); -void parse_simple_mob(FILE *mob_f, int i, int nr); -void interpret_espec(const char *keyword, const char *value, int i, int nr); -void parse_espec(char *buf, int i, int nr); -void parse_enhanced_mob(FILE *mob_f, int i, int nr); -void get_one_line(FILE *fl, char *buf); -void check_start_rooms(void); -void renum_world(void); -void renum_zone_table(void); -void log_zone_error(zone_rnum zone, int cmd_no, const char *message); -void reset_time(void); -char fread_letter(FILE *fp); -void free_followers(struct follow_type *k); -void load_default_config( void ); -void load_config( void ); -void free_extra_descriptions(struct extra_descr_data *edesc); -bitvector_t asciiflag_conv_aff(char *flag); -/* external functions */ -void paginate_string(char *str, struct descriptor_data *d); -struct time_info_data *mud_time_passed(time_t t2, time_t t1); -void free_alias(struct alias_data *a); -void load_messages(void); -void mag_assign_spells(void); -void update_obj_file(void); /* In objsave.c */ -void sort_commands(void); -void sort_spells(void); -void load_banned(void); -void read_invalid_list(void); -void boot_the_shops(FILE *shop_f, char *filename, int rec_count); -int hsort(const void *a, const void *b); -void prune_crlf(char *txt); -void destroy_shops(void); -void free_object_strings(struct obj_data *obj); -void free_object_strings_proto(struct obj_data *obj); -void clean_llog_entries(void); -void create_command_list(void); -void build_player_index(void); -void clean_pfiles(void); -int add_to_save_list(zone_vnum, int type); -int save_all(void); -extern zone_rnum real_zone_by_thing(room_vnum vznum); +/* declaration of local (file scope) variables */ +static int converting = FALSE; -/* external vars */ -extern struct descriptor_data *descriptor_list; -extern const char *unused_spellname; /* spell_parser.c */ -extern int no_specials; -extern int scheck; -extern int bitwarning; -extern int bitsavetodisk; -extern struct player_index_element *player_table; -extern int top_of_p_table; -extern long top_idnum; -extern int display_closed_doors; -/* external ASCII Player Files vars */ -extern int auto_pwipe; + +/* Local (file scope) utility functions */ +static int check_bitvector_names(bitvector_t bits, size_t namecount, const char *whatami, const char *whatbits); +static int check_object_spell_number(struct obj_data *obj, int val); +static int check_object_level(struct obj_data *obj, int val); +static int check_object(struct obj_data *); +static void load_zones(FILE *fl, char *zonename); +static int file_to_string(const char *name, char *buf); +static int file_to_string_alloc(const char *name, char **buf); +static int count_alias_records(FILE *fl); +static void parse_simple_mob(FILE *mob_f, int i, int nr); +static void interpret_espec(const char *keyword, const char *value, int i, int nr); +static void parse_espec(char *buf, int i, int nr); +static void parse_enhanced_mob(FILE *mob_f, int i, int nr); +static void get_one_line(FILE *fl, char *buf); +static void check_start_rooms(void); +static void renum_zone_table(void); +static void log_zone_error(zone_rnum zone, int cmd_no, const char *message); +static void reset_time(void); +static char fread_letter(FILE *fp); +static void free_followers(struct follow_type *k); +static void load_default_config( void ); +static void free_extra_descriptions(struct extra_descr_data *edesc); +static bitvector_t asciiflag_conv_aff(char *flag); +static int hsort(const void *a, const void *b); /* routines for booting the system */ char *fread_action(FILE *fl, int nr) @@ -473,9 +442,13 @@ void boot_world(void) log("Loading shops."); index_boot(DB_BOOT_SHP); } + + log("Loading quests."); + index_boot(DB_BOOT_QST); + } -void free_extra_descriptions(struct extra_descr_data *edesc) +static void free_extra_descriptions(struct extra_descr_data *edesc) { struct extra_descr_data *enext; @@ -582,6 +555,9 @@ void destroy_db(void) /* Shops */ destroy_shops(); + /* Quests */ + destroy_quests(); + /* Zones */ #define THIS_CMD zone_table[cnt].cmd[itr] @@ -706,6 +682,8 @@ void boot_db(void) assign_objects(); log(" Rooms."); assign_rooms(); + log(" Questmasters."); + assign_the_quests(); } log("Assigning spell and skill levels."); @@ -742,7 +720,6 @@ void boot_db(void) #if 1 { int i; - extern SPECIAL(shop_keeper); for (i = 0 ; i < top_of_objt; i++) { if (obj_proto[i].script == (struct script_data *)&shop_keeper) { @@ -768,7 +745,7 @@ void boot_db(void) } /* reset the time in the game from file */ -void reset_time(void) +static void reset_time(void) { time_t beginning_of_time = 0; FILE *bgtime; @@ -776,7 +753,7 @@ void reset_time(void) if ((bgtime = fopen(TIME_FILE, "r")) == NULL) log("No time file '%s' starting from the beginning.", TIME_FILE); else { - fscanf(bgtime, "%ld\n", &beginning_of_time); + fscanf(bgtime, "%ld\n", (long *)&beginning_of_time); fclose(bgtime); } @@ -825,14 +802,14 @@ void save_mud_time(struct time_info_data *when) if ((bgtime = fopen(TIME_FILE, "w")) == NULL) log("SYSERR: Can't write to '%s' time file.", TIME_FILE); else { - fprintf(bgtime, "%ld\n", mud_time_to_secs(when)); + fprintf(bgtime, "%ld\n", (long)mud_time_to_secs(when)); fclose(bgtime); } } /* Thanks to Andrey (andrey@alex-ua.com) for this bit of code, although I did * add the 'goto' and changed some "while()" into "do { } while()". -gg */ -int count_alias_records(FILE *fl) +static int count_alias_records(FILE *fl) { char key[READ_SIZE], next_key[READ_SIZE]; char line[READ_SIZE], *scan; @@ -914,6 +891,9 @@ void index_boot(int mode) case DB_BOOT_TRG: prefix = TRG_PREFIX; break; + case DB_BOOT_QST: + prefix = QST_PREFIX; + break; default: log("SYSERR: Unknown subcommand %d to index_boot!", mode); exit(1); @@ -954,7 +934,7 @@ void index_boot(int mode) /* Exit if 0 records, unless this is shops */ if (!rec_count) { - if (mode == DB_BOOT_SHP) + if (mode == DB_BOOT_SHP || mode == DB_BOOT_QST) return; log("SYSERR: boot error - 0 records counted in %s/%s.", prefix, index_filename); @@ -995,6 +975,11 @@ void index_boot(int mode) size[0] = sizeof(struct help_index_element) * rec_count; log(" %d entries, %d bytes.", rec_count, size[0]); break; + case DB_BOOT_QST: + CREATE(aquest_table, struct aq_data, rec_count); + size[0] = sizeof(struct aq_data) * rec_count; + log(" %d entries, %d bytes.", rec_count, size[0]); + break; } rewind(db_index); @@ -1010,6 +995,7 @@ void index_boot(int mode) case DB_BOOT_OBJ: case DB_BOOT_MOB: case DB_BOOT_TRG: + case DB_BOOT_QST: discrete_load(db_file, mode, buf2); break; case DB_BOOT_ZON: @@ -1040,7 +1026,7 @@ void discrete_load(FILE *fl, int mode, char *filename) int nr = -1, last; char line[READ_SIZE]; - const char *modes[] = {"world", "mob", "obj", "ZON", "SHP", "HLP", "trg"}; + const char *modes[] = {"world", "mob", "obj", "ZON", "SHP", "HLP", "trg", "qst"}; /* modes positions correspond to DB_BOOT_xxx in db.h */ for (;;) { @@ -1083,6 +1069,9 @@ void discrete_load(FILE *fl, int mode, char *filename) case DB_BOOT_OBJ: strlcpy(line, parse_object(fl, nr), sizeof(line)); break; + case DB_BOOT_QST: + parse_quest(fl, nr); + break; } } else { log("SYSERR: Format error in %s file %s near %s #%d", modes[mode], @@ -1093,7 +1082,7 @@ void discrete_load(FILE *fl, int mode, char *filename) } } -char fread_letter(FILE *fp) +static char fread_letter(FILE *fp) { char c; do { @@ -1114,7 +1103,8 @@ bitvector_t asciiflag_conv(char *flag) else if (isupper(*p)) flags |= 1 << (26 + (*p - 'A')); - if (!isdigit(*p)) + /* Allow the first character to be a minus sign */ + if (!isdigit(*p) && (*p != '-' || p != flag)) is_num = FALSE; } @@ -1124,7 +1114,7 @@ bitvector_t asciiflag_conv(char *flag) return (flags); } -bitvector_t asciiflag_conv_aff(char *flag) +static bitvector_t asciiflag_conv_aff(char *flag) { bitvector_t flags = 0; int is_num = TRUE; @@ -1136,7 +1126,8 @@ bitvector_t asciiflag_conv_aff(char *flag) else if (isupper(*p)) flags |= 1 << (26 + (*p - 'A' + 1)); - if (!isdigit(*p)) + /* Allow the first character to be a minus sign */ + if (!isdigit(*p) && (*p != '-' || p != flag)) is_num = FALSE; } @@ -1317,7 +1308,7 @@ void setup_dir(FILE *fl, int room, int dir) } /* make sure the start rooms exist & resolve their vnums to rnums */ -void check_start_rooms(void) +static void check_start_rooms(void) { if ((r_mortal_start_room = real_room(CONFIG_MORTAL_START)) == NOWHERE) { log("SYSERR: Mortal start room does not exist. Change in config.c."); @@ -1348,6 +1339,11 @@ void renum_world(void) real_room(world[room].dir_option[door]->to_room); } +/** This is not the same ZCMD as used elsewhere. GRUMBLE... namespace conflict + * @todo refactor this particular ZCMD and remove this redefine. */ +#ifdef ZCMD +#undef ZCMD +#endif #define ZCMD zone_table[zone].cmd[cmd_no] /* Resolve vnums into rnums in the zone reset tables. In English: Once all of @@ -1356,7 +1352,7 @@ void renum_world(void) * is running. This does make adding any room, mobile, or object a little more * difficult while the game is running. Assumes NOWHERE == NOBODY == NOTHING. * Assumes sizeof(room_rnum) >= (sizeof(mob_rnum) and sizeof(obj_rnum)) */ -void renum_zone_table(void) +static void renum_zone_table(void) { int cmd_no; room_rnum a, b, c, olda, oldb, oldc; @@ -1415,7 +1411,7 @@ void renum_zone_table(void) } } -void parse_simple_mob(FILE *mob_f, int i, int nr) +static void parse_simple_mob(FILE *mob_f, int i, int nr) { int j, t[10]; char line[READ_SIZE]; @@ -1510,7 +1506,7 @@ void parse_simple_mob(FILE *mob_f, int i, int nr) #define RANGE(low, high) \ (num_arg = MAX((low), MIN((high), (num_arg)))) -void interpret_espec(const char *keyword, const char *value, int i, int nr) +static void interpret_espec(const char *keyword, const char *value, int i, int nr) { int num_arg = 0, matched = FALSE; @@ -1569,7 +1565,7 @@ void interpret_espec(const char *keyword, const char *value, int i, int nr) #undef BOOL_CASE #undef RANGE -void parse_espec(char *buf, int i, int nr) +static void parse_espec(char *buf, int i, int nr) { char *ptr; @@ -1581,7 +1577,7 @@ void parse_espec(char *buf, int i, int nr) interpret_espec(buf, ptr, i, nr); } -void parse_enhanced_mob(FILE *mob_f, int i, int nr) +static void parse_enhanced_mob(FILE *mob_f, int i, int nr) { char line[READ_SIZE]; @@ -1946,7 +1942,7 @@ char *parse_object(FILE *obj_f, int nr) #define Z zone_table[zone] /* load the zone table and command tables */ -void load_zones(FILE *fl, char *zonename) +static void load_zones(FILE *fl, char *zonename) { static zone_rnum zone = 0; int cmd_no, num_of_cmds = 0, line_num = 0, tmp, error; @@ -2077,7 +2073,7 @@ void load_zones(FILE *fl, char *zonename) } #undef Z -void get_one_line(FILE *fl, char *buf) +static void get_one_line(FILE *fl, char *buf) { if (fgets(buf, READ_SIZE, fl) == NULL) { log("SYSERR: error reading help file: not terminated with $?"); @@ -2174,7 +2170,7 @@ void load_help(FILE * fl, char *name) } } -int hsort(const void *a, const void *b) +static int hsort(const void *a, const void *b) { const struct help_index_element *a1, *b1; @@ -2409,7 +2405,7 @@ void zone_update(void) } } -void log_zone_error(zone_rnum zone, int cmd_no, const char *message) +static void log_zone_error(zone_rnum zone, int cmd_no, const char *message) { mudlog(NRM, LVL_GOD, TRUE, "SYSERR: zone file: %s", message); mudlog(NRM, LVL_GOD, TRUE, "SYSERR: ...offending cmd: '%c' cmd in zone #%d, line %d", @@ -2720,7 +2716,7 @@ char *fread_string(FILE *fl, const char *error) } /* Called to free all allocated follow_type structs */ -void free_followers(struct follow_type *k) +static void free_followers(struct follow_type *k) { if (!k) return; @@ -2747,6 +2743,8 @@ void free_char(struct char_data *ch) free(ch->player_specials->poofin); if (ch->player_specials->poofout) free(ch->player_specials->poofout); + if (ch->player_specials->saved.completed_quests) + free(ch->player_specials->saved.completed_quests); if (GET_HOST(ch)) free(GET_HOST(ch)); if (IS_NPC(ch)) @@ -2843,7 +2841,7 @@ void free_obj(struct obj_data *obj) * interested in and not a copy. If someone is reading a global copy we're * trying to replace, give everybody using it a different copy so as to avoid * special cases. */ -int file_to_string_alloc(const char *name, char **buf) +static int file_to_string_alloc(const char *name, char **buf) { int temppage; char temp[MAX_STRING_LENGTH]; @@ -2875,7 +2873,7 @@ int file_to_string_alloc(const char *name, char **buf) } /* read contents of a text file, and place in buf */ -int file_to_string(const char *name, char *buf) +static int file_to_string(const char *name, char *buf) { FILE *fl; char tmp[READ_SIZE + 3]; @@ -2996,6 +2994,10 @@ void init_char(struct char_data *ch) ch->player.long_descr = NULL; ch->player.description = NULL; + GET_NUM_QUESTS(ch) = 0; + ch->player_specials->saved.completed_quests = NULL; + GET_QUEST(ch) = -1; + ch->player.time.birth = time(0); ch->player.time.logon = time(0); ch->player.time.played = 0; @@ -3044,6 +3046,7 @@ void init_char(struct char_data *ch) GET_COND(ch, i) = (GET_LEVEL(ch) == LVL_IMPL ? -1 : 24); GET_LOADROOM(ch) = NOWHERE; + GET_SCREEN_WIDTH(ch) = PAGE_WIDTH; } /* returns the real number of the room with given virtual number */ @@ -3149,7 +3152,7 @@ zone_rnum real_zone(zone_vnum vnum) } /* Extend later to include more checks and add checks for unknown bitvectors. */ -int check_object(struct obj_data *obj) +static int check_object(struct obj_data *obj) { char objname[MAX_INPUT_LENGTH + 32]; int error = FALSE, y; @@ -3205,7 +3208,6 @@ int check_object(struct obj_data *obj) break; case ITEM_NOTE: if (obj->ex_description) { - extern char *find_exdesc(char *word, struct extra_descr_data *list); char onealias[MAX_INPUT_LENGTH],*next_name; next_name = any_one_arg(obj->name, onealias); do { @@ -3228,7 +3230,7 @@ int check_object(struct obj_data *obj) return (error); } -int check_object_spell_number(struct obj_data *obj, int val) +static int check_object_spell_number(struct obj_data *obj, int val) { int error = FALSE; const char *spellname; @@ -3262,7 +3264,7 @@ int check_object_spell_number(struct obj_data *obj, int val) return (error); } -int check_object_level(struct obj_data *obj, int val) +static int check_object_level(struct obj_data *obj, int val) { int error = FALSE; @@ -3273,7 +3275,7 @@ int check_object_level(struct obj_data *obj, int val) return (error); } -int check_bitvector_names(bitvector_t bits, size_t namecount, const char *whatami, const char *whatbits) +static int check_bitvector_names(bitvector_t bits, size_t namecount, const char *whatami, const char *whatbits) { unsigned int flagnum; bool error = FALSE; @@ -3284,64 +3286,14 @@ int check_bitvector_names(bitvector_t bits, size_t namecount, const char *whatam for (flagnum = namecount; flagnum < sizeof(bitvector_t) * 8; flagnum++) if ((1 << flagnum) & bits) { - log("SYSERR: %s has unknown %s flag, bit %d (0 through %d known).", whatami, whatbits, flagnum, namecount - 1); + log("SYSERR: %s has unknown %s flag, bit %d (0 through %d known).", whatami, whatbits, flagnum, (int)namecount - 1); error = TRUE; } return (error); } -/* External variables from config.c */ -extern int pk_allowed; -extern int pt_allowed; -extern int level_can_shout; -extern int holler_move_cost; -extern int tunnel_size; -extern int max_exp_gain; -extern int max_exp_loss; -extern int max_npc_corpse_time; -extern int max_pc_corpse_time; -extern int idle_void; -extern int idle_rent_time; -extern int idle_max_level; -extern int dts_are_dumps; -extern int load_into_inventory; -extern int track_through_doors; -extern int no_mort_to_immort; -extern int free_rent; -extern int max_obj_save; -extern int min_rent_cost; -extern int auto_save; -extern int autosave_time; -extern int crash_file_timeout; -extern int rent_file_timeout; -extern room_vnum mortal_start_room; -extern room_vnum immort_start_room; -extern room_vnum frozen_start_room; -extern room_vnum donation_room_1; -extern room_vnum donation_room_2; -extern room_vnum donation_room_3; -extern ush_int DFLT_PORT; -extern const char *DFLT_IP; -extern const char *DFLT_DIR; -extern const char *LOGNAME; -extern int max_playing; -extern int max_filesize; -extern int max_bad_pws; -extern int siteok_everyone; -extern int nameserver_is_slow; -extern int use_new_socials; -extern int auto_save_olc; -extern const char *MENU; -extern const char *WELC_MESSG; -extern const char *START_MESSG; -extern int use_autowiz; -extern int min_wizlist_lev; -extern const char *OK; -extern const char *NOPERSON; -extern const char *NOEFFECT; - -void load_default_config( void ) +static void load_default_config( void ) { /* This function is called only once, at boot-time. We assume config_info is * empty. -Welcor */ @@ -3366,6 +3318,9 @@ void load_default_config( void ) CONFIG_TRACK_T_DOORS = track_through_doors; CONFIG_NO_MORT_TO_IMMORT = no_mort_to_immort; CONFIG_DISP_CLOSED_DOORS = display_closed_doors; + CONFIG_MAP = map_option; + CONFIG_MAP_SIZE = default_map_size; + CONFIG_MINIMAP_SIZE = default_minimap_size; /* Rent / crashsave options. */ CONFIG_FREE_RENT = free_rent; @@ -3425,7 +3380,7 @@ void load_config( void ) load_default_config(); - snprintf(buf, sizeof(buf), "%s/%s", DFLT_DIR, CONFIG_CONFFILE); + snprintf(buf, sizeof(buf), "%s/%s", CONFIG_DFLT_DIR, CONFIG_CONFFILE); if ( !(fl = fopen(CONFIG_CONFFILE, "r")) && !(fl = fopen(buf, "r")) ) { snprintf(buf, sizeof(buf), "No %s file, using defaults", CONFIG_CONFFILE); perror(buf); @@ -3488,6 +3443,10 @@ void load_config( void ) CONFIG_DFLT_IP = NULL; } else if (!str_cmp(tag, "dflt_port")) CONFIG_DFLT_PORT = num; + else if (!str_cmp(tag, "default_map_size")) + CONFIG_MAP_SIZE = num; + else if (!str_cmp(tag, "default_minimap_size")) + CONFIG_MINIMAP_SIZE = num; break; case 'f': @@ -3558,6 +3517,8 @@ void load_config( void ) CONFIG_MIN_WIZLIST_LEV = num; else if (!str_cmp(tag, "mortal_start_room")) CONFIG_MORTAL_START = num; + else if (!str_cmp(tag, "map_option")) + CONFIG_MAP = num; break; case 'n': diff --git a/src/db.h b/src/db.h index 70df17b..41d3bb0 100644 --- a/src/db.h +++ b/src/db.h @@ -1,12 +1,18 @@ -/************************************************************************** -* File: db.h Part of tbaMUD * -* Usage: Header file for database handling. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file db.h +* Header file for database handling. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +*/ +#ifndef _DB_H_ +#define _DB_H_ + /* arbitrary constants used by index_boot() (must be unique) */ #define DB_BOOT_WLD 0 @@ -16,6 +22,7 @@ #define DB_BOOT_SHP 4 #define DB_BOOT_HLP 5 #define DB_BOOT_TRG 6 +#define DB_BOOT_QST 7 #if defined(CIRCLE_MACINTOSH) #define LIB_WORLD ":world:" @@ -69,13 +76,14 @@ /* names of various files and directories */ #define INDEX_FILE "index" /* index of world files */ #define MINDEX_FILE "index.mini" /* ... and for mini-mud-mode */ -#define WLD_PREFIX LIB_WORLD"wld"SLASH /* room definitions */ -#define MOB_PREFIX LIB_WORLD"mob"SLASH /* monster prototypes */ -#define OBJ_PREFIX LIB_WORLD"obj"SLASH /* object prototypes */ -#define ZON_PREFIX LIB_WORLD"zon"SLASH /* zon defs & command tables */ -#define SHP_PREFIX LIB_WORLD"shp"SLASH /* shop definitions */ -#define TRG_PREFIX LIB_WORLD"trg"SLASH /* trigger files */ -#define HLP_PREFIX LIB_TEXT"help"SLASH /* Help files */ +#define WLD_PREFIX LIB_WORLD"wld"SLASH /* room definitions */ +#define MOB_PREFIX LIB_WORLD"mob"SLASH /* monster prototypes */ +#define OBJ_PREFIX LIB_WORLD"obj"SLASH /* object prototypes */ +#define ZON_PREFIX LIB_WORLD"zon"SLASH /* zon defs & command tables */ +#define SHP_PREFIX LIB_WORLD"shp"SLASH /* shop definitions */ +#define TRG_PREFIX LIB_WORLD"trg"SLASH /* trigger files */ +#define HLP_PREFIX LIB_TEXT"help"SLASH /* Help files */ +#define QST_PREFIX LIB_WORLD"qst"SLASH /* quest files */ #define CREDITS_FILE LIB_TEXT"credits" /* for the 'credits' command */ #define NEWS_FILE LIB_TEXT"news" /* for the 'news' command */ @@ -100,6 +108,27 @@ #define SOCMESS_FILE_NEW LIB_MISC"socials.new" /* messages for social acts with aedit patch*/ #define XNAME_FILE LIB_MISC"xnames" /* invalid name substrings */ +/* BEGIN: Assumed default locations for logfiles, mainly used in do_file. */ +/**/ +#define SYSLOG_LOGFILE "../syslog" +#define CRASH_LOGFILE "../syslog.CRASH" +#define PREFIX_LOGFILE "../log/" +#define LEVELS_LOGFILE PREFIX_LOGFILE"levels" +#define RIP_LOGFILE PREFIX_LOGFILE"rip" +#define NEWPLAYERS_LOGFILE PREFIX_LOGFILE"newplayers" +#define RENTGONE_LOGFILE PREFIX_LOGFILE"rentgone" +#define ERRORS_LOGFILE PREFIX_LOGFILE"errors" +#define GODCMDS_LOGFILE PREFIX_LOGFILE"godcmds" +#define HELP_LOGFILE PREFIX_LOGFILE"help" +#define DELETES_LOGFILE PREFIX_LOGFILE"delete" +#define RESTARTS_LOGFILE PREFIX_LOGFILE"restarts" +#define USAGE_LOGFILE PREFIX_LOGFILE"usage" +#define BADPWS_LOGFILE PREFIX_LOGFILE"badpws" +#define OLC_LOGFILE PREFIX_LOGFILE"olc" +#define TRIGGER_LOGFILE PREFIX_LOGFILE"trigger" +/**/ +/* END: Assumed default locations for logfiles, mainly used in do_file. */ + #define CONFIG_FILE LIB_ETC"config" /* OasisOLC * GAME CONFIG FL */ #define PLAYER_FILE LIB_ETC"players" /* the player database */ #define MAIL_FILE LIB_ETC"plrmail" /* for the mudmail system */ @@ -115,47 +144,6 @@ #define PINDEX_SELFDELETE (1 << 2) /* player is selfdeleting*/ #define PINDEX_NOWIZLIST (1 << 3) /* Player shouldn't be on wizlist*/ -/* public procedures in db.c */ -void boot_db(void); -void destroy_db(void); -int create_entry(char *name); -void zone_update(void); -char *fread_string(FILE *fl, const char *error); -long get_id_by_name(const char *name); -char *get_name_by_id(long id); -void save_mud_time(struct time_info_data *when); -void free_text_files(void); -void free_help_table(void); -void free_player_index(void); -void load_help(FILE *fl, char *name); -void clean_pfiles(void); - -zone_rnum real_zone(zone_vnum vnum); -room_rnum real_room(room_vnum vnum); -mob_rnum real_mobile(mob_vnum vnum); -obj_rnum real_object(obj_vnum vnum); - -int load_char(const char *name, struct char_data *ch); -void save_char(struct char_data *ch); -void init_char(struct char_data *ch); -struct char_data* create_char(void); -struct char_data *read_mobile(mob_vnum nr, int type); -int vnum_mobile(char *searchname, struct char_data *ch); -void clear_char(struct char_data *ch); -void reset_char(struct char_data *ch); -void free_char(struct char_data *ch); -void save_player_index(void); -long get_ptable_by_name(const char *name); -void remove_player(int pfilepos); - -struct obj_data *create_obj(void); -void clear_object(struct obj_data *obj); -void free_obj(struct obj_data *obj); -struct obj_data *read_object(obj_vnum nr, int type); -int vnum_object(char *searchname, struct char_data *ch); -int vnum_room(char *, struct char_data *); -int vnum_trig(char *, struct char_data *); - #define REAL 0 #define VIRTUAL 1 @@ -233,20 +221,7 @@ struct help_index_element { int min_level; /*Min Level to read help entry*/ }; -/* don't change these */ -#define BAN_NOT 0 -#define BAN_NEW 1 -#define BAN_SELECT 2 -#define BAN_ALL 3 - -#define BANNED_SITE_LENGTH 50 -struct ban_list_element { - char site[BANNED_SITE_LENGTH+1]; - int type; - time_t date; - char name[MAX_NAME_LENGTH+1]; - struct ban_list_element *next; -}; +/* The ban defines and structs were moved to ban.h */ /* for the "buffered" rent and house object loading */ struct obj_save_data_t { @@ -257,18 +232,132 @@ struct obj_save_data_t { typedef struct obj_save_data_t obj_save_data; +/* public procedures in db.c */ +void boot_db(void); +void destroy_db(void); +char *fread_action(FILE *fl, int nr); +int create_entry(char *name); +void zone_update(void); +char *fread_string(FILE *fl, const char *error); +long get_id_by_name(const char *name); +char *get_name_by_id(long id); +void save_mud_time(struct time_info_data *when); +void free_text_files(void); +void free_help_table(void); +void free_player_index(void); +void load_help(FILE *fl, char *name); + +zone_rnum real_zone(zone_vnum vnum); +room_rnum real_room(room_vnum vnum); +mob_rnum real_mobile(mob_vnum vnum); +obj_rnum real_object(obj_vnum vnum); + +/* Public Procedures from objsave.c */ +void Crash_save_all(void); +void Crash_idlesave(struct char_data *ch); +void Crash_crashsave(struct char_data *ch); +int Crash_load(struct char_data *ch); +void Crash_listrent(struct char_data *ch, char *name); +int Crash_clean_file(char *name); +int Crash_delete_crashfile(struct char_data *ch); +int Crash_delete_file(char *name); +void update_obj_file(void); +void Crash_rentsave(struct char_data *ch, int cost); +obj_save_data *objsave_parse_objects(FILE *fl); +int objsave_save_obj_record(struct obj_data *obj, FILE *fl, int location); +/* Special functions */ +SPECIAL(receptionist); +SPECIAL(cryogenicist); + +/* Functions from players.c */ +void tag_argument(char *argument, char *tag); +int load_char(const char *name, struct char_data *ch); +void save_char(struct char_data *ch); +void init_char(struct char_data *ch); +struct char_data* create_char(void); +struct char_data *read_mobile(mob_vnum nr, int type); +int vnum_mobile(char *searchname, struct char_data *ch); +void clear_char(struct char_data *ch); +void reset_char(struct char_data *ch); +void free_char(struct char_data *ch); +void save_player_index(void); +long get_ptable_by_name(const char *name); +void remove_player(int pfilepos); +void clean_pfiles(void); +void build_player_index(void); + +struct obj_data *create_obj(void); +void clear_object(struct obj_data *obj); +void free_obj(struct obj_data *obj); +struct obj_data *read_object(obj_vnum nr, int type); +int vnum_object(char *searchname, struct char_data *ch); +int vnum_room(char *, struct char_data *); +int vnum_trig(char *, struct char_data *); + +void setup_dir(FILE *fl, int room, int dir); +void index_boot(int mode); +void discrete_load(FILE *fl, int mode, char *filename); +void parse_room(FILE *fl, int virtual_nr); +void parse_mobile(FILE *mob_f, int nr); +char *parse_object(FILE *obj_f, int nr); +int is_empty(zone_rnum zone_nr); +void reset_zone(zone_rnum zone); +void reboot_wizlists(void); +ACMD(do_reboot); +void boot_world(void); +int count_hash_records(FILE *fl); +bitvector_t asciiflag_conv(char *flag); +void renum_world(void); +void load_config( void ); + + + /* global buffering system */ #ifndef __DB_C__ + +/* Various Files */ +extern char *credits; +extern char *news; +extern char *motd; +extern char *imotd; +extern char *GREETINGS; +extern char *help; +extern char *ihelp; +extern char *info; +extern char *wizlist; +extern char *immlist; +extern char *background; +extern char *handbook; +extern char *policies; + +/* The ingame helpfile */ +extern int top_of_helpt; +extern struct help_index_element *help_table; + +/* Mud configurable variables */ +extern int no_mail; +extern int mini_mud; +extern int no_rent_check; +extern time_t boot_time; +extern int circle_restrict; +extern room_rnum r_mortal_start_room; +extern room_rnum r_immort_start_room; +extern room_rnum r_frozen_start_room; + extern struct config_data config_info; +extern struct time_info_data time_info; +extern struct weather_data weather_info; +extern struct player_special_data dummy_mob; +extern struct reset_q_type reset_q; + extern struct room_data *world; extern room_rnum top_of_world; extern struct zone_data *zone_table; extern zone_rnum top_of_zone_table; -extern struct descriptor_data *descriptor_list; extern struct char_data *character_list; extern struct player_special_data dummy_mob; @@ -294,4 +383,19 @@ extern long max_mob_id; extern long max_obj_id; extern int dg_owner_purged; +extern struct message_list fight_messages[MAX_MESSAGES]; + +/* autoquest globals */ +extern struct aq_data *aquest_table; +extern qst_rnum total_quests; + +/* begin previously located in players.c, returned to db.c */ +extern struct player_index_element *player_table; +extern int top_of_p_table; +extern int top_of_p_file; +extern long top_idnum; +/* end previously located in players.c */ + #endif /* __DB_C__ */ + +#endif /* _DB_H_ */ diff --git a/src/dg_comm.c b/src/dg_comm.c index 2b0f6e8..b89590d 100644 --- a/src/dg_comm.c +++ b/src/dg_comm.c @@ -23,7 +23,7 @@ #include "constants.h" /* local functions */ -void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], char type[]); +static void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], char type[]); /* same as any_one_arg except that it stops at punctuation */ char *any_one_name(char *argument, char *first_arg) @@ -44,7 +44,7 @@ char *any_one_name(char *argument, char *first_arg) return argument; } -void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], char type[]) +static void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], char type[]) { char sb[MAX_STRING_LENGTH]; int i; diff --git a/src/dg_db_scripts.c b/src/dg_db_scripts.c index 88b0929..54b61d2 100644 --- a/src/dg_db_scripts.c +++ b/src/dg_db_scripts.c @@ -22,12 +22,10 @@ #include "dg_event.h" #include "comm.h" #include "constants.h" - -extern void half_chop(char *string, char *arg1, char *arg2); -extern bitvector_t asciiflag_conv(char *flag); +#include "interpreter.h" /* For half_chop */ /* local functions */ -void trig_data_init(trig_data *this_data); +static void trig_data_init(trig_data *this_data); void parse_trigger(FILE *trig_f, int nr) { @@ -93,7 +91,7 @@ trig_data *read_trigger(int nr) return trig; } -void trig_data_init(trig_data *this_data) +static void trig_data_init(trig_data *this_data) { this_data->nr = NOTHING; this_data->data_type = 0; diff --git a/src/dg_event.c b/src/dg_event.c index ecaa2bc..99e9014 100644 --- a/src/dg_event.c +++ b/src/dg_event.c @@ -1,33 +1,59 @@ -/************************************************************************** -* File: dg_event.c Part of tbaMUD * -* Usage: This file contains a simplified event system to allow trigedit * -* to use the "wait" command, causing a delay in the middle of a script. * -* * -* $Author: Mark A. Heilpern/egreen/Welcor $ * -* $Date: 2004/10/11 12:07:00$ * -* $Revision: 1.0.14 $ * -**************************************************************************/ +/** +* @file dg_event.c +* This file contains a simplified event system to allow trigedit +* to use the "wait" command, causing a delay in the middle of a script. +* This system could easily be expanded by coders who wish to implement +* an event driven mud. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* was created by the following people: +* $Author: Mark A. Heilpern/egreen/Welcor $ +* $Date: 2004/10/11 12:07:00$ +* $Revision: 1.0.14 $ +*/ + #include "conf.h" #include "sysdep.h" #include "structs.h" -#include "db.h" #include "utils.h" +#include "db.h" #include "dg_event.h" #include "constants.h" +#include "comm.h" /* For access to the game pulse */ -struct queue *event_q; /* the event queue */ -extern long pulse; +/*************************************************************************** + * Begin mud specific event queue functions + **************************************************************************/ +/* file scope variables */ +/** The mud specific queue of events. */ +static struct dg_queue *event_q; -/* initializes the event queue */ + +/** Initializes the main event queue event_q. + * @post The main event queue, event_q, has been created and initialized. + */ void event_init(void) { event_q = queue_init(); } -/* Add an event to the current list. Creates an event and returns it. */ +/** Creates a new event 'object' that is then enqueued to the global event_q. + * @post If the newly created event is valid, it is always added to event_q. + * @param func The function to be called when this event fires. This function + * will be passed event_obj when it fires. The function must match the form + * described by EVENTFUNC. + * @param event_obj An optional 'something' to be passed to func when this + * event fires. It is func's job to cast event_obj. If event_obj is not needed, + * pass in NULL. + * @param when Number of pulses between firing(s) of this event. + * @retval event * Returns a pointer to the newly created event. + * */ struct event *event_create(EVENTFUNC(*func), void *event_obj, long when) { struct event *new_event; @@ -43,7 +69,9 @@ struct event *event_create(EVENTFUNC(*func), void *event_obj, long when) return new_event; } -/* removes the event from the system */ +/** Removes an event from event_q and frees the event. + * @param event Pointer to the event to be dequeued and removed. + */ void event_cancel(struct event *event) { if (!event) { @@ -61,7 +89,9 @@ void event_cancel(struct event *event) free(event); } -/* Process any events whose time has come. */ +/** Process any events whose time has come. Should be called from, and at, every + * pulse of heartbeat. Re-enqueues multi-use events. + */ void event_process(void) { struct event *the_event; @@ -82,11 +112,17 @@ void event_process(void) if ((new_time = (the_event->func)(the_event->event_obj)) > 0) the_event->q_el = queue_enq(event_q, the_event, new_time + pulse); else + { + /* It is assumed that the_event will already have freed ->event_obj. */ free(the_event); + } + } } -/* returns the time remaining before the event */ +/** Returns the time remaining before the event as how many pulses from now. + * @param event Check this event for it's scheduled activation time. + * @retval long Number of pulses before this event will fire. */ long event_time(struct event *event) { long when; @@ -96,13 +132,16 @@ long event_time(struct event *event) return (when - pulse); } -/* frees all events in the queue */ +/** Frees all events from event_q. */ void event_free_all(void) { queue_free(event_q); } -/* boolean function to tell whether an event is queued or not */ +/** Boolean function to tell whether an event is queued or not. Does this by + * checking if event->q_el points to anything but null. + * @retval int 1 if the event has been queued, 0 if the event has not been + * queued. */ int event_is_queued(struct event *event) { if (event->q_el) @@ -110,20 +149,35 @@ int event_is_queued(struct event *event) else return 0; } +/*************************************************************************** + * End mud specific event queue functions + **************************************************************************/ -/* Generic queue functions for building and using a priority queue. */ -/* returns a new, initialized queue */ -struct queue *queue_init(void) +/*************************************************************************** + * Begin generic (abstract) priority queue functions + **************************************************************************/ +/** Create a new, empty, priority queue and return it. + * @retval dg_queue * Pointer to the newly created queue structure. */ +struct dg_queue *queue_init(void) { - struct queue *q; + struct dg_queue *q; - CREATE(q, struct queue, 1); + CREATE(q, struct dg_queue, 1); return q; } -/* add data into the priority queue q with key */ -struct q_element *queue_enq(struct queue *q, void *data, long key) +/** Add some 'data' to a priority queue. + * @pre The paremeter q must have been previously created by queue_init. + * @post A new q_element is created to hold the data parameter. + * @param q The existing dg_queue to add an element to. + * @param data The data to be associated with, and theoretically used, when + * the element comes up in q. data is wrapped in a new q_element. + * @param key Indicates where this event should be located in the queue, and + * when the element should be activated. + * @retval q_element * Pointer to the created q_element that contains + * the data. */ +struct q_element *queue_enq(struct dg_queue *q, void *data, long key) { struct q_element *qe, *i; int bucket; @@ -166,8 +220,13 @@ struct q_element *queue_enq(struct queue *q, void *data, long key) return qe; } -/* remove queue element qe from the priority queue q */ -void queue_deq(struct queue *q, struct q_element *qe) +/** Remove queue element qe from the priority queue q. + * @pre qe->data has been dealt with in some way. + * @post qe has been freed. + * @param q Pointer to the queue containing qe. + * @param qe Pointer to the q_element to remove from q. + */ +void queue_deq(struct dg_queue *q, struct q_element *qe) { int i; @@ -188,8 +247,14 @@ void queue_deq(struct queue *q, struct q_element *qe) free(qe); } -/* Removes and returns the data of the first element of the priority queue q. */ -void *queue_head(struct queue *q) +/** Removes and returns the data of the first element of the priority queue q. + * @pre pulse must be defined. This is a multi-headed queue, the current + * head is determined by the current pulse. + * @post the q->head is dequeued. + * @param q The queue to return the head of. + * @retval void * NULL if there is not a currently available head, pointer + * to any data object associated with the queue element. */ +void *queue_head(struct dg_queue *q) { void *dg_data; int i; @@ -204,9 +269,13 @@ void *queue_head(struct queue *q) return dg_data; } -/* Returns the key of the head element of the priority queue if q is NULL, then - * return the largest unsigned number. */ -long queue_key(struct queue *q) +/** Returns the key of the head element of the priority queue. + * @pre pulse must be defined. This is a multi-headed queue, the current + * head is determined by the current pulse. + * @param q Queue to check for. + * @retval long Return the key element of the head q_element. If no head + * q_element is available, return LONG_MAX. */ +long queue_key(struct dg_queue *q) { int i; @@ -218,29 +287,39 @@ long queue_key(struct queue *q) return LONG_MAX; } -/* returns the key of queue element qe */ +/** Returns the key of queue element qe. + * @param qe Pointer to the keyed q_element. + * @retval long Key of qe. */ long queue_elmt_key(struct q_element *qe) { return qe->key; } -/* free q and contents */ -void queue_free(struct queue *q) +/** Free q and all contents. + * @pre Function requires definition of struct event. + * @post All items associeated qith q, including non-abstract data, are freed. + * @param q The priority queue to free. + */ +void queue_free(struct dg_queue *q) { int i; struct q_element *qe, *next_qe; struct event *event; for (i = 0; i < NUM_EVENT_QUEUES; i++) - for (qe = q->head[i]; qe; qe = next_qe) { + { + for (qe = q->head[i]; qe; qe = next_qe) + { next_qe = qe->next; - if ((event = (struct event *) qe->data) != NULL) { - if (event->event_obj) - free(event->event_obj); - free(event); + if ((event = (struct event *) qe->data) != NULL) + { + if (event->event_obj) + free(event->event_obj); + free(event); } free(qe); } + } free(q); } diff --git a/src/dg_event.h b/src/dg_event.h index df0f830..8f82a44 100644 --- a/src/dg_event.h +++ b/src/dg_event.h @@ -1,42 +1,66 @@ -/************************************************************************** -* File: dg_event.h Part of tbaMUD * -* Usage: Structures and prototypes for events. * -* * -* $Author: Mark A. Heilpern/egreen/Welcor $ * -* $Date: 2004/10/11 12:07:00$ * -* $Revision: 1.0.14 $ * -**************************************************************************/ +/** +* @file dg_event.h +* This file contains defines for the simplified event system to allow trigedit +* to use the "wait" command, causing a delay in the middle of a script. +* This system could easily be expanded by coders who wish to implement +* an event driven mud. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* is attributed to: +* $Author: Mark A. Heilpern/egreen/Welcor $ +* $Date: 2004/10/11 12:07:00$ +* $Revision: 1.0.14 $ +*/ +#ifndef _DG_EVENT_H_ +#define _DG_EVENT_H_ -/* How often will heartbeat() call the 'wait' event function? */ +/** How often will heartbeat() call the 'wait' event function? + * @deprecated Currently not used. */ #define PULSE_DG_EVENT 1 -/* Event related section.*/ +/************************************************************************** + * Begin event structures and defines. + **************************************************************************/ +/** All Functions handled by the event system must be of this format. */ #define EVENTFUNC(name) long (name)(void *event_obj) -/* Define event related structures. */ +/** The event structure. Events get attached to the queue and are executed + * when their turn comes up in the queue. */ struct event { - EVENTFUNC(*func); - void *event_obj; - struct q_element *q_el; + EVENTFUNC(*func); /**< The function called when this event comes up. */ + void *event_obj; /**< event_obj is passed to func when func is called */ + struct q_element *q_el; /**< Where this event is located in the queue */ }; -/* End of Event related info. */ +/************************************************************************** + * End event structures and defines. + **************************************************************************/ -/* Queue related info. */ -/* number of queues to use (reduces enqueue cost) */ +/************************************************************************** + * Begin priority queue structures and defines. + **************************************************************************/ +/** Number of buckets available in each queue. Reduces enqueue cost. */ #define NUM_EVENT_QUEUES 10 -struct queue { - struct q_element *head[NUM_EVENT_QUEUES], *tail[NUM_EVENT_QUEUES]; +/** The priority queue. */ +struct dg_queue { + struct q_element *head[NUM_EVENT_QUEUES]; /**< Front of each queue bucket. */ + struct q_element *tail[NUM_EVENT_QUEUES]; /**< Rear of each queue bucket. */ }; +/** Queued elements. */ struct q_element { - void *data; - long key; - struct q_element *prev, *next; + void *data; /**< The event to be handled. */ + long key; /**< When the event should be handled. */ + struct q_element *prev, *next; /**< Points to other q_elements in line. */ }; -/* End of Queue related info. */ +/************************************************************************** + * End priority queue structures and defines. + **************************************************************************/ -/* - events - function protos need by other modules */ +/* - events - function protos needed by other modules */ void event_init(void); struct event *event_create(EVENTFUNC(*func), void *event_obj, long when); void event_cancel(struct event *event); @@ -45,11 +69,13 @@ long event_time(struct event *event); void event_free_all(void); /* - queues - function protos need by other modules */ -struct queue *queue_init(void); -struct q_element *queue_enq(struct queue *q, void *data, long key); -void queue_deq(struct queue *q, struct q_element *qe); -void *queue_head(struct queue *q); -long queue_key(struct queue *q); +struct dg_queue *queue_init(void); +struct q_element *queue_enq(struct dg_queue *q, void *data, long key); +void queue_deq(struct dg_queue *q, struct q_element *qe); +void *queue_head(struct dg_queue *q); +long queue_key(struct dg_queue *q); long queue_elmt_key(struct q_element *qe); -void queue_free(struct queue *q); +void queue_free(struct dg_queue *q); int event_is_queued(struct event *event); + +#endif /* _DG_EVENT_H_ */ diff --git a/src/dg_handler.c b/src/dg_handler.c index a28e776..ef2eab6 100644 --- a/src/dg_handler.c +++ b/src/dg_handler.c @@ -15,8 +15,8 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" -#include "dg_scripts.h" #include "utils.h" +#include "dg_scripts.h" #include "comm.h" #include "db.h" #include "handler.h" diff --git a/src/dg_misc.c b/src/dg_misc.c index 3e7f538..ecc4a9e 100644 --- a/src/dg_misc.c +++ b/src/dg_misc.c @@ -10,8 +10,8 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" -#include "dg_scripts.h" #include "utils.h" +#include "dg_scripts.h" #include "comm.h" #include "interpreter.h" #include "handler.h" @@ -20,14 +20,12 @@ #include "screen.h" #include "spells.h" #include "constants.h" +#include "fight.h" -void die(struct char_data *ch, struct char_data * killer); /* copied from spell_parser.c: */ #define SINFO spell_info[spellnum] -/* external vars */ -extern struct spell_info_type spell_info[]; /* Cast a spell; can be called by mobiles, objects and rooms, and no level * check is required. Note that mobs should generally use the normal 'cast' diff --git a/src/dg_mobcmd.c b/src/dg_mobcmd.c index e6d0ca2..63b603c 100644 --- a/src/dg_mobcmd.c +++ b/src/dg_mobcmd.c @@ -10,48 +10,26 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "screen.h" #include "dg_scripts.h" #include "db.h" -#include "utils.h" #include "handler.h" #include "interpreter.h" #include "comm.h" #include "spells.h" #include "constants.h" +#include "genzon.h" /* for real_zone_by_thing */ +#include "act.h" +#include "fight.h" -/* External functions */ -bitvector_t asciiflag_conv(char *flag); -zone_rnum real_zone_by_thing(room_vnum vznum); -void die(struct char_data *ch, struct char_data *killer); -room_rnum find_target_room(struct char_data *ch, char *rawroomstr); -/* Local functions. */ -void mob_log(char_data *mob, const char *format, ...); -ACMD(do_masound); -ACMD(do_mkill); -ACMD(do_mjunk); -ACMD(do_mechoaround); -ACMD(do_msend); -ACMD(do_mecho); -ACMD(do_mzoneecho); -ACMD(do_mload); -ACMD(do_mpurge); -ACMD(do_mgoto); -ACMD(do_mat); -ACMD(do_mteleport); -ACMD(do_mdamage); -ACMD(do_mforce); -ACMD(do_mhunt); -ACMD(do_mremember); -ACMD(do_mforget); -ACMD(do_mtransform); -ACMD(do_mdoor); -ACMD(do_mfollow); -ACMD(do_mrecho); +/* Local file scope functions. */ +static void mob_log(char_data *mob, const char *format, ...); + /* attaches mob's name and vnum to msg and sends it to script_log */ -void mob_log(char_data *mob, const char *format, ...) +static void mob_log(char_data *mob, const char *format, ...) { va_list args; char output[MAX_STRING_LENGTH]; diff --git a/src/dg_objcmd.c b/src/dg_objcmd.c index 6d9b48e..bf226fc 100644 --- a/src/dg_objcmd.c +++ b/src/dg_objcmd.c @@ -18,33 +18,33 @@ #include "handler.h" #include "db.h" #include "constants.h" +#include "genzon.h" /* for access to real_zone_by_thing */ +#include "fight.h" /* for die() */ + -void die(struct char_data * ch, struct char_data *killer); -bitvector_t asciiflag_conv(char *flag); -zone_rnum real_zone_by_thing(room_vnum vznum); /* Local functions */ #define OCMD(name) \ void (name)(obj_data *obj, char *argument, int cmd, int subcmd) -void obj_log(obj_data *obj, const char *format, ...); -room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr); -OCMD(do_oecho); -OCMD(do_oforce); -OCMD(do_ozoneecho); -OCMD(do_osend); -OCMD(do_orecho); -OCMD(do_otimer); -OCMD(do_otransform); -OCMD(do_opurge); -OCMD(do_oteleport); -OCMD(do_dgoload); -OCMD(do_odamage); -OCMD(do_oasound); -OCMD(do_odoor); -OCMD(do_osetval); -OCMD(do_oat); -void obj_command_interpreter(obj_data *obj, char *argument); +static void obj_log(obj_data *obj, const char *format, ...); +static room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr); +static OCMD(do_oecho); +static OCMD(do_oforce); +static OCMD(do_ozoneecho); +static OCMD(do_osend); +static OCMD(do_orecho); +static OCMD(do_otimer); +static OCMD(do_otransform); +static OCMD(do_opurge); +static OCMD(do_oteleport); +static OCMD(do_dgoload); +static OCMD(do_odamage); +static OCMD(do_oasound); +static OCMD(do_odoor); +static OCMD(do_osetval); +static OCMD(do_oat); + struct obj_command_info { char *command; @@ -57,7 +57,7 @@ struct obj_command_info { #define SCMD_OECHOAROUND 1 /* attaches object name and vnum to msg and sends it to script_log */ -void obj_log(obj_data *obj, const char *format, ...) +static void obj_log(obj_data *obj, const char *format, ...) { va_list args; char output[MAX_STRING_LENGTH]; @@ -85,7 +85,7 @@ room_rnum obj_room(obj_data *obj) } /* returns the real room number, or NOWHERE if not found or invalid */ -room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr) +static room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr) { int tmp; room_rnum location; @@ -133,7 +133,7 @@ room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr) } /* Object commands */ -OCMD(do_oecho) +static OCMD(do_oecho) { int room; @@ -154,7 +154,7 @@ OCMD(do_oecho) obj_log(obj, "oecho called by object in NOWHERE"); } -OCMD(do_oforce) +static OCMD(do_oforce) { char_data *ch, *next_ch; int room; @@ -200,7 +200,7 @@ OCMD(do_oforce) } } -OCMD(do_ozoneecho) +static OCMD(do_ozoneecho) { int zone; char room_number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg; @@ -220,7 +220,7 @@ OCMD(do_ozoneecho) } } -OCMD(do_osend) +static OCMD(do_osend) { char buf[MAX_INPUT_LENGTH], *msg; char_data *ch; @@ -255,7 +255,7 @@ OCMD(do_osend) /* Prints the message to everyone in the range of numbers. Thanks to Jamie * Nelson of 4D for this contribution. */ -OCMD(do_orecho) +static OCMD(do_orecho) { char start[MAX_INPUT_LENGTH], finish[MAX_INPUT_LENGTH], *msg; @@ -271,7 +271,7 @@ OCMD(do_orecho) } /* set the object's timer value */ -OCMD(do_otimer) +static OCMD(do_otimer) { char arg[MAX_INPUT_LENGTH]; @@ -287,7 +287,7 @@ OCMD(do_otimer) /* Transform into a different object. Note: this shouldn't be used with * containers unless both objects are containers! */ -OCMD(do_otransform) +static OCMD(do_otransform) { char arg[MAX_INPUT_LENGTH]; obj_data *o, tmpobj; @@ -337,7 +337,7 @@ OCMD(do_otransform) } /* purge all objects an npcs in room, or specified object or mob */ -OCMD(do_opurge) +static OCMD(do_opurge) { char arg[MAX_INPUT_LENGTH]; char_data *ch, *next_ch; @@ -386,7 +386,7 @@ OCMD(do_opurge) extract_char(ch); } -OCMD(do_oteleport) +static OCMD(do_oteleport) { char_data *ch, *next_ch; room_rnum target, rm; @@ -437,7 +437,7 @@ OCMD(do_oteleport) } } -OCMD(do_dgoload) +static OCMD(do_dgoload) { char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; int number = 0, room; @@ -539,7 +539,7 @@ OCMD(do_dgoload) } -OCMD(do_odamage) { +static OCMD(do_odamage) { char name[MAX_INPUT_LENGTH], amount[MAX_INPUT_LENGTH]; int dam = 0; char_data *ch; @@ -562,7 +562,7 @@ OCMD(do_odamage) { script_damage(ch, dam); } -OCMD(do_oasound) +static OCMD(do_oasound) { room_rnum room; int door; @@ -590,7 +590,7 @@ OCMD(do_oasound) } } -OCMD(do_odoor) +static OCMD(do_odoor) { char target[MAX_INPUT_LENGTH], direction[MAX_INPUT_LENGTH]; char field[MAX_INPUT_LENGTH], *value; @@ -682,7 +682,7 @@ OCMD(do_odoor) } } -OCMD(do_osetval) +static OCMD(do_osetval) { char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; int position, new_value; @@ -703,7 +703,7 @@ OCMD(do_osetval) } /* Submitted by PurpleOnyx */ -OCMD(do_oat) +static OCMD(do_oat) { room_rnum loc = NOWHERE; struct char_data *ch; diff --git a/src/dg_olc.c b/src/dg_olc.c index 0656dbc..902e71b 100644 --- a/src/dg_olc.c +++ b/src/dg_olc.c @@ -18,20 +18,17 @@ #include "oasis.h" #include "dg_olc.h" #include "dg_event.h" +#include "genzon.h" /* for real_zone_by_thing */ +#include "constants.h" /* for the *trig_types */ +#include "modify.h" /* for smash_tilde */ -/* external functions */ -extern const char *trig_types[], *otrig_types[], *wtrig_types[]; -zone_rnum real_zone_by_thing(room_vnum vznum); /* local functions */ -void trigedit_disp_menu(struct descriptor_data *d); -void trigedit_disp_types(struct descriptor_data *d); -void trigedit_save(struct descriptor_data *d); -void trigedit_create_index(int znum, char *type); -void trigedit_string_cleanup(struct descriptor_data *d, int terminator); -int format_script(struct descriptor_data *d); -void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num); -void trigedit_setup_new(struct descriptor_data *d); +static void trigedit_disp_menu(struct descriptor_data *d); +static void trigedit_disp_types(struct descriptor_data *d); +static void trigedit_create_index(int znum, char *type); +static void trigedit_setup_new(struct descriptor_data *d); + /* Trigedit */ ACMD(do_oasis_trigedit) @@ -130,7 +127,7 @@ void script_save_to_disk(FILE *fp, void *item, int type) } } -void trigedit_setup_new(struct descriptor_data *d) +static void trigedit_setup_new(struct descriptor_data *d) { struct trig_data *trig; @@ -180,7 +177,7 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num) OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */ } -void trigedit_disp_menu(struct descriptor_data *d) +static void trigedit_disp_menu(struct descriptor_data *d) { struct trig_data *trig = OLC_TRIG(d); char *attach_type; @@ -225,7 +222,7 @@ void trigedit_disp_menu(struct descriptor_data *d) OLC_MODE(d) = TRIGEDIT_MAIN_MENU; } -void trigedit_disp_types(struct descriptor_data *d) +static void trigedit_disp_types(struct descriptor_data *d) { int i, columns = 0; const char **types; @@ -637,7 +634,7 @@ void trigedit_save(struct descriptor_data *d) trigedit_create_index(zone, "trg"); } -void trigedit_create_index(int znum, char *type) +static void trigedit_create_index(int znum, char *type) { FILE *newfile, *oldfile; char new_name[128], old_name[128], *prefix; diff --git a/src/dg_olc.h b/src/dg_olc.h index 47c445c..82098c5 100644 --- a/src/dg_olc.h +++ b/src/dg_olc.h @@ -1,12 +1,18 @@ -/************************************************************************** -* File: dg_olc.h Part of tbaMUD * -* * -* Usage: This source file is used in extending Oasis OLC for trigedit. * -* * -* $Author: Mark A. Heilpern/egreen/Welcor $ * -* $Date: 2004/10/11 12:07:00$ * -* $Revision: 1.0.14 $ * -**************************************************************************/ +/** +* @file dg_olc.h +* This source file is used in extending Oasis OLC for trigedit. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* was created by the following people: +* $Author: Mark A. Heilpern/egreen/Welcor $ +* $Date: 2004/10/11 12:07:00$ +* $Revision: 1.0.14 $ +*/ +#ifndef _DG_OLC_H_ +#define _DG_OLC_H_ #include "dg_scripts.h" @@ -39,3 +45,5 @@ void dg_olc_script_copy(struct descriptor_data *d); void dg_script_menu(struct descriptor_data *d); int dg_script_edit_parse(struct descriptor_data *d, char *arg); + +#endif /* _DG_OLC_H_ */ diff --git a/src/dg_scripts.c b/src/dg_scripts.c index 9ba1e12..662cd4b 100644 --- a/src/dg_scripts.c +++ b/src/dg_scripts.c @@ -1,11 +1,16 @@ -/************************************************************************** -* File: dg_scripts.c Part of tbaMUD * -* Usage: Contains the main script driver interface. * -* * -* $Author: Mark A. Heilpern/egreen/Welcor $ * -* $Date: 2004/10/11 12:07:00$ * -* $Revision: 1.0.14 $ * -**************************************************************************/ +/** +* @file dg_scripts.c +* Contains the main script driver interface. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* was created by the following people: +* $Author: Mark A. Heilpern/egreen/Welcor $ +* $Date: 2004/10/11 12:07:00$ +* $Revision: 1.0.14 $ +*/ #include "conf.h" #include "sysdep.h" @@ -21,71 +26,64 @@ #include "constants.h" #include "spells.h" #include "oasis.h" +#include "genzon.h" /* for real_zone_by_thing */ +#include "act.h" +#include "modify.h" #define PULSES_PER_MUD_HOUR (SECS_PER_MUD_HOUR*PASSES_PER_SEC) -/* external vars */ -extern unsigned long pulse; -extern struct spell_info_type spell_info[]; -extern struct time_info_data time_info; - -/* external functions */ -int is_empty(zone_rnum zone_nr); -room_rnum find_target_room(struct char_data *ch, char *rawroomstr); -zone_rnum real_zone_by_thing(room_vnum vznum); - /* Local functions not used elsewhere */ -obj_data *find_obj(long n); -room_data *find_room(long n); -void do_stat_trigger(struct char_data *ch, trig_data *trig); -void script_stat (char_data *ch, struct script_data *sc); -int remove_trigger(struct script_data *sc, char *name); -int is_num(char *arg); -void eval_op(char *op, char *lhs, char *rhs, char *result, void *go, - struct script_data *sc, trig_data *trig); -char *matching_paren(char *p); -void eval_expr(char *line, char *result, void *go, struct script_data *sc, - trig_data *trig, int type); -int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc, - trig_data *trig, int type); -int process_if(char *cond, void *go, struct script_data *sc, - trig_data *trig, int type); -struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl); -struct cmdlist_element *find_else_end(trig_data *trig, - struct cmdlist_element *cl, void *go, - struct script_data *sc, int type); -void process_wait(void *go, trig_data *trig, int type, char *cmd, - struct cmdlist_element *cl); -void process_set(struct script_data *sc, trig_data *trig, char *cmd); -void process_attach(void *go, struct script_data *sc, trig_data *trig, - int type, char *cmd); -void process_detach(void *go, struct script_data *sc, trig_data *trig, - int type, char *cmd); -void makeuid_var(void *go, struct script_data *sc, trig_data *trig, - int type, char *cmd); -int process_return(trig_data *trig, char *cmd); -void process_unset(struct script_data *sc, trig_data *trig, char *cmd); -void process_remote(struct script_data *sc, trig_data *trig, char *cmd); -void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd); -void process_global(struct script_data *sc, trig_data *trig, char *cmd, long id); -void process_context(struct script_data *sc, trig_data *trig, char *cmd); -void extract_value(struct script_data *sc, trig_data *trig, char *cmd); -void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd); -struct cmdlist_element * -find_case(struct trig_data *trig, struct cmdlist_element *cl, +static obj_data *find_obj(long n); +static room_data *find_room(long n); +static void do_stat_trigger(struct char_data *ch, trig_data *trig); +static void script_stat(char_data *ch, struct script_data *sc); +static int remove_trigger(struct script_data *sc, char *name); +static int is_num(char *arg); +static void eval_op(char *op, char *lhs, char *rhs, char *result, void *go, + struct script_data *sc, trig_data *trig); +static char *matching_paren(char *p); +static void eval_expr(char *line, char *result, void *go, struct script_data *sc, + trig_data *trig, int type); +static int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc, + trig_data *trig, int type); +static int process_if(char *cond, void *go, struct script_data *sc, + trig_data *trig, int type); +static struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl); +static struct cmdlist_element *find_else_end(trig_data *trig, + struct cmdlist_element *cl, void *go, struct script_data *sc, int type); +static void process_wait(void *go, trig_data *trig, int type, char *cmd, + struct cmdlist_element *cl); +static void process_set(struct script_data *sc, trig_data *trig, char *cmd); +static void process_attach(void *go, struct script_data *sc, trig_data *trig, + int type, char *cmd); +static void process_detach(void *go, struct script_data *sc, trig_data *trig, + int type, char *cmd); +static void makeuid_var(void *go, struct script_data *sc, trig_data *trig, + int type, char *cmd); +static int process_return(trig_data *trig, char *cmd); +static void process_unset(struct script_data *sc, trig_data *trig, char *cmd); +static void process_remote(struct script_data *sc, trig_data *trig, char *cmd); +static void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd); +static void process_global(struct script_data *sc, trig_data *trig, char *cmd, long id); +static void process_context(struct script_data *sc, trig_data *trig, char *cmd); +static void extract_value(struct script_data *sc, trig_data *trig, char *cmd); +static void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd); +static struct cmdlist_element * find_case(struct trig_data *trig, struct cmdlist_element *cl, void *go, struct script_data *sc, int type, char *cond); -struct cmdlist_element *find_done(struct cmdlist_element *cl); -int fgetline(FILE *file, char *p); -struct char_data *find_char_by_uid_in_lookup_table(long uid); -struct obj_data *find_obj_by_uid_in_lookup_table(long uid); -EVENTFUNC(trig_wait_event); -ACMD(do_attach) ; -ACMD(do_detach); -ACMD(do_vdelete); -ACMD(do_tstat); +static struct cmdlist_element *find_done(struct cmdlist_element *cl); +static struct char_data *find_char_by_uid_in_lookup_table(long uid); +static struct obj_data *find_obj_by_uid_in_lookup_table(long uid); +static EVENTFUNC(trig_wait_event); + /* Return pointer to first occurrence of string ct in cs, or NULL if not - * present. Case insensitive */ + * present. Case insensitive. All of ct must be found in cs for it to be + * a match. + * @todo Move this function to string util library. + * @param cs The string to search. + * @param ct What to search for in cs. + * @retval char * NULL if ct is not a substring of cs, or pointer to the + * location in cs where substring ct begins. */ char *str_str(char *cs, char *ct) { char *s, *t; @@ -106,6 +104,8 @@ char *str_str(char *cs, char *ct) cs++; } + /* If there we haven reached the end of ct via t, + * then the whole string was found. */ if (!*t) return s; } @@ -113,7 +113,12 @@ char *str_str(char *cs, char *ct) return NULL; } -int trgvar_in_room(room_vnum vnum) { +/** Returns the number of people in a room. + * @param vnum The virtual number of a room. + * @retval int Returns -1 if the room does not exist, or the total number of + * PCs and NPCs in the room. */ +int trgvar_in_room(room_vnum vnum) +{ room_rnum rnum = real_room(vnum); int i = 0; char_data *ch; @@ -129,6 +134,14 @@ int trgvar_in_room(room_vnum vnum) { return i; } + +/** Find out if an object is within a list of objects. + * @param name Either the unique id of an object or a string identifying the + * object. Note the unique id must be prefixed with UID_CHAR. + * @param list The list of objects to look through. + * @retval obj_data * Pointer to the object if it is found in the list of + * objects, NULL if the object is not found in the list. + */ obj_data *get_obj_in_list(char *name, obj_data *list) { obj_data *i; @@ -140,6 +153,7 @@ obj_data *get_obj_in_list(char *name, obj_data *list) for (i = list; i; i = i->next_content) if (id == GET_ID(i)) return i; + } else { for (i = list; i; i = i->next_content) if (isname(name, i->name)) @@ -149,6 +163,13 @@ obj_data *get_obj_in_list(char *name, obj_data *list) return NULL; } +/** Find out if an NPC or PC is carrying an object. + * @param ch Pointer to the NPC/PC to search through. + * @param name String describing either the name of the object or the unique + * id of the object. Note the unique id must be prefixed with UID_CHAR. + * @retval obj_data * Either a pointer to the first object found that matches + * the name argument, or the NULL if the object isn't found. + */ obj_data *get_object_in_equip(char_data * ch, char *name) { int j, n = 0, number; @@ -185,8 +206,14 @@ obj_data *get_object_in_equip(char_data * ch, char *name) return NULL; } -/* Handles 'held', 'light' and 'wield' positions - Welcor. After idea from - * Byron Ellacott. */ +/** Figures out if the argument is a valid location to 'wear' equipment. + * Handles 'held', 'light' and 'wield' positions - Welcor. After idea from + * Byron Ellacott. + * @param arg Either the name of the position, or the number of a wear + * location definition to check for. + * @retval int If arg is not a valid wear location name or number, return + * -1, else return the defined number of the wear location. + */ int find_eq_pos_script(char *arg) { int i; @@ -226,6 +253,11 @@ int find_eq_pos_script(char *arg) return (-1); } +/** Figures out if an object can be worn on a defined wear location. + * @param obj The object to check. + * @param pos The defined wear location to check. + * @retval int TRUE if obj can be worn on pos, FALSE if not. + */ int can_wear_on_pos(struct obj_data *obj, int pos) { switch (pos) { @@ -251,7 +283,11 @@ int can_wear_on_pos(struct obj_data *obj, int pos) } } -/* Search by number routines. Return char with UID n. */ +/** Search for an NPC or PC by number routines. + * @param n The unique ID (PC or NPC) to look for. + * @retval char_data * Pointer to the character structure if it exists, or NULL + * if it cannot be found. + */ struct char_data *find_char(long n) { if (n>=ROOM_ID_BASE) /* See note in dg_scripts.h */ @@ -260,8 +296,12 @@ struct char_data *find_char(long n) return find_char_by_uid_in_lookup_table(n); } -/* return object with UID n */ -obj_data *find_obj(long n) +/** Search for an object by number routines. + * @param n The unique ID to look for. + * @retval obj_data * Pointer to the object if it exists, or NULL if it cannot + * be found. + */ +static obj_data *find_obj(long n) { if (n < OBJ_ID_BASE) /* see note in dg_scripts.h */ return NULL; @@ -269,8 +309,12 @@ obj_data *find_obj(long n) return find_obj_by_uid_in_lookup_table(n); } -/* return room with UID n */ -room_data *find_room(long n) +/* Search for a room with UID n. + * @param n the Unique ID to look for. + * @retval room_data * Pointer to the room if it exists, or NULL if it cannot + * be found. + */ +static room_data *find_room(long n) { room_rnum rnum; @@ -286,7 +330,10 @@ room_data *find_room(long n) } /* Generic searches based only on name. */ -/* search the entire world for a char, and return a pointer */ +/** Search the entire world for an NPC or PC by name. + * @param name String describing the name or the unique id of the char. + * Note the unique id must be prefixed with UID_CHAR. + * @retval char_data * Pointer to the char or NULL if char is not found. */ char_data *get_char(char *name) { char_data *i; @@ -306,7 +353,15 @@ char_data *get_char(char *name) return NULL; } -/* Finds a char in the same room as the object with the name 'name.' */ +/** Find a character by name in the same room as a known object. + * @todo Should this function not be constrained to the same room as an object + * if 'name' is a unique id? + * @param obj An object that will constrain the search to the location that + * the object is in *if* the name argument is not a unique id. + * @param name Character name keyword to search for, or unique ID. Unique + * id must be prefixed with UID_CHAR. + * @retval char_data * Pointer to the the char if found, NULL if not. Will + * only find god characters if DG_ALLOW_GODS is on. */ char_data *get_char_near_obj(obj_data *obj, char *name) { char_data *ch; @@ -328,8 +383,15 @@ char_data *get_char_near_obj(obj_data *obj, char *name) return NULL; } -/* Returns a pointer to the first character in world by name name, or NULL if - * none found. Starts searching in room room first. */ +/** Find a character by name in a specific room. + * @todo Should this function not be constrained to the room + * if 'name' is a unique id? + * @param room A room that will constrain the search to that location + * *if* the name argument is not a unique id. + * @param name Character name keyword to search for, or unique ID. Unique + * id must be prefixed with UID_CHAR. + * @retval char_data * Pointer to the the char if found, NULL if not. Will + * only find god characters if DG_ALLOW_GODS is on. */ char_data *get_char_in_room(room_data *room, char *name) { char_data *ch; @@ -349,7 +411,13 @@ char_data *get_char_in_room(room_data *room, char *name) return NULL; } -/* searches the room with the object for an object with name 'name'*/ +/** Find a named object near another object (either in the same room, as + * a container or contained by). + * @param obj The obj with which to constrain the search. + * @param name The keyword of the object to search for. If 'self' or 'me' + * are passed in as arguments, obj is returned. Can also be a unique object + * id, and if so it must be prefixed with UID_CHAR. + * @retval obj_data * Pointer to the object if found, NULL if not. */ obj_data *get_obj_near_obj(obj_data *obj, char *name) { obj_data *i = NULL; @@ -635,7 +703,7 @@ void check_time_triggers(void) } } -EVENTFUNC(trig_wait_event) +static EVENTFUNC(trig_wait_event) { struct wait_event_data *wait_event_obj = (struct wait_event_data *)event_obj; trig_data *trig; @@ -684,7 +752,7 @@ EVENTFUNC(trig_wait_event) return 0; } -void do_stat_trigger(struct char_data *ch, trig_data *trig) +static void do_stat_trigger(struct char_data *ch, trig_data *trig) { struct cmdlist_element *cmd_list; char sb[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH]; @@ -749,7 +817,7 @@ void find_uid_name(char *uid, char *name, size_t nlen) } /* general function to display stats on script sc */ -void script_stat (char_data *ch, struct script_data *sc) +static void script_stat (char_data *ch, struct script_data *sc) { struct trig_var_data *tv; trig_data *t; @@ -1009,7 +1077,7 @@ ACMD(do_attach) * trigger, otherwise 1. If it matters, you might need to check to see if all * the triggers were removed after this function returns, in order to remove * the script. */ -int remove_trigger(struct script_data *sc, char *name) +static int remove_trigger(struct script_data *sc, char *name) { trig_data *i, *j; int num = 0, string = FALSE, n; @@ -1256,7 +1324,7 @@ void script_log(const char *format, ...) /* Returns 1 if string is all digits, else 0. Bugfixed - would have returned * true on num="------". */ -int is_num(char *arg) +static int is_num(char *arg) { if (*arg == '\0') return FALSE; @@ -1274,7 +1342,7 @@ int is_num(char *arg) } /* evaluates 'lhs op rhs', and copies to result */ -void eval_op(char *op, char *lhs, char *rhs, char *result, void *go, +static void eval_op(char *op, char *lhs, char *rhs, char *result, void *go, struct script_data *sc, trig_data *trig) { unsigned char *p; @@ -1389,7 +1457,7 @@ char *matching_quote(char *p) /* p points to the first paren. returns a pointer to the matching closing * paren, or the last non-null char in p. */ -char *matching_paren(char *p) +static char *matching_paren(char *p) { int i; @@ -1406,7 +1474,7 @@ char *matching_paren(char *p) } /* evaluates line, and returns answer in result */ -void eval_expr(char *line, char *result, void *go, struct script_data *sc, +static void eval_expr(char *line, char *result, void *go, struct script_data *sc, trig_data *trig, int type) { char expr[MAX_INPUT_LENGTH], *p; @@ -1429,7 +1497,7 @@ void eval_expr(char *line, char *result, void *go, struct script_data *sc, /* Evaluates expr if it is in the form lhs op rhs, and copies answer in result. * Returns 1 if expr is evaluated, else 0. */ -int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc, +static int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc, trig_data *trig, int type) { char *p, *tokens[MAX_INPUT_LENGTH]; @@ -1492,7 +1560,7 @@ int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc, } /* returns 1 if cond is true, else 0 */ -int process_if(char *cond, void *go, struct script_data *sc, +static int process_if(char *cond, void *go, struct script_data *sc, trig_data *trig, int type) { char result[MAX_INPUT_LENGTH], *p; @@ -1510,7 +1578,7 @@ int process_if(char *cond, void *go, struct script_data *sc, /* Scans for end of if-block. returns the line containg 'end', or the last * line of the trigger if not found. */ -struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl) +static struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl) { struct cmdlist_element *c; char *p; @@ -1542,7 +1610,7 @@ struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl) /* Searches for valid elseif, else, or end to continue execution at. Returns * line of elseif, else, or end if found, or last line of trigger. */ -struct cmdlist_element *find_else_end(trig_data *trig, +static struct cmdlist_element *find_else_end(trig_data *trig, struct cmdlist_element *cl, void *go, struct script_data *sc, int type) { struct cmdlist_element *c; @@ -1587,7 +1655,7 @@ struct cmdlist_element *find_else_end(trig_data *trig, } /* processes any 'wait' commands in a trigger */ -void process_wait(void *go, trig_data *trig, int type, char *cmd, +static void process_wait(void *go, trig_data *trig, int type, char *cmd, struct cmdlist_element *cl) { char buf[MAX_INPUT_LENGTH], *arg; @@ -1644,7 +1712,7 @@ void process_wait(void *go, trig_data *trig, int type, char *cmd, } /* processes a script set command */ -void process_set(struct script_data *sc, trig_data *trig, char *cmd) +static void process_set(struct script_data *sc, trig_data *trig, char *cmd) { char arg[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH], *value; @@ -1685,7 +1753,7 @@ void process_eval(void *go, struct script_data *sc, trig_data *trig, } /* script attaching a trigger to something */ -void process_attach(void *go, struct script_data *sc, trig_data *trig, +static void process_attach(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd) { char arg[MAX_INPUT_LENGTH], trignum_s[MAX_INPUT_LENGTH]; @@ -1767,7 +1835,7 @@ void process_attach(void *go, struct script_data *sc, trig_data *trig, } /* script detaching a trigger from something */ -void process_detach(void *go, struct script_data *sc, trig_data *trig, +static void process_detach(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd) { char arg[MAX_INPUT_LENGTH], trignum_s[MAX_INPUT_LENGTH]; @@ -1864,7 +1932,7 @@ struct room_data *dg_room_of_obj(struct obj_data *obj) } /* create a UID variable from the id number */ -void makeuid_var(void *go, struct script_data *sc, trig_data *trig, +static void makeuid_var(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd) { char junk[MAX_INPUT_LENGTH], varname[MAX_INPUT_LENGTH]; @@ -1963,7 +2031,7 @@ void makeuid_var(void *go, struct script_data *sc, trig_data *trig, /* Processes a script return command. Returns the new value for the script to * return. */ -int process_return(trig_data *trig, char *cmd) +static int process_return(trig_data *trig, char *cmd) { char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; @@ -1981,7 +2049,7 @@ int process_return(trig_data *trig, char *cmd) /* Removes a variable from the global vars of sc, or the local vars of trig if * not found in global list. */ -void process_unset(struct script_data *sc, trig_data *trig, char *cmd) +static void process_unset(struct script_data *sc, trig_data *trig, char *cmd) { char arg[MAX_INPUT_LENGTH], *var; @@ -2001,7 +2069,7 @@ void process_unset(struct script_data *sc, trig_data *trig, char *cmd) /* Copy a locally owned variable to the globals of another script. * 'remote ' */ -void process_remote(struct script_data *sc, trig_data *trig, char *cmd) +static void process_remote(struct script_data *sc, trig_data *trig, char *cmd) { struct trig_var_data *vd; struct script_data *sc_remote=NULL; @@ -2182,7 +2250,7 @@ int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_a /* Delete a variable from the globals of another script. * 'rdelete ' */ -void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd) +static void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd) { struct trig_var_data *vd, *vd_prev=NULL; struct script_data *sc_remote=NULL; @@ -2249,7 +2317,7 @@ void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd) } /* Makes a local variable into a global variable. */ -void process_global(struct script_data *sc, trig_data *trig, char *cmd, long id) +static void process_global(struct script_data *sc, trig_data *trig, char *cmd, long id) { struct trig_var_data *vd; char arg[MAX_INPUT_LENGTH], *var; @@ -2279,7 +2347,7 @@ void process_global(struct script_data *sc, trig_data *trig, char *cmd, long id) } /* set the current context for a script */ -void process_context(struct script_data *sc, trig_data *trig, char *cmd) +static void process_context(struct script_data *sc, trig_data *trig, char *cmd) { char arg[MAX_INPUT_LENGTH], *var; @@ -2296,7 +2364,7 @@ void process_context(struct script_data *sc, trig_data *trig, char *cmd) sc->context = atol(var); } -void extract_value(struct script_data *sc, trig_data *trig, char *cmd) +static void extract_value(struct script_data *sc, trig_data *trig, char *cmd) { char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH]; char *buf3; @@ -2331,7 +2399,7 @@ void extract_value(struct script_data *sc, trig_data *trig, char *cmd) * dg_letter var2 11 %string% * now %var1% == 7 and %var2% == g * Note that the index starts at 1. */ -void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd) +static void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd) { /* Set the letter/number at position 'num' as the variable. */ char junk[MAX_INPUT_LENGTH]; @@ -2667,7 +2735,7 @@ ACMD(do_tstat) /* Scans for a case/default instance. Returns the line containg the correct * case instance, or the last line of the trigger if not found. */ -struct cmdlist_element * +static struct cmdlist_element * find_case(struct trig_data *trig, struct cmdlist_element *cl, void *go, struct script_data *sc, int type, char *cond) { @@ -2704,7 +2772,7 @@ find_case(struct trig_data *trig, struct cmdlist_element *cl, /* Scans for end of while/switch-blocks. Returns the line containg 'end', or * the last line of the trigger if not found. Malformed scripts may cause NULL * to be returned. */ -struct cmdlist_element *find_done(struct cmdlist_element *cl) +static struct cmdlist_element *find_done(struct cmdlist_element *cl) { struct cmdlist_element *c; char *p; @@ -2724,23 +2792,6 @@ struct cmdlist_element *find_done(struct cmdlist_element *cl) return c; } -/* read a line in from a file, return the number of chars read */ -int fgetline(FILE *file, char *p) -{ - int count = 0; - - do { - *p = fgetc(file); - if (*p != '\n' && !feof(file)) { - p++; - count++; - } - } while (*p != '\n' && !feof(file)); - - if (*p == '\n') *p = '\0'; - - return count; -} /* load in a character's saved variables */ void read_saved_vars(struct char_data *ch) @@ -2916,7 +2967,7 @@ void init_lookup_table(void) } } -struct char_data *find_char_by_uid_in_lookup_table(long uid) +static struct char_data *find_char_by_uid_in_lookup_table(long uid) { int bucket = (int) (uid & (BUCKET_COUNT - 1)); struct lookup_table_t *lt = &lookup_table[bucket]; @@ -2930,7 +2981,7 @@ struct char_data *find_char_by_uid_in_lookup_table(long uid) return NULL; } -struct obj_data *find_obj_by_uid_in_lookup_table(long uid) +static struct obj_data *find_obj_by_uid_in_lookup_table(long uid) { int bucket = (int) (uid & (BUCKET_COUNT - 1)); struct lookup_table_t *lt = &lookup_table[bucket]; diff --git a/src/dg_scripts.h b/src/dg_scripts.h index 650287c..eb258fa 100644 --- a/src/dg_scripts.h +++ b/src/dg_scripts.h @@ -1,13 +1,21 @@ -/************************************************************************** -* File: dg_scripts.h Part of tbaMUD * -* * -* Usage: header file for script structures, constants, and function * -* prototypes for dg_scripts.c * -* * -* $Author: Mark A. Heilpern/egreen/Welcor $ * -* $Date: 2004/10/11 12:07:00$ * -* $Revision: 1.0.14 $ * -**************************************************************************/ +/** +* @file dg_scripts.h +* Header file for script structures, constants, and function prototypes for +* dg_scripts.c +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* was created by the following people: +* $Author: Mark A. Heilpern/egreen/Welcor $ +* $Date: 2004/10/11 12:07:00$ +* $Revision: 1.0.14 $ +*/ +#ifndef _DG_SCRIPTS_H_ +#define _DG_SCRIPTS_H_ + +#include "utils.h" /* To make sure ACMD is defined */ #define DG_SCRIPT_VERSION "DG Scripts 1.0.14" @@ -138,36 +146,36 @@ struct trig_var_data { struct trig_var_data *next; }; -/* structure for triggers */ +/** structure for triggers */ struct trig_data { - IDXTYPE nr; /* trigger's rnum */ - byte attach_type; /* mob/obj/wld intentions */ - byte data_type; /* type of game_data for trig */ - char *name; /* name of trigger */ - long trigger_type; /* type of trigger (for bitvector) */ - struct cmdlist_element *cmdlist; /* top of command list */ - struct cmdlist_element *curr_state; /* ptr to current line of trigger */ - int narg; /* numerical argument */ - char *arglist; /* argument list */ - int depth; /* depth into nest ifs/whiles/etc */ - int loops; /* loop iteration counter */ - struct event *wait_event; /* event to pause the trigger */ - ubyte purged; /* trigger is set to be purged */ - struct trig_var_data *var_list; /* list of local vars for trigger */ + IDXTYPE nr; /**< trigger's rnum */ + byte attach_type; /**< mob/obj/wld intentions */ + byte data_type; /**< type of game_data for trig */ + char *name; /**< name of trigger */ + long trigger_type; /**< type of trigger (for bitvector) */ + struct cmdlist_element *cmdlist; /**< top of command list */ + struct cmdlist_element *curr_state; /**< ptr to current line of trigger */ + int narg; /**< numerical argument */ + char *arglist; /**< argument list */ + int depth; /**< depth into nest ifs/whiles/etc */ + int loops; /**< loop iteration counter */ + struct event *wait_event; /**< event to pause the trigger */ + ubyte purged; /**< trigger is set to be purged */ + struct trig_var_data *var_list; /**< list of local vars for trigger */ struct trig_data *next; - struct trig_data *next_in_world; /* next in the global trigger list */ + struct trig_data *next_in_world; /**< next in the global trigger list */ }; -/* a complete script (composed of several triggers) */ +/** a complete script (composed of several triggers) */ struct script_data { - long types; /* bitvector of trigger types */ - struct trig_data *trig_list; /* list of triggers */ - struct trig_var_data *global_vars; /* list of global variables */ - ubyte purged; /* script is set to be purged */ - long context; /* current context for statics */ + long types; /**< bitvector of trigger types */ + struct trig_data *trig_list; /**< list of triggers */ + struct trig_var_data *global_vars; /**< list of global variables */ + ubyte purged; /**< script is set to be purged */ + long context; /**< current context for statics */ - struct script_data *next; /* used for purged_scripts */ + struct script_data *next; /**< used for purged_scripts */ }; /* The event data for the wait command */ @@ -177,6 +185,13 @@ struct wait_event_data { int type; }; +/* used for actor memory triggers */ +struct script_memory { + long id; /* id of who to remember */ + char *cmd; /* command, or NULL for generic */ + struct script_memory *next; +}; + /* typedefs that the dg functions rely on */ typedef struct index_data index_data; typedef struct room_data room_data; @@ -184,12 +199,6 @@ typedef struct obj_data obj_data; typedef struct trig_data trig_data; typedef struct char_data char_data; -/* used for actor memory triggers */ -struct script_memory { - long id; /* id of who to remember */ - char *cmd; /* command, or NULL for generic */ - struct script_memory *next; -}; /* function prototypes from dg_triggers.c */ char *one_phrase(char *arg, char *first_arg); @@ -254,6 +263,10 @@ void time_otrigger(obj_data *obj); void time_wtrigger(room_data *room); /* function prototypes from dg_scripts.c */ +ACMD(do_attach) ; +ACMD(do_detach); +ACMD(do_vdelete); +ACMD(do_tstat); char *str_str(char *cs, char *ct); int find_eq_pos_script(char *arg); int can_wear_on_pos(struct obj_data *obj, int pos); @@ -283,6 +296,10 @@ void script_vlog(const char *format, va_list args); void script_log(const char *format, ...) __attribute__ ((format (printf, 1, 2))); char *matching_quote(char *p); struct room_data *dg_room_of_obj(struct obj_data *obj); +bool check_flags_by_name_ar(int *array, int numflags, char *search, const char *namelist[]); +void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count); +void save_char_vars_ascii(FILE *file, struct char_data *ch); +int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg); /* To maintain strict-aliasing we'll have to do this trick with a union */ /* Thanks to Chris Gilbert for reminding me that there are other options. */ @@ -343,8 +360,41 @@ void send_char_pos(struct char_data *ch, int dam); int valid_dg_target(char_data *ch, int bitvector); void script_damage(char_data *vict, int dam); +/* from dg_mobcmd.c */ +ACMD(do_masound); +ACMD(do_mat); +ACMD(do_mdamage); +ACMD(do_mdoor); +ACMD(do_mecho); +ACMD(do_mechoaround); +ACMD(do_mfollow); +ACMD(do_mforce); +ACMD(do_mforget); +ACMD(do_mgoto); +ACMD(do_mhunt); +ACMD(do_mjunk); +ACMD(do_mkill); +ACMD(do_mload); +ACMD(do_mpurge); +ACMD(do_mrecho); +ACMD(do_mremember); +ACMD(do_msend); +ACMD(do_mteleport); +ACMD(do_mtransform); +ACMD(do_mzoneecho); + +/* from dg_olc.c... thinking these should be moved to oasis.h */ +void trigedit_save(struct descriptor_data *d); +void trigedit_string_cleanup(struct descriptor_data *d, int terminator); +int format_script(struct descriptor_data *d); +void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num); + /* from dg_objcmd.c */ room_rnum obj_room(obj_data *obj); +void obj_command_interpreter(obj_data *obj, char *argument); + +/* from dg_wldcmd.c */ +void wld_command_interpreter(room_data *room, char *argument); /* defines for valid_dg_target */ #define DG_ALLOW_GODS (1<<0) @@ -388,3 +438,4 @@ room_rnum obj_room(obj_data *obj); sprintf(buf, "%c%ld", UID_CHAR, GET_ID(go)); \ add_var(&GET_TRIG_VARS(trig), name, buf, context); } while (0) +#endif /* _DG_SCRIPTS_H_ */ diff --git a/src/dg_triggers.c b/src/dg_triggers.c index c46152b..1ac11a7 100644 --- a/src/dg_triggers.c +++ b/src/dg_triggers.c @@ -23,12 +23,8 @@ #include "db.h" #include "oasis.h" #include "constants.h" - -extern const char *cmd_door[]; -extern struct time_info_data time_info; - -/* external functions */ -const char *skill_name(int num); +#include "spells.h" /* for skill_name() */ +#include "act.h" /* for cmd_door[] */ /* General functions used by several triggers. */ diff --git a/src/dg_variables.c b/src/dg_variables.c index b9ba2da..89d592e 100644 --- a/src/dg_variables.c +++ b/src/dg_variables.c @@ -21,12 +21,8 @@ #include "constants.h" #include "spells.h" #include "oasis.h" +#include "class.h" -/* External variables and functions */ -extern const char *pc_class_types[]; -extern struct time_info_data time_info; -int find_eq_pos_script(char *arg); -bool check_flags_by_name_ar(int *array, int numflags, char *search, const char *namelist[]); /* Utility functions */ @@ -141,7 +137,7 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd, char tmpvar[MAX_STRING_LENGTH]; if (!str_cmp(field, "strlen")) { /* strlen */ - snprintf(str, slen, "%d", strlen(vd->value)); + snprintf(str, slen, "%d", (int)strlen(vd->value)); return TRUE; } else if (!str_cmp(field, "trim")) { /* trim */ /* trim whitespace from ends */ @@ -188,7 +184,6 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd, /* find the mud command returned from this text */ /* NOTE: you may need to replace "cmd_info" with "complete_cmd_info", */ /* depending on what patches you've got applied. */ - extern const struct command_info cmd_info[]; /* on older source bases: extern struct command_info *cmd_info; */ int length, cmd; for (length = strlen(vd->value), cmd = 0; @@ -851,9 +846,21 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, } snprintf(str, slen, "%d", GET_PRACTICES(c)); } + else if (!str_cmp(field, "pref")) { + if (subfield && *subfield) { + int pref = get_flag_by_name(preference_bits, subfield); + if (pref != NOFLAG && PRF_FLAGGED(c, pref)) + strcpy(str, "1"); + else + strcpy(str, "0"); + } else + strcpy(str, "0"); + } break; case 'q': - if (!str_cmp(field, "questpoints")) { + if (!str_cmp(field, "questpoints") || + !str_cmp(field, "qp") || !str_cmp(field, "qpnts")) + { if (subfield && *subfield) { int addition = atoi(subfield); GET_QUESTPOINTS(c) += addition; diff --git a/src/dg_wldcmd.c b/src/dg_wldcmd.c index 4f6889b..417718a 100644 --- a/src/dg_wldcmd.c +++ b/src/dg_wldcmd.c @@ -18,17 +18,25 @@ #include "handler.h" #include "db.h" #include "constants.h" +#include "genzon.h" /* for zone_rnum real_zone_by_thing */ +#include "fight.h" /* for die() */ -/* External functions. */ -void die(struct char_data * ch, struct char_data * killer); -zone_rnum real_zone_by_thing(room_vnum vznum); -bitvector_t asciiflag_conv(char *flag); - -/* Local functions. */ +/* Local functions, macros, defines and structs */ #define WCMD(name) \ void (name)(room_data *room, char *argument, int cmd, int subcmd) +/* for do_wsend */ +#define SCMD_WSEND 0 +#define SCMD_WECHOAROUND 1 + +struct wld_command_info { + char *command; + void (*command_pointer) + (room_data *room, char *argument, int cmd, int subcmd); + int subcmd; +}; + void wld_log(room_data *room, const char *format, ...); void act_to_room(char *str, room_data *room); WCMD(do_wasound); @@ -43,18 +51,8 @@ WCMD(do_wpurge); WCMD(do_wload); WCMD(do_wdamage); WCMD(do_wat); -void wld_command_interpreter(room_data *room, char *argument); -struct wld_command_info { - char *command; - void (*command_pointer) - (room_data *room, char *argument, int cmd, int subcmd); - int subcmd; -}; -/* do_wsend */ -#define SCMD_WSEND 0 -#define SCMD_WECHOAROUND 1 /* attaches room vnum to msg and sends it to script_log */ void wld_log(room_data *room, const char *format, ...) diff --git a/src/dox_noGraphs.doxyfile b/src/dox_noGraphs.doxyfile new file mode 100644 index 0000000..0956c04 --- /dev/null +++ b/src/dox_noGraphs.doxyfile @@ -0,0 +1,1294 @@ +# Doxyfile 1.5.3 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = tbaMUD + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 3.55 + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ../doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = YES + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be extracted +# and appear in the documentation as a namespace called 'anonymous_namespace{file}', +# where file will be replaced with the base name of the file that contains the anonymous +# namespace. By default anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST = YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH +# then you must also enable this option. If you don't then doxygen will produce +# a warning and turn it on anyway + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = YES + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = "ACMD(name)=void name (struct char_data *ch, char *argument, int cmd, int subcmd)" "WCMD(name)=void name (room_data *room, char *argument, int cmd, int subcmd)" "OCMD(name)=void name(obj_data *obj, char *argument, int cmd, int subcmd)" "SPECIAL(name)=int name(struct char_data *ch, void *me, int cmd, char *argument)" + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = NO + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = NO + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the number +# of direct children of the root node in a graph is already larger than +# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 3 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/src/dox_withGraphs.doxyfile b/src/dox_withGraphs.doxyfile new file mode 100644 index 0000000..40af116 --- /dev/null +++ b/src/dox_withGraphs.doxyfile @@ -0,0 +1,1294 @@ +# Doxyfile 1.5.3 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = tbaMUD + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 3.55 + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ../doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = YES + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be extracted +# and appear in the documentation as a namespace called 'anonymous_namespace{file}', +# where file will be replaced with the base name of the file that contains the anonymous +# namespace. By default anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST = YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH +# then you must also enable this option. If you don't then doxygen will produce +# a warning and turn it on anyway + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = YES + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = "ACMD(name)=void name (struct char_data *ch, char *argument, int cmd, int subcmd)" "WCMD(name)=void name (room_data *room, char *argument, int cmd, int subcmd)" "OCMD(name)=void name(obj_data *obj, char *argument, int cmd, int subcmd)" "SPECIAL(name)=int name(struct char_data *ch, void *me, int cmd, char *argument)" + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = NO + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = NO + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the number +# of direct children of the root node in a graph is already larger than +# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 3 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/src/fight.c b/src/fight.c index 1a8f929..6f1525b 100644 --- a/src/fight.c +++ b/src/fight.c @@ -8,6 +8,8 @@ * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * **************************************************************************/ +#define __FIGHT_C__ + #include "conf.h" #include "sysdep.h" #include "structs.h" @@ -20,65 +22,52 @@ #include "screen.h" #include "constants.h" #include "dg_scripts.h" +#include "act.h" +#include "class.h" +#include "fight.h" +#include "shop.h" +#include "quest.h" -/* Structures */ -struct char_data *combat_list = NULL; /* head of l-list of fighting chars */ -struct char_data *next_combat_list = NULL; - -/* External structures */ -extern struct message_list fight_messages[MAX_MESSAGES]; - -/* External procedures */ -char *fread_action(FILE *fl, int nr); -ACMD(do_flee); -ACMD(do_get); -ACMD(do_split); -ACMD(do_sac); -ACMD(do_assist); -int backstab_mult(int level); -int thaco(int ch_class, int level); -int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim); - -/* local functions */ -void perform_group_gain(struct char_data *ch, int base, struct char_data *victim); -void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type); -void appear(struct char_data *ch); -void load_messages(void); -void free_messages(void); -void free_messages_type(struct msg_type *msg); -void check_killer(struct char_data *ch, struct char_data *vict); -void make_corpse(struct char_data *ch); -void change_alignment(struct char_data *ch, struct char_data *victim); -void death_cry(struct char_data *ch); -void raw_kill(struct char_data * ch, struct char_data * killer); -void die(struct char_data * ch, struct char_data * killer); -void group_gain(struct char_data *ch, struct char_data *victim); -void solo_gain(struct char_data *ch, struct char_data *victim); -char *replace_string(const char *str, const char *weapon_singular, const char *weapon_plural); -void perform_violence(void); -int compute_armor_class(struct char_data *ch); -int compute_thaco(struct char_data *ch, struct char_data *vict); +/* locally defined global variables, used externally */ +/* head of l-list of fighting chars */ +struct char_data *combat_list = NULL; /* Weapon attack texts */ struct attack_hit_type attack_hit_text[] = { - {"hit", "hits"}, /* 0 */ + {"hit", "hits"}, /* 0 */ {"sting", "stings"}, {"whip", "whips"}, {"slash", "slashes"}, {"bite", "bites"}, - {"bludgeon", "bludgeons"}, /* 5 */ + {"bludgeon", "bludgeons"}, /* 5 */ {"crush", "crushes"}, {"pound", "pounds"}, {"claw", "claws"}, {"maul", "mauls"}, - {"thrash", "thrashes"}, /* 10 */ + {"thrash", "thrashes"}, /* 10 */ {"pierce", "pierces"}, {"blast", "blasts"}, {"punch", "punches"}, {"stab", "stabs"} }; +/* local (file scope only) variables */ +static struct char_data *next_combat_list = NULL; + +/* local file scope utility functions */ +static void perform_group_gain(struct char_data *ch, int base, struct char_data *victim); +static void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type); +static void free_messages_type(struct msg_type *msg); +static void make_corpse(struct char_data *ch); +static void change_alignment(struct char_data *ch, struct char_data *victim); +static void group_gain(struct char_data *ch, struct char_data *victim); +static void solo_gain(struct char_data *ch, struct char_data *victim); +/** @todo refactor this function name */ +static char *replace_string(const char *str, const char *weapon_singular, const char *weapon_plural); +static int compute_thaco(struct char_data *ch, struct char_data *vict); + + #define IS_WEAPON(type) (((type) >= TYPE_HIT) && ((type) < TYPE_SUFFERING)) /* The Fight related routines */ void appear(struct char_data *ch) @@ -106,7 +95,7 @@ int compute_armor_class(struct char_data *ch) return (MAX(-100, armorclass)); /* -100 is lowest */ } -void free_messages_type(struct msg_type *msg) +static void free_messages_type(struct msg_type *msg) { if (msg->attacker_msg) free(msg->attacker_msg); if (msg->victim_msg) free(msg->victim_msg); @@ -257,7 +246,7 @@ void stop_fighting(struct char_data *ch) update_pos(ch); } -void make_corpse(struct char_data *ch) +static void make_corpse(struct char_data *ch) { char buf2[MAX_NAME_LENGTH + 64]; struct obj_data *corpse, *o; @@ -328,7 +317,7 @@ void make_corpse(struct char_data *ch) } /* When ch kills victim */ -void change_alignment(struct char_data *ch, struct char_data *victim) +static void change_alignment(struct char_data *ch, struct char_data *victim) { /* new alignment change algorithm: if you kill a monster with alignment A, * you move 1/16th of the way to having alignment -A. Simple and fast. */ @@ -363,10 +352,18 @@ void raw_kill(struct char_data * ch, struct char_data * killer) } else death_cry(ch); + if (killer) + autoquest_trigger_check(killer, ch, NULL, AQ_MOB_KILL); + update_pos(ch); make_corpse(ch); extract_char(ch); + + if (killer) { + autoquest_trigger_check(killer, NULL, NULL, AQ_MOB_SAVE); + autoquest_trigger_check(killer, NULL, NULL, AQ_ROOM_CLEAR); + } } void die(struct char_data * ch, struct char_data * killer) @@ -379,7 +376,7 @@ void die(struct char_data * ch, struct char_data * killer) raw_kill(ch, killer); } -void perform_group_gain(struct char_data *ch, int base, +static void perform_group_gain(struct char_data *ch, int base, struct char_data *victim) { int share; @@ -395,7 +392,7 @@ void perform_group_gain(struct char_data *ch, int base, change_alignment(ch, victim); } -void group_gain(struct char_data *ch, struct char_data *victim) +static void group_gain(struct char_data *ch, struct char_data *victim) { int tot_members, base, tot_gain; struct char_data *k; @@ -433,7 +430,7 @@ void group_gain(struct char_data *ch, struct char_data *victim) perform_group_gain(f->follower, base, victim); } -void solo_gain(struct char_data *ch, struct char_data *victim) +static void solo_gain(struct char_data *ch, struct char_data *victim) { int exp; @@ -456,7 +453,7 @@ void solo_gain(struct char_data *ch, struct char_data *victim) change_alignment(ch, victim); } -char *replace_string(const char *str, const char *weapon_singular, const char *weapon_plural) +static char *replace_string(const char *str, const char *weapon_singular, const char *weapon_plural) { static char buf[256]; char *cp = buf; @@ -484,7 +481,7 @@ char *replace_string(const char *str, const char *weapon_singular, const char *w } /* message for doing damage with a weapon */ -void dam_message(int dam, struct char_data *ch, struct char_data *victim, +static void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type) { char *buf; @@ -856,7 +853,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty /* Calculate the THAC0 of the attacker. 'victim' currently isn't used but you * could use it for special cases like weapons that hit evil creatures easier * or a weapon that always misses attacking an animal. */ -int compute_thaco(struct char_data *ch, struct char_data *victim) +static int compute_thaco(struct char_data *ch, struct char_data *victim) { int calc_thaco; diff --git a/src/genmob.c b/src/genmob.c index 98308b0..ea8ecd3 100644 --- a/src/genmob.c +++ b/src/genmob.c @@ -18,7 +18,7 @@ #include "dg_olc.h" /* local functions */ -void extract_mobile_all(mob_vnum vnum); +static void extract_mobile_all(mob_vnum vnum); int add_mobile(struct char_data *mob, mob_vnum vnum) { @@ -98,7 +98,7 @@ int copy_mobile(struct char_data *to, struct char_data *from) return TRUE; } -void extract_mobile_all(mob_vnum vnum) +static void extract_mobile_all(mob_vnum vnum) { struct char_data *next, *ch; diff --git a/src/genmob.h b/src/genmob.h index 15b36dc..50bc717 100644 --- a/src/genmob.h +++ b/src/genmob.h @@ -1,10 +1,16 @@ -/************************************************************************** -* File: genmob.h Part of tbaMUD * -* * -* Usage: Generic OLC Library - Mobiles. * -* * -* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. * -**************************************************************************/ +/** +* @file genmob.h +* Generic OLC Library - Mobiles. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* is attributed to: +* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +*/ +#ifndef _GENMOB_H_ +#define _GENMOB_H_ int delete_mobile(mob_rnum); int copy_mobile(struct char_data *to, struct char_data *from); @@ -32,3 +38,5 @@ int write_mobile_mobprog(mob_vnum mvnum, struct char_data *mob, FILE *fd); #define GET_LDESC(mob) ((mob)->player.long_descr) #define GET_DDESC(mob) ((mob)->player.description) #define GET_ATTACK(mob) ((mob)->mob_specials.attack_type) + +#endif /* _GENMOB_H_ */ diff --git a/src/genobj.c b/src/genobj.c index 11327be..9c22a54 100644 --- a/src/genobj.c +++ b/src/genobj.c @@ -17,14 +17,12 @@ #include "genzon.h" #include "dg_olc.h" #include "handler.h" +#include "boards.h" /* for board_info */ -/* extern functions */ -extern struct board_info_type board_info[]; /* local functions */ -void free_object_strings_proto(struct obj_data *obj); -int update_all_objects(struct obj_data *obj); -void copy_object_strings(struct obj_data *to, struct obj_data *from); +static int update_all_objects(struct obj_data *obj); +static void copy_object_strings(struct obj_data *to, struct obj_data *from); obj_rnum add_object(struct obj_data *newobj, obj_vnum ovnum) { @@ -49,7 +47,7 @@ obj_rnum add_object(struct obj_data *newobj, obj_vnum ovnum) * and every object currently in the game to see which ones are pointing to * this prototype. If object is pointing to this prototype, then we need to * replace it with the new one. */ -int update_all_objects(struct obj_data *refobj) +static int update_all_objects(struct obj_data *refobj) { struct obj_data *obj, swap; int count = 0; @@ -341,7 +339,7 @@ void free_object_strings_proto(struct obj_data *obj) } } -void copy_object_strings(struct obj_data *to, struct obj_data *from) +static void copy_object_strings(struct obj_data *to, struct obj_data *from) { to->name = from->name ? strdup(from->name) : NULL; to->description = from->description ? strdup(from->description) : NULL; diff --git a/src/genobj.h b/src/genobj.h index 6ec9713..991ed21 100644 --- a/src/genobj.h +++ b/src/genobj.h @@ -1,11 +1,18 @@ -/************************************************************************** -* File: genobj.h Part of tbaMUD * -* * -* Usage: Generic OLC Library - Objects. * -* * -* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. * -**************************************************************************/ +/** +* @file genobj.h +* Generic OLC Library - Objects. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* is attributed to: +* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +*/ +#ifndef _GENOBJ_H_ +#define _GENOBJ_H_ +void free_object_strings_proto(struct obj_data *obj); void free_object_strings(struct obj_data *obj); int copy_object(struct obj_data *to, struct obj_data *from); int copy_object_preserve(struct obj_data *to, struct obj_data *from); @@ -13,8 +20,8 @@ int save_objects(zone_rnum vznum); obj_rnum insert_object(struct obj_data *obj, obj_vnum ovnum); obj_rnum adjust_objects(obj_rnum refpt); obj_rnum index_object(struct obj_data *obj, obj_vnum ovnum, obj_rnum ornum); -int update_objects(struct obj_data *refobj); obj_rnum add_object(struct obj_data *, obj_vnum ovnum); int copy_object_main(struct obj_data *to, struct obj_data *from, int free_object); int delete_object(obj_rnum); +#endif /* _GENOBJ_H_ */ diff --git a/src/genolc.c b/src/genolc.c index 51ab9e0..70b20f1 100644 --- a/src/genolc.c +++ b/src/genolc.c @@ -25,14 +25,17 @@ #include "dg_olc.h" #include "constants.h" #include "interpreter.h" +#include "act.h" /* for the space_to_minus function */ +#include "modify.h" /* for smash_tilde */ +#include "quest.h" -int save_config( IDXTYPE nowhere ); /* Exported from cedit.c */ - +/* Global variables defined here, used elsewhere */ /* List of zones to be saved. */ struct save_list_data *save_list; +/* Local (file scope) variables */ /* Structure defining all known save types. */ -struct { +static struct { int save_type; int (*func)(IDXTYPE rnum); const char *message; @@ -43,10 +46,26 @@ struct { { SL_WLD, save_rooms, "room" }, { SL_ZON, save_zone, "zone" }, { SL_CFG, save_config, "config" }, + { SL_QST, save_quests, "quest" }, { SL_ACT, NULL, "social" }, { SL_HLP, NULL, "help" }, { -1, NULL, NULL }, }; +/* for Zone Export */ +static int zone_exits = 0; + +/* Local (file scope) functions */ +/* Zone export functions */ +static int export_save_shops(zone_rnum zrnum); +static int export_save_mobiles(zone_rnum rznum); +static int export_save_zone(zone_rnum zrnum); +static int export_save_objects(zone_rnum zrnum); +static int export_save_rooms(zone_rnum zrnum); +static int export_save_triggers(zone_rnum zrnum); +static int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd); +static void export_script_save_to_disk(FILE *fp, void *item, int type); +static int export_info_file(zone_rnum zrnum); + int genolc_checkstring(struct descriptor_data *d, char *arg) { @@ -59,6 +78,20 @@ char *str_udup(const char *txt) return strdup((txt && *txt) ? txt : "undefined"); } +char *str_udupnl(const char *txt) +{ + char *str = NULL, undef[] = "undefined"; + const char *ptr = NULL; + + ptr = (txt && *txt) ? txt : undef; + CREATE(str, char, strlen(ptr) + 3); + + strlcpy(str, ptr, strlen(ptr)); + strcat(str, "\r\n"); + + return str; +} + /* Original use: to be called at shutdown time. */ int save_all(void) { @@ -244,67 +277,109 @@ int sprintascii(char *out, bitvector_t bits) return j; } -/* Zone export functions */ -int export_save_shops(zone_rnum zrnum); -int export_save_mobiles(zone_rnum rznum); -int export_save_zone(zone_rnum zrnum); -int export_save_objects(zone_rnum zrnum); -int export_save_rooms(zone_rnum zrnum); -int export_save_triggers(zone_rnum zrnum); -int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd); -void export_script_save_to_disk(FILE *fp, void *item, int type); -int export_info_file(zone_rnum zrnum); -static int zone_exits = 0; -ACMD(do_export_zone); - -ACMD(do_export_zone) -{ - zone_rnum zrnum; - zone_vnum zvnum; - char sysbuf[MAX_INPUT_LENGTH]; - char fn[MAX_INPUT_LENGTH], *f; - void space_to_minus(char *str); - - if (IS_NPC(ch) || GET_LEVEL(ch) < LVL_IMPL) - return; - - skip_spaces(&argument); - zvnum = atoi(argument); - zrnum = real_zone(zvnum); - - if (zrnum == NOWHERE) { - send_to_char(ch, "Export which zone?\r\n"); - return; - } - - if (!export_info_file(zrnum)) - send_to_char(ch, "Info file not saved!\r\n"); - if (!export_save_shops(zrnum)) - send_to_char(ch, "Shops not saved!\r\n"); - if (!export_save_mobiles(zrnum)) - send_to_char(ch, "Mobiles not saved!\r\n"); - if (!export_save_objects(zrnum)) - send_to_char(ch, "Objects not saved!\r\n"); - if (!export_save_zone(zrnum)) - send_to_char(ch, "Zone info not saved!\r\n"); - if (!export_save_rooms(zrnum)) - send_to_char(ch, "Rooms not saved!\r\n"); - if (!export_save_triggers(zrnum)) - send_to_char(ch, "Triggers not saved!\r\n"); - - send_to_char(ch, "Files saved to /lib/world/export.\r\n"); - snprintf(fn, sizeof(fn), "%d_%s.tgz", zvnum, zone_table[zrnum].name); - f = fn; - space_to_minus(f); - snprintf(sysbuf, sizeof(sysbuf), - LIB_ETC "export_script.sh %s &", - fn); - system(sysbuf); - send_to_char(ch, "Files tar'ed to \"%s\"\r\n", fn); - +/* converts illegal filename chars into appropriate equivalents */ +char *fix_filename(char *str) +{ + static char good_file_name[MAX_STRING_LENGTH]; + char *index = good_file_name; + + while(*str) { + switch(*str) { + case ' ': *index = '_'; index++; break; + case '(': *index = '{'; index++; break; + case ')': *index = '}'; index++; break; + + /* skip the following */ + case '\'': break; + case '"': break; + + /* Legal character */ + default: *index = *str; index++;break; + } + str++; + } + *index = '\0'; + + return good_file_name; } -int export_info_file(zone_rnum zrnum) +/* Export command by Kyle */ +ACMD(do_export_zone) +{ + zone_rnum zrnum; + zone_vnum zvnum; + char sysbuf[MAX_INPUT_LENGTH]; + char zone_name[MAX_INPUT_LENGTH], *f; + int success; + + /* system command locations are relative to + * where the binary IS, not where it was run + * from, thus we act like we are in the bin + * folder, because we are*/ + char *path = "../lib/world/export/"; + + if (IS_NPC(ch) || GET_LEVEL(ch) < LVL_IMPL) + return; + + skip_spaces(&argument); + zvnum = atoi(argument); + zrnum = real_zone(zvnum); + + if (zrnum == NOWHERE) { + send_to_char(ch, "Export which zone?\r\n"); + return; + } + + /* If we fail, it might just be because the + * directory didn't exist. Can't hurt to try + * again. Do it silently though ( no logs ). */ + if (!export_info_file(zrnum)) { + sprintf(sysbuf, "mkdir %s", path); + system(sysbuf); + } + + if (!(success = export_info_file(zrnum))) + send_to_char(ch, "Info file not saved!\r\n"); + if (!(success = export_save_shops(zrnum))) + send_to_char(ch, "Shops not saved!\r\n"); + if (!(success = export_save_mobiles(zrnum))) + send_to_char(ch, "Mobiles not saved!\r\n"); + if (!(success = export_save_objects(zrnum))) + send_to_char(ch, "Objects not saved!\r\n"); + if (!(success = export_save_zone(zrnum))) + send_to_char(ch, "Zone info not saved!\r\n"); + if (!(success = export_save_rooms(zrnum))) + send_to_char(ch, "Rooms not saved!\r\n"); + if (!(success = export_save_triggers(zrnum))) + send_to_char(ch, "Triggers not saved!\r\n"); + + /* If anything went wrong, don't try to tar the files. */ + if (success) { + send_to_char(ch, "Individual files saved to /lib/world/export.\r\n"); + snprintf(zone_name, sizeof(zone_name), "%s", zone_table[zrnum].name); + } else { + send_to_char(ch, "Ran into problems writing to files.\r\n"); + return; + } + /* Make sure the name of the zone doesn't make the filename illegal. */ + f = fix_filename(zone_name); + + /* Remove the old copy. */ + sprintf(sysbuf, "rm %s%s.tar.gz", path, f); + system(sysbuf); + + /* Tar the new copy. */ + sprintf(sysbuf, "tar -cf %s%s.tar %sqq.info %sqq.wld %sqq.zon %sqq.mob %sqq.obj %sqq.trg", path, f, path, path, path, path, path, path); + system(sysbuf); + + /* Gzip it. */ + sprintf(sysbuf, "gzip %s%s.tar", path, f); + system(sysbuf); + + send_to_char(ch, "Files tar'ed to \"%s%s.tar.gz\"\r\n", path, f); +} + +static int export_info_file(zone_rnum zrnum) { int i; FILE *info_file; @@ -312,7 +387,7 @@ int export_info_file(zone_rnum zrnum) if (!(info_file = fopen("world/export/qq.info", "w"))) { mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_info_file : Cannot open file!"); return FALSE; - } else if (fprintf(info_file, "CircleMUD v3.1 Area file.\n") < 0) { + } else if (fprintf(info_file, "tbaMUD Area file.\n") < 0) { mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_info_file: Cannot write to file!"); fclose(info_file); return FALSE; @@ -357,26 +432,26 @@ int export_info_file(zone_rnum zrnum) zone_exits = 0; } else { fprintf(info_file, "2. This area doesn't have any exits _out_ of the zone.\n"); - fprintf(info_file, " More info on connections in the zone description room.\n"); + fprintf(info_file, " More info on connections can be found in the zone description room (QQ00).\n"); } fprintf(info_file, "\nAdditional zone information is available in the zone description room QQ00.\n"); fprintf(info_file, "The Builder's Academy is maintaining and improving these zones. Any typo or\n"); - fprintf(info_file, "bug reports should be reported to rumble@builderacademy.net or stop by The Builder Academy\n"); - fprintf(info_file, "port telnet://builderacademy.net:9091\n"); + fprintf(info_file, "bug reports should be reported to rumble@tbamud.com or stop by The Builder Academy\n"); + fprintf(info_file, "port telnet://tbamud.com:9091\n"); fprintf(info_file, "\nAnyone interested in submitting areas or helping improve the existing ones\n"); fprintf(info_file, "please stop by TBA and talk to Rumble.\n\n"); fprintf(info_file, "We at The Builder's Academy hope you will enjoy using the area.\n\n"); fprintf(info_file, "Rumble - Admin of TBA\n"); fprintf(info_file, "Welcor - Coder of TBA\n"); - fprintf(info_file, "\ntelnet://builderacademy.net:9091/\n"); + fprintf(info_file, "\ntelnet://tbamud.com:9091/\n"); fclose(info_file); return TRUE; } -int export_save_shops(zone_rnum zrnum) +static int export_save_shops(zone_rnum zrnum) { int i, j, rshop; FILE *shop_file; @@ -466,7 +541,7 @@ int export_save_shops(zone_rnum zrnum) return TRUE; } -int export_save_mobiles(zone_rnum rznum) +static int export_save_mobiles(zone_rnum rznum) { FILE *mob_file; mob_vnum i; @@ -490,7 +565,7 @@ int export_save_mobiles(zone_rnum rznum) return TRUE; } -int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd) +static int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd) { char ldesc[MAX_STRING_LENGTH]; @@ -538,7 +613,7 @@ int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd) return TRUE; } -int export_save_zone(zone_rnum zrnum) +static int export_save_zone(zone_rnum zrnum) { int subcmd; FILE *zone_file; @@ -665,7 +740,7 @@ int export_save_zone(zone_rnum zrnum) return TRUE; } -int export_save_objects(zone_rnum zrnum) +static int export_save_objects(zone_rnum zrnum) { char buf[MAX_STRING_LENGTH]; char ebuf1[MAX_STRING_LENGTH], ebuf2[MAX_STRING_LENGTH], ebuf3[MAX_STRING_LENGTH], ebuf4[MAX_STRING_LENGTH]; @@ -776,7 +851,7 @@ int export_save_objects(zone_rnum zrnum) return TRUE; } -int export_save_rooms(zone_rnum zrnum) +static int export_save_rooms(zone_rnum zrnum) { int i; struct room_data *room; @@ -891,7 +966,7 @@ int export_save_rooms(zone_rnum zrnum) return TRUE; } -void export_script_save_to_disk(FILE *fp, void *item, int type) +static void export_script_save_to_disk(FILE *fp, void *item, int type) { struct trig_proto_list *t; @@ -914,7 +989,7 @@ void export_script_save_to_disk(FILE *fp, void *item, int type) } /* save the zone's triggers to internal memory and to disk */ -int export_save_triggers(zone_rnum zrnum) +static int export_save_triggers(zone_rnum zrnum) { int i; trig_data *trig; diff --git a/src/genolc.h b/src/genolc.h index b23fb29..efc075a 100644 --- a/src/genolc.h +++ b/src/genolc.h @@ -1,15 +1,20 @@ -/************************************************************************** -* File: genolc.h Part of tbaMUD * -* * -* Usage: Generic OLC Library - General. * -* * -* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. * -**************************************************************************/ +/** +* @file genolc.h +* Generic OLC Library - General. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* is attributed to: +* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +*/ +#ifndef _GENOLC_H_ +#define _GENOLC_H_ #define STRING_TERMINATOR '~' #define CONFIG_GENOLC_MOBPROG 0 -void smash_tilde(char *str); /* from modify.c */ int genolc_checkstring(struct descriptor_data *d, char *arg); int remove_from_save_list(zone_vnum, int type); int add_to_save_list(zone_vnum, int type); @@ -17,9 +22,12 @@ int in_save_list(zone_vnum, int type); void strip_cr(char *); int save_all(void); char *str_udup(const char *); +char *str_udupnl(const char *); void copy_ex_descriptions(struct extra_descr_data **to, struct extra_descr_data *from); void free_ex_descriptions(struct extra_descr_data *head); int sprintascii(char *out, bitvector_t bits); +ACMD(do_export_zone); +ACMD(do_show_save_list); struct save_list_data { int zone; @@ -36,7 +44,8 @@ extern struct save_list_data *save_list; #define SL_WLD 3 #define SL_ZON 4 #define SL_CFG 5 -#define SL_MAX 5 +#define SL_QST 6 +#define SL_MAX 6 #define SL_ACT SL_MAX + 1 /* must be above MAX */ #define SL_HLP SL_MAX + 2 @@ -46,4 +55,6 @@ extern struct save_list_data *save_list; room_vnum genolc_zone_bottom(zone_rnum rznum); room_vnum genolc_zonep_bottom(struct zone_data *zone); +extern void free_save_list(void); +#endif /* _GENOLC_H_ */ diff --git a/src/genshp.c b/src/genshp.c index 88faaf7..ed1cbcf 100644 --- a/src/genshp.c +++ b/src/genshp.c @@ -18,11 +18,11 @@ /* NOTE (gg): Didn't modify sedit much. Don't consider it as 'recent' as the * other editors with regard to updates or style. */ -/* local functions */ -void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist); -void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *flist); -void free_shop_strings(struct shop_data *shop); -void free_shop_type_list(struct shop_buy_data **list); +/* local (file scope) functions */ +static void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist); +static void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *flist); +static void free_shop_strings(struct shop_data *shop); +static void free_shop_type_list(struct shop_buy_data **list); void copy_shop(struct shop_data *tshop, struct shop_data *fshop, int free_old_strings) { @@ -61,7 +61,7 @@ void copy_shop(struct shop_data *tshop, struct shop_data *fshop, int free_old_st } /* Copy a 'NOTHING' terminated integer array list. */ -void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist) +static void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist) { int num_items, i; @@ -81,7 +81,7 @@ void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist) } /* Copy a -1 terminated (in the type field) shop_buy_data array list. */ -void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *flist) +static void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *flist) { int num_items, i; @@ -193,7 +193,7 @@ void remove_shop_from_int_list(IDXTYPE **list, IDXTYPE num) } /* Free all the notice character strings in a shop structure. */ -void free_shop_strings(struct shop_data *shop) +static void free_shop_strings(struct shop_data *shop) { if (S_NOITEM1(shop)) { free(S_NOITEM1(shop)); @@ -226,7 +226,7 @@ void free_shop_strings(struct shop_data *shop) } /* Free a type list and all the strings it contains. */ -void free_shop_type_list(struct shop_buy_data **list) +static void free_shop_type_list(struct shop_buy_data **list) { int i; @@ -343,7 +343,7 @@ int add_shop(struct shop_data *nshp) int save_shops(zone_rnum zone_num) { - int i, j, rshop; + int i, j, rshop, num_shops = 0; FILE *shop_file; char fname[128], oldname[128]; struct shop_data *shop; @@ -423,7 +423,8 @@ int save_shops(zone_rnum zone_num) /* Save open/closing times. */ fprintf(shop_file, "%d\n%d\n%d\n%d\n", S_OPEN1(shop), S_CLOSE1(shop), - S_OPEN2(shop), S_CLOSE2(shop)); + S_OPEN2(shop), S_CLOSE2(shop)); + num_shops++; } } fprintf(shop_file, "$~\n"); @@ -431,6 +432,9 @@ int save_shops(zone_rnum zone_num) snprintf(oldname, sizeof(oldname), "%s/%d.shp", SHP_PREFIX, zone_table[zone_num].number); remove(oldname); rename(fname, oldname); + + if (num_shops > 0) + create_world_index(zone_table[zone_num].number, "shp"); if (in_save_list(zone_table[zone_num].number, SL_SHP)) remove_from_save_list(zone_table[zone_num].number, SL_SHP); diff --git a/src/genshp.h b/src/genshp.h index 85f4683..1f36132 100644 --- a/src/genshp.h +++ b/src/genshp.h @@ -1,10 +1,16 @@ -/************************************************************************** -* File: genshp.h Part of tbaMUD * -* * -* Usage: Generic OLC Library - Shops. * -* * -* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. * -**************************************************************************/ +/** +* @file genshp.h +* Generic OLC Library - Shops. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* is attributed to: +* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +*/ +#ifndef _GENSHP_H_ +#define _GENSHP_H_ void copy_shop(struct shop_data *tshop, struct shop_data *fshop, int free_old_strings); void remove_shop_from_type_list(struct shop_buy_data **list, int num); @@ -49,3 +55,5 @@ shop_rnum real_shop(shop_vnum vnum); #define S_NOBUY(i) ((i)->do_not_buy) #define S_BUY(i) ((i)->message_buy) #define S_SELL(i) ((i)->message_sell) + +#endif /* _GENSHP_H_ */ diff --git a/src/genwld.c b/src/genwld.c index a53b99f..1ba7eeb 100644 --- a/src/genwld.c +++ b/src/genwld.c @@ -18,9 +18,6 @@ #include "shop.h" #include "dg_olc.h" -extern room_rnum r_mortal_start_room; -extern room_rnum r_immort_start_room; -extern room_rnum r_frozen_start_room; /* This function will copy the strings so be sure you free your own copies of * the description, title, and such. */ diff --git a/src/genwld.h b/src/genwld.h index f2c24a8..923ad64 100644 --- a/src/genwld.h +++ b/src/genwld.h @@ -1,10 +1,16 @@ -/************************************************************************** -* File: genwld.h Part of tbaMUD * -* * -* Usage: Generic OLC Library - Rooms. * -* * -* By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. * -**************************************************************************/ +/** +* @file genwld.h +* Generic OLC Library - Rooms. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* is attributed to: +* By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +*/ +#ifndef _GENWLD_H_ +#define _GENWLD_H_ room_rnum add_room(struct room_data *); int delete_room(room_rnum); @@ -13,3 +19,5 @@ int copy_room(struct room_data *to, struct room_data *from); room_rnum duplicate_room(room_vnum to, room_rnum from); int copy_room_strings(struct room_data *dest, struct room_data *source); int free_room_strings(struct room_data *); + +#endif /* _GENWLD_H_ */ diff --git a/src/genzon.c b/src/genzon.c index cdf7629..6eb51b2 100644 --- a/src/genzon.c +++ b/src/genzon.c @@ -15,8 +15,7 @@ #include "dg_scripts.h" /* local functions */ -void create_world_index(int znum, const char *type); -void remove_cmd_from_list(struct reset_com **list, int pos); +static void remove_cmd_from_list(struct reset_com **list, int pos); /* real zone of room/mobile/object/shop given */ zone_rnum real_zone_by_thing(room_vnum vznum) @@ -124,6 +123,16 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, fprintf(fp, "$~\n"); fclose(fp); + /* Create the quests file */ + snprintf(buf, sizeof(buf), "%s/%d.qst", QST_PREFIX, vzone_num); + if (!(fp = fopen(buf, "w"))) { + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new quest file"); + *error = "Could not write quest file.\r\n"; + return NOWHERE; + } + fprintf(fp, "$~\n"); + fclose(fp); + /* Create the trigger file. */ snprintf(buf, sizeof(buf), "%s/%d.trg", TRG_PREFIX, vzone_num); if (!(fp = fopen(buf, "w"))) { @@ -212,6 +221,9 @@ void create_world_index(int znum, const char *type) case 't': prefix = TRG_PREFIX; break; + case 'q': + prefix = QST_PREFIX; + break; default: /* Caller messed up. */ return; @@ -242,6 +254,12 @@ void create_world_index(int znum, const char *type) if (num > znum) { found = TRUE; fprintf(newfile, "%s\n", buf1); + } else if (num == znum) { + /* index file already had an entry for this zone. */ + fclose(oldfile); + fclose(newfile); + remove(new_name); + return; } } fprintf(newfile, "%s\n", buf); @@ -456,7 +474,7 @@ void add_cmd_to_list(struct reset_com **list, struct reset_com *newcmd, int pos) /* Remove a reset command from a list. Takes a pointer to the list so that it * may play with the memory locations. */ -void remove_cmd_from_list(struct reset_com **list, int pos) +static void remove_cmd_from_list(struct reset_com **list, int pos) { int count, i, l; struct reset_com *newlist; diff --git a/src/genzon.h b/src/genzon.h index 32346c2..01b57f5 100644 --- a/src/genzon.h +++ b/src/genzon.h @@ -1,10 +1,16 @@ -/************************************************************************** -* File: genzon.h Part of tbaMUD * -* * -* Usage: Generic OLC Library - Zones. * -* * -* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. * -**************************************************************************/ +/** +* @file genzon.h +* Generic OLC Library - Zones. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* is attributed to: +* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +*/ +#ifndef _GENZON_H_ +#define _GENZON_H_ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, const char **error); void remove_room_zone_commands(zone_rnum zone, room_rnum room_num); @@ -14,4 +20,6 @@ void add_cmd_to_list(struct reset_com **list, struct reset_com *newcmd, int pos) int new_command(struct zone_data *zone, int pos); void delete_zone_command(struct zone_data *zone, int pos); zone_rnum real_zone_by_thing(room_vnum vznum); +void create_world_index(int znum, const char *type); +#endif /* _GENZON_H_ */ diff --git a/src/graph.c b/src/graph.c index 400abd1..00a129e 100644 --- a/src/graph.c +++ b/src/graph.c @@ -17,21 +17,17 @@ #include "handler.h" #include "db.h" #include "spells.h" - -/* external functions */ -ACMD(do_say); - -/* external variables */ -extern const char *dirs[]; +#include "act.h" /* for the do_say command */ +#include "constants.h" +#include "graph.h" +#include "fight.h" /* local functions */ -int VALID_EDGE(room_rnum x, int y); -void bfs_enqueue(room_rnum room, int dir); -void bfs_dequeue(void); -void bfs_clear_queue(void); -int find_first_step(room_rnum src, room_rnum target); -ACMD(do_track); -void hunt_victim(struct char_data *ch); +static int VALID_EDGE(room_rnum x, int y); +static void bfs_enqueue(room_rnum room, int dir); +static void bfs_dequeue(void); +static void bfs_clear_queue(void); +static int find_first_step(room_rnum src, room_rnum target); struct bfs_queue_struct { room_rnum room; @@ -48,7 +44,7 @@ static struct bfs_queue_struct *queue_head = 0, *queue_tail = 0; #define TOROOM(x, y) (world[(x)].dir_option[(y)]->to_room) #define IS_CLOSED(x, y) (EXIT_FLAGGED(world[(x)].dir_option[(y)], EX_CLOSED)) -int VALID_EDGE(room_rnum x, int y) +static int VALID_EDGE(room_rnum x, int y) { if (world[x].dir_option[y] == NULL || TOROOM(x, y) == NOWHERE) return 0; @@ -60,7 +56,7 @@ int VALID_EDGE(room_rnum x, int y) return 1; } -void bfs_enqueue(room_rnum room, int dir) +static void bfs_enqueue(room_rnum room, int dir) { struct bfs_queue_struct *curr; @@ -76,7 +72,7 @@ void bfs_enqueue(room_rnum room, int dir) queue_head = queue_tail = curr; } -void bfs_dequeue(void) +static void bfs_dequeue(void) { struct bfs_queue_struct *curr; @@ -87,7 +83,7 @@ void bfs_dequeue(void) free(curr); } -void bfs_clear_queue(void) +static void bfs_clear_queue(void) { while (queue_head) bfs_dequeue(); @@ -97,7 +93,7 @@ void bfs_clear_queue(void) * on the shortest path from the source to the target. Intended usage: in * mobile_activity, give a mob a dir to go if they're tracking another mob or a * PC. Or, a 'track' skill for PCs. */ -int find_first_step(room_rnum src, room_rnum target) +static int find_first_step(room_rnum src, room_rnum target) { int curr_dir; room_rnum curr_room; diff --git a/src/handler.c b/src/handler.c index 278c6f5..442fe24 100644 --- a/src/handler.c +++ b/src/handler.c @@ -18,23 +18,19 @@ #include "interpreter.h" #include "spells.h" #include "dg_scripts.h" +#include "act.h" +#include "class.h" +#include "fight.h" +#include "quest.h" -/* local vars */ -int extractions_pending = 0; +/* local file scope variables */ +static int extractions_pending = 0; -/* external vars */ -extern struct char_data *combat_list; +/* local file scope functions */ +static int apply_ac(struct char_data *ch, int eq_pos); +static void update_object(struct obj_data *obj, int use); +static void affect_modify(struct char_data *ch, byte loc, sbyte mod, long bitv, bool add); -/* local functions */ -int apply_ac(struct char_data *ch, int eq_pos); -void update_object(struct obj_data *obj, int use); -void update_char_objects(struct char_data *ch); -void affect_modify(struct char_data *ch, byte loc, sbyte mod, long bitv, bool add); - -/* external functions */ -int invalid_class(struct char_data *ch, struct obj_data *obj); -void clearMemory(struct char_data *ch); -ACMD(do_return); char *fname(const char *namelist) { @@ -207,7 +203,7 @@ void aff_apply_modify(struct char_data *ch, byte loc, sbyte mod, char *msg) } /* switch */ } -void affect_modify(struct char_data * ch, byte loc, sbyte mod, long bitv, bool add) +static void affect_modify(struct char_data * ch, byte loc, sbyte mod, long bitv, bool add) { if (add) { SET_BIT_AR(AFF_FLAGS(ch), bitv); @@ -412,6 +408,9 @@ void char_to_room(struct char_data *ch, room_rnum room) world[room].people = ch; IN_ROOM(ch) = room; + autoquest_trigger_check(ch, 0, 0, AQ_ROOM_FIND); + autoquest_trigger_check(ch, 0, 0, AQ_MOB_FIND); + if (GET_EQ(ch, WEAR_LIGHT)) if (GET_OBJ_TYPE(GET_EQ(ch, WEAR_LIGHT)) == ITEM_LIGHT) if (GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2)) /* Light ON */ @@ -435,6 +434,8 @@ void obj_to_char(struct obj_data *object, struct char_data *ch) IN_ROOM(object) = NOWHERE; IS_CARRYING_W(ch) += GET_OBJ_WEIGHT(object); IS_CARRYING_N(ch)++; + + autoquest_trigger_check(ch, NULL, object, AQ_OBJ_FIND); /* set flag for crash-save system, but not on mobs! */ if (!IS_NPC(ch)) @@ -465,7 +466,7 @@ void obj_from_char(struct obj_data *object) } /* Return the effect of a piece of armor in position eq_pos */ -int apply_ac(struct char_data *ch, int eq_pos) +static int apply_ac(struct char_data *ch, int eq_pos) { int factor; @@ -820,7 +821,7 @@ void extract_obj(struct obj_data *obj) free_obj(obj); } -void update_object(struct obj_data *obj, int use) +static void update_object(struct obj_data *obj, int use) { /* dont update objects with a timer trigger */ if (!SCRIPT_CHECK(obj, OTRIG_TIMER) && (GET_OBJ_TIMER(obj) > 0)) diff --git a/src/handler.h b/src/handler.h index c5ee32d..da14948 100644 --- a/src/handler.h +++ b/src/handler.h @@ -1,13 +1,16 @@ -/************************************************************************** -* File: handler.h Part of tbaMUD * -* * -* Usage: header file: prototypes of handling and utility functions * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file handler.h +* Prototypes of handling and utility functions. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ +#ifndef _HANDLER_H_ +#define _HANDLER_H_ /* handling the affected-structures */ void affect_total(struct char_data *ch); @@ -42,6 +45,8 @@ void object_list_new_owner(struct obj_data *list, struct char_data *ch); void extract_obj(struct obj_data *obj); +void update_char_objects(struct char_data *ch); + /* characters*/ struct char_data *get_char_room(char *name, int *num, room_rnum room); struct char_data *get_char_num(mob_rnum nr); @@ -85,28 +90,15 @@ int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch, #define FIND_OBJ_EQUIP (1 << 5) -/* prototypes from crash save system */ -int Crash_delete_file(char *name); -int Crash_delete_crashfile(struct char_data *ch); -int Crash_clean_file(char *name); -void Crash_listrent(struct char_data *ch, char *name); -int Crash_load(struct char_data *ch); -void Crash_crashsave(struct char_data *ch); -void Crash_idlesave(struct char_data *ch); -void Crash_save_all(void); +/* prototypes from mobact.c */ +void forget(struct char_data *ch, struct char_data *victim); +void remember(struct char_data *ch, struct char_data *victim); +void mobile_activity(void); +void clearMemory(struct char_data *ch); -/* prototypes from fight.c */ -void set_fighting(struct char_data *ch, struct char_data *victim); -void stop_fighting(struct char_data *ch); -void hit(struct char_data *ch, struct char_data *victim, int type); -void forget(struct char_data *ch, struct char_data *victim); -void remember(struct char_data *ch, struct char_data *victim); -int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype); -int skill_message(int dam, struct char_data *ch, struct char_data *vict, - int attacktype); /* For new last command: */ -#define LAST_FILE LIB_ETC"last" +#define LAST_FILE LIB_ETC "last" #define LAST_CONNECT 0 #define LAST_ENTER_GAME 1 @@ -132,3 +124,5 @@ struct last_entry { void add_llog_entry(struct char_data *ch, int type); struct last_entry *find_llog_entry(int punique, long idnum); + +#endif /* _HANDLER_H_ */ diff --git a/src/hedit.c b/src/hedit.c index a658457..b07cf33 100644 --- a/src/hedit.c +++ b/src/hedit.c @@ -13,9 +13,9 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "comm.h" #include "interpreter.h" -#include "utils.h" #include "db.h" #include "boards.h" #include "oasis.h" @@ -23,26 +23,17 @@ #include "genzon.h" #include "handler.h" #include "improved-edit.h" - -/* external variables */ -extern int top_of_helpt; -extern struct help_index_element *help_table; - -/* external functions */ -int search_help(char *argument, int level); -void index_boot(int mode); +#include "act.h" +#include "hedit.h" +#include "modify.h" /* local functions */ -ACMD(do_oasis_hedit); -void hedit_disp_menu(struct descriptor_data *); -void hedit_parse(struct descriptor_data *, char *); -void hedit_setup_new(struct descriptor_data *); -void hedit_setup_existing(struct descriptor_data *, int); -void hedit_save_to_disk(struct descriptor_data *); -void hedit_save_internally(struct descriptor_data *); -void hedit_string_cleanup(struct descriptor_data *, int); -ACMD(do_helpcheck); -ACMD(do_hindex); +static void hedit_disp_menu(struct descriptor_data *); +static void hedit_setup_new(struct descriptor_data *); +static void hedit_setup_existing(struct descriptor_data *, int); +static void hedit_save_to_disk(struct descriptor_data *); +static void hedit_save_internally(struct descriptor_data *); + ACMD(do_oasis_hedit) { @@ -107,7 +98,7 @@ ACMD(do_oasis_hedit) mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing help files.", GET_NAME(d->character)); } -void hedit_setup_new(struct descriptor_data *d) +static void hedit_setup_new(struct descriptor_data *d) { CREATE(OLC_HELP(d), struct help_index_element, 1); @@ -120,7 +111,7 @@ void hedit_setup_new(struct descriptor_data *d) hedit_disp_menu(d); } -void hedit_setup_existing(struct descriptor_data *d, int rnum) +static void hedit_setup_existing(struct descriptor_data *d, int rnum) { CREATE(OLC_HELP(d), struct help_index_element, 1); @@ -133,7 +124,7 @@ void hedit_setup_existing(struct descriptor_data *d, int rnum) hedit_disp_menu(d); } -void hedit_save_internally(struct descriptor_data *d) +static void hedit_save_internally(struct descriptor_data *d) { struct help_index_element *new_help_table = NULL; @@ -153,7 +144,7 @@ void hedit_save_internally(struct descriptor_data *d) hedit_save_to_disk(d); } -void hedit_save_to_disk(struct descriptor_data *d) +static void hedit_save_to_disk(struct descriptor_data *d) { FILE *fp; char buf1[MAX_STRING_LENGTH], index_name[READ_SIZE]; @@ -186,7 +177,7 @@ void hedit_save_to_disk(struct descriptor_data *d) } /* The main menu. */ -void hedit_disp_menu(struct descriptor_data *d) +static void hedit_disp_menu(struct descriptor_data *d) { get_char_colors(d->character); @@ -367,7 +358,6 @@ void hedit_string_cleanup(struct descriptor_data *d, int terminator) ACMD(do_helpcheck) { - ACMD(do_action); char buf[MAX_STRING_LENGTH]; int i, count = 0; diff --git a/src/house.c b/src/house.c index ce957b1..ba31b9c 100644 --- a/src/house.c +++ b/src/house.c @@ -11,47 +11,39 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "comm.h" #include "handler.h" #include "db.h" #include "interpreter.h" -#include "utils.h" #include "house.h" #include "constants.h" +#include "modify.h" -/* external functions */ -obj_save_data *objsave_parse_objects(FILE *fl); -int objsave_save_obj_record(struct obj_data *obj, FILE *fl, int location); - -/* local globals */ -struct house_control_rec house_control[MAX_HOUSES]; -int num_of_houses = 0; +/* local (file scope only) globals */ +static struct house_control_rec house_control[MAX_HOUSES]; +static int num_of_houses = 0; /* local functions */ -int House_get_filename(room_vnum vnum, char *filename, size_t maxlen); -int House_load(room_vnum vnum); -int House_save(struct obj_data *obj, FILE *fp); -void House_restore_weight(struct obj_data *obj); -void House_delete_file(room_vnum vnum); -int find_house(room_vnum vnum); -void House_save_control(void); -void hcontrol_list_houses(struct char_data *ch, char *arg); -void hcontrol_build_house(struct char_data *ch, char *arg); -void hcontrol_destroy_house(struct char_data *ch, char *arg); -void hcontrol_pay_house(struct char_data *ch, char *arg); -void House_listrent(struct char_data *ch, room_vnum vnum); -ACMD(do_hcontrol); -ACMD(do_house); - +static int House_get_filename(room_vnum vnum, char *filename, size_t maxlen); +static int House_load(room_vnum vnum); +static void House_restore_weight(struct obj_data *obj); +static void House_delete_file(room_vnum vnum); +static int find_house(room_vnum vnum); +static void House_save_control(void); +static void hcontrol_build_house(struct char_data *ch, char *arg); +static void hcontrol_destroy_house(struct char_data *ch, char *arg); +static void hcontrol_pay_house(struct char_data *ch, char *arg); +static void House_listrent(struct char_data *ch, room_vnum vnum); /* CONVERSION code starts here -- see comment below. */ -int ascii_convert_house(struct char_data *ch, obj_vnum vnum); -void hcontrol_convert_houses(struct char_data *ch); -struct obj_data *Obj_from_store(struct obj_file_elem object, int *location); +static int ascii_convert_house(struct char_data *ch, obj_vnum vnum); +static void hcontrol_convert_houses(struct char_data *ch); +static struct obj_data *Obj_from_store(struct obj_file_elem object, int *location); /* CONVERSION code ends here -- see comment below. */ /* First, the basics: finding the filename; loading/saving objects */ /* Return a filename given a house vnum */ -int House_get_filename(room_vnum vnum, char *filename, size_t maxlen) +static int House_get_filename(room_vnum vnum, char *filename, size_t maxlen) { if (vnum == NOWHERE) return (0); @@ -61,7 +53,7 @@ int House_get_filename(room_vnum vnum, char *filename, size_t maxlen) } /* Load all objects for a house */ -int House_load(room_vnum vnum) +static int House_load(room_vnum vnum) { FILE *fl; char filename[MAX_STRING_LENGTH]; @@ -115,7 +107,7 @@ int House_save(struct obj_data *obj, FILE *fp) } /* restore weight of containers after House_save has changed them for saving */ -void House_restore_weight(struct obj_data *obj) +static void House_restore_weight(struct obj_data *obj) { if (obj) { House_restore_weight(obj->contains); @@ -150,7 +142,7 @@ void House_crashsave(room_vnum vnum) } /* Delete a house save file */ -void House_delete_file(room_vnum vnum) +static void House_delete_file(room_vnum vnum) { char filename[MAX_INPUT_LENGTH]; FILE *fl; @@ -168,7 +160,7 @@ void House_delete_file(room_vnum vnum) } /* List all objects in a house file */ -void House_listrent(struct char_data *ch, room_vnum vnum) +static void House_listrent(struct char_data *ch, room_vnum vnum) { FILE *fl; char filename[MAX_STRING_LENGTH]; @@ -206,7 +198,7 @@ void House_listrent(struct char_data *ch, room_vnum vnum) } /* Functions for house administration (creation, deletion, etc. */ -int find_house(room_vnum vnum) +static int find_house(room_vnum vnum) { int i; @@ -218,7 +210,7 @@ int find_house(room_vnum vnum) } /* Save the house control information */ -void House_save_control(void) +static void House_save_control(void) { FILE *fl; @@ -351,7 +343,7 @@ void hcontrol_list_houses(struct char_data *ch, char *arg) } } -void hcontrol_build_house(struct char_data *ch, char *arg) +static void hcontrol_build_house(struct char_data *ch, char *arg) { char arg1[MAX_INPUT_LENGTH]; struct house_control_rec temp_house; @@ -435,7 +427,7 @@ void hcontrol_build_house(struct char_data *ch, char *arg) House_save_control(); } -void hcontrol_destroy_house(struct char_data *ch, char *arg) +static void hcontrol_destroy_house(struct char_data *ch, char *arg) { int i, j; room_rnum real_atrium, real_house; @@ -477,7 +469,7 @@ void hcontrol_destroy_house(struct char_data *ch, char *arg) SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM); } -void hcontrol_pay_house(struct char_data *ch, char *arg) +static void hcontrol_pay_house(struct char_data *ch, char *arg) { int i; @@ -630,7 +622,7 @@ void House_list_guests(struct char_data *ch, int i, int quiet) * will let your house files load on the next bootup. -Welcor * ************************************************************************/ /* Code for conversion to ascii house rent files. */ -void hcontrol_convert_houses(struct char_data *ch) +static void hcontrol_convert_houses(struct char_data *ch) { int i; @@ -664,7 +656,7 @@ void hcontrol_convert_houses(struct char_data *ch) send_to_char(ch, "All done.\r\n"); } -int ascii_convert_house(struct char_data *ch, obj_vnum vnum) +static int ascii_convert_house(struct char_data *ch, obj_vnum vnum) { FILE *in, *out; char infile[MAX_INPUT_LENGTH], *outfile; @@ -729,7 +721,7 @@ int ascii_convert_house(struct char_data *ch, obj_vnum vnum) } /* The circle 3.1 function for reading rent files. No longer used by the rent system. */ -struct obj_data *Obj_from_store(struct obj_file_elem object, int *location) +static struct obj_data *Obj_from_store(struct obj_file_elem object, int *location) { struct obj_data *obj; obj_rnum itemnum; diff --git a/src/house.h b/src/house.h index 60b8c1d..10aee3d 100644 --- a/src/house.h +++ b/src/house.h @@ -1,3 +1,17 @@ +/** +* @file house.h +* Player house structures, prototypes and defines. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ +#ifndef _HOUSE_H_ +#define _HOUSE_H_ + #define MAX_HOUSES 100 #define MAX_GUESTS 10 @@ -26,8 +40,18 @@ struct house_control_rec { #define TOROOM(room, dir) (world[room].dir_option[dir] ? \ world[room].dir_option[dir]->to_room : NOWHERE) +/* Functions in house.c made externally available */ +/* Utility Functions */ void House_boot(void); void House_save_all(void); int House_can_enter(struct char_data *ch, room_vnum house); void House_crashsave(room_vnum vnum); void House_list_guests(struct char_data *ch, int i, int quiet); +int House_save(struct obj_data *obj, FILE *fp); +void hcontrol_list_houses(struct char_data *ch, char *arg); +/* In game Commands */ +ACMD(do_hcontrol); +ACMD(do_house); + + +#endif /* _HOUSE_H_ */ diff --git a/src/improved-edit.c b/src/improved-edit.c index c8d553e..a0831d8 100644 --- a/src/improved-edit.c +++ b/src/improved-edit.c @@ -11,8 +11,9 @@ #include "comm.h" #include "interpreter.h" #include "improved-edit.h" +#include "dg_scripts.h" +#include "modify.h" -int format_script(struct descriptor_data *d); void send_editor_help(struct descriptor_data *d) { diff --git a/src/improved-edit.h b/src/improved-edit.h index 893db31..36d2a2b 100644 --- a/src/improved-edit.h +++ b/src/improved-edit.h @@ -1,8 +1,14 @@ -/************************************************************************** -* File: improved-edit.h Part of tbaMUD * -* * -* Usage: The basic and improved editor. * -**************************************************************************/ +/** +* @file improved-edit.h +* The basic and improved editor. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This set of code was not originally part of the circlemud distribution. +*/ +#ifndef _IMPROVED_EDIT_H_ +#define _IMPROVED_EDIT_H_ /* This is here to allow different code for the basic and improved editor. If * you do not wish to use the improved editor, put #if 0 below, otherwise you @@ -35,3 +41,5 @@ void send_editor_help(struct descriptor_data *d); /* Settings for formatter. */ #define FORMAT_INDENT (1 << 0) + +#endif /* _IMPROVED_EDIT_H_ */ diff --git a/src/interpreter.c b/src/interpreter.c index 3cbaa81..57f1d33 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -13,10 +13,10 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "comm.h" #include "interpreter.h" #include "db.h" -#include "utils.h" #include "spells.h" #include "handler.h" #include "mail.h" @@ -26,204 +26,28 @@ #include "improved-edit.h" #include "dg_scripts.h" #include "constants.h" +#include "act.h" /* ACMDs located within the act*.c files */ +#include "ban.h" +#include "class.h" +#include "graph.h" +#include "hedit.h" +#include "house.h" +#include "config.h" +#include "modify.h" /* for do_skillset... */ +#include "quest.h" +#include "asciimap.h" -/* external variables */ -extern room_rnum r_mortal_start_room; -extern room_rnum r_immort_start_room; -extern room_rnum r_frozen_start_room; -extern const char *class_menu; -extern char *motd; -extern char *imotd; -extern char *background; -extern struct player_index_element *player_table; -extern int top_of_p_table; -extern int circle_restrict; -extern int no_specials; -extern int selfdelete_fastwipe; +/* local (file scope) functions */ +static int perform_dupe_check(struct descriptor_data *d); +static struct alias_data *find_alias(struct alias_data *alias_list, char *str); +static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a); +static int reserved_word(char *argument); +static int _parse_name(char *arg, char *name); +/* sort_commands utility */ +static int sort_commands_helper(const void *a, const void *b); -/* external functions */ -void echo_on(struct descriptor_data *d); -void echo_off(struct descriptor_data *d); -void do_start(struct char_data *ch); -int parse_class(char arg); -int special(struct char_data *ch, int cmd, char *arg); -int isbanned(char *hostname); -int valid_name(char *newname); -void remove_player(int pfilepos); - -/* local functions */ -int perform_dupe_check(struct descriptor_data *d); -struct alias_data *find_alias(struct alias_data *alias_list, char *str); -void free_alias(struct alias_data *a); -void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a); -int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen); -int reserved_word(char *argument); -int _parse_name(char *arg, char *name); -int enter_player_game (struct descriptor_data *d); - -/* prototypes for all do_x functions. */ -ACMD(do_action); -ACMD(do_advance); -ACMD(do_aedit); -ACMD(do_alias); -ACMD(do_assist); -ACMD(do_astat); -ACMD(do_at); -ACMD(do_attach); -ACMD(do_backstab); -ACMD(do_ban); -ACMD(do_bash); -ACMD(do_cast); -ACMD(do_changelog); -ACMD(do_checkloadstatus); -ACMD(do_commands); -ACMD(do_consider); -ACMD(do_copyover); -ACMD(do_credits); -ACMD(do_date); -ACMD(do_dc); -ACMD(do_detach); -ACMD(do_diagnose); -ACMD(do_dig); -ACMD(do_display); -ACMD(do_drink); -ACMD(do_drop); -ACMD(do_eat); -ACMD(do_echo); -ACMD(do_enter); -ACMD(do_equipment); -ACMD(do_examine); -ACMD(do_exit); -ACMD(do_exits); -ACMD(do_export_zone); -ACMD(do_file); -ACMD(do_flee); -ACMD(do_follow); -ACMD(do_force); -ACMD(do_gecho); -ACMD(do_gen_comm); -ACMD(do_gen_door); -ACMD(do_gen_ps); -ACMD(do_gen_tog); -ACMD(do_gen_write); -ACMD(do_get); -ACMD(do_give); -ACMD(do_gold); -ACMD(do_goto); -ACMD(do_grab); -ACMD(do_group); -ACMD(do_gsay); -ACMD(do_hcontrol); -ACMD(do_help); -ACMD(do_hindex); -ACMD(do_history); -ACMD(do_helpcheck); -ACMD(do_hide); -ACMD(do_hit); -ACMD(do_house); -ACMD(do_inventory); -ACMD(do_invis); -ACMD(do_kick); -ACMD(do_kill); -ACMD(do_last); -ACMD(do_leave); -ACMD(do_levels); -ACMD(do_links); -ACMD(do_load); -ACMD(do_look); -ACMD(do_masound); -ACMD(do_mat); -ACMD(do_mdamage); -ACMD(do_mdoor); -ACMD(do_mecho); -ACMD(do_mechoaround); -ACMD(do_mfollow); -ACMD(do_mforce); -ACMD(do_mgoto); -ACMD(do_mhunt); -ACMD(do_mjunk); -ACMD(do_mkill); -ACMD(do_mload); -/* ACMD(do_move); -- interpreter.h */ -ACMD(do_mpurge); -ACMD(do_msend); -ACMD(do_mteleport); -ACMD(do_mremember); -ACMD(do_mforget); -ACMD(do_mtransform); -ACMD(do_mzoneecho); -ACMD(do_mrecho); -ACMD(do_not_here); -ACMD(do_oasis_copy); -ACMD(do_order); -ACMD(do_page); -ACMD(do_peace); -ACMD(do_plist); -ACMD(do_pour); -ACMD(do_practice); -ACMD(do_purge); -ACMD(do_put); -ACMD(do_qcomm); -ACMD(do_quit); -ACMD(do_reboot); -ACMD(do_remove); -ACMD(do_reply); -ACMD(do_report); -ACMD(do_rescue); -ACMD(do_rest); -ACMD(do_restore); -ACMD(do_return); -ACMD(do_save); -ACMD(do_saveall); -ACMD(do_say); -ACMD(do_score); -ACMD(do_send); -ACMD(do_set); -ACMD(do_show); -ACMD(do_show_save_list); -ACMD(do_shutdown); -ACMD(do_sit); -ACMD(do_skillset); -ACMD(do_sleep); -ACMD(do_sneak); -ACMD(do_snoop); -ACMD(do_spec_comm); -ACMD(do_split); -ACMD(do_stand); -ACMD(do_stat); -ACMD(do_steal); -ACMD(do_switch); -ACMD(do_teleport); -ACMD(do_tell); -ACMD(do_time); -ACMD(do_title); -ACMD(do_tlist); -ACMD(do_toggle); -ACMD(do_track); -ACMD(do_trans); -ACMD(do_tstat); -ACMD(do_unban); -ACMD(do_ungroup); -ACMD(do_use); -ACMD(do_users); -ACMD(do_vdelete); -ACMD(do_visible); -ACMD(do_vnum); -ACMD(do_vstat); -ACMD(do_wake); -ACMD(do_wear); -ACMD(do_weather); -ACMD(do_where); -ACMD(do_who); -ACMD(do_wield); -ACMD(do_wizlock); -ACMD(do_wiznet); -ACMD(do_wizupdate); -ACMD(do_wizutil); -ACMD(do_write); -ACMD(do_zcheck); -ACMD(do_zreset); -ACMD(do_zpurge); +/* globals defined here, used here and elsewhere */ +int *cmd_sort_info = NULL; struct command_info *complete_cmd_info; @@ -257,14 +81,14 @@ cpp_extern const struct command_info cmd_info[] = { { "astat" , "ast" , POS_DEAD , do_astat , 0, 0 }, { "attach" , "attach" , POS_DEAD , do_attach , LVL_BUILDER, 0 }, { "auction" , "auc" , POS_SLEEPING, do_gen_comm , 0, SCMD_AUCTION }, - { "autoexits" , "autoex" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOEXIT }, + { "autoexits" , "autoex" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOEXIT }, { "backstab" , "ba" , POS_STANDING, do_backstab , 1, 0 }, { "ban" , "ban" , POS_DEAD , do_ban , LVL_GRGOD, 0 }, { "balance" , "bal" , POS_STANDING, do_not_here , 1, 0 }, { "bash" , "bas" , POS_FIGHTING, do_bash , 1, 0 }, { "brief" , "br" , POS_DEAD , do_gen_tog , 0, SCMD_BRIEF }, - { "buildwalk", "buildwalk", POS_STANDING, do_gen_tog, LVL_BUILDER, SCMD_BUILDWALK }, + { "buildwalk", "buildwalk", POS_STANDING, do_gen_tog , LVL_BUILDER, SCMD_BUILDWALK }, { "buy" , "bu" , POS_STANDING, do_not_here , 0, 0 }, { "bug" , "bug" , POS_DEAD , do_gen_write, 0, SCMD_BUG }, @@ -360,8 +184,9 @@ cpp_extern const struct command_info cmd_info[] = { { "motd" , "motd" , POS_DEAD , do_gen_ps , 0, SCMD_MOTD }, { "mail" , "mail" , POS_STANDING, do_not_here , 1, 0 }, + { "map" , "map" , POS_STANDING, do_map , 1, 0 }, { "medit" , "med" , POS_DEAD , do_oasis_medit, LVL_BUILDER, 0 }, - { "mlist" , "mlist" , POS_DEAD , do_oasis_list , LVL_BUILDER, SCMD_OASIS_MLIST }, + { "mlist" , "mlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_MLIST }, { "mcopy" , "mcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_MEDIT }, { "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_MUTE }, @@ -388,7 +213,7 @@ cpp_extern const struct command_info cmd_info[] = { { "put" , "p" , POS_RESTING , do_put , 0, 0 }, { "peace" , "pe" , POS_DEAD , do_peace , LVL_BUILDER, 0 }, { "pick" , "pi" , POS_STANDING, do_gen_door , 1, SCMD_PICK }, - { "practice" , "pr" , POS_RESTING , do_practice , 1, 0 }, + { "practice" , "pr" , POS_RESTING , do_practice , 1, 0 }, { "page" , "pag" , POS_DEAD , do_page , 1, 0 }, { "pardon" , "pardon" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_PARDON }, { "plist" , "plist" , POS_DEAD , do_plist , LVL_GOD, 0 }, @@ -397,9 +222,11 @@ cpp_extern const struct command_info cmd_info[] = { { "prompt" , "pro" , POS_DEAD , do_display , 0, 0 }, { "purge" , "purge" , POS_DEAD , do_purge , LVL_BUILDER, 0 }, + { "qedit" , "qedit" , POS_DEAD , do_oasis_qedit, LVL_BUILDER, 0 }, + { "qlist" , "qlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_QLIST }, { "quaff" , "qua" , POS_RESTING , do_use , 0, SCMD_QUAFF }, { "qecho" , "qec" , POS_DEAD , do_qcomm , LVL_GOD, SCMD_QECHO }, - { "quest" , "que" , POS_DEAD , do_gen_tog , 0, SCMD_QUEST }, + { "quest" , "que" , POS_DEAD , do_quest , 0, 0 }, { "qui" , "qui" , POS_DEAD , do_quit , 0, 0 }, { "quit" , "quit" , POS_DEAD , do_quit , 0, SCMD_QUIT }, { "qsay" , "qsay" , POS_RESTING , do_qcomm , 0, SCMD_QSAY }, @@ -505,7 +332,7 @@ cpp_extern const struct command_info cmd_info[] = { { "zcheck" , "zcheck" , POS_DEAD , do_zcheck , LVL_GOD, 0 }, { "zpurge" , "zpurge" , POS_DEAD , do_zpurge , LVL_BUILDER, 0 }, - /* DG trigger commands */ + /* DG trigger commands. minimum_level should be set to -1. */ { "masound" , "masound" , POS_DEAD , do_masound , -1, 0 }, { "mkill" , "mkill" , POS_STANDING, do_mkill , -1, 0 }, { "mjunk" , "mjunk" , POS_SITTING , do_mjunk , -1, 0 }, @@ -555,6 +382,30 @@ const char *reserved[] = "\n" }; +static int sort_commands_helper(const void *a, const void *b) +{ + return strcmp(complete_cmd_info[*(const int *)a].sort_as, + complete_cmd_info[*(const int *)b].sort_as); +} + +void sort_commands(void) +{ + int a, num_of_cmds = 0; + + while (complete_cmd_info[num_of_cmds].command[0] != '\n') + num_of_cmds++; + num_of_cmds++; /* \n */ + + CREATE(cmd_sort_info, int, num_of_cmds); + + for (a = 0; a < num_of_cmds; a++) + cmd_sort_info[a] = a; + + /* Don't sort the RESERVED or \n entries. */ + qsort(cmd_sort_info + 1, num_of_cmds - 2, sizeof(int), sort_commands_helper); +} + + /* This is the actual command interpreter called from game_loop() in comm.c * It makes sure you are the proper level and position to execute the command, * then calls the appropriate function. */ @@ -610,12 +461,17 @@ void command_interpreter(struct char_data *ch, char *argument) int found = 0; send_to_char(ch, "Huh!?!\r\n"); - for (cmd = 0; *cmd_info[cmd].command != '\n'; cmd++) { + for (cmd = 0; *cmd_info[cmd].command != '\n'; cmd++) + { if (*arg != *cmd_info[cmd].command || cmd_info[cmd].minimum_level > GET_LEVEL(ch)) continue; - if (levenshtein_distance(arg, (char *) cmd_info[cmd].command) <= 2) { - if (!found) { + /* Only apply levenshtein counts if the command is not a trigger command. */ + if ( (levenshtein_distance(arg, (char *) cmd_info[cmd].command) <= 2) && + (cmd_info[cmd].minimum_level >= 0) ) + { + if (!found) + { send_to_char(ch, "\r\nDid you mean:\r\n"); found = 1; } @@ -658,7 +514,7 @@ void command_interpreter(struct char_data *ch, char *argument) } /* Routines to handle aliasing. */ -struct alias_data *find_alias(struct alias_data *alias_list, char *str) +static struct alias_data *find_alias(struct alias_data *alias_list, char *str) { while (alias_list != NULL) { if (*str == *alias_list->alias) /* hey, every little bit counts :-) */ @@ -741,7 +597,7 @@ ACMD(do_alias) * commands. */ #define NUM_TOKENS 9 -void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a) +static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a) { struct txt_q temp_queue; char *tokens[NUM_TOKENS], *temp, *write_point; @@ -924,7 +780,7 @@ int fill_word(char *argument) return (search_block(argument, fill, TRUE) >= 0); } -int reserved_word(char *argument) +static int reserved_word(char *argument) { return (search_block(argument, reserved, TRUE) >= 0); } @@ -1082,7 +938,7 @@ int special(struct char_data *ch, int cmd, char *arg) /* Stuff for controlling the non-playing sockets (get name, pwd etc). * This function needs to die. */ -int _parse_name(char *arg, char *name) +static int _parse_name(char *arg, char *name) { int i; @@ -1102,7 +958,7 @@ int _parse_name(char *arg, char *name) #define UNSWITCH 3 /* This function seems a bit over-extended. */ -int perform_dupe_check(struct descriptor_data *d) +static int perform_dupe_check(struct descriptor_data *d) { struct descriptor_data *k, *next_k; struct char_data *target = NULL, *ch, *next_ch; @@ -1308,7 +1164,8 @@ void nanny(struct descriptor_data *d, char *arg) { CON_CEDIT, cedit_parse }, { CON_TRIGEDIT, trigedit_parse }, { CON_AEDIT, aedit_parse }, - { CON_HEDIT, hedit_parse }, + { CON_HEDIT, hedit_parse }, + { CON_QEDIT, qedit_parse }, { -1, NULL } }; diff --git a/src/interpreter.h b/src/interpreter.h index 8c93d54..194c13d 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -1,25 +1,28 @@ -/************************************************************************** -* File: interpreter.h Part of tbaMUD * -* Usage: header file: public procs, macro defs, subcommand defines * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file interpreter.h +* Public procs, macro defs, subcommand defines for the command intepreter. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ +#ifndef _INTERPRETER_H_ +#define _INTERPRETER_H_ -#define ACMD(name) \ - void name(struct char_data *ch, char *argument, int cmd, int subcmd) -ACMD(do_move); +/* List of external function prototypes. + * @todo Organize the functions into modules. */ #define CMD_NAME (complete_cmd_info[cmd].command) #define CMD_IS(cmd_name) (!strcmp(cmd_name, complete_cmd_info[cmd].command)) #define IS_MOVE(cmdnum) (complete_cmd_info[cmdnum].command_pointer == do_move) +void sort_commands(void); void command_interpreter(struct char_data *ch, char *argument); int search_block(char *arg, const char **list, int exact); -char lower( char c ); char *one_argument(char *argument, char *first_arg); char *one_word(char *argument, char *first_arg); char *any_one_arg(char *argument, char *first_arg); @@ -32,6 +35,13 @@ int is_number(const char *str); int find_command(const char *command); void skip_spaces(char **string); char *delete_doubledollar(char *string); +int special(struct char_data *ch, int cmd, char *arg); +void free_alias(struct alias_data *a); +int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen); +int enter_player_game (struct descriptor_data *d); +/* ACMDs available through interpreter.c */ +ACMD(do_alias); + /* for compatibility with 2.20: */ #define argument_interpreter(a, b, c) two_arguments(a, b, c) @@ -52,12 +62,6 @@ struct command_info { int subcmd; }; -/* Necessary for CMD_IS macro. Borland needs the structure defined first - * so it has been moved down here. */ -#ifndef __INTERPRETER_C__ -extern struct command_info *complete_cmd_info; -#endif - struct alias_data { char *alias; char *replacement; @@ -75,142 +79,23 @@ struct alias_data { /* SUBCOMMANDS: You can define these however you want to, and the definitions * of the subcommands are independent from function to function.*/ /* directions */ -#define SCMD_NORTH 1 -#define SCMD_EAST 2 -#define SCMD_SOUTH 3 -#define SCMD_WEST 4 -#define SCMD_UP 5 -#define SCMD_DOWN 6 -/* do_gen_ps */ -#define SCMD_INFO 0 -#define SCMD_HANDBOOK 1 -#define SCMD_CREDITS 2 -#define SCMD_NEWS 3 -#define SCMD_WIZLIST 4 -#define SCMD_POLICIES 5 -#define SCMD_VERSION 6 -#define SCMD_IMMLIST 7 -#define SCMD_MOTD 8 -#define SCMD_IMOTD 9 -#define SCMD_CLEAR 10 -#define SCMD_WHOAMI 11 +/* do_move + * + * Make sure the SCMD_XX directions are mapped + * to the cardinal directions. + */ +#define SCMD_NORTH NORTH +#define SCMD_EAST EAST +#define SCMD_SOUTH SOUTH +#define SCMD_WEST WEST +#define SCMD_UP UP +#define SCMD_DOWN DOWN -/* do_gen_tog */ -#define SCMD_NOSUMMON 0 -#define SCMD_NOHASSLE 1 -#define SCMD_BRIEF 2 -#define SCMD_COMPACT 3 -#define SCMD_NOTELL 4 -#define SCMD_NOAUCTION 5 -#define SCMD_NOSHOUT 6 -#define SCMD_NOGOSSIP 7 -#define SCMD_NOGRATZ 8 -#define SCMD_NOWIZ 9 -#define SCMD_QUEST 10 -#define SCMD_SHOWVNUMS 11 -#define SCMD_NOREPEAT 12 -#define SCMD_HOLYLIGHT 13 -#define SCMD_SLOWNS 14 -#define SCMD_AUTOEXIT 15 -#define SCMD_TRACK 16 -#define SCMD_CLS 17 -#define SCMD_BUILDWALK 18 -#define SCMD_AFK 19 -#define SCMD_COLOR 20 -#define SCMD_SYSLOG 21 -#define SCMD_WIMPY 22 -#define SCMD_PAGELENGTH 23 - -/* do_wizutil */ -#define SCMD_REROLL 0 -#define SCMD_PARDON 1 -#define SCMD_NOTITLE 2 -#define SCMD_MUTE 3 -#define SCMD_FREEZE 4 -#define SCMD_THAW 5 -#define SCMD_UNAFFECT 6 - -/* do_spec_com */ -#define SCMD_WHISPER 0 -#define SCMD_ASK 1 - -/* do_gen_com */ -#define SCMD_HOLLER 0 -#define SCMD_SHOUT 1 -#define SCMD_GOSSIP 2 -#define SCMD_AUCTION 3 -#define SCMD_GRATZ 4 -#define SCMD_GEMOTE 5 - -/* do_shutdown */ -#define SCMD_SHUTDOW 0 -#define SCMD_SHUTDOWN 1 - -/* do_quit */ -#define SCMD_QUI 0 -#define SCMD_QUIT 1 - -/* do_date */ -#define SCMD_DATE 0 -#define SCMD_UPTIME 1 - -/* do_commands */ -#define SCMD_COMMANDS 0 -#define SCMD_SOCIALS 1 -#define SCMD_WIZHELP 2 - -/* do_drop */ -#define SCMD_DROP 0 -#define SCMD_JUNK 1 -#define SCMD_DONATE 2 - -/* do_gen_write */ -#define SCMD_BUG 0 -#define SCMD_TYPO 1 -#define SCMD_IDEA 2 - -/* do_look */ -#define SCMD_LOOK 0 -#define SCMD_READ 1 - -/* do_qcomm */ -#define SCMD_QSAY 0 -#define SCMD_QECHO 1 - -/* do_pour */ -#define SCMD_POUR 0 -#define SCMD_FILL 1 - -/* do_poof */ -#define SCMD_POOFIN 0 -#define SCMD_POOFOUT 1 - -/* do_hit */ -#define SCMD_HIT 0 -#define SCMD_MURDER 1 - -/* do_eat */ -#define SCMD_EAT 0 -#define SCMD_TASTE 1 -#define SCMD_DRINK 2 -#define SCMD_SIP 3 - -/* do_use */ -#define SCMD_USE 0 -#define SCMD_QUAFF 1 -#define SCMD_RECITE 2 - -/* do_echo */ -#define SCMD_ECHO 0 -#define SCMD_EMOTE 1 - -/* do_gen_door */ -#define SCMD_OPEN 0 -#define SCMD_CLOSE 1 -#define SCMD_UNLOCK 2 -#define SCMD_LOCK 3 -#define SCMD_PICK 4 +/** @deprecated all old do_poof stuff is deprecated and unused. */ +#define SCMD_POOFIN 0 +/** @deprecated all old do_poof stuff is deprecated and unused. */ +#define SCMD_POOFOUT 1 /* do_oasis_Xlist */ #define SCMD_OASIS_RLIST 0 @@ -219,6 +104,17 @@ struct alias_data { #define SCMD_OASIS_SLIST 3 #define SCMD_OASIS_ZLIST 4 #define SCMD_OASIS_TLIST 5 +#define SCMD_OASIS_QLIST 6 -/* do_last */ -#define SCMD_LIST_ALL 1 +/* Necessary for CMD_IS macro. Borland needs the structure defined first + * so it has been moved down here. */ +/* Global buffering system */ +#ifndef __INTERPRETER_C__ + +extern int *cmd_sort_info; +extern struct command_info *complete_cmd_info; +extern const struct command_info cmd_info[]; + +#endif /* __INTERPRETER_C__ */ + +#endif /* _INTERPRETER_H_ */ diff --git a/src/limits.c b/src/limits.c index 7f132cc..9c5b436 100644 --- a/src/limits.c +++ b/src/limits.c @@ -18,17 +18,13 @@ #include "handler.h" #include "interpreter.h" #include "dg_scripts.h" +#include "class.h" +#include "fight.h" + +/* local file scope function prototypes */ +static int graf(int grafage, int p0, int p1, int p2, int p3, int p4, int p5, int p6); +static void check_idling(struct char_data *ch); -/* local functions */ -int graf(int grafage, int p0, int p1, int p2, int p3, int p4, int p5, int p6); -void run_autowiz(void); -void Crash_rentsave(struct char_data *ch, int cost); -int level_exp(int chclass, int level); -char *title_male(int chclass, int level); -char *title_female(int chclass, int level); -void update_char_objects(struct char_data *ch); /* handler.c */ -void reboot_wizlists(void); -void check_idling(struct char_data *ch); /* When age < 15 return the value p0 When age is 15..29 calculate the line between p1 & p2 @@ -36,7 +32,7 @@ void check_idling(struct char_data *ch); When age is 45..59 calculate the line between p3 & p4 When age is 60..79 calculate the line between p4 & p5 When age >= 80 return the value p6 */ -int graf(int grafage, int p0, int p1, int p2, int p3, int p4, int p5, int p6) +static int graf(int grafage, int p0, int p1, int p2, int p3, int p4, int p5, int p6) { if (grafage < 15) @@ -179,20 +175,19 @@ int move_gain(struct char_data *ch) void set_title(struct char_data *ch, char *title) { - if (title == NULL) { - if (GET_SEX(ch) == SEX_FEMALE) - title = title_female(GET_CLASS(ch), GET_LEVEL(ch)); - else - title = title_male(GET_CLASS(ch), GET_LEVEL(ch)); - } - - if (strlen(title) > MAX_TITLE_LENGTH) - title[MAX_TITLE_LENGTH] = '\0'; - if (GET_TITLE(ch) != NULL) free(GET_TITLE(ch)); - GET_TITLE(ch) = strdup(title); + if (title == NULL) { + GET_TITLE(ch) = strdup(GET_SEX(ch) == SEX_FEMALE ? + title_female(GET_CLASS(ch), GET_LEVEL(ch)) : + title_male(GET_CLASS(ch), GET_LEVEL(ch))); + } else { + if (strlen(title) > MAX_TITLE_LENGTH) + title[MAX_TITLE_LENGTH] = '\0'; + + GET_TITLE(ch) = strdup(title); + } } void run_autowiz(void) @@ -263,7 +258,7 @@ void gain_exp(struct char_data *ch, int gain) } if (GET_LEVEL(ch) >= LVL_IMMORT && !PLR_FLAGGED(ch, PLR_NOWIZLIST)) run_autowiz(); -} + } void gain_exp_regardless(struct char_data *ch, int gain) { @@ -331,7 +326,7 @@ void gain_condition(struct char_data *ch, int condition, int value) } -void check_idling(struct char_data *ch) +static void check_idling(struct char_data *ch) { if (++(ch->char_specials.timer) > CONFIG_IDLE_VOID) { if (GET_WAS_IN(ch) == NOWHERE && IN_ROOM(ch) != NOWHERE) { diff --git a/src/magic.c b/src/magic.c index 42a02b6..54e1860 100644 --- a/src/magic.c +++ b/src/magic.c @@ -19,20 +19,14 @@ #include "interpreter.h" #include "constants.h" #include "dg_scripts.h" +#include "class.h" +#include "fight.h" -/* external variables */ -extern int mini_mud; -extern struct spell_info_type spell_info[]; -/* external functions */ -byte saving_throws(int class_num, int type, int level); /* class.c */ -void clearMemory(struct char_data *ch); +/* local file scope function prototypes */ +static int mag_materials(struct char_data *ch, IDXTYPE item0, IDXTYPE item1, IDXTYPE item2, int extract, int verbose); +static void perform_mag_groups(int level, struct char_data *ch, struct char_data *tch, int spellnum, int savetype); -/* local functions */ -int mag_materials(struct char_data *ch, int item0, int item1, int item2, int extract, int verbose); -void perform_mag_groups(int level, struct char_data *ch, struct char_data *tch, int spellnum, int savetype); -int mag_savingthrow(struct char_data *ch, int type, int modifier); -void affect_update(void); /* Negative apply_saving_throw[] values make saving throws better! So do * negative modifiers. Though people may be used to the reverse of that. @@ -83,56 +77,113 @@ void affect_update(void) } } -/* mag_materials: Checks for up to 3 vnums (spell reagents) in the player's - * inventory. No spells currently use mag_materials, but you can use it to - * implement your own spells which require ingredients (i.e. heal spells which - * requires a rare herb or some such.) */ -int mag_materials(struct char_data *ch, int item0, int item1, int item2, - int extract, int verbose) +/* Checks for up to 3 vnums (spell reagents) in the player's inventory. If + * multiple vnums are passed in, the function ANDs the items together as + * requirements (ie. if one or more are missing, the spell will not fail). + * @param ch The caster of the spell. + * @param item0 The first required item of the spell, NOTHING if not required. + * @param item1 The second required item of the spell, NOTHING if not required. + * @param item2 The third required item of the spell, NOTHING if not required. + * @param extract TRUE if mag_materials should consume (destroy) the items in + * the players inventory, FALSE if not. Items will only be removed on a + * successful cast. + * @param verbose TRUE to provide some generic failure or success messages, + * FALSE to send no in game messages from this function. + * @retval int TRUE if ch has all materials to cast the spell, FALSE if not. + */ +static int mag_materials(struct char_data *ch, IDXTYPE item0, + IDXTYPE item1, IDXTYPE item2, int extract, int verbose) { - struct obj_data *tobj; + /* Begin Local variable definitions. */ + /*------------------------------------------------------------------------*/ + /* Used for object searches. */ + struct obj_data *tobj = NULL; + /* Points to found reagents. */ struct obj_data *obj0 = NULL, *obj1 = NULL, *obj2 = NULL; + /*------------------------------------------------------------------------*/ + /* End Local variable definitions. */ - for (tobj = ch->carrying; tobj; tobj = tobj->next_content) { - if ((item0 > 0) && (GET_OBJ_VNUM(tobj) == item0)) { + /* Begin success checks. Checks must pass to signal a success. */ + /*------------------------------------------------------------------------*/ + /* Check for the objects in the players inventory. */ + for (tobj = ch->carrying; tobj; tobj = tobj->next_content) + { + if ((item0 != NOTHING) && (GET_OBJ_VNUM(tobj) == item0)) + { obj0 = tobj; - item0 = -1; - } else if ((item1 > 0) && (GET_OBJ_VNUM(tobj) == item1)) { + item0 = NOTHING; + } + else if ((item1 != NOTHING) && (GET_OBJ_VNUM(tobj) == item1)) + { obj1 = tobj; - item1 = -1; - } else if ((item2 > 0) && (GET_OBJ_VNUM(tobj) == item2)) { + item1 = NOTHING; + } + else if ((item2 != NOTHING) && (GET_OBJ_VNUM(tobj) == item2)) + { obj2 = tobj; - item2 = -1; + item2 = NOTHING; } } - if ((item0 > 0) || (item1 > 0) || (item2 > 0)) { - if (verbose) { - switch (rand_number(0, 2)) { + + /* If we needed items, but didn't find all of them, then the spell is a + * failure. */ + if ((item0 != NOTHING) || (item1 != NOTHING) || (item2 != NOTHING)) + { + /* Generic spell failure messages. */ + if (verbose) + { + switch (rand_number(0, 2)) + { case 0: - send_to_char(ch, "A wart sprouts on your nose.\r\n"); - break; + send_to_char(ch, "A wart sprouts on your nose.\r\n"); + break; case 1: - send_to_char(ch, "Your hair falls out in clumps.\r\n"); - break; + send_to_char(ch, "Your hair falls out in clumps.\r\n"); + break; case 2: - send_to_char(ch, "A huge corn develops on your big toe.\r\n"); - break; + send_to_char(ch, "A huge corn develops on your big toe.\r\n"); + break; } } + /* Return fales, the material check has failed. */ return (FALSE); } - if (extract) { - if (item0 < 0) + /*------------------------------------------------------------------------*/ + /* End success checks. */ + + /* From here on, ch has all required materials in their inventory and the + * material check will return a success. */ + + /* Begin Material Processing. */ + /*------------------------------------------------------------------------*/ + /* Extract (destroy) the materials, if so called for. */ + if (extract) + { + if (obj0 != NULL) extract_obj(obj0); - if (item1 < 0) + if (obj1 != NULL) extract_obj(obj1); - if (item2 < 0) + if (obj2 != NULL) extract_obj(obj2); + /* Generic success messages that signals extracted objects. */ + if (verbose) + { + send_to_char(ch, "A puff of smoke rises from your pack.\r\n"); + act("A puff of smoke rises from $n's pack.", TRUE, ch, NULL, NULL, TO_ROOM); + } } - if (verbose) { - send_to_char(ch, "A puff of smoke rises from your pack.\r\n"); - act("A puff of smoke rises from $n's pack.", TRUE, ch, NULL, NULL, TO_ROOM); + + /* Don't extract the objects, but signal materials successfully found. */ + if(!extract && verbose) + { + send_to_char(ch, "Your pack rumbles.\r\n"); + act("Something rumbles in $n's pack.", TRUE, ch, NULL, NULL, TO_ROOM); } + /*------------------------------------------------------------------------*/ + /* End Material Processing. */ + + /* Signal to calling function that the materials were successfully found + * and processed. */ return (TRUE); } @@ -489,7 +540,7 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim, /* This function is used to provide services to mag_groups. This function is * the one you should change to add new group spells. */ -void perform_mag_groups(int level, struct char_data *ch, +static void perform_mag_groups(int level, struct char_data *ch, struct char_data *tch, int spellnum, int savetype) { switch (spellnum) { @@ -605,9 +656,13 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype) } } +/*----------------------------------------------------------------------------*/ +/* Begin Magic Summoning - Generic Routines and Local Globals */ +/*----------------------------------------------------------------------------*/ + /* Every spell which summons/gates/conjours a mob comes through here. */ /* These use act(), don't put the \r\n. */ -const char *mag_summon_msgs[] = { +static const char *mag_summon_msgs[] = { "\r\n", "$n makes a strange magical gesture; you feel a strong breeze!", "$n animates a corpse!", @@ -624,7 +679,7 @@ const char *mag_summon_msgs[] = { }; /* Keep the \r\n because these use send_to_char. */ -const char *mag_summon_fail_msgs[] = { +static const char *mag_summon_fail_msgs[] = { "\r\n", "There are no such creatures.\r\n", "Uh oh...\r\n", @@ -635,11 +690,10 @@ const char *mag_summon_fail_msgs[] = { "There is no corpse!\r\n" }; -/* Defined mobiles. */ -#define MOB_ELEMENTAL_BASE 20 -#define MOB_CLONE 10 -#define MOB_ZOMBIE 11 -#define MOB_AERIALSERVANT 19 +/* Defines for Mag_Summons */ +#define MOB_CLONE 10 /**< vnum for the clone mob. */ +#define OBJ_CLONE 161 /**< vnum for clone material. */ +#define MOB_ZOMBIE 11 /**< vnum for the zombie mob. */ void mag_summons(int level, struct char_data *ch, struct obj_data *obj, int spellnum, int savetype) @@ -657,7 +711,19 @@ void mag_summons(int level, struct char_data *ch, struct obj_data *obj, msg = 10; fmsg = rand_number(2, 6); /* Random fail message. */ mob_num = MOB_CLONE; - pfail = 50; /* 50% failure, should be based on something later. */ + /* + * We have designated the clone spell as the example for how to use the + * mag_materials function. + * In stock tbaMUD it checks to see if the character has item with + * vnum 161 which is a set of sacrificial entrails. If we have the entrails + * the spell will succeed, and if not, the spell will fail 102% of the time + * (prevents random success... see below). + * The object is extracted and the generic cast messages are displayed. + */ + if( !mag_materials(ch, OBJ_CLONE, NOTHING, NOTHING, TRUE, TRUE) ) + pfail = 102; /* No materials, spell fails. */ + else + pfail = 0; /* We have the entrails, spell is successfully cast. */ break; case SPELL_ANIMATE_DEAD: @@ -712,6 +778,16 @@ void mag_summons(int level, struct char_data *ch, struct obj_data *obj, } } +/* Clean up the defines used for mag_summons. */ +#undef MOB_CLONE +#undef OBJ_CLONE +#undef MOB_ZOMBIE + +/*----------------------------------------------------------------------------*/ +/* End Magic Summoning - Generic Routines and Local Globals */ +/*----------------------------------------------------------------------------*/ + + void mag_points(int level, struct char_data *ch, struct char_data *victim, int spellnum, int savetype) { @@ -811,7 +887,7 @@ void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj, } break; case SPELL_INVISIBLE: - if (!OBJ_FLAGGED(obj, ITEM_NOINVIS | ITEM_INVISIBLE)) { + if (!OBJ_FLAGGED(obj, ITEM_NOINVIS) || !OBJ_FLAGGED(obj, ITEM_INVISIBLE)) { SET_BIT_AR(GET_OBJ_EXTRA(obj), ITEM_INVISIBLE); to_char = "$p vanishes."; } diff --git a/src/mail.c b/src/mail.c index 55257ee..eb843f7 100644 --- a/src/mail.c +++ b/src/mail.c @@ -18,61 +18,18 @@ #include "interpreter.h" #include "handler.h" #include "mail.h" +#include "modify.h" -/* external variables */ -extern int no_mail; -extern struct player_index_element *player_table; +/* local (file scope) function prototypes */ +static void postmaster_send_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg); +static void postmaster_check_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg); +static void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg); +static int mail_recip_ok(const char *name); +static void write_mail_record(FILE *mail_file, struct mail_t *record); +static void free_mail_record(struct mail_t *record); +static struct mail_t *read_mail_record(FILE *mail_file); -/* external functions */ -SPECIAL(postmaster); - -/* local functions */ -void postmaster_send_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg); -void postmaster_check_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg); -void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg); -int mail_recip_ok(const char *name); -void write_mail_record(FILE *mail_file, struct mail_t *record); - -char *decrypt_hex(char *string, size_t len) -{ - static char output[MAX_STRING_LENGTH]; - char *p; - char *src = string; - int i; - - p = output; - for (i = 0;i>4; - lo&=0x0F; - *p++ = hi+(hi>9 ? 'A'-10 : '0'); - *p++ = lo+(lo>9 ? 'A'-10 : '0'); - } - return output; -} - -int mail_recip_ok(const char *name) +static int mail_recip_ok(const char *name) { int player_i, ret = FALSE; @@ -83,14 +40,14 @@ int mail_recip_ok(const char *name) return ret; } -void free_mail_record(struct mail_t *record) +static void free_mail_record(struct mail_t *record) { if (record->body) free(record->body); free(record); } -struct mail_t *read_mail_record(FILE *mail_file) +static struct mail_t *read_mail_record(FILE *mail_file) { char line[READ_SIZE]; long sender, recipient; @@ -100,7 +57,7 @@ struct mail_t *read_mail_record(FILE *mail_file) if (!get_line(mail_file, line)) return NULL; - if (sscanf(line, "### %ld %ld %ld", &recipient, &sender, &sent_time) != 3) { + if (sscanf(line, "### %ld %ld %ld", &recipient, &sender, (long *)&sent_time) != 3) { log("Mail system - fatal error - malformed mail header"); log("Line was: %s", line); return NULL; @@ -116,13 +73,13 @@ struct mail_t *read_mail_record(FILE *mail_file) return record; } -void write_mail_record(FILE *mail_file, struct mail_t *record) +static void write_mail_record(FILE *mail_file, struct mail_t *record) { fprintf(mail_file, "### %ld %ld %ld\n" "%s~\n", record->recipient, record->sender, - record->sent_time, + (long)record->sent_time, record->body ); } @@ -313,7 +270,7 @@ SPECIAL(postmaster) return (0); } -void postmaster_send_mail(struct char_data *ch, struct char_data *mailman, +static void postmaster_send_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg) { long recipient; @@ -360,7 +317,7 @@ void postmaster_send_mail(struct char_data *ch, struct char_data *mailman, string_write(ch->desc, mailwrite, MAX_MAIL_SIZE, recipient, NULL); } -void postmaster_check_mail(struct char_data *ch, struct char_data *mailman, +static void postmaster_check_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg) { if (has_mail(GET_IDNUM(ch))) @@ -369,7 +326,7 @@ void postmaster_check_mail(struct char_data *ch, struct char_data *mailman, act("$n tells you, 'Sorry, you don't have any mail waiting.'", FALSE, mailman, 0, ch, TO_VICT); } -void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman, +static void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg) { char buf[256]; diff --git a/src/mail.h b/src/mail.h index 470cad6..dfba68e 100644 --- a/src/mail.h +++ b/src/mail.h @@ -1,13 +1,17 @@ -/************************************************************************** -* File: mail.h Part of tbaMUD * -* Usage: header file for mudmail system * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -* By Jeremy Elson. * -**************************************************************************/ +/** +* @file mail.h +* Public procs, macro defs, subcommand defines mudmail system. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* By Jeremy Elson. +*/ +#ifndef _MAIL_H_ +#define _MAIL_H_ /* You can modify the following constants to fit your own MUD. */ @@ -23,6 +27,9 @@ /* size of mail file allocation blocks */ #define BLOCK_SIZE 100 +/* General, publicly available functions */ +SPECIAL(postmaster); + /* NOTE: Make sure that your block size is big enough. If not, HEADER_BLOCK_ * DATASIZE will end up negative. This is a bad thing. Check the define below * to make sure it is >0 when choosing values for NAME_SIZE and BLOCK_SIZE. @@ -97,3 +104,5 @@ struct mail_index_type_d { }; typedef struct mail_index_type_d mail_index_type; + +#endif /* _MAIL_H_ */ diff --git a/src/medit.c b/src/medit.c index f4712f4..669e0fe 100644 --- a/src/medit.c +++ b/src/medit.c @@ -8,10 +8,10 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "interpreter.h" #include "comm.h" #include "spells.h" -#include "utils.h" #include "db.h" #include "shop.h" #include "genolc.h" @@ -24,22 +24,19 @@ #include "improved-edit.h" #include "dg_olc.h" #include "screen.h" - -/* external variables */ -extern struct attack_hit_type attack_hit_text[]; +#include "fight.h" +#include "modify.h" /* for smash_tilde */ /* local functions */ -void medit_setup_new(struct descriptor_data *d); -void medit_setup_existing(struct descriptor_data *d, int rmob_num); -void init_mobile(struct char_data *mob); -void medit_save_internally(struct descriptor_data *d); -void medit_save_to_disk(zone_vnum zone_num); -void medit_disp_positions(struct descriptor_data *d); -void medit_disp_sex(struct descriptor_data *d); -void medit_disp_attack_types(struct descriptor_data *d); -void medit_disp_mob_flags(struct descriptor_data *d); -void medit_disp_aff_flags(struct descriptor_data *d); -void medit_disp_menu(struct descriptor_data *d); +static void medit_setup_new(struct descriptor_data *d); +static void init_mobile(struct char_data *mob); +static void medit_save_to_disk(zone_vnum zone_num); +static void medit_disp_positions(struct descriptor_data *d); +static void medit_disp_sex(struct descriptor_data *d); +static void medit_disp_attack_types(struct descriptor_data *d); +static void medit_disp_mob_flags(struct descriptor_data *d); +static void medit_disp_aff_flags(struct descriptor_data *d); +static void medit_disp_menu(struct descriptor_data *d); /* utility functions */ ACMD(do_oasis_medit) @@ -167,12 +164,12 @@ ACMD(do_oasis_medit) GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); } -void medit_save_to_disk(zone_vnum foo) +static void medit_save_to_disk(zone_vnum foo) { save_mobiles(real_zone(foo)); } -void medit_setup_new(struct descriptor_data *d) +static void medit_setup_new(struct descriptor_data *d) { struct char_data *mob; @@ -217,7 +214,7 @@ void medit_setup_existing(struct descriptor_data *d, int rmob_num) } /* Ideally, this function should be in db.c, but I'll put it here for portability. */ -void init_mobile(struct char_data *mob) +static void init_mobile(struct char_data *mob) { clear_char(mob); @@ -294,7 +291,7 @@ void medit_save_internally(struct descriptor_data *d) /* Menu functions Display positions. (sitting, standing, etc) */ -void medit_disp_positions(struct descriptor_data *d) +static void medit_disp_positions(struct descriptor_data *d) { int i; @@ -308,7 +305,7 @@ void medit_disp_positions(struct descriptor_data *d) } /* Display the gender of the mobile. */ -void medit_disp_sex(struct descriptor_data *d) +static void medit_disp_sex(struct descriptor_data *d) { int i; @@ -322,7 +319,7 @@ void medit_disp_sex(struct descriptor_data *d) } /* Display attack types menu. */ -void medit_disp_attack_types(struct descriptor_data *d) +static void medit_disp_attack_types(struct descriptor_data *d) { int i; @@ -336,41 +333,43 @@ void medit_disp_attack_types(struct descriptor_data *d) } /* Display mob-flags menu. */ -void medit_disp_mob_flags(struct descriptor_data *d) +static void medit_disp_mob_flags(struct descriptor_data *d) { - int i, columns = 0; - char flags[MAX_STRING_LENGTH]; + char buf[MAX_STRING_LENGTH]; get_char_colors(d->character); clear_screen(d); - for (i = 0; i < NUM_MOB_FLAGS; i++) { - write_to_output(d, "%s%2d%s) %-20.20s %s", grn, i + 1, nrm, action_bits[i], - !(++columns % 2) ? "\r\n" : ""); - } - sprintbitarray(MOB_FLAGS(OLC_MOB(d)), action_bits, AF_ARRAY_MAX, flags); + + column_list(buf, sizeof(buf), 0, 0, + 2, action_bits, NUM_MOB_FLAGS, 0, + "%s$2i%s) $20l", grn, nrm); + write_to_output(d, buf); + + sprintbitarray(MOB_FLAGS(OLC_MOB(d)), action_bits, AF_ARRAY_MAX, buf); write_to_output(d, "\r\nCurrent flags : %s%s%s\r\nEnter mob flags (0 to quit) : ", - cyn, flags, nrm); + cyn, buf, nrm); } /* Display affection flags menu. */ -void medit_disp_aff_flags(struct descriptor_data *d) +static void medit_disp_aff_flags(struct descriptor_data *d) { - int i, columns = 0; - char flags[MAX_STRING_LENGTH]; + char buf[MAX_STRING_LENGTH]; get_char_colors(d->character); clear_screen(d); - for (i = 0; i < NUM_AFF_FLAGS; i++) { - write_to_output(d, "%s%2d%s) %-20.20s %s", grn, i + 1, nrm, affected_bits[i+1], - !(++columns % 2) ? "\r\n" : ""); - } - sprintbitarray(AFF_FLAGS(OLC_MOB(d)), affected_bits, AF_ARRAY_MAX, flags); + + column_list(buf, sizeof(buf), 0, 0, + 2, affected_bits, NUM_AFF_FLAGS, 1, + "%s$2i%s) $20l", grn, nrm); + write_to_output(d, buf); + + sprintbitarray(AFF_FLAGS(OLC_MOB(d)), affected_bits, AF_ARRAY_MAX, buf); write_to_output(d, "\r\nCurrent flags : %s%s%s\r\nEnter aff flags (0 to quit) : ", - cyn, flags, nrm); + cyn, buf, nrm); } /* Display main menu. */ -void medit_disp_menu(struct descriptor_data *d) +static void medit_disp_menu(struct descriptor_data *d) { struct char_data *mob; char flags[MAX_STRING_LENGTH], flag2[MAX_STRING_LENGTH]; diff --git a/src/mobact.c b/src/mobact.c index 0b24c9f..21e4bcd 100644 --- a/src/mobact.c +++ b/src/mobact.c @@ -18,19 +18,13 @@ #include "handler.h" #include "spells.h" #include "constants.h" +#include "act.h" +#include "graph.h" +#include "fight.h" -/* external globals */ -extern int no_specials; -/* external functions */ -ACMD(do_get); -ACMD(do_action); -void hunt_victim(struct char_data *ch); - -/* local functions */ -void mobile_activity(void); -void clearMemory(struct char_data *ch); -bool aggressive_mob_on_a_leash(struct char_data *slave, struct char_data *master, struct char_data *attack); +/* local file scope only function prototypes */ +static bool aggressive_mob_on_a_leash(struct char_data *slave, struct char_data *master, struct char_data *attack); void mobile_activity(void) { @@ -84,12 +78,15 @@ void mobile_activity(void) /* Mob Movement */ if (!MOB_FLAGGED(ch, MOB_SENTINEL) && (GET_POS(ch) == POS_STANDING) && - ((door = rand_number(0, 18)) < NUM_OF_DIRS) && CAN_GO(ch, door) && - !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB) && - !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_DEATH) && - (!MOB_FLAGGED(ch, MOB_STAY_ZONE) || - (world[EXIT(ch, door)->to_room].zone == world[IN_ROOM(ch)].zone))) { - perform_move(ch, door, 1); + ((door = rand_number(0, 18)) < NUM_OF_DIRS) && CAN_GO(ch, door) && + !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB) && + !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_DEATH) && + (!MOB_FLAGGED(ch, MOB_STAY_ZONE) || + (world[EXIT(ch, door)->to_room].zone == world[IN_ROOM(ch)].zone))) + { + /* If the mob is charmed, do not move the mob. */ + if (ch->master != NULL) + perform_move(ch, door, 1); } /* Aggressive Mobs */ @@ -152,17 +149,19 @@ void mobile_activity(void) } /* Helper Mobs */ - if (MOB_FLAGGED(ch, MOB_HELPER) && !AFF_FLAGGED(ch, AFF_BLIND | AFF_CHARM)) { + if (MOB_FLAGGED(ch, MOB_HELPER) && (!AFF_FLAGGED(ch, AFF_BLIND) || !AFF_FLAGGED(ch, AFF_CHARM))) + { found = FALSE; - for (vict = world[IN_ROOM(ch)].people; vict && !found; vict = vict->next_in_room) { - if (ch == vict || !IS_NPC(vict) || !FIGHTING(vict)) - continue; - if (IS_NPC(FIGHTING(vict)) || ch == FIGHTING(vict)) - continue; + for (vict = world[IN_ROOM(ch)].people; vict && !found; vict = vict->next_in_room) + { + if (ch == vict || !IS_NPC(vict) || !FIGHTING(vict)) + continue; + if (IS_NPC(FIGHTING(vict)) || ch == FIGHTING(vict)) + continue; - act("$n jumps to the aid of $N!", FALSE, ch, 0, vict, TO_ROOM); - hit(ch, FIGHTING(vict), TYPE_UNDEFINED); - found = TRUE; + act("$n jumps to the aid of $N!", FALSE, ch, 0, vict, TO_ROOM); + hit(ch, FIGHTING(vict), TYPE_UNDEFINED); + found = TRUE; } } @@ -236,7 +235,7 @@ void clearMemory(struct char_data *ch) /* An aggressive mobile wants to attack something. If they're under the * influence of mind altering PC, then see if their master can talk them out * of it, eye them down, or otherwise intimidate the slave. */ -bool aggressive_mob_on_a_leash(struct char_data *slave, struct char_data *master, struct char_data *attack) +static bool aggressive_mob_on_a_leash(struct char_data *slave, struct char_data *master, struct char_data *attack) { static int snarl_cmd; int dieroll; diff --git a/src/modify.c b/src/modify.c index a289adc..9799cd6 100644 --- a/src/modify.c +++ b/src/modify.c @@ -21,23 +21,20 @@ #include "boards.h" #include "improved-edit.h" #include "oasis.h" +#include "dg_scripts.h" /* for trigedit_string_cleanup */ +#include "modify.h" +#include "quest.h" -void show_string(struct descriptor_data *d, char *input); +/* local (file scope) function prototpyes */ +static char *next_page(char *str, struct char_data *ch); +static int count_pages(char *str, struct char_data *ch); +static void playing_string_cleanup(struct descriptor_data *d, int action); +static void exdesc_string_cleanup(struct descriptor_data *d, int action); -extern struct spell_info_type spell_info[]; -extern const char *unused_spellname; /* spell_parser.c */ - -/* local functions */ -void smash_tilde(char *str); -ACMD(do_skillset); -char *next_page(char *str, struct char_data *ch); -int count_pages(char *str, struct char_data *ch); -void paginate_string(char *str, struct descriptor_data *d); -void playing_string_cleanup(struct descriptor_data *d, int action); -void exdesc_string_cleanup(struct descriptor_data *d, int action); -void trigedit_string_cleanup(struct descriptor_data *d, int terminator); - -const char *string_fields[] = +/* Local (file scope) global variables */ +/* @deprecated string_fields appears to be no longer be used. + * Left in but commented out. +static const char *string_fields[] = { "name", "short", @@ -47,9 +44,11 @@ const char *string_fields[] = "delete-description", "\n" }; +*/ -/* maximum length for text field x+1 */ -int length[] = +/** maximum length for text field x+1 + * @deprecated length appears to no longer be used. Left in but commented out. +static int length[] = { 15, 60, @@ -57,6 +56,7 @@ int length[] = 240, 60 }; +*/ /* modification of malloc'ed strings */ /* Put '#if 1' here to erase ~, or roll your own method. A common idea is @@ -151,6 +151,7 @@ void string_add(struct descriptor_data *d, char *str) case CON_PLR_DESC: case CON_TRIGEDIT: case CON_HEDIT: + case CON_QEDIT: free(*d->str); *d->str = d->backstr; d->backstr = NULL; @@ -190,6 +191,7 @@ void string_add(struct descriptor_data *d, char *str) { CON_PLR_DESC , exdesc_string_cleanup }, { CON_PLAYING, playing_string_cleanup }, { CON_HEDIT, hedit_string_cleanup }, + { CON_QEDIT , qedit_string_cleanup }, { -1, NULL } }; @@ -209,7 +211,7 @@ void string_add(struct descriptor_data *d, char *str) strcat(*d->str, "\r\n"); } -void playing_string_cleanup(struct descriptor_data *d, int action) +static void playing_string_cleanup(struct descriptor_data *d, int action) { if (PLR_FLAGGED(d->character, PLR_MAILING)) { if (action == STRINGADD_SAVE && *d->str) { @@ -231,7 +233,7 @@ void playing_string_cleanup(struct descriptor_data *d, int action) } } -void exdesc_string_cleanup(struct descriptor_data *d, int action) +static void exdesc_string_cleanup(struct descriptor_data *d, int action) { if (action == STRINGADD_ABORT) write_to_output(d, "Description aborted.\r\n"); @@ -325,7 +327,7 @@ ACMD(do_skillset) /* By Michael Buselli. Traverse down the string until the begining of the next * page has been reached. Return NULL if this is the last page of the string. */ -char *next_page(char *str, struct char_data *ch) +static char *next_page(char *str, struct char_data *ch) { int col = 1, line = 1; @@ -367,7 +369,7 @@ char *next_page(char *str, struct char_data *ch) } /* Function that returns the number of pages in the string. */ -int count_pages(char *str, struct char_data *ch) +static int count_pages(char *str, struct char_data *ch) { int pages; diff --git a/src/oasis.c b/src/oasis.c index 5cf80a5..56c6310 100644 --- a/src/oasis.c +++ b/src/oasis.c @@ -22,12 +22,14 @@ #include "oasis.h" #include "screen.h" #include "dg_olc.h" +#include "act.h" +#include "handler.h" /* for is_name */ +#include "quest.h" -/* External Functions */ -int is_name(const char *str, const char *namelist); /* Internal Data Structures */ -struct olc_scmd_info_t { +/** @deprecated olc_scmd_info appears to be deprecated. Commented out for now. +static struct olc_scmd_info_t { const char *text; int con_type; } olc_scmd_info[] = { @@ -40,13 +42,16 @@ struct olc_scmd_info_t { { "trigger", CON_TRIGEDIT }, { "action", CON_AEDIT }, { "help", CON_HEDIT }, + { "quest", CON_QEDIT }, { "\n", -1 } }; +*/ +/* Global variables defined here, used elsewhere */ const char *nrm, *grn, *cyn, *yel; -/* Internal Functions */ -void free_config(struct config_data *data); +/* Internal Function prototypes */ +static void free_config(struct config_data *data); /* Only player characters should be using OLC anyway. */ void clear_screen(struct descriptor_data *d) @@ -125,6 +130,20 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type) if (OLC_SHOP(d)) free_shop(OLC_SHOP(d)); + /* Check for a quest. */ + if (OLC_QUEST(d)) { + switch (cleanup_type) { + case CLEANUP_ALL: + free_quest(OLC_QUEST(d)); + break; + case CLEANUP_STRUCTS: + free(OLC_QUEST(d)); + break; + default: + break; + } + } + /*. Check for aedit stuff -- M. Scott */ if (OLC_ACTION(d)) { switch(cleanup_type) { @@ -214,7 +233,7 @@ void split_argument(char *argument, char *tag) *wrt = '\0'; } -void free_config(struct config_data *data) +static void free_config(struct config_data *data) { /* Free strings. */ free_strings(data, OASIS_CFG); diff --git a/src/oasis.h b/src/oasis.h index 6967d77..c7bf4b2 100644 --- a/src/oasis.h +++ b/src/oasis.h @@ -1,9 +1,18 @@ -/************************************************************************** -* File: oasis.c Part of tbaMUD * -* Usage: Oasis - General. * -* * -* By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. * -**************************************************************************/ +/** +* @file oasis.h +* Oasis online creation general defines. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This source code, which was not part of the CircleMUD legacy code, +* is attributed to: +* By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +*/ +#ifndef _OASIS_H_ +#define _OASIS_H_ + +#include "utils.h" /* for ACMD macro */ #define _OASISOLC 0x206 /* 2.0.6 */ @@ -16,25 +25,8 @@ #define ALL_PERMISSION 666 /* arbitrary number higher then max zone vnum*/ /* Macros, defines, structs and globals for the OLC suite. You will need - to adjust these numbers if you ever add more. */ -#define NUM_ROOM_FLAGS 16 -#define NUM_ROOM_SECTORS 10 - -#define NUM_MOB_FLAGS 18 -#define NUM_AFF_FLAGS 22 -#define NUM_ATTACK_TYPES 15 - -#define NUM_ITEM_TYPES 24 -#define NUM_ITEM_FLAGS 17 -#define NUM_ITEM_WEARS 15 -#define NUM_APPLIES 25 -#define NUM_LIQ_TYPES 16 -#define NUM_POSITIONS 15 -#define NUM_SPELLS 51 - -#define NUM_GENDERS 3 -#define NUM_SHOP_FLAGS 3 -#define NUM_TRADERS 7 + to adjust these numbers if you ever add more. Note: Most of the NUM_ and + MAX_ limits have been moved to more appropriate locations. */ #define MAX_PEOPLE 10 /* Max # of people you want to sit in furniture. */ @@ -85,9 +77,7 @@ void split_argument(char *argument, char *tag); void send_cannot_edit(struct char_data *ch, zone_vnum zone); /* OLC structures. */ -/* The following defines used to be in config.c. */ -#define NO 0 -#define YES 1 +/* NO and YES are defined in utils.h. Removed from here. */ struct oasis_olc_data { int mode; /* how to parse input */ @@ -101,6 +91,7 @@ struct oasis_olc_data { struct zone_data *zone; /* used for 'zedit' */ struct shop_data *shop; /* used for 'sedit' */ struct config_data *config; /* used for 'cedit' */ + struct aq_data *quest; /* used for 'qedit' */ struct extra_descr_data *desc; /* used in '[r|o|m]edit' */ struct social_messg *action; /* Aedit uses this one */ struct trig_data *trig; @@ -115,24 +106,25 @@ struct oasis_olc_data { extern const char *nrm, *grn, *cyn, *yel; /* Descriptor access macros. */ -#define OLC(d) ((d)->olc) -#define OLC_MODE(d) (OLC(d)->mode) /* Parse input mode. */ -#define OLC_NUM(d) (OLC(d)->number) /* Room/Obj VNUM. */ -#define OLC_VAL(d) (OLC(d)->value) /* Scratch variable. */ -#define OLC_ZNUM(d) (OLC(d)->zone_num) /* Real zone number. */ +#define OLC(d) ((d)->olc) +#define OLC_MODE(d) (OLC(d)->mode) /**< Parse input mode. */ +#define OLC_NUM(d) (OLC(d)->number) /**< Room/Obj VNUM. */ +#define OLC_VAL(d) (OLC(d)->value) /**< Scratch variable. */ +#define OLC_ZNUM(d) (OLC(d)->zone_num) /**< Real zone number. */ -#define OLC_STORAGE(d) (OLC(d)->storage) /* char pointer. */ -#define OLC_ROOM(d) (OLC(d)->room) /* Room structure. */ -#define OLC_OBJ(d) (OLC(d)->obj) /* Object structure. */ -#define OLC_ZONE(d) (OLC(d)->zone) /* Zone structure. */ -#define OLC_MOB(d) (OLC(d)->mob) /* Mob structure. */ -#define OLC_SHOP(d) (OLC(d)->shop) /* Shop structure. */ -#define OLC_DESC(d) (OLC(d)->desc) /* Extra description. */ -#define OLC_CONFIG(d) (OLC(d)->config) /* Config structure. */ -#define OLC_TRIG(d) (OLC(d)->trig) /* Trigger structure. */ +#define OLC_STORAGE(d) (OLC(d)->storage) /**< char pointer. */ +#define OLC_ROOM(d) (OLC(d)->room) /**< Room structure. */ +#define OLC_OBJ(d) (OLC(d)->obj) /**< Object structure. */ +#define OLC_ZONE(d) (OLC(d)->zone) /**< Zone structure. */ +#define OLC_MOB(d) (OLC(d)->mob) /**< Mob structure. */ +#define OLC_SHOP(d) (OLC(d)->shop) /**< Shop structure. */ +#define OLC_DESC(d) (OLC(d)->desc) /**< Extra description. */ +#define OLC_CONFIG(d) (OLC(d)->config) /**< Config structure. */ +#define OLC_TRIG(d) (OLC(d)->trig) /**< Trigger structure. */ +#define OLC_QUEST(d) (OLC(d)->quest) /**< Quest structure */ -#define OLC_ACTION(d) (OLC(d)->action) /* Action structure */ -#define OLC_HELP(d) (OLC(d)->help) /* Hedit structure */ +#define OLC_ACTION(d) (OLC(d)->action) /**< Action structure */ +#define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */ /* Other macros. */ #define OLC_EXIT(d) (OLC_ROOM(d)->dir_option[OLC_VAL(d)]) @@ -355,6 +347,9 @@ extern const char *nrm, *grn, *cyn, *yel; #define CEDIT_NAMESERVER_IS_SLOW 51 #define CEDIT_USE_AUTOWIZ 52 #define CEDIT_MIN_WIZLIST_LEV 53 +#define CEDIT_MAP_OPTION 54 +#define CEDIT_MAP_SIZE 55 +#define CEDIT_MINIMAP_SIZE 56 /* Hedit Submodes of connectedness. */ #define HEDIT_CONFIRM_SAVESTRING 0 @@ -365,25 +360,29 @@ extern const char *nrm, *grn, *cyn, *yel; #define HEDIT_KEYWORDS 5 #define HEDIT_MIN_LEVEL 6 -#ifndef __GENOLC_C__ +int save_config( IDXTYPE nowhere ); /* Prototypes to keep. */ -#ifndef ACMD -#define ACMD(name) \ - void name(struct char_data *ch, char *argument, int cmd, int subcmd) -#endif void clear_screen(struct descriptor_data *); int can_edit_zone(struct char_data *ch, zone_rnum rnum); ACMD(do_oasis); +/* public functions from medit.c */ +void medit_setup_existing(struct descriptor_data *d, int rnum); +void medit_save_internally(struct descriptor_data *d); void medit_parse(struct descriptor_data *d, char *arg); void medit_string_cleanup(struct descriptor_data *d, int terminator); ACMD(do_oasis_medit); +/* public functions from oedit.c */ +void oedit_setup_existing(struct descriptor_data *d, int rnum); +void oedit_save_internally(struct descriptor_data *d); void oedit_parse(struct descriptor_data *d, char *arg); void oedit_string_cleanup(struct descriptor_data *d, int terminator); ACMD(do_oasis_oedit); +/* public functions from redit.c */ +void redit_setup_existing(struct descriptor_data *d, int rnum); void redit_string_cleanup(struct descriptor_data *d, int terminator); void redit_save_internally(struct descriptor_data *d); void redit_save_to_disk(zone_vnum zone_num); @@ -391,36 +390,56 @@ void redit_parse(struct descriptor_data *d, char *arg); void free_room(struct room_data *room); ACMD(do_oasis_redit); +/* public functions from sedit.c */ +void sedit_setup_existing(struct descriptor_data *d, int rnum); +void sedit_save_internally(struct descriptor_data *d); void sedit_parse(struct descriptor_data *d, char *arg); ACMD(do_oasis_sedit); +/* public functions from zedit.c */ void zedit_parse(struct descriptor_data *d, char *arg); ACMD(do_oasis_zedit); +/* public functions from cedit.c */ +void cedit_save_to_disk( void ); void cedit_parse(struct descriptor_data *d, char *arg); void cedit_string_cleanup(struct descriptor_data *d, int terminator); ACMD(do_oasis_cedit); +/* public functions from dg_olc.c */ void trigedit_parse(struct descriptor_data *d, char *arg); ACMD(do_oasis_trigedit); +/* public functions from from aedit.c */ void aedit_parse(struct descriptor_data * d, char *arg); -void free_action(struct social_messg *mess); ACMD(do_oasis_aedit); +ACMD(do_astat); +/* public functions from hedit.c */ void hedit_parse(struct descriptor_data *d, char *arg); void hedit_string_cleanup(struct descriptor_data *d, int terminator); void free_help(struct help_index_element *help); ACMD(do_oasis_hedit); +/* public functions from tedit.c */ void tedit_string_cleanup(struct descriptor_data *d, int terminator); ACMD(do_tedit); -/* oasis_delete.c */ +/* public functions from qedit.c */ +ACMD(do_oasis_qedit); + +/* public functions from oasis_copy.c */ +int buildwalk(struct char_data *ch, int dir); +ACMD(do_dig); +ACMD(do_oasis_copy); + +/* public functions from oasis_delete.c */ int free_strings(void *data, int type); -/* oasis_list.c */ -ACMD(do_oasis_list); -ACMD(do_oasis_links); +/* public functions from oasis_list.c */ void print_zone(struct char_data *ch, zone_rnum rnum); -#endif +/** @deprecated is do_oasis_links intentionally dead code? */ +ACMD(do_oasis_links); +ACMD(do_oasis_list); + +#endif /* _OASIS_H_ */ diff --git a/src/oasis_copy.c b/src/oasis_copy.c index 78b74cd..1726a8d 100644 --- a/src/oasis_copy.c +++ b/src/oasis_copy.c @@ -24,22 +24,9 @@ #include "constants.h" #include "dg_scripts.h" -/* Internal Functions */ -ACMD(do_dig); -room_vnum redit_find_new_vnum(zone_rnum zone); -int buildwalk(struct char_data *ch, int dir); - -/* External Functions */ -void trigedit_save(struct descriptor_data *d); -void redit_save_internally(struct descriptor_data *d); -void oedit_save_internally(struct descriptor_data *d); -void medit_save_internally(struct descriptor_data *d); -void sedit_save_internally(struct descriptor_data *d); -void trigedit_setup_existing(struct descriptor_data *d, int rnum); -void redit_setup_existing(struct descriptor_data *d, int rnum); -void oedit_setup_existing(struct descriptor_data *d, int rnum); -void medit_setup_existing(struct descriptor_data *d, int rnum); -void sedit_setup_existing(struct descriptor_data *d, int rnum); +/* Local, filescope function prototypes */ +/* Utility function for buildwalk */ +static room_vnum redit_find_new_vnum(zone_rnum zone); /*********************************************************** @@ -302,7 +289,7 @@ ACMD(do_dig) /* BuildWalk - OasisOLC Extension by D. Tyler Barnes. */ /* For buildwalk. Finds the next free vnum in the zone */ -room_vnum redit_find_new_vnum(zone_rnum zone) +static room_vnum redit_find_new_vnum(zone_rnum zone) { room_vnum vnum = genolc_zone_bottom(zone); room_rnum rnum = real_room(vnum); diff --git a/src/oasis_list.c b/src/oasis_list.c index 83a5c0c..85bdcc5 100644 --- a/src/oasis_list.c +++ b/src/oasis_list.c @@ -21,14 +21,15 @@ #include "screen.h" #include "constants.h" #include "dg_scripts.h" +#include "quest.h" /* local functions */ -void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax); -void list_rooms(struct char_data *ch , zone_rnum rnum, room_vnum vmin, room_vnum vmax); -void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin , mob_vnum vmax ); -void list_objects(struct char_data *ch, zone_rnum rnum, obj_vnum vmin , obj_vnum vmax ); -void list_shops(struct char_data *ch , zone_rnum rnum, shop_vnum vmin, shop_vnum vmax); -void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax); +static void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax); +static void list_rooms(struct char_data *ch , zone_rnum rnum, room_vnum vmin, room_vnum vmax); +static void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin , mob_vnum vmax ); +static void list_objects(struct char_data *ch, zone_rnum rnum, obj_vnum vmin , obj_vnum vmax ); +static void list_shops(struct char_data *ch , zone_rnum rnum, shop_vnum vmin, shop_vnum vmax); +static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax); /* Ingame Commands */ ACMD(do_oasis_list) @@ -67,6 +68,7 @@ ACMD(do_oasis_list) case SCMD_OASIS_RLIST: list_rooms(ch, rzone, vmin, vmax); break; case SCMD_OASIS_TLIST: list_triggers(ch, rzone, vmin, vmax); break; case SCMD_OASIS_SLIST: list_shops(ch, rzone, vmin, vmax); break; + case SCMD_OASIS_QLIST: list_quests(ch, rzone, vmin, vmax); break; case SCMD_OASIS_ZLIST: if (!*smin) list_zones(ch, NOWHERE, 0, zone_table[top_of_zone_table].number); @@ -133,7 +135,7 @@ ACMD(do_oasis_links) /* Helper Functions */ /* List all rooms in a zone. */ -void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax) +static void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax) { room_rnum i; room_vnum bottom, top; @@ -187,7 +189,7 @@ void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum } /* List all mobiles in a zone. */ -void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum vmax) +static void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum vmax) { mob_rnum i; mob_vnum bottom, top; @@ -226,7 +228,7 @@ void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum } /* List all objects in a zone. */ -void list_objects(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax) +static void list_objects(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax) { obj_rnum i; obj_vnum bottom, top; @@ -266,7 +268,7 @@ void list_objects(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnu } /* List all shops in a zone. */ -void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum vmax) +static void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum vmax) { shop_rnum i; shop_vnum bottom, top; @@ -310,7 +312,7 @@ void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum } /* List all zones in the world (sort of like 'show zones'). */ -void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax) +static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax) { int counter = 0; zone_rnum i; @@ -349,7 +351,7 @@ void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum void print_zone(struct char_data *ch, zone_vnum vnum) { zone_rnum rnum; - int size_rooms, size_objects, size_mobiles, i; + int size_rooms, size_objects, size_mobiles, size_quests, i; room_vnum top, bottom; int largest_table; @@ -370,6 +372,7 @@ void print_zone(struct char_data *ch, zone_vnum vnum) size_rooms = 0; size_objects = 0; size_mobiles = 0; + size_quests = 0; top = zone_table[rnum].top; bottom = zone_table[rnum].bot; @@ -386,7 +389,8 @@ void print_zone(struct char_data *ch, zone_vnum vnum) if (mob_index[i].vnum >= bottom && mob_index[i].vnum <= top) size_mobiles++; } - + size_quests = count_quests(bottom, top); + /* Display all of the zone information at once. */ send_to_char(ch, "%sVirtual Number = %s%d\r\n" @@ -400,7 +404,8 @@ void print_zone(struct char_data *ch, zone_vnum vnum) "%sSize\r\n" "%s Rooms = %s%d\r\n" "%s Objects = %s%d\r\n" - "%s Mobiles = %s%d%s\r\n", + "%s Mobiles = %s%d\r\n" + "%s Quests = %s%d%s\r\n", QGRN, QCYN, zone_table[rnum].number, QGRN, QCYN, zone_table[rnum].name, QGRN, QCYN, zone_table[rnum].builders, @@ -413,11 +418,12 @@ void print_zone(struct char_data *ch, zone_vnum vnum) QGRN, QGRN, QCYN, size_rooms, QGRN, QCYN, size_objects, - QGRN, QCYN, size_mobiles, QNRM); + QGRN, QCYN, size_mobiles, + QGRN, QCYN, size_quests, QNRM); } /* List code by Ronald Evers. */ -void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax) +static void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax) { int i, bottom, top, counter = 0; char trgtypes[256]; diff --git a/src/objsave.c b/src/objsave.c index 1d850fe..e624ed5 100644 --- a/src/objsave.c +++ b/src/objsave.c @@ -11,12 +11,17 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "comm.h" #include "handler.h" #include "db.h" #include "interpreter.h" -#include "utils.h" #include "spells.h" +#include "act.h" +#include "class.h" +#include "config.h" +#include "modify.h" +#include "genolc.h" /* for strip_cr and sprintascii */ /* these factors should be unique integers */ #define RENT_FACTOR 1 @@ -25,48 +30,25 @@ #define LOC_INVENTORY 0 #define MAX_BAG_ROWS 5 -/* external variables */ -extern struct player_index_element *player_table; -extern int top_of_p_table; -extern int rent_file_timeout, crash_file_timeout; -extern int free_rent; -extern int min_rent_cost; -extern int max_obj_save; /* change in config.c */ - -/* Extern functions */ -ACMD(do_action); -SPECIAL(receptionist); -SPECIAL(cryogenicist); -int invalid_class(struct char_data *ch, struct obj_data *obj); -bitvector_t asciiflag_conv(char *flag); -int sprintascii(char *out, bitvector_t bits); - /* local functions */ -void Crash_extract_norent_eq(struct char_data *ch); -void auto_equip(struct char_data *ch, struct obj_data *obj, int location); -int Crash_offer_rent(struct char_data *ch, struct char_data *receptionist, int display, int factor); -int Crash_report_unrentables(struct char_data *ch, struct char_data *recep, struct obj_data *obj); -void Crash_report_rent(struct char_data *ch, struct char_data *recep, struct obj_data *obj, long *cost, long *nitems, int display, int factor); -struct obj_data *Obj_from_store(struct obj_file_elem object, int *location); -void update_obj_file(void); -int gen_receptionist(struct char_data *ch, struct char_data *recep, int cmd, char *arg, int mode); -int Crash_save(struct obj_data *obj, FILE *fp, int location); -void Crash_rent_deadline(struct char_data *ch, struct char_data *recep, long cost); -void Crash_restore_weight(struct obj_data *obj); -void Crash_extract_objs(struct obj_data *obj); -int Crash_is_unrentable(struct obj_data *obj); -void Crash_extract_norents(struct obj_data *obj); -void Crash_extract_expensive(struct obj_data *obj); -void Crash_calculate_rent(struct obj_data *obj, int *cost); -void Crash_rentsave(struct char_data *ch, int cost); -void Crash_cryosave(struct char_data *ch, int cost); -int Crash_load_objs(struct char_data *ch); -void tag_argument(char *argument, char *tag); -int handle_obj(struct obj_data *obj, struct char_data *ch, int locate, struct obj_data **cont_rows); -obj_save_data *objsave_parse_objects(FILE *fl); -int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, struct char_data *ch); -int objsave_save_obj_record(struct obj_data *obj, FILE *fl, int location); -void strip_cr(char *buffer); +static int Crash_save(struct obj_data *obj, FILE *fp, int location); +static void Crash_extract_norent_eq(struct char_data *ch); +static void auto_equip(struct char_data *ch, struct obj_data *obj, int location); +static int Crash_offer_rent(struct char_data *ch, struct char_data *receptionist, int display, int factor); +static int Crash_report_unrentables(struct char_data *ch, struct char_data *recep, struct obj_data *obj); +static void Crash_report_rent(struct char_data *ch, struct char_data *recep, struct obj_data *obj, long *cost, long *nitems, int display, int factor); +static int gen_receptionist(struct char_data *ch, struct char_data *recep, int cmd, char *arg, int mode); +static void Crash_rent_deadline(struct char_data *ch, struct char_data *recep, long cost); +static void Crash_restore_weight(struct obj_data *obj); +static void Crash_extract_objs(struct obj_data *obj); +static int Crash_is_unrentable(struct obj_data *obj); +static void Crash_extract_norents(struct obj_data *obj); +static void Crash_extract_expensive(struct obj_data *obj); +static void Crash_calculate_rent(struct obj_data *obj, int *cost); +static void Crash_cryosave(struct char_data *ch, int cost); +static int Crash_load_objs(struct char_data *ch); +static int handle_obj(struct obj_data *obj, struct char_data *ch, int locate, struct obj_data **cont_rows); +static int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, struct char_data *ch); /* Writes one object record to FILE. Old name: Obj_to_store() */ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate) @@ -182,7 +164,7 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate) #undef TEST_OBJN /* AutoEQ by Burkhard Knopf. */ -void auto_equip(struct char_data *ch, struct obj_data *obj, int location) +static void auto_equip(struct char_data *ch, struct obj_data *obj, int location) { int j; @@ -356,7 +338,7 @@ int Crash_clean_file(char *name) if ((rentcode == RENT_CRASH) || (rentcode == RENT_FORCED) || (rentcode == RENT_TIMEDOUT) ) { - if (timed < time(0) - (crash_file_timeout * SECS_PER_REAL_DAY)) { + if (timed < time(0) - (CONFIG_CRASH_TIMEOUT * SECS_PER_REAL_DAY)) { Crash_delete_file(name); switch (rentcode) { case RENT_CRASH: @@ -377,7 +359,7 @@ int Crash_clean_file(char *name) } /* Must retrieve rented items w/in 30 days */ } else if (rentcode == RENT_RENTED) - if (timed < time(0) - (rent_file_timeout * SECS_PER_REAL_DAY)) { + if (timed < time(0) - (CONFIG_RENT_TIMEOUT * SECS_PER_REAL_DAY)) { Crash_delete_file(name); log(" Deleting %s's rent file.", name); return TRUE; @@ -470,7 +452,7 @@ int Crash_load(struct char_data *ch) return (Crash_load_objs(ch)); } -int Crash_save(struct obj_data *obj, FILE *fp, int location) +static int Crash_save(struct obj_data *obj, FILE *fp, int location) { struct obj_data *tmp; int result; @@ -490,7 +472,7 @@ int Crash_save(struct obj_data *obj, FILE *fp, int location) return (TRUE); } -void Crash_restore_weight(struct obj_data *obj) +static void Crash_restore_weight(struct obj_data *obj) { if (obj) { Crash_restore_weight(obj->contains); @@ -502,7 +484,7 @@ void Crash_restore_weight(struct obj_data *obj) /* Get !RENT items from equipment to inventory and extract !RENT out of worn * containers. */ -void Crash_extract_norent_eq(struct char_data *ch) +static void Crash_extract_norent_eq(struct char_data *ch) { int j; @@ -517,7 +499,7 @@ void Crash_extract_norent_eq(struct char_data *ch) } } -void Crash_extract_objs(struct obj_data *obj) +static void Crash_extract_objs(struct obj_data *obj) { if (obj) { Crash_extract_objs(obj->contains); @@ -526,7 +508,7 @@ void Crash_extract_objs(struct obj_data *obj) } } -int Crash_is_unrentable(struct obj_data *obj) +static int Crash_is_unrentable(struct obj_data *obj) { if (!obj) return FALSE; @@ -542,7 +524,7 @@ int Crash_is_unrentable(struct obj_data *obj) return FALSE; } -void Crash_extract_norents(struct obj_data *obj) +static void Crash_extract_norents(struct obj_data *obj) { if (obj) { Crash_extract_norents(obj->contains); @@ -552,7 +534,7 @@ void Crash_extract_norents(struct obj_data *obj) } } -void Crash_extract_expensive(struct obj_data *obj) +static void Crash_extract_expensive(struct obj_data *obj) { struct obj_data *tobj, *max; @@ -563,7 +545,7 @@ void Crash_extract_expensive(struct obj_data *obj) extract_obj(max); } -void Crash_calculate_rent(struct obj_data *obj, int *cost) +static void Crash_calculate_rent(struct obj_data *obj, int *cost) { if (obj) { *cost += MAX(0, GET_OBJ_RENT(obj)); @@ -725,7 +707,7 @@ void Crash_rentsave(struct char_data *ch, int cost) Crash_extract_objs(ch->carrying); } -int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, struct char_data *ch) +static int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, struct char_data *ch) { if (fprintf(fl, "%d %ld %d %d %d %d\r\n", rentcode, @@ -743,7 +725,7 @@ int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, struct char } -void Crash_cryosave(struct char_data *ch, int cost) +static void Crash_cryosave(struct char_data *ch, int cost) { char buf[MAX_INPUT_LENGTH]; int j; @@ -787,7 +769,7 @@ void Crash_cryosave(struct char_data *ch, int cost) } /* Routines used for the receptionist. */ -void Crash_rent_deadline(struct char_data *ch, struct char_data *recep, +static void Crash_rent_deadline(struct char_data *ch, struct char_data *recep, long cost) { long rent_deadline; @@ -802,7 +784,7 @@ void Crash_rent_deadline(struct char_data *ch, struct char_data *recep, act(buf, FALSE, recep, 0, ch, TO_VICT); } -int Crash_report_unrentables(struct char_data *ch, struct char_data *recep, +static int Crash_report_unrentables(struct char_data *ch, struct char_data *recep, struct obj_data *obj) { char buf[128]; @@ -820,7 +802,7 @@ int Crash_report_unrentables(struct char_data *ch, struct char_data *recep, return (has_norents); } -void Crash_report_rent(struct char_data *ch, struct char_data *recep, struct +static void Crash_report_rent(struct char_data *ch, struct char_data *recep, struct obj_data *obj, long *cost, long *nitems, int display, int factor) { static char buf[256]; @@ -840,7 +822,7 @@ void Crash_report_rent(struct char_data *ch, struct char_data *recep, struct } } -int Crash_offer_rent(struct char_data *ch, struct char_data *receptionist, +static int Crash_offer_rent(struct char_data *ch, struct char_data *receptionist, int display, int factor) { char buf[MAX_INPUT_LENGTH]; @@ -854,7 +836,7 @@ int Crash_offer_rent(struct char_data *ch, struct char_data *receptionist, if (norent) return FALSE; - totalcost = min_rent_cost * factor; + totalcost = CONFIG_MIN_RENT_COST * factor; Crash_report_rent(ch, receptionist, ch->carrying, &totalcost, &numitems, display, factor); @@ -866,15 +848,15 @@ int Crash_offer_rent(struct char_data *ch, struct char_data *receptionist, FALSE, receptionist, 0, ch, TO_VICT); return FALSE; } - if (numitems > max_obj_save) { + if (numitems > CONFIG_MAX_OBJ_SAVE) { sprintf(buf, "$n tells you, 'Sorry, but I cannot store more than %d items.'", - max_obj_save); + CONFIG_MAX_OBJ_SAVE); act(buf, FALSE, receptionist, 0, ch, TO_VICT); return FALSE; } if (display) { sprintf(buf, "$n tells you, 'Plus, my %d coin fee..'", - min_rent_cost * factor); + CONFIG_MIN_RENT_COST * factor); act(buf, FALSE, receptionist, 0, ch, TO_VICT); sprintf(buf, "$n tells you, 'For a total of %ld coins%s.'", totalcost, (factor == RENT_FACTOR ? " per day" : "")); @@ -889,7 +871,7 @@ int Crash_offer_rent(struct char_data *ch, struct char_data *receptionist, return (totalcost); } -int gen_receptionist(struct char_data *ch, struct char_data *recep, int cmd, +static int gen_receptionist(struct char_data *ch, struct char_data *recep, int cmd, char *arg, int mode) { int cost; @@ -917,7 +899,7 @@ int gen_receptionist(struct char_data *ch, struct char_data *recep, int cmd, return (TRUE); } - if (free_rent) { + if (CONFIG_FREE_RENT) { act("$n tells you, 'Rent is free here. Just quit, and your objects will be saved!'", FALSE, recep, 0, ch, TO_VICT); return TRUE; @@ -1178,7 +1160,7 @@ obj_save_data *objsave_parse_objects(FILE *fl) return head; } -int Crash_load_objs(struct char_data *ch) { +static int Crash_load_objs(struct char_data *ch) { FILE *fl; char fname[MAX_STRING_LENGTH]; char line[READ_SIZE]; @@ -1265,7 +1247,7 @@ int Crash_load_objs(struct char_data *ch) { /* Little hoarding check. -gg 3/1/98 */ mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s (level %d) has %d objects (max %d).", - GET_NAME(ch), GET_LEVEL(ch), num_objs, max_obj_save); + GET_NAME(ch), GET_LEVEL(ch), num_objs, CONFIG_MAX_OBJ_SAVE); fclose(fl); @@ -1275,7 +1257,7 @@ int Crash_load_objs(struct char_data *ch) { return 1; } -int handle_obj(struct obj_data *temp, struct char_data *ch, int locate, struct obj_data **cont_row) +static int handle_obj(struct obj_data *temp, struct char_data *ch, int locate, struct obj_data **cont_row) { int j; struct obj_data *obj1; diff --git a/src/oedit.c b/src/oedit.c index 766145e..0aafb3c 100644 --- a/src/oedit.c +++ b/src/oedit.c @@ -8,10 +8,10 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "comm.h" #include "interpreter.h" #include "spells.h" -#include "utils.h" #include "db.h" #include "boards.h" #include "constants.h" @@ -22,33 +22,28 @@ #include "oasis.h" #include "improved-edit.h" #include "dg_olc.h" - -/* external variables */ -extern struct attack_hit_type attack_hit_text[]; -extern struct spell_info_type spell_info[]; -extern struct board_info_type board_info[]; +#include "fight.h" +#include "modify.h" /* local functions */ -void oedit_setup_new(struct descriptor_data *d); -void oedit_setup_existing(struct descriptor_data *d, int real_num); -void oedit_save_internally(struct descriptor_data *d); -void oedit_save_to_disk(int zone_num); -void oedit_disp_container_flags_menu(struct descriptor_data *d); -void oedit_disp_extradesc_menu(struct descriptor_data *d); -void oedit_disp_prompt_apply_menu(struct descriptor_data *d); -void oedit_liquid_type(struct descriptor_data *d); -void oedit_disp_apply_menu(struct descriptor_data *d); -void oedit_disp_weapon_menu(struct descriptor_data *d); -void oedit_disp_spells_menu(struct descriptor_data *d); -void oedit_disp_val1_menu(struct descriptor_data *d); -void oedit_disp_val2_menu(struct descriptor_data *d); -void oedit_disp_val3_menu(struct descriptor_data *d); -void oedit_disp_val4_menu(struct descriptor_data *d); -void oedit_disp_type_menu(struct descriptor_data *d); -void oedit_disp_extra_menu(struct descriptor_data *d); -void oedit_disp_wear_menu(struct descriptor_data *d); -void oedit_disp_menu(struct descriptor_data *d); -void oedit_disp_perm_menu(struct descriptor_data *d); +static void oedit_setup_new(struct descriptor_data *d); +static void oedit_disp_container_flags_menu(struct descriptor_data *d); +static void oedit_disp_extradesc_menu(struct descriptor_data *d); +static void oedit_disp_prompt_apply_menu(struct descriptor_data *d); +static void oedit_liquid_type(struct descriptor_data *d); +static void oedit_disp_apply_menu(struct descriptor_data *d); +static void oedit_disp_weapon_menu(struct descriptor_data *d); +static void oedit_disp_spells_menu(struct descriptor_data *d); +static void oedit_disp_val1_menu(struct descriptor_data *d); +static void oedit_disp_val2_menu(struct descriptor_data *d); +static void oedit_disp_val3_menu(struct descriptor_data *d); +static void oedit_disp_val4_menu(struct descriptor_data *d); +static void oedit_disp_type_menu(struct descriptor_data *d); +static void oedit_disp_extra_menu(struct descriptor_data *d); +static void oedit_disp_wear_menu(struct descriptor_data *d); +static void oedit_disp_menu(struct descriptor_data *d); +static void oedit_disp_perm_menu(struct descriptor_data *d); +static void oedit_save_to_disk(int zone_num); /* handy macro */ #define S_PRODUCT(s, i) ((s)->producing[(i)]) @@ -182,7 +177,7 @@ ACMD(do_oasis_oedit) GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); } -void oedit_setup_new(struct descriptor_data *d) +static void oedit_setup_new(struct descriptor_data *d) { CREATE(OLC_OBJ(d), struct obj_data, 1); @@ -284,14 +279,14 @@ void oedit_save_internally(struct descriptor_data *d) } } -void oedit_save_to_disk(int zone_num) +static void oedit_save_to_disk(int zone_num) { save_objects(zone_num); } /* Menu functions */ /* For container flags. */ -void oedit_disp_container_flags_menu(struct descriptor_data *d) +static void oedit_disp_container_flags_menu(struct descriptor_data *d) { char bits[MAX_STRING_LENGTH]; get_char_colors(d->character); @@ -309,7 +304,7 @@ void oedit_disp_container_flags_menu(struct descriptor_data *d) } /* For extra descriptions. */ -void oedit_disp_extradesc_menu(struct descriptor_data *d) +static void oedit_disp_extradesc_menu(struct descriptor_data *d) { struct extra_descr_data *extra_desc = OLC_DESC(d); @@ -330,7 +325,7 @@ void oedit_disp_extradesc_menu(struct descriptor_data *d) } /* Ask for *which* apply to edit. */ -void oedit_disp_prompt_apply_menu(struct descriptor_data *d) +static void oedit_disp_prompt_apply_menu(struct descriptor_data *d) { char apply_buf[MAX_STRING_LENGTH]; int counter; @@ -352,7 +347,7 @@ void oedit_disp_prompt_apply_menu(struct descriptor_data *d) } /* Ask for liquid type. */ -void oedit_liquid_type(struct descriptor_data *d) +static void oedit_liquid_type(struct descriptor_data *d) { int counter, columns = 0; @@ -368,7 +363,7 @@ void oedit_liquid_type(struct descriptor_data *d) } /* The actual apply to set. */ -void oedit_disp_apply_menu(struct descriptor_data *d) +static void oedit_disp_apply_menu(struct descriptor_data *d) { int counter, columns = 0; @@ -384,7 +379,7 @@ void oedit_disp_apply_menu(struct descriptor_data *d) } /* Weapon type. */ -void oedit_disp_weapon_menu(struct descriptor_data *d) +static void oedit_disp_weapon_menu(struct descriptor_data *d) { int counter, columns = 0; @@ -400,7 +395,7 @@ void oedit_disp_weapon_menu(struct descriptor_data *d) } /* Spell type. */ -void oedit_disp_spells_menu(struct descriptor_data *d) +static void oedit_disp_spells_menu(struct descriptor_data *d) { int counter, columns = 0; @@ -415,7 +410,7 @@ void oedit_disp_spells_menu(struct descriptor_data *d) } /* Object value #1 */ -void oedit_disp_val1_menu(struct descriptor_data *d) +static void oedit_disp_val1_menu(struct descriptor_data *d) { OLC_MODE(d) = OEDIT_VALUE_1; switch (GET_OBJ_TYPE(OLC_OBJ(d))) { @@ -459,7 +454,7 @@ void oedit_disp_val1_menu(struct descriptor_data *d) } /* Object value #2 */ -void oedit_disp_val2_menu(struct descriptor_data *d) +static void oedit_disp_val2_menu(struct descriptor_data *d) { OLC_MODE(d) = OEDIT_VALUE_2; switch (GET_OBJ_TYPE(OLC_OBJ(d))) { @@ -492,7 +487,7 @@ void oedit_disp_val2_menu(struct descriptor_data *d) } /* Object value #3 */ -void oedit_disp_val3_menu(struct descriptor_data *d) +static void oedit_disp_val3_menu(struct descriptor_data *d) { OLC_MODE(d) = OEDIT_VALUE_3; switch (GET_OBJ_TYPE(OLC_OBJ(d))) { @@ -523,7 +518,7 @@ void oedit_disp_val3_menu(struct descriptor_data *d) } /* Object value #4 */ -void oedit_disp_val4_menu(struct descriptor_data *d) +static void oedit_disp_val4_menu(struct descriptor_data *d) { OLC_MODE(d) = OEDIT_VALUE_4; switch (GET_OBJ_TYPE(OLC_OBJ(d))) { @@ -547,7 +542,7 @@ void oedit_disp_val4_menu(struct descriptor_data *d) } /* Object type. */ -void oedit_disp_type_menu(struct descriptor_data *d) +static void oedit_disp_type_menu(struct descriptor_data *d) { int counter, columns = 0; @@ -562,7 +557,7 @@ void oedit_disp_type_menu(struct descriptor_data *d) } /* Object extra flags. */ -void oedit_disp_extra_menu(struct descriptor_data *d) +static void oedit_disp_extra_menu(struct descriptor_data *d) { char bits[MAX_STRING_LENGTH]; int counter, columns = 0; @@ -581,7 +576,7 @@ void oedit_disp_extra_menu(struct descriptor_data *d) } /* Object perm flags. */ -void oedit_disp_perm_menu(struct descriptor_data *d) +static void oedit_disp_perm_menu(struct descriptor_data *d) { char bits[MAX_STRING_LENGTH]; int counter, columns = 0; @@ -598,7 +593,7 @@ void oedit_disp_perm_menu(struct descriptor_data *d) } /* Object wear flags. */ -void oedit_disp_wear_menu(struct descriptor_data *d) +static void oedit_disp_wear_menu(struct descriptor_data *d) { char bits[MAX_STRING_LENGTH]; int counter, columns = 0; @@ -616,7 +611,7 @@ void oedit_disp_wear_menu(struct descriptor_data *d) } /* Display main menu. */ -void oedit_disp_menu(struct descriptor_data *d) +static void oedit_disp_menu(struct descriptor_data *d) { char buf1[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH]; diff --git a/src/pfdefaults.h b/src/pfdefaults.h index 12f789b..2c5e8db 100644 --- a/src/pfdefaults.h +++ b/src/pfdefaults.h @@ -1,8 +1,12 @@ -/************************************************************************** -* File: pfdefaults.h Part of tbaMUD * -* Usage: ASCII player file defaults. * -**************************************************************************/ - +/** +* @file pfdefaults.h +* ASCII player file defaults. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This set of code was not originally part of the circlemud distribution. +*/ #ifndef _PFDEFAULTS_H_ #define _PFDEFAULTS_H_ @@ -50,7 +54,10 @@ #define PFDEF_DRUNK 0 #define PFDEF_OLC NOWHERE #define PFDEF_PAGELENGTH 22 +#define PFDEF_SCREENWIDTH 80 #define PFDEF_QUESTPOINTS 0 +#define PFDEF_QUESTCOUNT 0 +#define PFDEF_COMPQUESTS 0 +#define PFDEF_CURRQUEST NOTHING -#endif - +#endif /* _PFDEFAULTS_H_ */ diff --git a/src/players.c b/src/players.c index ceda24f..54d310b 100644 --- a/src/players.c +++ b/src/players.c @@ -18,37 +18,35 @@ #include "dg_scripts.h" #include "comm.h" #include "interpreter.h" +#include "genolc.h" /* for strip_cr */ +#include "config.h" /* for pclean_criteria[] */ +#include "spells.h" /* for NUM_OF_SAVING_THROWS */ +#include "dg_scripts.h" /* To enable saving of player variables to disk */ +#include "quest.h" #define LOAD_HIT 0 #define LOAD_MANA 1 #define LOAD_MOVE 2 #define LOAD_STRENGTH 3 +/* 'global' vars defined here and used externally */ +/** @deprecated Since this file really is basically a functional extension + * of the database handling in db.c, until the day that the mud is broken + * down to be less monolithic, I don't see why the following should be defined + * anywhere but there. +struct player_index_element *player_table = NULL; +int top_of_p_table = 0; +int top_of_p_file = 0; +long top_idnum = 0; +*/ + /* local functions */ -void build_player_index(void); -int sprintascii(char *out, bitvector_t bits); -void tag_argument(char *argument, char *tag); -void load_affects(FILE *fl, struct char_data *ch); -void load_skills(FILE *fl, struct char_data *ch); -void load_HMVS(struct char_data *ch, const char *line, int mode); -void write_aliases_ascii(FILE *file, struct char_data *ch); -void read_aliases_ascii(FILE *file, struct char_data *ch, int count); - -/* external fuctions */ -bitvector_t asciiflag_conv(char *flag); -void save_char_vars(struct char_data *ch); -void save_char_vars_ascii(FILE *file, struct char_data *ch); -void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count); -void strip_cr(char *buffer); - -/* 'global' vars */ -struct player_index_element *player_table = NULL; /* index to plr file */ -int top_of_p_table = 0; /* ref to top of table */ -int top_of_p_file = 0; /* ref of size of p file */ -long top_idnum = 0; /* highest idnum in use */ - -/* external ASCII Player Files vars */ -extern struct pclean_criteria_data pclean_criteria[]; +static void load_affects(FILE *fl, struct char_data *ch); +static void load_skills(FILE *fl, struct char_data *ch); +static void load_quests(FILE *fl, struct char_data *ch); +static void load_HMVS(struct char_data *ch, const char *line, int mode); +static void write_aliases_ascii(FILE *file, struct char_data *ch); +static void read_aliases_ascii(FILE *file, struct char_data *ch, int count); /* New version to build player index for ASCII Player Files. Generate index * table for the player file. */ @@ -81,7 +79,7 @@ void build_player_index(void) for (i = 0; i < rec_count; i++) { get_line(plr_index, line); sscanf(line, "%ld %s %d %s %ld", &player_table[i].id, arg2, - &player_table[i].level, bits, &player_table[i].last); + &player_table[i].level, bits, (long *)&player_table[i].last); CREATE(player_table[i].name, char, strlen(arg2) + 1); strcpy(player_table[i].name, arg2); player_table[i].flags = asciiflag_conv(bits); @@ -139,7 +137,7 @@ void save_player_index(void) sprintascii(bits, player_table[i].flags); fprintf(index_file, "%ld %s %d %s %ld\n", player_table[i].id, player_table[i].name, player_table[i].level, *bits ? bits : "0", - player_table[i].last); + (long)player_table[i].last); } fprintf(index_file, "~\n"); @@ -196,8 +194,6 @@ char *get_name_by_id(long id) } /* Stuff related to the save/load player system. */ -#define NUM_OF_SAVE_THROWS 5 - /* New load_char reads ASCII Player Files. Load a char, TRUE if loaded, FALSE * if not. */ int load_char(const char *name, struct char_data *ch) @@ -228,7 +224,7 @@ int load_char(const char *name, struct char_data *ch) GET_HEIGHT(ch) = PFDEF_HEIGHT; GET_WEIGHT(ch) = PFDEF_WEIGHT; GET_ALIGNMENT(ch) = PFDEF_ALIGNMENT; - for (i = 0; i < NUM_OF_SAVE_THROWS; i++) + for (i = 0; i < NUM_OF_SAVING_THROWS; i++) GET_SAVE(ch, i) = PFDEF_SAVETHROW; GET_LOADROOM(ch) = PFDEF_LOADROOM; GET_INVIS_LEV(ch) = PFDEF_INVISLEV; @@ -260,11 +256,15 @@ int load_char(const char *name, struct char_data *ch) GET_MAX_MOVE(ch) = PFDEF_MAXMOVE; GET_OLC_ZONE(ch) = PFDEF_OLC; GET_PAGE_LENGTH(ch) = PFDEF_PAGELENGTH; + GET_SCREEN_WIDTH(ch) = PFDEF_SCREENWIDTH; GET_ALIASES(ch) = NULL; SITTING(ch) = NULL; NEXT_SITTING(ch) = NULL; GET_QUESTPOINTS(ch) = PFDEF_QUESTPOINTS; - + GET_QUEST_COUNTER(ch) = PFDEF_QUESTCOUNT; + GET_QUEST(ch) = PFDEF_CURRQUEST; + GET_NUM_QUESTS(ch) = PFDEF_COMPQUESTS; + for (i = 0; i < AF_ARRAY_MAX; i++) AFF_FLAGS(ch)[i] = PFDEF_AFFFLAGS; for (i = 0; i < PM_ARRAY_MAX; i++) @@ -387,6 +387,10 @@ int load_char(const char *name, struct char_data *ch) case 'Q': if (!strcmp(tag, "Qstp")) GET_QUESTPOINTS(ch) = atoi(line); + else if (!strcmp(tag, "Qpnt")) GET_QUESTPOINTS(ch) = atoi(line); /* Backward compatibility */ + else if (!strcmp(tag, "Qcur")) GET_QUEST(ch) = atoi(line); + else if (!strcmp(tag, "Qcnt")) GET_QUEST_COUNTER(ch) = atoi(line); + else if (!strcmp(tag, "Qest")) load_quests(fl, ch); break; case 'R': @@ -395,6 +399,7 @@ int load_char(const char *name, struct char_data *ch) case 'S': if (!strcmp(tag, "Sex ")) GET_SEX(ch) = atoi(line); + else if (!strcmp(tag, "ScrW")) GET_SCREEN_WIDTH(ch) = atoi(line); else if (!strcmp(tag, "Skil")) load_skills(fl, ch); else if (!strcmp(tag, "Str ")) load_HMVS(ch, line, LOAD_STRENGTH); break; @@ -531,9 +536,9 @@ void save_char(struct char_data * ch) if (GET_LEVEL(ch) != PFDEF_LEVEL) fprintf(fl, "Levl: %d\n", GET_LEVEL(ch)); fprintf(fl, "Id : %ld\n", GET_IDNUM(ch)); - fprintf(fl, "Brth: %ld\n", ch->player.time.birth); + fprintf(fl, "Brth: %ld\n", (long)ch->player.time.birth); fprintf(fl, "Plyd: %d\n", ch->player.time.played); - fprintf(fl, "Last: %ld\n", ch->player.time.logon); + fprintf(fl, "Last: %ld\n", (long)ch->player.time.logon); if (GET_HOST(ch)) fprintf(fl, "Host: %s\n", GET_HOST(ch)); if (GET_HEIGHT(ch) != PFDEF_HEIGHT) fprintf(fl, "Hite: %d\n", GET_HEIGHT(ch)); @@ -598,8 +603,18 @@ void save_char(struct char_data * ch) if (GET_DAMROLL(ch) != PFDEF_DAMROLL) fprintf(fl, "Drol: %d\n", GET_DAMROLL(ch)); if (GET_OLC_ZONE(ch) != PFDEF_OLC) fprintf(fl, "Olc : %d\n", GET_OLC_ZONE(ch)); if (GET_PAGE_LENGTH(ch) != PFDEF_PAGELENGTH) fprintf(fl, "Page: %d\n", GET_PAGE_LENGTH(ch)); + if (GET_SCREEN_WIDTH(ch) != PFDEF_SCREENWIDTH) fprintf(fl, "ScrW: %d\n", GET_SCREEN_WIDTH(ch)); if (GET_QUESTPOINTS(ch) != PFDEF_QUESTPOINTS) fprintf(fl, "Qstp: %d\n", GET_QUESTPOINTS(ch)); + if (GET_QUEST_COUNTER(ch)!= PFDEF_QUESTCOUNT) fprintf(fl, "Qcnt: %d\n", GET_QUEST_COUNTER(ch)); + if (GET_NUM_QUESTS(ch) != PFDEF_COMPQUESTS) { + fprintf(fl, "Qest:\n"); + for (i = 0; i < GET_NUM_QUESTS(ch); i++) + fprintf(fl, "%d\n", ch->player_specials->saved.completed_quests[i]); + fprintf(fl, "%d\n", NOTHING); + } + if (GET_QUEST(ch) != PFDEF_CURRQUEST) fprintf(fl, "Qcur: %d\n", GET_QUEST(ch)); + /* Save skills */ if (GET_LEVEL(ch) < LVL_IMMORT) { fprintf(fl, "Skil:\n"); @@ -755,7 +770,7 @@ void clean_pfiles(void) * entries of the players that were just deleted. */ } -void load_affects(FILE *fl, struct char_data *ch) +static void load_affects(FILE *fl, struct char_data *ch) { int num = 0, num2 = 0, num3 = 0, num4 = 0, num5 = 0, i; char line[MAX_INPUT_LENGTH + 1]; @@ -777,7 +792,7 @@ void load_affects(FILE *fl, struct char_data *ch) } while (num != 0); } -void load_skills(FILE *fl, struct char_data *ch) +static void load_skills(FILE *fl, struct char_data *ch) { int num = 0, num2 = 0; char line[MAX_INPUT_LENGTH + 1]; @@ -790,7 +805,20 @@ void load_skills(FILE *fl, struct char_data *ch) } while (num != 0); } -void load_HMVS(struct char_data *ch, const char *line, int mode) +void load_quests(FILE *fl, struct char_data *ch) +{ + int num = NOTHING; + char line[MAX_INPUT_LENGTH + 1]; + + do { + get_line(fl, line); + sscanf(line, "%d", &num); + if (num != NOTHING) + add_completed_quest(ch, num); + } while (num != NOTHING); +} + +static void load_HMVS(struct char_data *ch, const char *line, int mode) { int num = 0, num2 = 0; @@ -820,7 +848,7 @@ void load_HMVS(struct char_data *ch, const char *line, int mode) } /* Aliases are now saved in pfiles only. */ -void write_aliases_ascii(FILE *file, struct char_data *ch) +static void write_aliases_ascii(FILE *file, struct char_data *ch) { struct alias_data *temp; int count = 0; @@ -844,7 +872,7 @@ void write_aliases_ascii(FILE *file, struct char_data *ch) } } -void read_aliases_ascii(FILE *file, struct char_data *ch, int count) +static void read_aliases_ascii(FILE *file, struct char_data *ch, int count) { int i; struct alias_data *temp; diff --git a/src/random.c b/src/random.c index 97052f6..54f4f6e 100644 --- a/src/random.c +++ b/src/random.c @@ -19,6 +19,11 @@ * THIS GENERATOR REPRESENTS THE MINIMUM STANDARD AGAINST WHICH OTHER * GENERATORS SHOULD BE JUDGED. */ +#include "conf.h" +#include "sysdep.h" +#include "structs.h" +#include "utils.h" /* for function prototypes */ + #define m (unsigned long)2147483647 #define q (unsigned long)127773 @@ -37,10 +42,6 @@ static unsigned long seed; -/* local functions */ -void circle_srandom(unsigned long initial_seed); -unsigned long circle_random(void); - void circle_srandom(unsigned long initial_seed) { seed = initial_seed; diff --git a/src/redit.c b/src/redit.c index cd19d06..a97ab11 100644 --- a/src/redit.c +++ b/src/redit.c @@ -20,16 +20,16 @@ #include "improved-edit.h" #include "dg_olc.h" #include "constants.h" +#include "modify.h" /* local functions */ -void redit_setup_new(struct descriptor_data *d); -void redit_setup_existing(struct descriptor_data *d, int real_num); -void redit_disp_extradesc_menu(struct descriptor_data *d); -void redit_disp_exit_menu(struct descriptor_data *d); -void redit_disp_exit_flag_menu(struct descriptor_data *d); -void redit_disp_flag_menu(struct descriptor_data *d); -void redit_disp_sector_menu(struct descriptor_data *d); -void redit_disp_menu(struct descriptor_data *d); +static void redit_setup_new(struct descriptor_data *d); +static void redit_disp_extradesc_menu(struct descriptor_data *d); +static void redit_disp_exit_menu(struct descriptor_data *d); +static void redit_disp_exit_flag_menu(struct descriptor_data *d); +static void redit_disp_flag_menu(struct descriptor_data *d); +static void redit_disp_sector_menu(struct descriptor_data *d); +static void redit_disp_menu(struct descriptor_data *d); /* Utils and exported functions. */ ACMD(do_oasis_redit) @@ -148,7 +148,7 @@ ACMD(do_oasis_redit) GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); } -void redit_setup_new(struct descriptor_data *d) +static void redit_setup_new(struct descriptor_data *d) { CREATE(OLC_ROOM(d), struct room_data, 1); @@ -298,7 +298,7 @@ void free_room(struct room_data *room) /* Menu functions */ /* For extra descriptions. */ -void redit_disp_extradesc_menu(struct descriptor_data *d) +static void redit_disp_extradesc_menu(struct descriptor_data *d) { struct extra_descr_data *extra_desc = OLC_DESC(d); @@ -319,7 +319,7 @@ void redit_disp_extradesc_menu(struct descriptor_data *d) } /* For exits. */ -void redit_disp_exit_menu(struct descriptor_data *d) +static void redit_disp_exit_menu(struct descriptor_data *d) { char door_buf[24]; /* if exit doesn't exist, alloc/create it */ @@ -358,7 +358,7 @@ void redit_disp_exit_menu(struct descriptor_data *d) } /* For exit flags. */ -void redit_disp_exit_flag_menu(struct descriptor_data *d) +static void redit_disp_exit_flag_menu(struct descriptor_data *d) { get_char_colors(d->character); write_to_output(d, "%s0%s) No door\r\n" @@ -368,7 +368,7 @@ void redit_disp_exit_flag_menu(struct descriptor_data *d) } /* For room flags. */ -void redit_disp_flag_menu(struct descriptor_data *d) +static void redit_disp_flag_menu(struct descriptor_data *d) { char bits[MAX_STRING_LENGTH]; int counter, columns = 0; @@ -386,7 +386,7 @@ void redit_disp_flag_menu(struct descriptor_data *d) } /* For sector type. */ -void redit_disp_sector_menu(struct descriptor_data *d) +static void redit_disp_sector_menu(struct descriptor_data *d) { int counter, columns = 0; @@ -400,7 +400,7 @@ void redit_disp_sector_menu(struct descriptor_data *d) } /* The main menu. */ -void redit_disp_menu(struct descriptor_data *d) +static void redit_disp_menu(struct descriptor_data *d) { char buf1[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH]; diff --git a/src/screen.h b/src/screen.h index 1ecccf9..463908d 100644 --- a/src/screen.h +++ b/src/screen.h @@ -1,12 +1,16 @@ -/************************************************************************** -* File: screen.h Part of tbaMUD * -* Usage: Header file with ANSI color codes for online color. * -* * -* 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. * -**************************************************************************/ +/** +* @file screen.h +* Header file with ANSI color codes for online color. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ +#ifndef _SCREEN_H_ +#define _SCREEN_H_ #define CNRM "\x1B[0;0m" /* "Normal" */ #define CNUL "" /* No Change */ @@ -175,3 +179,5 @@ #define QBKMAG CBKMAG(ch,C_SPR) #define QBKCYN CBKCYN(ch,C_SPR) #define QBKWHT CBKWHT(ch,C_SPR) + +#endif /* _SCREEN_H_ */ diff --git a/src/sedit.c b/src/sedit.c index 9fb079b..525a9c9 100644 --- a/src/sedit.c +++ b/src/sedit.c @@ -18,27 +18,20 @@ #include "genzon.h" #include "oasis.h" #include "constants.h" - -/* external functions */ -SPECIAL(shop_keeper); - -/* external variables */ -extern const char *trade_letters[]; -extern const char *shop_bits[]; +#include "shop.h" /* local functions */ -void sedit_setup_new(struct descriptor_data *d); -void sedit_setup_existing(struct descriptor_data *d, int rshop_num); -void sedit_save_internally(struct descriptor_data *d); -void sedit_save_to_disk(int zone_num); -void sedit_products_menu(struct descriptor_data *d); -void sedit_compact_rooms_menu(struct descriptor_data *d); -void sedit_rooms_menu(struct descriptor_data *d); -void sedit_namelist_menu(struct descriptor_data *d); -void sedit_shop_flags_menu(struct descriptor_data *d); -void sedit_no_trade_menu(struct descriptor_data *d); -void sedit_types_menu(struct descriptor_data *d); -void sedit_disp_menu(struct descriptor_data *d); +static void sedit_setup_new(struct descriptor_data *d); +static void sedit_save_to_disk(int zone_num); +static void sedit_products_menu(struct descriptor_data *d); +static void sedit_compact_rooms_menu(struct descriptor_data *d); +static void sedit_rooms_menu(struct descriptor_data *d); +static void sedit_namelist_menu(struct descriptor_data *d); +static void sedit_shop_flags_menu(struct descriptor_data *d); +static void sedit_no_trade_menu(struct descriptor_data *d); +static void sedit_types_menu(struct descriptor_data *d); +static void sedit_disp_menu(struct descriptor_data *d); + void sedit_save_internally(struct descriptor_data *d) { @@ -46,7 +39,7 @@ void sedit_save_internally(struct descriptor_data *d) add_shop(OLC_SHOP(d)); } -void sedit_save_to_disk(int num) +static void sedit_save_to_disk(int num) { save_shops(num); } @@ -174,7 +167,7 @@ ACMD(do_oasis_sedit) GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); } -void sedit_setup_new(struct descriptor_data *d) +static void sedit_setup_new(struct descriptor_data *d) { struct shop_data *shop; @@ -219,7 +212,7 @@ void sedit_setup_existing(struct descriptor_data *d, int rshop_num) } /* Menu functions */ -void sedit_products_menu(struct descriptor_data *d) +static void sedit_products_menu(struct descriptor_data *d) { struct shop_data *shop; int i; @@ -243,7 +236,7 @@ void sedit_products_menu(struct descriptor_data *d) OLC_MODE(d) = SEDIT_PRODUCTS_MENU; } -void sedit_compact_rooms_menu(struct descriptor_data *d) +static void sedit_compact_rooms_menu(struct descriptor_data *d) { struct shop_data *shop; int i; @@ -269,7 +262,7 @@ void sedit_compact_rooms_menu(struct descriptor_data *d) OLC_MODE(d) = SEDIT_ROOMS_MENU; } -void sedit_rooms_menu(struct descriptor_data *d) +static void sedit_rooms_menu(struct descriptor_data *d) { struct shop_data *shop; int i; @@ -300,7 +293,7 @@ void sedit_rooms_menu(struct descriptor_data *d) OLC_MODE(d) = SEDIT_ROOMS_MENU; } -void sedit_namelist_menu(struct descriptor_data *d) +static void sedit_namelist_menu(struct descriptor_data *d) { struct shop_data *shop; int i; @@ -324,7 +317,7 @@ void sedit_namelist_menu(struct descriptor_data *d) OLC_MODE(d) = SEDIT_NAMELIST_MENU; } -void sedit_shop_flags_menu(struct descriptor_data *d) +static void sedit_shop_flags_menu(struct descriptor_data *d) { char bits[MAX_STRING_LENGTH]; int i, count = 0; @@ -341,7 +334,7 @@ void sedit_shop_flags_menu(struct descriptor_data *d) OLC_MODE(d) = SEDIT_SHOP_FLAGS; } -void sedit_no_trade_menu(struct descriptor_data *d) +static void sedit_no_trade_menu(struct descriptor_data *d) { char bits[MAX_STRING_LENGTH]; int i, count = 0; @@ -358,7 +351,7 @@ void sedit_no_trade_menu(struct descriptor_data *d) OLC_MODE(d) = SEDIT_NOTRADE; } -void sedit_types_menu(struct descriptor_data *d) +static void sedit_types_menu(struct descriptor_data *d) { struct shop_data *shop; int i, count = 0; @@ -376,7 +369,7 @@ void sedit_types_menu(struct descriptor_data *d) } /* Display main menu. */ -void sedit_disp_menu(struct descriptor_data *d) +static void sedit_disp_menu(struct descriptor_data *d) { char buf1[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH]; diff --git a/src/shop.c b/src/shop.c index c43581d..927e764 100644 --- a/src/shop.c +++ b/src/shop.c @@ -9,9 +9,12 @@ * By Jeff Fink. * **************************************************************************/ +#define __SHOP_C__ + #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "comm.h" #include "handler.h" #include "db.h" @@ -19,73 +22,10 @@ #include "utils.h" #include "shop.h" #include "constants.h" +#include "act.h" +#include "modify.h" -/* External variables */ -extern struct time_info_data time_info; - -/* Forward/External function declarations */ -ACMD(do_tell); -ACMD(do_action); -ACMD(do_echo); -ACMD(do_say); -void sort_keeper_objs(struct char_data *keeper, int shop_nr); - -/* Local variables */ -int cmd_say, cmd_tell, cmd_emote, cmd_slap, cmd_puke; - -/* local functions */ -char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why); -int read_type_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max); -int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max, int type); -void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr); -void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr); -void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr); -struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_data *keeper, int shop_nr, int msg); -struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr); -void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr); -struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct char_data *keeper, int shop_nr, int msg); -struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struct obj_data *list); -struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, struct obj_data *list); -void boot_the_shops(FILE *shop_f, char *filename, int rec_count); -void assign_the_shopkeepers(void); -char *customer_string(int shop_nr, int detailed); -void list_all_shops(struct char_data *ch); -void list_detailed_shop(struct char_data *ch, int shop_nr); -void show_shops(struct char_data *ch, char *arg); -int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_nr); -int is_open(struct char_data *keeper, int shop_nr, int msg); -int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr); -void push(struct stack_data *stack, int pushval); -int top(struct stack_data *stack); -int pop(struct stack_data *stack); -void evaluate_operation(struct stack_data *ops, struct stack_data *vals); -int find_oper_num(char token); -int evaluate_expression(struct obj_data *obj, char *expr); -int trade_with(struct obj_data *item, int shop_nr); -int same_obj(struct obj_data *obj1, struct obj_data *obj2); -int shop_producing(struct obj_data *item, int shop_nr); -int transaction_amt(char *arg); -char *times_message(struct obj_data *obj, char *name, int num); -int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer); -int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller); -char *list_object(struct obj_data *obj, int cnt, int oindex, int shop_nr, struct char_data *keeper, struct char_data *seller); -int ok_shop_room(int shop_nr, room_vnum room); -SPECIAL(shop_keeper); -int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim); -int add_to_list(struct shop_buy_data *list, int type, int *len, int *val); -int end_read_list(struct shop_buy_data *list, int len, int error); -void read_line(FILE *shop_f, const char *string, void *data); -void destroy_shops(void); - -/* config arrays */ -const char *operator_str[] = { - "[({", - "])}", - "|+", - "&*", - "^'" -} ; - +/* Global variables definitions used externally */ /* Constant list for printing out who we sell to */ const char *trade_letters[] = { "Good", /* First, the alignment based ones */ @@ -105,7 +45,65 @@ const char *shop_bits[] = { "\n" }; -int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_nr) + +/* local (file scope) function prototypes */ +static void push(struct stack_data *stack, int pushval); /**< @todo Move to utils.c */ +static int top(struct stack_data *stack); /**< @todo Move to utils.c */ +static int pop(struct stack_data *stack); /**< @todo Move to utils.c */ +static char *list_object(struct obj_data *obj, int cnt, int oindex, int shop_nr, struct char_data *keeper, struct char_data *seller); +static int find_shop(int); +static void sort_keeper_objs(struct char_data *keeper, int shop_nr); +static char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why); +static int read_type_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max); +static int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max, int type); +static void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr); +static void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr); +static void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr); +static struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_data *keeper, int shop_nr, int msg); +static struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr); +static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr); +static struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct char_data *keeper, int shop_nr, int msg); +static struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struct obj_data *list); +static struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, struct obj_data *list); +static char *customer_string(int shop_nr, int detailed); +static void list_all_shops(struct char_data *ch); +static void list_detailed_shop(struct char_data *ch, int shop_nr); +static int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_nr); +static int is_open(struct char_data *keeper, int shop_nr, int msg); +static int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr); +static void evaluate_operation(struct stack_data *ops, struct stack_data *vals); +static int find_oper_num(char token); +static int evaluate_expression(struct obj_data *obj, char *expr); +static int trade_with(struct obj_data *item, int shop_nr); +static int same_obj(struct obj_data *obj1, struct obj_data *obj2); +static int shop_producing(struct obj_data *item, int shop_nr); +static int transaction_amt(char *arg); +static char *times_message(struct obj_data *obj, char *name, int num); +static int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer); +static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller); +static int ok_shop_room(int shop_nr, room_vnum room); +static int add_to_list(struct shop_buy_data *list, int type, int *len, int *val); +static int end_read_list(struct shop_buy_data *list, int len, int error); +static void read_line(FILE *shop_f, const char *string, void *data); + +/* Local file scope only variables */ +static int cmd_say; +static int cmd_tell; +static int cmd_emote; +static int cmd_slap; +static int cmd_puke; + +/* config arrays */ +static const char *operator_str[] = { + "[({", + "])}", + "|+", + "&*", + "^'" +} ; + + +static int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_nr) { char buf[MAX_INPUT_LENGTH]; @@ -138,7 +136,7 @@ int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_nr) return (TRUE); } -int is_open(struct char_data *keeper, int shop_nr, int msg) +static int is_open(struct char_data *keeper, int shop_nr, int msg) { char buf[MAX_INPUT_LENGTH]; @@ -158,7 +156,7 @@ int is_open(struct char_data *keeper, int shop_nr, int msg) return (FALSE); } -int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr) +static int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr) { if (is_open(keeper, shop_nr, TRUE)) return (is_ok_char(keeper, ch, shop_nr)); @@ -166,12 +164,12 @@ int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr) return (FALSE); } -void push(struct stack_data *stack, int pushval) +static void push(struct stack_data *stack, int pushval) { S_DATA(stack, S_LEN(stack)++) = pushval; } -int top(struct stack_data *stack) +static int top(struct stack_data *stack) { if (S_LEN(stack) > 0) return (S_DATA(stack, S_LEN(stack) - 1)); @@ -179,7 +177,7 @@ int top(struct stack_data *stack) return (-1); } -int pop(struct stack_data *stack) +static int pop(struct stack_data *stack) { if (S_LEN(stack) > 0) return (S_DATA(stack, --S_LEN(stack))); @@ -189,7 +187,7 @@ int pop(struct stack_data *stack) } } -void evaluate_operation(struct stack_data *ops, struct stack_data *vals) +static void evaluate_operation(struct stack_data *ops, struct stack_data *vals) { int oper; @@ -207,7 +205,7 @@ void evaluate_operation(struct stack_data *ops, struct stack_data *vals) } } -int find_oper_num(char token) +static int find_oper_num(char token) { int oindex; @@ -217,7 +215,7 @@ int find_oper_num(char token) return (NOTHING); } -int evaluate_expression(struct obj_data *obj, char *expr) +static int evaluate_expression(struct obj_data *obj, char *expr) { struct stack_data ops, vals; char *ptr, *end, name[MAX_STRING_LENGTH]; @@ -271,7 +269,7 @@ int evaluate_expression(struct obj_data *obj, char *expr) return (temp); } -int trade_with(struct obj_data *item, int shop_nr) +static int trade_with(struct obj_data *item, int shop_nr) { int counter; @@ -293,7 +291,7 @@ int trade_with(struct obj_data *item, int shop_nr) return (OBJECT_NOTOK); } -int same_obj(struct obj_data *obj1, struct obj_data *obj2) +static int same_obj(struct obj_data *obj1, struct obj_data *obj2) { int aindex; @@ -314,7 +312,7 @@ int same_obj(struct obj_data *obj1, struct obj_data *obj2) return (TRUE); } -int shop_producing(struct obj_data *item, int shop_nr) +static int shop_producing(struct obj_data *item, int shop_nr) { int counter; @@ -327,7 +325,7 @@ int shop_producing(struct obj_data *item, int shop_nr) return (FALSE); } -int transaction_amt(char *arg) +static int transaction_amt(char *arg) { char buf[MAX_INPUT_LENGTH]; @@ -343,7 +341,7 @@ int transaction_amt(char *arg) return (1); } -char *times_message(struct obj_data *obj, char *name, int num) +static char *times_message(struct obj_data *obj, char *name, int num) { static char buf[256]; size_t len; @@ -365,7 +363,7 @@ char *times_message(struct obj_data *obj, char *name, int num) return (buf); } -struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, struct obj_data *list) +static struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, struct obj_data *list) { struct obj_data *i, *last_match = NULL; int j, number; @@ -388,7 +386,7 @@ struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, struct obj_ return (NULL); } -struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struct obj_data *list) +static struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struct obj_data *list) { struct obj_data *loop, *last_obj = NULL; int qindex; @@ -410,7 +408,7 @@ struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struct obj_d return (NULL); } -struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct char_data *keeper, int shop_nr, int msg) +static struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct char_data *keeper, int shop_nr, int msg) { char name[MAX_INPUT_LENGTH]; struct obj_data *obj; @@ -454,7 +452,7 @@ struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct char_d discount beyond the basic price. That assumes they put a lot of points into charisma, because on the flip side they'd get 11% inflation by having a 3. */ -int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer) +static int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer) { return (int) (GET_OBJ_COST(obj) * SHOP_BUYPROFIT(shop_nr) * (1 + (GET_CHA(keeper) - GET_CHA(buyer)) / (float)70)); @@ -462,7 +460,7 @@ int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struc /* When the shopkeeper is buying, we reverse the discount. Also make sure we don't buy for more than we sell for, to prevent infinite money-making. */ -int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller) +static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller) { float sell_cost_modifier = SHOP_SELLPROFIT(shop_nr) * (1 - (GET_CHA(keeper) - GET_CHA(seller)) / (float)70); float buy_cost_modifier = SHOP_BUYPROFIT(shop_nr) * (1 + (GET_CHA(keeper) - GET_CHA(seller)) / (float)70); @@ -473,7 +471,7 @@ int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, stru return (int) (GET_OBJ_COST(obj) * sell_cost_modifier); } -void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) +static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) { char tempstr[MAX_INPUT_LENGTH], tempbuf[MAX_INPUT_LENGTH]; struct obj_data *obj, *last_obj = NULL; @@ -503,6 +501,16 @@ void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int if (!(obj = get_purchase_obj(ch, arg, keeper, shop_nr, TRUE))) return; + if (OBJ_FLAGGED(obj, ITEM_QUEST)) { + if (GET_OBJ_COST(obj) > GET_QUESTPOINTS(ch) && !IS_GOD(ch)) { + char actbuf[MAX_INPUT_LENGTH]; + snprintf(actbuf, sizeof(actbuf), + "%s You haven't earned enough quest points for such an item.", + GET_NAME(ch)); + do_tell(keeper, actbuf, cmd_tell, 0); + return; + } + } else { /*has the player got enough gold? */ if (buy_price(obj, shop_nr, keeper, ch) > GET_GOLD(ch) && !IS_GOD(ch)) { char actbuf[MAX_INPUT_LENGTH]; @@ -520,6 +528,7 @@ void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int return; } } + } if (IS_CARRYING_N(ch) + 1 > CAN_CARRY_N(ch)) { send_to_char(ch, "%s: You can't carry any more items.\r\n", fname(obj->name)); return; @@ -528,6 +537,32 @@ void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int send_to_char(ch, "%s: You can't carry that much weight.\r\n", fname(obj->name)); return; } + if (OBJ_FLAGGED(obj, ITEM_QUEST)) { + while (obj && + (GET_QUESTPOINTS(ch) >= GET_OBJ_COST(obj) || IS_GOD(ch)) + && IS_CARRYING_N(ch) < CAN_CARRY_N(ch) + && bought < buynum + && IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) <= CAN_CARRY_W(ch)) { + bought++; + /* Test if producing shop ! */ + if (shop_producing(obj, shop_nr)) { + obj = read_object(GET_OBJ_RNUM(obj), REAL); + } else { + obj_from_char(obj); + SHOP_SORT(shop_nr)--; + } + obj_to_char(obj, ch); + + goldamt += GET_OBJ_COST(obj); + if (!IS_GOD(ch)) + GET_QUESTPOINTS(ch) -= GET_OBJ_COST(obj); + + last_obj = obj; + obj = get_purchase_obj(ch, arg, keeper, shop_nr, FALSE); + if (!same_obj(obj, last_obj)) + break; + } + } else { while (obj && (GET_GOLD(ch) >= buy_price(obj, shop_nr, keeper, ch) || IS_GOD(ch)) && IS_CARRYING_N(ch) < CAN_CARRY_N(ch) && bought < buynum && IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) <= CAN_CARRY_W(ch)) { @@ -553,14 +588,19 @@ void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int if (!same_obj(obj, last_obj)) break; } - + } if (bought < buynum) { char buf[MAX_INPUT_LENGTH]; if (!obj || !same_obj(last_obj, obj)) snprintf(buf, sizeof(buf), "%s I only have %d to sell you.", GET_NAME(ch), bought); - else if (GET_GOLD(ch) < buy_price(obj, shop_nr, keeper, ch)) + else if (!OBJ_FLAGGED(obj, ITEM_QUEST) && + GET_GOLD(ch) < buy_price(obj, shop_nr, keeper, ch)) snprintf(buf, sizeof(buf), "%s You can only afford %d.", GET_NAME(ch), bought); + else if (OBJ_FLAGGED(obj, ITEM_QUEST) && + GET_QUESTPOINTS(ch) < GET_OBJ_COST(obj)) + snprintf(buf, sizeof(buf), "%s You only had sufficient quest points for %d.", + GET_NAME(ch), bought); else if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)) snprintf(buf, sizeof(buf), "%s You can only hold %d.", GET_NAME(ch), bought); else if (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) > CAN_CARRY_W(ch)) @@ -569,27 +609,31 @@ void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int snprintf(buf, sizeof(buf), "%s Something screwy only gave you %d.", GET_NAME(ch), bought); do_tell(keeper, buf, cmd_tell, 0); } - if (!IS_GOD(ch)) + if (!IS_GOD(ch) && !OBJ_FLAGGED(obj, ITEM_QUEST)) { GET_GOLD(keeper) += goldamt; - + if (SHOP_USES_BANK(shop_nr)) + if (GET_GOLD(keeper) > MAX_OUTSIDE_BANK) { + SHOP_BANK(shop_nr) += (GET_GOLD(keeper) - MAX_OUTSIDE_BANK); + GET_GOLD(keeper) = MAX_OUTSIDE_BANK; + } + } strlcpy(tempstr, times_message(ch->carrying, 0, bought), sizeof(tempstr)); snprintf(tempbuf, sizeof(tempbuf), "$n buys %s.", tempstr); act(tempbuf, FALSE, ch, obj, 0, TO_ROOM); - snprintf(tempbuf, sizeof(tempbuf), shop_index[shop_nr].message_buy, GET_NAME(ch), goldamt); + if (OBJ_FLAGGED(obj, ITEM_QUEST)) + snprintf(tempbuf, sizeof(tempbuf), "%s That has cost you %d quest points.", GET_NAME(ch), goldamt); + else + snprintf(tempbuf, sizeof(tempbuf), shop_index[shop_nr].message_buy, GET_NAME(ch), goldamt); + do_tell(keeper, tempbuf, cmd_tell, 0); send_to_char(ch, "You now have %s.\r\n", tempstr); - if (SHOP_USES_BANK(shop_nr)) - if (GET_GOLD(keeper) > MAX_OUTSIDE_BANK) { - SHOP_BANK(shop_nr) += (GET_GOLD(keeper) - MAX_OUTSIDE_BANK); - GET_GOLD(keeper) = MAX_OUTSIDE_BANK; - } } -struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_data *keeper, int shop_nr, int msg) +static struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_data *keeper, int shop_nr, int msg) { char buf[MAX_INPUT_LENGTH]; struct obj_data *obj; @@ -635,7 +679,7 @@ struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_d * is put together, and manipulating the order of the objects on the list. (But * since most of DIKU is not encapsulated, and information hiding is almost * never used, it isn't that big a deal). -JF */ -struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr) +static struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr) { struct obj_data *loop; int temp; @@ -665,7 +709,7 @@ struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int s return (obj); } -void sort_keeper_objs(struct char_data *keeper, int shop_nr) +static void sort_keeper_objs(struct char_data *keeper, int shop_nr) { struct obj_data *list = NULL, *temp; @@ -688,7 +732,7 @@ void sort_keeper_objs(struct char_data *keeper, int shop_nr) } } -void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) +static void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) { char tempstr[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH], tempbuf[MAX_INPUT_LENGTH]; struct obj_data *obj; @@ -765,7 +809,7 @@ void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, in } } -void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) +static void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) { char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH]; struct obj_data *obj; @@ -786,7 +830,7 @@ void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, i do_tell(keeper, buf, cmd_tell, 0); } -char *list_object(struct obj_data *obj, int cnt, int aindex, int shop_nr, struct char_data *keeper, struct char_data *ch) +static char *list_object(struct obj_data *obj, int cnt, int aindex, int shop_nr, struct char_data *keeper, struct char_data *ch) { static char result[256]; char itemname[128], @@ -817,18 +861,21 @@ char *list_object(struct obj_data *obj, int cnt, int aindex, int shop_nr, struct } CAP(itemname); - snprintf(result, sizeof(result), " %2d) %9s %-*s %6d\r\n", aindex, quantity, count_color_chars(itemname)+48, itemname, buy_price(obj, shop_nr, keeper, ch)); + snprintf(result, sizeof(result), " %2d) %9s %-*s %6d%s\r\n", + aindex, quantity, count_color_chars(itemname)+48, itemname, + buy_price(obj, shop_nr, keeper, ch), OBJ_FLAGGED(obj, ITEM_QUEST) ? " qp" : ""); return (result); } -void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) +static void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) { char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH]; struct obj_data *obj, *last_obj = NULL; - int cnt = 0, lindex = 0, found = FALSE; + int cnt = 0, lindex = 0, found = FALSE, has_quest = FALSE; size_t len; /* cnt is the number of that particular object available */ + /* has_quest indicates if the shopkeeper sells quest items */ if (!is_ok(keeper, ch, shop_nr)) return; @@ -839,7 +886,7 @@ void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, in one_argument(arg, name); len = strlcpy(buf, " ## Available Item Cost\r\n" - "-------------------------------------------------------------------------\r\n", sizeof(buf)); + "----------------------------------------------------------------------------\r\n", sizeof(buf)); if (keeper->carrying) for (obj = keeper->carrying; obj; obj = obj->next_content) if (CAN_SEE_OBJ(ch, obj) && GET_OBJ_COST(obj) > 0) { @@ -856,7 +903,9 @@ void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, in if (len + 1 >= sizeof(buf)) break; found = TRUE; - } + if (OBJ_FLAGGED(last_obj, ITEM_QUEST)) + has_quest = TRUE; + } cnt = 1; last_obj = obj; } @@ -871,10 +920,12 @@ void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, in if (len < sizeof(buf)) strncat(buf, list_object(last_obj, cnt, lindex, shop_nr, keeper, ch), sizeof(buf) - len - 1); /* strncat: OK */ page_string(ch->desc, buf, TRUE); + if (has_quest) + send_to_char(ch, "Items flagged \"qp\" require quest points to purchase.\r\n"); } } -int ok_shop_room(int shop_nr, room_vnum room) +static int ok_shop_room(int shop_nr, room_vnum room) { int mindex; @@ -963,7 +1014,7 @@ int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim) } /* val == obj_vnum and obj_rnum (?) */ -int add_to_list(struct shop_buy_data *list, int type, int *len, int *val) +static int add_to_list(struct shop_buy_data *list, int type, int *len, int *val) { if (*val != NOTHING && *val >= 0) { /* necessary after changing to unsigned v/rnums -- Welcor */ if (*len < MAX_SHOP_OBJ) { @@ -981,7 +1032,7 @@ int add_to_list(struct shop_buy_data *list, int type, int *len, int *val) return (FALSE); } -int end_read_list(struct shop_buy_data *list, int len, int error) +static int end_read_list(struct shop_buy_data *list, int len, int error) { if (error) log("SYSERR: Raise MAX_SHOP_OBJ constant in shop.h to %d", len + error); @@ -990,7 +1041,7 @@ int end_read_list(struct shop_buy_data *list, int len, int error) return (len); } -void read_line(FILE *shop_f, const char *string, void *data) +static void read_line(FILE *shop_f, const char *string, void *data) { char buf[READ_SIZE]; @@ -1000,7 +1051,7 @@ void read_line(FILE *shop_f, const char *string, void *data) } } -int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format, +static int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max, int type) { int count, temp, len = 0, error = 0; @@ -1021,7 +1072,7 @@ int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format, } /* END_OF inefficient. */ -int read_type_list(FILE *shop_f, struct shop_buy_data *list, +static int read_type_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max) { int tindex, num, len = 0, error = 0; @@ -1067,7 +1118,7 @@ int read_type_list(FILE *shop_f, struct shop_buy_data *list, return (end_read_list(list, len, error)); } -char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why) +static char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why) { int cht, ss = 0, ds = 0, err = 0; char *tbuf; @@ -1205,7 +1256,7 @@ void assign_the_shopkeepers(void) } } -char *customer_string(int shop_nr, int detailed) +static char *customer_string(int shop_nr, int detailed) { int sindex = 0, flag = 1, nlen; size_t len = 0; @@ -1238,7 +1289,7 @@ char *customer_string(int shop_nr, int detailed) } /* END_OF inefficient */ -void list_all_shops(struct char_data *ch) +static void list_all_shops(struct char_data *ch) { const char *list_all_shops_header = " ## Virtual Where Keeper Buy Sell Customers\r\n" @@ -1276,11 +1327,11 @@ void list_all_shops(struct char_data *ch) page_string(ch->desc, buf, TRUE); } -void list_detailed_shop(struct char_data *ch, int shop_nr) +static void list_detailed_shop(struct char_data *ch, int shop_nr) { struct char_data *k; - int sindex, column; - char *ptrsave; + int sindex, column, flag = 1, found = 0; + /* char *ptrsave; */ send_to_char(ch, "Vnum: [%5d], Rnum: [%5d]\r\n", SHOP_NUM(shop_nr), shop_nr + 1); @@ -1327,7 +1378,33 @@ void list_detailed_shop(struct char_data *ch, int shop_nr) } else send_to_char(ch, "\r\n"); - send_to_char(ch, "Customers: %s\r\n", (ptrsave = customer_string(shop_nr, TRUE)) ? ptrsave : "None"); + /* send_to_char(ch, "Customers: %s\r\n", (ptrsave = customer_string(shop_nr, TRUE)) ? ptrsave : "None"); */ + send_to_char(ch, "Customers: "); + column = 12; /* ^^^ strlen ^^^ */ + for (sindex = 0; *trade_letters[sindex] != '\n'; sindex++) { + char buf1[128]; + int linelen; + + if (!IS_SET(flag, SHOP_TRADE_WITH(shop_nr))){ + if (sindex) { + send_to_char(ch, ", "); + column += 2; + } + linelen = snprintf(buf1, sizeof(buf1), "%s", trade_letters[sindex]); + /* Implementing word-wrapping: assumes screen-size == 80 */ + if (linelen + column >= 78 && column >= 20) { + send_to_char(ch, "\r\n "); + column = 12; + } + + if (!send_to_char(ch, "%s", buf1)) + return; + column += linelen; + found = TRUE; + } + flag <<= 1; /* next flag */ + } + send_to_char(ch, "%s\r\n", found ? "" : "Nobody!"); send_to_char(ch, "Produces: "); column = 12; /* ^^^ strlen ^^^ */ @@ -1468,7 +1545,7 @@ void destroy_shops(void) top_shop = -1; } -int find_shop(int vnum) +static int find_shop(int vnum) { int bot, mid, top; diff --git a/src/shop.h b/src/shop.h index bcd0e70..50ed8a7 100644 --- a/src/shop.h +++ b/src/shop.h @@ -1,14 +1,24 @@ -/************************************************************************** -* File: shop.h Part of tbaMUD * -* Usage: Shop file definitions, structures, constants. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file shop.h +* Shop file definitions, structures, constants. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ +#ifndef _SHOP_H_ +#define _SHOP_H_ -int find_shop(int); +/* Public function prototypes */ +SPECIAL(shop_keeper); +void boot_the_shops(FILE *shop_f, char *filename, int rec_count); +void assign_the_shopkeepers(void); +void show_shops(struct char_data *ch, char *arg); +int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim); +void destroy_shops(void); struct shop_buy_data { int type; @@ -64,13 +74,15 @@ struct shop_data { #define LIST_ROOM 2 /* Whom will we not trade with (bitvector for SHOP_TRADE_WITH()) */ -#define TRADE_NOGOOD (1 << 0) -#define TRADE_NOEVIL (1 << 1) -#define TRADE_NONEUTRAL (1 << 2) -#define TRADE_NOMAGIC_USER (1 << 3) -#define TRADE_NOCLERIC (1 << 4) -#define TRADE_NOTHIEF (1 << 5) -#define TRADE_NOWARRIOR (1 << 6) +#define TRADE_NOGOOD (1 << 0) +#define TRADE_NOEVIL (1 << 1) +#define TRADE_NONEUTRAL (1 << 2) +#define TRADE_NOMAGIC_USER (1 << 3) +#define TRADE_NOCLERIC (1 << 4) +#define TRADE_NOTHIEF (1 << 5) +#define TRADE_NOWARRIOR (1 << 6) +/** Total number of trade types */ +#define NUM_TRADERS 7 struct stack_data { int data[100]; @@ -115,9 +127,12 @@ struct stack_data { #define NOTRADE_THIEF(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOTHIEF)) #define NOTRADE_WARRIOR(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOWARRIOR)) -#define WILL_START_FIGHT (1 << 0) -#define WILL_BANK_MONEY (1 << 1) -#define HAS_UNLIMITED_CASH (1 << 2) +/* Shop flags */ +#define WILL_START_FIGHT (1 << 0) +#define WILL_BANK_MONEY (1 << 1) +#define HAS_UNLIMITED_CASH (1 << 2) +/** Total number of shop flags */ +#define NUM_SHOP_FLAGS 3 #define SHOP_KILL_CHARS(i) (IS_SET(SHOP_BITVECTOR(i), WILL_START_FIGHT)) #define SHOP_USES_BANK(i) (IS_SET(SHOP_BITVECTOR(i), WILL_BANK_MONEY)) @@ -135,3 +150,12 @@ struct stack_data { #define MSG_NO_USED_WANDSTAFF "I don't buy used up wands or staves!" #define MSG_CANT_KILL_KEEPER "Get out of here before I call the guards!" +/* Global variables */ +#ifndef __SHOP_C__ + +extern const char *trade_letters[]; +extern const char *shop_bits[]; + +#endif /* __SHOP_C__ */ + +#endif /* _SHOP_H_ */ diff --git a/src/spec_assign.c b/src/spec_assign.c index 3a0b2a2..99d5cba 100644 --- a/src/spec_assign.c +++ b/src/spec_assign.c @@ -11,35 +11,21 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "db.h" #include "interpreter.h" -#include "utils.h" +#include "spec_procs.h" +#include "ban.h" /* for SPECIAL(gen_board) */ +#include "boards.h" +#include "mail.h" -/* external globals */ -extern int mini_mud; - -/* external functions */ -SPECIAL(dump); -SPECIAL(pet_shops); -SPECIAL(postmaster); -SPECIAL(receptionist); -SPECIAL(cryogenicist); -SPECIAL(guild); -SPECIAL(mayor); -SPECIAL(bank); -SPECIAL(gen_board); -void assign_kings_castle(void); - -/* local functions */ -void assign_mobiles(void); -void assign_objects(void); -void assign_rooms(void); -void ASSIGNROOM(room_vnum room, SPECIAL(fname)); -void ASSIGNMOB(mob_vnum mob, SPECIAL(fname)); -void ASSIGNOBJ(obj_vnum obj, SPECIAL(fname)); +/* local (file scope only) functions */ +static void ASSIGNROOM(room_vnum room, SPECIAL(fname)); +static void ASSIGNMOB(mob_vnum mob, SPECIAL(fname)); +static void ASSIGNOBJ(obj_vnum obj, SPECIAL(fname)); /* functions to perform assignments */ -void ASSIGNMOB(mob_vnum mob, SPECIAL(fname)) +static void ASSIGNMOB(mob_vnum mob, SPECIAL(fname)) { mob_rnum rnum; @@ -49,7 +35,7 @@ void ASSIGNMOB(mob_vnum mob, SPECIAL(fname)) log("SYSERR: Attempt to assign spec to non-existant mob #%d", mob); } -void ASSIGNOBJ(obj_vnum obj, SPECIAL(fname)) +static void ASSIGNOBJ(obj_vnum obj, SPECIAL(fname)) { obj_rnum rnum; @@ -59,7 +45,7 @@ void ASSIGNOBJ(obj_vnum obj, SPECIAL(fname)) log("SYSERR: Attempt to assign spec to non-existant obj #%d", obj); } -void ASSIGNROOM(room_vnum room, SPECIAL(fname)) +static void ASSIGNROOM(room_vnum room, SPECIAL(fname)) { room_rnum rnum; diff --git a/src/spec_procs.c b/src/spec_procs.c index e13b9b6..67fa0e8 100644 --- a/src/spec_procs.c +++ b/src/spec_procs.c @@ -21,42 +21,24 @@ #include "db.h" #include "spells.h" #include "constants.h" +#include "act.h" +#include "spec_procs.h" +#include "class.h" +#include "fight.h" +#include "modify.h" -/* external vars */ -extern struct time_info_data time_info; -extern struct spell_info_type spell_info[]; -extern struct guild_info_type guild_info[]; -/* extern functions */ -ACMD(do_drop); -ACMD(do_gen_door); -ACMD(do_say); -ACMD(do_action); +/* locally defined functions of local (file) scope */ +static int compare_spells(const void *x, const void *y); +static const char *how_good(int percent); +static void npc_steal(struct char_data *ch, struct char_data *victim); -/* local functions */ -void sort_spells(void); -int compare_spells(const void *x, const void *y); -const char *how_good(int percent); -void list_skills(struct char_data *ch); -SPECIAL(guild); -SPECIAL(dump); -SPECIAL(mayor); -void npc_steal(struct char_data *ch, struct char_data *victim); -SPECIAL(snake); -SPECIAL(thief); -SPECIAL(magic_user); -SPECIAL(guild_guard); -SPECIAL(puff); -SPECIAL(fido); -SPECIAL(janitor); -SPECIAL(cityguard); -SPECIAL(pet_shops); -SPECIAL(bank); +/* Special procedures for mobiles. */ +static int spell_sort_info[MAX_SKILLS + 1]; -/* Special procedures for mobiles */ -int spell_sort_info[MAX_SKILLS + 1]; -int compare_spells(const void *x, const void *y) + +static int compare_spells(const void *x, const void *y) { int a = *(const int *)x, b = *(const int *)y; @@ -75,7 +57,7 @@ void sort_spells(void) qsort(&spell_sort_info[1], MAX_SKILLS, sizeof(int), compare_spells); } -const char *how_good(int percent) +static const char *how_good(int percent) { if (percent < 0) return " error)"; @@ -109,9 +91,6 @@ const char *prac_types[] = { #define MIN_PER_PRAC 2 /* min percent gain in skill per practice */ #define PRAC_TYPE 3 /* should it say 'spell' or 'skill'? */ -/* actual prac_params are in class.c */ -extern int prac_params[4][NUM_CLASSES]; - #define LEARNED(ch) (prac_params[LEARNED_LEVEL][(int)GET_CLASS(ch)]) #define MINGAIN(ch) (prac_params[MIN_PER_PRAC][(int)GET_CLASS(ch)]) #define MAXGAIN(ch) (prac_params[MAX_PER_PRAC][(int)GET_CLASS(ch)]) @@ -314,7 +293,7 @@ SPECIAL(mayor) /* General special procedures for mobiles. */ -void npc_steal(struct char_data *ch, struct char_data *victim) +static void npc_steal(struct char_data *ch, struct char_data *victim) { int gold; @@ -440,34 +419,43 @@ SPECIAL(magic_user) } /* Special procedures for mobiles. */ -SPECIAL(guild_guard) -{ - int i; - struct char_data *guard = (struct char_data *)me; - const char *buf = "The guard humiliates you, and blocks your way.\r\n"; - const char *buf2 = "The guard humiliates $n, and blocks $s way."; +SPECIAL(guild_guard) +{ + int i, direction; + struct char_data *guard = (struct char_data *)me; + const char *buf = "The guard humiliates you, and blocks your way.\r\n"; + const char *buf2 = "The guard humiliates $n, and blocks $s way."; - if (!IS_MOVE(cmd) || AFF_FLAGGED(guard, AFF_BLIND)) - return (FALSE); + if (!IS_MOVE(cmd) || AFF_FLAGGED(guard, AFF_BLIND)) + return (FALSE); + + if (GET_LEVEL(ch) >= LVL_IMMORT) + return (FALSE); + + /* find out what direction they are trying to go */ + for (direction = 0; direction < NUM_OF_DIRS; direction++) + if (!strcmp(cmd_info[cmd].command, dirs[direction])) + break; - if (GET_LEVEL(ch) >= LVL_IMMORT) - return (FALSE); + for (i = 0; guild_info[i].guild_room != NOWHERE; i++) { + /* Wrong guild. */ + if (GET_ROOM_VNUM(IN_ROOM(ch)) != guild_info[i].guild_room) + continue; - for (i = 0; guild_info[i].guild_room != NOWHERE; i++) { - /* Wrong guild or not trying to enter. */ - if (GET_ROOM_VNUM(IN_ROOM(ch)) != guild_info[i].guild_room || cmd != guild_info[i].direction) - continue; + /* Wrong direction. */ + if (direction != guild_info[i].direction) + continue; - /* Allow the people of the guild through. */ - if (!IS_NPC(ch) && GET_CLASS(ch) == guild_info[i].pc_class) - continue; - - send_to_char(ch, "%s", buf); - act(buf2, FALSE, ch, 0, 0, TO_ROOM); - return (TRUE); - } - return (FALSE); -} + /* Allow the people of the guild through. */ + if (!IS_NPC(ch) && GET_CLASS(ch) == guild_info[i].pc_class) + continue; + + send_to_char(ch, "%s", buf); + act(buf2, FALSE, ch, 0, 0, TO_ROOM); + return (TRUE); + } + return (FALSE); +} SPECIAL(puff) { diff --git a/src/spell_parser.c b/src/spell_parser.c index b6c03e7..0eba80c 100644 --- a/src/spell_parser.c +++ b/src/spell_parser.c @@ -8,6 +8,8 @@ * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * **************************************************************************/ +#define __SPELL_PARSER_C__ + #include "conf.h" #include "sysdep.h" #include "structs.h" @@ -18,32 +20,26 @@ #include "comm.h" #include "db.h" #include "dg_scripts.h" +#include "fight.h" /* for hit() */ #define SINFO spell_info[spellnum] -/* local globals */ +/* Global Variables definitions, used elsewhere */ struct spell_info_type spell_info[TOP_SPELL_DEFINE + 1]; char cast_arg2[MAX_INPUT_LENGTH]; +const char *unused_spellname = "!UNUSED!"; /* So we can get &unused_spellname */ -/* local functions */ -void say_spell(struct char_data *ch, int spellnum, struct char_data *tch, struct obj_data *tobj); -void spello(int spl, const char *name, int max_mana, int min_mana, int mana_change, int minpos, int targets, int violent, int routines, const char *wearoff); -int mag_manacost(struct char_data *ch, int spellnum); -ACMD(do_cast); -void unused_spell(int spl); -void mag_assign_spells(void); - -/* This arrangement is pretty stupid, but the number of skills is limited by - * the playerfile. We can arbitrarily increase the number of skills by - * increasing the space in the playerfile. Meanwhile, 200 should provide - * ample slots for skills. */ +/* Local (File Scope) Function Prototypes */ +static void say_spell(struct char_data *ch, int spellnum, struct char_data *tch, struct obj_data *tobj); +static void spello(int spl, const char *name, int max_mana, int min_mana, int mana_change, int minpos, int targets, int violent, int routines, const char *wearoff); +static int mag_manacost(struct char_data *ch, int spellnum); +/* Local (File Scope) Variables */ struct syllable { const char *org; const char *news; }; - -struct syllable syls[] = { +static struct syllable syls[] = { {" ", " "}, {"ar", "abra"}, {"ate", "i"}, @@ -78,15 +74,16 @@ struct syllable syls[] = { {"v", "z"}, {"w", "x"}, {"x", "n"}, {"y", "l"}, {"z", "k"}, {"", ""} }; -const char *unused_spellname = "!UNUSED!"; /* So we can get &unused_spellname */ -int mag_manacost(struct char_data *ch, int spellnum) + + +static int mag_manacost(struct char_data *ch, int spellnum) { return MAX(SINFO.mana_max - (SINFO.mana_change * (GET_LEVEL(ch) - SINFO.min_level[(int) GET_CLASS(ch)])), SINFO.mana_min); } -void say_spell(struct char_data *ch, int spellnum, struct char_data *tch, +static void say_spell(struct char_data *ch, int spellnum, struct char_data *tch, struct obj_data *tobj) { char lbuf[256], buf[256], buf1[256], buf2[256]; /* FIXME */ @@ -652,7 +649,7 @@ void spell_level(int spell, int chclass, int level) /* Assign the spells on boot up */ -void spello(int spl, const char *name, int max_mana, int min_mana, +static void spello(int spl, const char *name, int max_mana, int min_mana, int mana_change, int minpos, int targets, int violent, int routines, const char *wearoff) { int i; @@ -753,7 +750,7 @@ void mag_assign_spells(void) "You feel your strength return."); spello(SPELL_CLONE, "clone", 80, 65, 5, POS_STANDING, - TAR_SELF_ONLY, FALSE, MAG_SUMMONS, + TAR_IGNORE, FALSE, MAG_SUMMONS, NULL); spello(SPELL_COLOR_SPRAY, "color spray", 30, 15, 3, POS_FIGHTING, diff --git a/src/spells.c b/src/spells.c index 2600e23..39231dc 100644 --- a/src/spells.c +++ b/src/spells.c @@ -19,18 +19,11 @@ #include "constants.h" #include "interpreter.h" #include "dg_scripts.h" +#include "act.h" +#include "fight.h" + -/* external variables */ -extern room_rnum r_mortal_start_room; -extern int mini_mud; -extern char cast_arg2[MAX_INPUT_LENGTH]; -/* external functions */ -void weight_change_object(struct obj_data *obj, int weight); -int mag_savingthrow(struct char_data *ch, int type, int modifier); -void name_to_drinkcon(struct obj_data *obj, int type); -void name_from_drinkcon(struct obj_data *obj); -int compute_armor_class(struct char_data *ch); /* Special spells appear below. */ ASPELL(spell_create_water) @@ -85,7 +78,7 @@ ASPELL(spell_teleport) do { to_room = rand_number(0, top_of_world); - } while (ROOM_FLAGGED(to_room, ROOM_PRIVATE | ROOM_DEATH | ROOM_GODROOM)); + } while (ROOM_FLAGGED(to_room, ROOM_PRIVATE) || ROOM_FLAGGED(to_room, ROOM_DEATH) || ROOM_FLAGGED(to_room, ROOM_GODROOM)); act("$n slowly fades out of existence and is gone.", FALSE, victim, 0, 0, TO_ROOM); diff --git a/src/spells.h b/src/spells.h index 38ffd75..6c3674d 100644 --- a/src/spells.h +++ b/src/spells.h @@ -1,12 +1,16 @@ -/************************************************************************** -* File: spells.h Part of tbaMUD * -* Usage: Header file: constants and fn prototypes for spell system. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file spells.h +* Constants and function prototypes for the spell system. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ +#ifndef _SPELLS_H_ +#define _SPELLS_H_ #define DEFAULT_STAFF_LVL 12 #define DEFAULT_WAND_LVL 12 @@ -85,6 +89,9 @@ #define SPELL_GROUP_RECALL 49 /* Reserved Skill[] DO NOT CHANGE */ #define SPELL_INFRAVISION 50 /* Reserved Skill[] DO NOT CHANGE */ #define SPELL_WATERWALK 51 /* Reserved Skill[] DO NOT CHANGE */ +/** Total Number of defined spells */ +#define NUM_SPELLS 51 + /* Insert new spells here, up to MAX_SPELLS */ #define MAX_SPELLS 130 @@ -116,21 +123,23 @@ /* NEW NPC/OBJECT SPELLS can be inserted here up to 299 */ /* WEAPON ATTACK TYPES */ -#define TYPE_HIT 300 -#define TYPE_STING 301 -#define TYPE_WHIP 302 -#define TYPE_SLASH 303 -#define TYPE_BITE 304 -#define TYPE_BLUDGEON 305 -#define TYPE_CRUSH 306 -#define TYPE_POUND 307 -#define TYPE_CLAW 308 -#define TYPE_MAUL 309 -#define TYPE_THRASH 310 -#define TYPE_PIERCE 311 -#define TYPE_BLAST 312 -#define TYPE_PUNCH 313 -#define TYPE_STAB 314 +#define TYPE_HIT 300 +#define TYPE_STING 301 +#define TYPE_WHIP 302 +#define TYPE_SLASH 303 +#define TYPE_BITE 304 +#define TYPE_BLUDGEON 305 +#define TYPE_CRUSH 306 +#define TYPE_POUND 307 +#define TYPE_CLAW 308 +#define TYPE_MAUL 309 +#define TYPE_THRASH 310 +#define TYPE_PIERCE 311 +#define TYPE_BLAST 312 +#define TYPE_PUNCH 313 +#define TYPE_STAB 314 +/** The total number of attack types */ +#define NUM_ATTACK_TYPES 15 /* new attack types can be added here - up to TYPE_SUFFERING */ #define TYPE_SUFFERING 399 @@ -140,6 +149,8 @@ #define SAVING_PETRI 2 #define SAVING_BREATH 3 #define SAVING_SPELL 4 +/* Equals the total number of SAVING_* defines */ +#define NUM_OF_SAVING_THROWS 5 #define TAR_IGNORE (1 << 0) #define TAR_CHAR_ROOM (1 << 1) @@ -151,7 +162,7 @@ #define TAR_OBJ_INV (1 << 7) #define TAR_OBJ_ROOM (1 << 8) #define TAR_OBJ_WORLD (1 << 9) -#define TAR_OBJ_EQUIP (1 << 10) +#define TAR_OBJ_EQUIP (1 << 10) struct spell_info_type { byte min_position; /* Position for caster */ @@ -184,12 +195,6 @@ struct spell_info_type { #define SPELL_TYPE_STAFF 3 #define SPELL_TYPE_SCROLL 4 -/* Attacktypes with grammar */ -struct attack_hit_type { - const char *singular; - const char *plural; -}; - #define ASPELL(spellname) \ void spellname(int level, struct char_data *ch, \ struct char_data *victim, struct obj_data *obj) @@ -250,3 +255,23 @@ int cast_spell(struct char_data *ch, struct char_data *tch, void spell_level(int spell, int chclass, int level); void init_spell_levels(void); const char *skill_name(int num); + +/* From magic.c */ +int mag_savingthrow(struct char_data *ch, int type, int modifier); +void affect_update(void); + +/* from spell_parser.c */ +ACMD(do_cast); +void unused_spell(int spl); +void mag_assign_spells(void); + +/* Global variables exported */ +#ifndef __SPELL_PARSER_C__ + +extern struct spell_info_type spell_info[]; +extern char cast_arg2[]; +extern const char *unused_spellname; + +#endif /* __SPELL_PARSER_C__ */ + +#endif /* _SPELLS_H_ */ diff --git a/src/structs.h b/src/structs.h index 0bdaa24..a91795b 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,441 +1,491 @@ -/************************************************************************** -* File: structs.h Part of tbaMUD * -* Usage: Header file for central structures and constants. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file structs.h +* Core structures used within the core mud code. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ +#ifndef _STRUCTS_H_ +#define _STRUCTS_H_ -/* Intended use of this macro is to allow external packages to work with a +/** Intended use of this macro is to allow external packages to work with a * variety of versions without modifications. For instance, an IS_CORPSE() * macro was introduced in pl13. Any future code add-ons could take into * account the version and supply their own definition for the macro if used * on an older version. You are supposed to compare this with the macro - * TBAMUD_VERSION() in utils.h. */ -#define _TBAMUD 0x030550 /* Major/Minor/Patchlevel - MMmmPP */ + * TBAMUD_VERSION() in utils.h. + * It is read as Major/Minor/Patchlevel - MMmmPP */ +#define _TBAMUD 0x030550 -/* If you want equipment to be automatically equipped to the same place - * it was when players rented, set the define below to 1. */ -#define USE_AUTOEQ 1 /* TRUE/FALSE aren't defined yet. */ +/** If you want equipment to be automatically equipped to the same place + * it was when players rented, set the define below to 1 because + * TRUE/FALSE aren't defined yet. */ +#define USE_AUTOEQ 1 /* preamble */ -/* As of bpl20, it should be safe to use unsigned data types for the various +/** As of bpl20, it should be safe to use unsigned data types for the various * virtual and real number data types. There really isn't a reason to use * signed anymore so use the unsigned types and get 65,535 objects instead of - * 32,768. NOTE: This will likely be unconditionally unsigned later. */ -#define CIRCLE_UNSIGNED_INDEX 1 /* 0 = signed, 1 = unsigned */ + * 32,768. NOTE: This will likely be unconditionally unsigned later. + * 0 = use signed indexes; 1 = use unsigned indexes */ +#define CIRCLE_UNSIGNED_INDEX 1 #if CIRCLE_UNSIGNED_INDEX -# define IDXTYPE ush_int -# define NOWHERE ((IDXTYPE)~0) -# define NOTHING ((IDXTYPE)~0) -# define NOBODY ((IDXTYPE)~0) +# define IDXTYPE ush_int /**< Index types are unsigned short ints */ +# define IDXTYPE_MAX USHRT_MAX /**< Used for compatibility checks. */ +# define IDXTYPE_MIN 0 /**< Used for compatibility checks. */ +# define NOWHERE ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ +# define NOTHING ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ +# define NOBODY ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ +# define NOFLAG ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ #else -# define IDXTYPE sh_int -# define NOWHERE (-1) /* nil reference for rooms */ -# define NOTHING (-1) /* nil reference for objects */ -# define NOBODY (-1) /* nil reference for mobiles */ +# define IDXTYPE sh_int /**< Index types are unsigned short ints */ +# define IDXTYPE_MAX SHRT_MAX /**< Used for compatibility checks. */ +# define IDXTYPE_MIN SHRT_MIN /**< Used for compatibility checks. */ +# define NOWHERE ((IDXTYPE)-1) /**< nil reference for rooms */ +# define NOTHING ((IDXTYPE)-1) /**< nil reference for objects */ +# define NOBODY ((IDXTYPE)-1) /**< nil reference for mobiles */ +# define NOFLAG ((IDXTYPE)-1) /**< nil reference for flags */ #endif +/** Function macro for the mob, obj and room special functions */ #define SPECIAL(name) \ int (name)(struct char_data *ch, void *me, int cmd, char *argument) /* room-related defines */ /* The cardinal directions: used as index to room_data.dir_option[] */ -#define NORTH 0 -#define EAST 1 -#define SOUTH 2 -#define WEST 3 -#define UP 4 -#define DOWN 5 +#define NORTH 0 /**< The direction north */ +#define EAST 1 /**< The direction east */ +#define SOUTH 2 /**< The direction south */ +#define WEST 3 /**< The direction west */ +#define UP 4 /**< The direction up */ +#define DOWN 5 /**< The direction down */ +/** Total number of directions available to move in. BEFORE CHANGING THIS, make + * sure you change every other direction and movement based item that this will + * impact. */ +#define NUM_OF_DIRS 6 /* Room flags: used in room_data.room_flags */ /* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */ -#define ROOM_DARK 0 /* Dark */ -#define ROOM_DEATH 1 /* Death trap */ -#define ROOM_NOMOB 2 /* MOBs not allowed */ -#define ROOM_INDOORS 3 /* Indoors */ -#define ROOM_PEACEFUL 4 /* Violence not allowed */ -#define ROOM_SOUNDPROOF 5 /* Shouts, gossip blocked */ -#define ROOM_NOTRACK 6 /* Track won't go through */ -#define ROOM_NOMAGIC 7 /* Magic not allowed */ -#define ROOM_TUNNEL 8 /* room for only 1 pers */ -#define ROOM_PRIVATE 9 /* Can't teleport in */ -#define ROOM_GODROOM 10 /* LVL_GOD+ only allowed */ -#define ROOM_HOUSE 11 /* (R) Room is a house */ -#define ROOM_HOUSE_CRASH 12 /* (R) House needs saving */ -#define ROOM_ATRIUM 13 /* (R) The door to a house */ -#define ROOM_OLC 14 /* (R) Modifyable/!compress */ -#define ROOM_BFS_MARK 15 /* (R) breath-first srch mrk */ +#define ROOM_DARK 0 /**< Dark room, light needed to see */ +#define ROOM_DEATH 1 /**< Death trap, instant death */ +#define ROOM_NOMOB 2 /**< MOBs not allowed in room */ +#define ROOM_INDOORS 3 /**< Indoors, no weather */ +#define ROOM_PEACEFUL 4 /**< Violence not allowed */ +#define ROOM_SOUNDPROOF 5 /**< Shouts, gossip blocked */ +#define ROOM_NOTRACK 6 /**< Track won't go through */ +#define ROOM_NOMAGIC 7 /**< Magic not allowed */ +#define ROOM_TUNNEL 8 /**< Room for only 1 pers */ +#define ROOM_PRIVATE 9 /**< Can't teleport in */ +#define ROOM_GODROOM 10 /**< LVL_GOD+ only allowed */ +#define ROOM_HOUSE 11 /**< (R) Room is a house */ +#define ROOM_HOUSE_CRASH 12 /**< (R) House needs saving */ +#define ROOM_ATRIUM 13 /**< (R) The door to a house */ +#define ROOM_OLC 14 /**< (R) Modifyable/!compress */ +#define ROOM_BFS_MARK 15 /**< (R) breath-first srch mrk */ +#define ROOM_WORLDMAP 16 /**< World-map style maps here */ +/** The total number of Room Flags */ +#define NUM_ROOM_FLAGS 17 /* Exit info: used in room_data.dir_option.exit_info */ -#define EX_ISDOOR (1 << 0) /* Exit is a door */ -#define EX_CLOSED (1 << 1) /* The door is closed */ -#define EX_LOCKED (1 << 2) /* The door is locked */ -#define EX_PICKPROOF (1 << 3) /* Lock can't be picked */ +#define EX_ISDOOR (1 << 0) /**< Exit is a door */ +#define EX_CLOSED (1 << 1) /**< The door is closed */ +#define EX_LOCKED (1 << 2) /**< The door is locked */ +#define EX_PICKPROOF (1 << 3) /**< Lock can't be picked */ /* Sector types: used in room_data.sector_type */ -#define SECT_INSIDE 0 /* Indoors */ -#define SECT_CITY 1 /* In a city */ -#define SECT_FIELD 2 /* In a field */ -#define SECT_FOREST 3 /* In a forest */ -#define SECT_HILLS 4 /* In the hills */ -#define SECT_MOUNTAIN 5 /* On a mountain */ -#define SECT_WATER_SWIM 6 /* Swimmable water */ -#define SECT_WATER_NOSWIM 7 /* Water - need a boat */ -#define SECT_FLYING 8 /* Wheee! */ -#define SECT_UNDERWATER 9 /* Underwater */ +#define SECT_INSIDE 0 /**< Indoors, connected to SECT macro. */ +#define SECT_CITY 1 /**< In a city */ +#define SECT_FIELD 2 /**< In a field */ +#define SECT_FOREST 3 /**< In a forest */ +#define SECT_HILLS 4 /**< In the hills */ +#define SECT_MOUNTAIN 5 /**< On a mountain */ +#define SECT_WATER_SWIM 6 /**< Swimmable water */ +#define SECT_WATER_NOSWIM 7 /**< Water - need a boat */ +#define SECT_FLYING 8 /**< Flying */ +#define SECT_UNDERWATER 9 /**< Underwater */ +/** The total number of room Sector Types */ +#define NUM_ROOM_SECTORS 10 /* char and mob-related defines */ /* History */ -#define HIST_ALL 0 -#define HIST_SAY 1 -#define HIST_GOSSIP 2 -#define HIST_WIZNET 3 -#define HIST_TELL 4 -#define HIST_SHOUT 5 -#define HIST_GRATS 6 -#define HIST_HOLLER 7 -#define HIST_AUCTION 8 +#define HIST_ALL 0 /**< Index to history of all channels */ +#define HIST_SAY 1 /**< Index to history of all 'say' */ +#define HIST_GOSSIP 2 /**< Index to history of all 'gossip' */ +#define HIST_WIZNET 3 /**< Index to history of all 'wiznet' */ +#define HIST_TELL 4 /**< Index to history of all 'tell' */ +#define HIST_SHOUT 5 /**< Index to history of all 'shout' */ +#define HIST_GRATS 6 /**< Index to history of all 'grats' */ +#define HIST_HOLLER 7 /**< Index to history of all 'holler' */ +#define HIST_AUCTION 8 /**< Index to history of all 'auction' */ -#define NUM_HIST 9 +#define NUM_HIST 9 /**< Total number of history indexes */ + +#define HISTORY_SIZE 5 /**< Number of last commands kept in each history */ /* PC classes */ -#define CLASS_UNDEFINED (-1) -#define CLASS_MAGIC_USER 0 -#define CLASS_CLERIC 1 -#define CLASS_THIEF 2 -#define CLASS_WARRIOR 3 - -#define NUM_CLASSES 4 /* This must be the number of classes!! */ +#define CLASS_UNDEFINED (-1) /**< PC Class undefined */ +#define CLASS_MAGIC_USER 0 /**< PC Class Magic User */ +#define CLASS_CLERIC 1 /**< PC Class Cleric */ +#define CLASS_THIEF 2 /**< PC Class Thief */ +#define CLASS_WARRIOR 3 /**< PC Class Warrior */ +/** Total number of available PC Classes */ +#define NUM_CLASSES 4 /* NPC classes (currently unused - feel free to implement!) */ -#define CLASS_OTHER 0 -#define CLASS_UNDEAD 1 -#define CLASS_HUMANOID 2 -#define CLASS_ANIMAL 3 -#define CLASS_DRAGON 4 -#define CLASS_GIANT 5 +#define CLASS_OTHER 0 /**< NPC Class Other (or undefined) */ +#define CLASS_UNDEAD 1 /**< NPC Class Undead */ +#define CLASS_HUMANOID 2 /**< NPC Class Humanoid */ +#define CLASS_ANIMAL 3 /**< NPC Class Animal */ +#define CLASS_DRAGON 4 /**< NPC Class Dragon */ +#define CLASS_GIANT 5 /**< NPC Class Giant */ /* Sex */ -#define SEX_NEUTRAL 0 -#define SEX_MALE 1 -#define SEX_FEMALE 2 +#define SEX_NEUTRAL 0 /**< Neutral Sex (Hermaphrodite) */ +#define SEX_MALE 1 /**< Male Sex (XY Chromosome) */ +#define SEX_FEMALE 2 /**< Female Sex (XX Chromosome) */ +/** Total number of Genders */ +#define NUM_GENDERS 3 /* Positions */ -#define POS_DEAD 0 /* dead */ -#define POS_MORTALLYW 1 /* mortally wounded */ -#define POS_INCAP 2 /* incapacitated */ -#define POS_STUNNED 3 /* stunned */ -#define POS_SLEEPING 4 /* sleeping */ -#define POS_RESTING 5 /* resting */ -#define POS_SITTING 6 /* sitting */ -#define POS_FIGHTING 7 /* fighting */ -#define POS_STANDING 8 /* standing */ +#define POS_DEAD 0 /**< Position = dead */ +#define POS_MORTALLYW 1 /**< Position = mortally wounded */ +#define POS_INCAP 2 /**< Position = incapacitated */ +#define POS_STUNNED 3 /**< Position = stunned */ +#define POS_SLEEPING 4 /**< Position = sleeping */ +#define POS_RESTING 5 /**< Position = resting */ +#define POS_SITTING 6 /**< Position = sitting */ +#define POS_FIGHTING 7 /**< Position = fighting */ +#define POS_STANDING 8 /**< Position = standing */ +/** Total number of positions. */ +#define NUM_POSITIONS 9 /* Player flags: used by char_data.char_specials.act */ -#define PLR_KILLER 0 /* Player is a player-killer */ -#define PLR_THIEF 1 /* Player is a player-thief */ -#define PLR_FROZEN 2 /* Player is frozen */ -#define PLR_DONTSET 3 /* Don't EVER set (ISNPC bit) */ -#define PLR_WRITING 4 /* Player writing (board/mail/olc) */ -#define PLR_MAILING 5 /* Player is writing mail */ -#define PLR_CRASH 6 /* Player needs to be crash-saved */ -#define PLR_SITEOK 7 /* Player has been site-cleared */ -#define PLR_NOSHOUT 8 /* Player not allowed to shout/goss */ -#define PLR_NOTITLE 9 /* Player not allowed to set title */ -#define PLR_DELETED 10 /* Player deleted - space reusable */ -#define PLR_LOADROOM 11 /* Player uses nonstandard loadroom */ -#define PLR_NOWIZLIST 12 /* Player shouldn't be on wizlist */ -#define PLR_NODELETE 13 /* Player shouldn't be deleted */ -#define PLR_INVSTART 14 /* Player should enter game wizinvis */ -#define PLR_CRYO 15 /* Player is cryo-saved (purge prog) */ -#define PLR_NOTDEADYET 16 /* (R) Player being extracted */ +#define PLR_KILLER 0 /**< Player is a player-killer */ +#define PLR_THIEF 1 /**< Player is a player-thief */ +#define PLR_FROZEN 2 /**< Player is frozen */ +#define PLR_DONTSET 3 /**< Don't EVER set (ISNPC bit, set by mud) */ +#define PLR_WRITING 4 /**< Player writing (board/mail/olc) */ +#define PLR_MAILING 5 /**< Player is writing mail */ +#define PLR_CRASH 6 /**< Player needs to be crash-saved */ +#define PLR_SITEOK 7 /**< Player has been site-cleared */ +#define PLR_NOSHOUT 8 /**< Player not allowed to shout/goss */ +#define PLR_NOTITLE 9 /**< Player not allowed to set title */ +#define PLR_DELETED 10 /**< Player deleted - space reusable */ +#define PLR_LOADROOM 11 /**< Player uses nonstandard loadroom */ +#define PLR_NOWIZLIST 12 /**< Player shouldn't be on wizlist */ +#define PLR_NODELETE 13 /**< Player shouldn't be deleted */ +#define PLR_INVSTART 14 /**< Player should enter game wizinvis */ +#define PLR_CRYO 15 /**< Player is cryo-saved (purge prog) */ +#define PLR_NOTDEADYET 16 /**< (R) Player being extracted */ /* Mobile flags: used by char_data.char_specials.act */ -#define MOB_SPEC 0 /* Mob has a callable spec-proc */ -#define MOB_SENTINEL 1 /* Mob should not move */ -#define MOB_SCAVENGER 2 /* Mob picks up stuff on the ground */ -#define MOB_ISNPC 3 /* (R) Automatically set on all Mobs */ -#define MOB_AWARE 4 /* Mob can't be backstabbed */ -#define MOB_AGGRESSIVE 5 /* Mob auto-attacks everybody nearby */ -#define MOB_STAY_ZONE 6 /* Mob shouldn't wander out of zone */ -#define MOB_WIMPY 7 /* Mob flees if severely injured */ -#define MOB_AGGR_EVIL 8 /* Auto-attack any evil PC's */ -#define MOB_AGGR_GOOD 9 /* Auto-attack any good PC's */ -#define MOB_AGGR_NEUTRAL 10 /* Auto-attack any neutral PC's */ -#define MOB_MEMORY 11 /* remember attackers if attacked */ -#define MOB_HELPER 12 /* attack PCs fighting other NPCs */ -#define MOB_NOCHARM 13 /* Mob can't be charmed */ -#define MOB_NOSUMMON 14 /* Mob can't be summoned */ -#define MOB_NOSLEEP 15 /* Mob can't be slept */ -#define MOB_NOBASH 16 /* Mob can't be bashed (e.g. trees) */ -#define MOB_NOBLIND 17 /* Mob can't be blinded */ -#define MOB_NOTDEADYET 18 /* (R) Mob being extracted */ +#define MOB_SPEC 0 /**< Mob has a callable spec-proc */ +#define MOB_SENTINEL 1 /**< Mob should not move */ +#define MOB_SCAVENGER 2 /**< Mob picks up stuff on the ground */ +#define MOB_ISNPC 3 /**< (R) Automatically set on all Mobs */ +#define MOB_AWARE 4 /**< Mob can't be backstabbed */ +#define MOB_AGGRESSIVE 5 /**< Mob auto-attacks everybody nearby */ +#define MOB_STAY_ZONE 6 /**< Mob shouldn't wander out of zone */ +#define MOB_WIMPY 7 /**< Mob flees if severely injured */ +#define MOB_AGGR_EVIL 8 /**< Auto-attack any evil PC's */ +#define MOB_AGGR_GOOD 9 /**< Auto-attack any good PC's */ +#define MOB_AGGR_NEUTRAL 10 /**< Auto-attack any neutral PC's */ +#define MOB_MEMORY 11 /**< remember attackers if attacked */ +#define MOB_HELPER 12 /**< attack PCs fighting other NPCs */ +#define MOB_NOCHARM 13 /**< Mob can't be charmed */ +#define MOB_NOSUMMON 14 /**< Mob can't be summoned */ +#define MOB_NOSLEEP 15 /**< Mob can't be slept */ +#define MOB_NOBASH 16 /**< Mob can't be bashed (e.g. trees) */ +#define MOB_NOBLIND 17 /**< Mob can't be blinded */ +#define MOB_NOTDEADYET 18 /**< (R) Mob being extracted */ +/** Total number of Mob Flags; it should be 1 less than MOB_NOT_DEADYET */ +#define NUM_MOB_FLAGS 18 /* Preference flags: used by char_data.player_specials.pref */ -#define PRF_BRIEF 0 /* Room descs won't normally be shown */ -#define PRF_COMPACT 1 /* No extra CRLF pair before prompts */ -#define PRF_NOSHOUT 2 /* Can't hear shouts */ -#define PRF_NOTELL 3 /* Can't receive tells */ -#define PRF_DISPHP 4 /* Display hit points in prompt */ -#define PRF_DISPMANA 5 /* Display mana points in prompt */ -#define PRF_DISPMOVE 6 /* Display move points in prompt */ -#define PRF_AUTOEXIT 7 /* Display exits in a room */ -#define PRF_NOHASSLE 8 /* Aggr mobs won't attack */ -#define PRF_QUEST 9 /* On quest */ -#define PRF_SUMMONABLE 10 /* Can be summoned */ -#define PRF_NOREPEAT 11 /* No repetition of comm commands */ -#define PRF_HOLYLIGHT 12 /* Can see in dark */ -#define PRF_COLOR_1 13 /* Color (low bit) */ -#define PRF_COLOR_2 14 /* Color (high bit) */ -#define PRF_NOWIZ 15 /* Can't hear wizline */ -#define PRF_LOG1 16 /* On-line System Log (low bit) */ -#define PRF_LOG2 17 /* On-line System Log (high bit) */ -#define PRF_NOAUCT 18 /* Can't hear auction channel */ -#define PRF_NOGOSS 19 /* Can't hear gossip channel */ -#define PRF_NOGRATZ 20 /* Can't hear grats channel */ -#define PRF_SHOWVNUMS 21 /* Can see VNUMs */ -#define PRF_DISPAUTO 22 /* Show prompt HP, MP, MV when < 25% */ -#define PRF_CLS 23 /* Clear screen in OLC */ -#define PRF_BUILDWALK 24 /* Build new rooms while walking */ -#define PRF_AFK 25 /* AFK flag */ -#define PRF_AUTOLOOT 26 /* Loot everything from a corpse */ -#define PRF_AUTOGOLD 27 /* Loot gold from a corpse */ -#define PRF_AUTOSPLIT 28 /* Split gold with group */ -#define PRF_AUTOSAC 29 /* Sacrifice a corpse */ -#define PRF_AUTOASSIST 30 /* Auto-assist toggle */ -#define NUM_PRF_FLAGS 31 +#define PRF_BRIEF 0 /**< Room descs won't normally be shown */ +#define PRF_COMPACT 1 /**< No extra CRLF pair before prompts */ +#define PRF_NOSHOUT 2 /**< Can't hear shouts */ +#define PRF_NOTELL 3 /**< Can't receive tells */ +#define PRF_DISPHP 4 /**< Display hit points in prompt */ +#define PRF_DISPMANA 5 /**< Display mana points in prompt */ +#define PRF_DISPMOVE 6 /**< Display move points in prompt */ +#define PRF_AUTOEXIT 7 /**< Display exits in a room */ +#define PRF_NOHASSLE 8 /**< Aggr mobs won't attack */ +#define PRF_QUEST 9 /**< On quest */ +#define PRF_SUMMONABLE 10 /**< Can be summoned */ +#define PRF_NOREPEAT 11 /**< No repetition of comm commands */ +#define PRF_HOLYLIGHT 12 /**< Can see in dark */ +#define PRF_COLOR_1 13 /**< Color (low bit) */ +#define PRF_COLOR_2 14 /**< Color (high bit) */ +#define PRF_NOWIZ 15 /**< Can't hear wizline */ +#define PRF_LOG1 16 /**< On-line System Log (low bit) */ +#define PRF_LOG2 17 /**< On-line System Log (high bit) */ +#define PRF_NOAUCT 18 /**< Can't hear auction channel */ +#define PRF_NOGOSS 19 /**< Can't hear gossip channel */ +#define PRF_NOGRATZ 20 /**< Can't hear grats channel */ +#define PRF_SHOWVNUMS 21 /**< Can see VNUMs */ +#define PRF_DISPAUTO 22 /**< Show prompt HP, MP, MV when < 25% */ +#define PRF_CLS 23 /**< Clear screen in OLC */ +#define PRF_BUILDWALK 24 /**< Build new rooms while walking */ +#define PRF_AFK 25 /**< AFK flag */ +#define PRF_AUTOLOOT 26 /**< Loot everything from a corpse */ +#define PRF_AUTOGOLD 27 /**< Loot gold from a corpse */ +#define PRF_AUTOSPLIT 28 /**< Split gold with group */ +#define PRF_AUTOSAC 29 /**< Sacrifice a corpse */ +#define PRF_AUTOASSIST 30 /**< Auto-assist toggle */ +#define PRF_AUTOMAP 31 /**< Show map at the side of room descs */ +/** Total number of available PRF flags */ +#define NUM_PRF_FLAGS 32 /* Affect bits: used in char_data.char_specials.saved.affected_by */ /* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */ -#define AFF_DONTUSE 0 /* DON'T USE! */ -#define AFF_BLIND 1 /* (R) Char is blind */ -#define AFF_INVISIBLE 2 /* Char is invisible */ -#define AFF_DETECT_ALIGN 3 /* Char is sensitive to align */ -#define AFF_DETECT_INVIS 4 /* Char can see invis chars */ -#define AFF_DETECT_MAGIC 5 /* Char is sensitive to magic */ -#define AFF_SENSE_LIFE 6 /* Char can sense hidden life */ -#define AFF_WATERWALK 7 /* Char can walk on water */ -#define AFF_SANCTUARY 8 /* Char protected by sanct */ -#define AFF_GROUP 9 /* (R) Char is grouped */ -#define AFF_CURSE 10 /* Char is cursed */ -#define AFF_INFRAVISION 11 /* Char can see in dark */ -#define AFF_POISON 12 /* (R) Char is poisoned */ -#define AFF_PROTECT_EVIL 13 /* Char protected from evil */ -#define AFF_PROTECT_GOOD 14 /* Char protected from good */ -#define AFF_SLEEP 15 /* (R) Char magically asleep */ -#define AFF_NOTRACK 16 /* Char can't be tracked */ -#define AFF_FLYING 17 /* Char is flying */ -#define AFF_SCUBA 18 /* Room for future expansion */ -#define AFF_SNEAK 19 /* Char can move quietly */ -#define AFF_HIDE 20 /* Char is hidden */ -#define AFF_FREE 21 /* Room for future expansion */ -#define AFF_CHARM 22 /* Char is charmed */ +#define AFF_DONTUSE 0 /**< DON'T USE! */ +#define AFF_BLIND 1 /**< (R) Char is blind */ +#define AFF_INVISIBLE 2 /**< Char is invisible */ +#define AFF_DETECT_ALIGN 3 /**< Char is sensitive to align */ +#define AFF_DETECT_INVIS 4 /**< Char can see invis chars */ +#define AFF_DETECT_MAGIC 5 /**< Char is sensitive to magic */ +#define AFF_SENSE_LIFE 6 /**< Char can sense hidden life */ +#define AFF_WATERWALK 7 /**< Char can walk on water */ +#define AFF_SANCTUARY 8 /**< Char protected by sanct */ +#define AFF_GROUP 9 /**< (R) Char is grouped */ +#define AFF_CURSE 10 /**< Char is cursed */ +#define AFF_INFRAVISION 11 /**< Char can see in dark */ +#define AFF_POISON 12 /**< (R) Char is poisoned */ +#define AFF_PROTECT_EVIL 13 /**< Char protected from evil */ +#define AFF_PROTECT_GOOD 14 /**< Char protected from good */ +#define AFF_SLEEP 15 /**< (R) Char magically asleep */ +#define AFF_NOTRACK 16 /**< Char can't be tracked */ +#define AFF_FLYING 17 /**< Char is flying */ +#define AFF_SCUBA 18 /**< Room for future expansion */ +#define AFF_SNEAK 19 /**< Char can move quietly */ +#define AFF_HIDE 20 /**< Char is hidden */ +#define AFF_FREE 21 /**< Room for future expansion */ +#define AFF_CHARM 22 /**< Char is charmed */ +/** Total number of affect flags not including the don't use flag. */ +#define NUM_AFF_FLAGS 22 /* Modes of connectedness: used by descriptor_data.state */ -#define CON_PLAYING 0 /* Playing - Nominal state */ -#define CON_CLOSE 1 /* User disconnect, remove character. */ -#define CON_GET_NAME 2 /* By what name ..? */ -#define CON_NAME_CNFRM 3 /* Did I get that right, x? */ -#define CON_PASSWORD 4 /* Password: */ -#define CON_NEWPASSWD 5 /* Give me a password for x */ -#define CON_CNFPASSWD 6 /* Please retype password: */ -#define CON_QSEX 7 /* Sex? */ -#define CON_QCLASS 8 /* Class? */ -#define CON_RMOTD 9 /* PRESS RETURN after MOTD */ -#define CON_MENU 10 /* Your choice: (main menu) */ -#define CON_PLR_DESC 11 /* Enter a new description: */ -#define CON_CHPWD_GETOLD 12 /* Changing passwd: get old */ -#define CON_CHPWD_GETNEW 13 /* Changing passwd: get new */ -#define CON_CHPWD_VRFY 14 /* Verify new password */ -#define CON_DELCNF1 15 /* Delete confirmation 1 */ -#define CON_DELCNF2 16 /* Delete confirmation 2 */ -#define CON_DISCONNECT 17 /* In-game link loss (leave character) */ -#define CON_OEDIT 18 /* OLC mode - object editor */ -#define CON_REDIT 19 /* OLC mode - room editor */ -#define CON_ZEDIT 20 /* OLC mode - zone info editor */ -#define CON_MEDIT 21 /* OLC mode - mobile editor */ -#define CON_SEDIT 22 /* OLC mode - shop editor */ -#define CON_TEDIT 23 /* OLC mode - text editor */ -#define CON_CEDIT 24 /* OLC mode - conf editor */ -#define CON_AEDIT 25 /* OLC mode - social (action) edit */ -#define CON_TRIGEDIT 26 /* OLC mode - trigger edit */ -#define CON_HEDIT 27 +#define CON_PLAYING 0 /**< Playing - Nominal state */ +#define CON_CLOSE 1 /**< User disconnect, remove character. */ +#define CON_GET_NAME 2 /**< Login with name */ +#define CON_NAME_CNFRM 3 /**< New character, confirm name */ +#define CON_PASSWORD 4 /**< Login with password */ +#define CON_NEWPASSWD 5 /**< New character, create password */ +#define CON_CNFPASSWD 6 /**< New character, confirm password */ +#define CON_QSEX 7 /**< Choose character sex */ +#define CON_QCLASS 8 /**< Choose character class */ +#define CON_RMOTD 9 /**< Reading the message of the day */ +#define CON_MENU 10 /**< At the main menu */ +#define CON_PLR_DESC 11 /**< Enter a new character description prompt */ +#define CON_CHPWD_GETOLD 12 /**< Changing passwd: Get old */ +#define CON_CHPWD_GETNEW 13 /**< Changing passwd: Get new */ +#define CON_CHPWD_VRFY 14 /**< Changing passwd: Verify new password */ +#define CON_DELCNF1 15 /**< Character Delete: Confirmation 1 */ +#define CON_DELCNF2 16 /**< Character Delete: Confirmation 2 */ +#define CON_DISCONNECT 17 /**< In-game link loss (leave character) */ +#define CON_OEDIT 18 /**< OLC mode - object editor */ +#define CON_REDIT 19 /**< OLC mode - room editor */ +#define CON_ZEDIT 20 /**< OLC mode - zone info editor */ +#define CON_MEDIT 21 /**< OLC mode - mobile editor */ +#define CON_SEDIT 22 /**< OLC mode - shop editor */ +#define CON_TEDIT 23 /**< OLC mode - text editor */ +#define CON_CEDIT 24 /**< OLC mode - conf editor */ +#define CON_AEDIT 25 /**< OLC mode - social (action) edit */ +#define CON_TRIGEDIT 26 /**< OLC mode - trigger edit */ +#define CON_HEDIT 27 /**< OLC mode - help edit */ +#define CON_QEDIT 28 /**< OLC mode - quest edit */ /* Character equipment positions: used as index for char_data.equipment[] */ /* NOTE: Don't confuse these constants with the ITEM_ bitvectors - which control the valid places you can wear a piece of equipment */ -#define WEAR_LIGHT 0 -#define WEAR_FINGER_R 1 -#define WEAR_FINGER_L 2 -#define WEAR_NECK_1 3 -#define WEAR_NECK_2 4 -#define WEAR_BODY 5 -#define WEAR_HEAD 6 -#define WEAR_LEGS 7 -#define WEAR_FEET 8 -#define WEAR_HANDS 9 -#define WEAR_ARMS 10 -#define WEAR_SHIELD 11 -#define WEAR_ABOUT 12 -#define WEAR_WAIST 13 -#define WEAR_WRIST_R 14 -#define WEAR_WRIST_L 15 -#define WEAR_WIELD 16 -#define WEAR_HOLD 17 - -#define NUM_WEARS 18 /* This must be the # of eq positions!! */ + which control the valid places you can wear a piece of equipment. + For example, there are two neck positions on the player, and items + only get the generic neck type. */ +#define WEAR_LIGHT 0 /**< Equipment Location Light */ +#define WEAR_FINGER_R 1 /**< Equipment Location Right Finger */ +#define WEAR_FINGER_L 2 /**< Equipment Location Left Finger */ +#define WEAR_NECK_1 3 /**< Equipment Location Neck #1 */ +#define WEAR_NECK_2 4 /**< Equipment Location Neck #2 */ +#define WEAR_BODY 5 /**< Equipment Location Body */ +#define WEAR_HEAD 6 /**< Equipment Location Head */ +#define WEAR_LEGS 7 /**< Equipment Location Legs */ +#define WEAR_FEET 8 /**< Equipment Location Feet */ +#define WEAR_HANDS 9 /**< Equipment Location Hands */ +#define WEAR_ARMS 10 /**< Equipment Location Arms */ +#define WEAR_SHIELD 11 /**< Equipment Location Shield */ +#define WEAR_ABOUT 12 /**< Equipment Location about body (like a cape)*/ +#define WEAR_WAIST 13 /**< Equipment Location Waist */ +#define WEAR_WRIST_R 14 /**< Equipment Location Right Wrist */ +#define WEAR_WRIST_L 15 /**< Equipment Location Left Wrist */ +#define WEAR_WIELD 16 /**< Equipment Location Weapon */ +#define WEAR_HOLD 17 /**< Equipment Location held in offhand */ +/** Total number of available equipment lcoations */ +#define NUM_WEARS 18 /* object-related defines */ /* Item types: used by obj_data.obj_flags.type_flag */ -#define ITEM_LIGHT 1 /* Item is a light source */ -#define ITEM_SCROLL 2 /* Item is a scroll */ -#define ITEM_WAND 3 /* Item is a wand */ -#define ITEM_STAFF 4 /* Item is a staff */ -#define ITEM_WEAPON 5 /* Item is a weapon */ -#define ITEM_FURNITURE 6 /* Sittable Furniture */ -#define ITEM_FREE 7 /* Unimplemented */ -#define ITEM_TREASURE 8 /* Item is a treasure, not gold */ -#define ITEM_ARMOR 9 /* Item is armor */ -#define ITEM_POTION 10 /* Item is a potion */ -#define ITEM_WORN 11 /* Unimplemented */ -#define ITEM_OTHER 12 /* Misc object */ -#define ITEM_TRASH 13 /* Trash - shopkeeps won't buy */ -#define ITEM_FREE2 14 /* Unimplemented */ -#define ITEM_CONTAINER 15 /* Item is a container */ -#define ITEM_NOTE 16 /* Item is note */ -#define ITEM_DRINKCON 17 /* Item is a drink container */ -#define ITEM_KEY 18 /* Item is a key */ -#define ITEM_FOOD 19 /* Item is food */ -#define ITEM_MONEY 20 /* Item is money (gold) */ -#define ITEM_PEN 21 /* Item is a pen */ -#define ITEM_BOAT 22 /* Item is a boat */ -#define ITEM_FOUNTAIN 23 /* Item is a fountain */ +#define ITEM_LIGHT 1 /**< Item is a light source */ +#define ITEM_SCROLL 2 /**< Item is a scroll */ +#define ITEM_WAND 3 /**< Item is a wand */ +#define ITEM_STAFF 4 /**< Item is a staff */ +#define ITEM_WEAPON 5 /**< Item is a weapon */ +#define ITEM_FURNITURE 6 /**< Sittable Furniture */ +#define ITEM_FREE 7 /**< Unimplemented */ +#define ITEM_TREASURE 8 /**< Item is a treasure, not gold */ +#define ITEM_ARMOR 9 /**< Item is armor */ +#define ITEM_POTION 10 /**< Item is a potion */ +#define ITEM_WORN 11 /**< Unimplemented */ +#define ITEM_OTHER 12 /**< Misc object */ +#define ITEM_TRASH 13 /**< Trash - shopkeepers won't buy */ +#define ITEM_FREE2 14 /**< Unimplemented */ +#define ITEM_CONTAINER 15 /**< Item is a container */ +#define ITEM_NOTE 16 /**< Item is note */ +#define ITEM_DRINKCON 17 /**< Item is a drink container */ +#define ITEM_KEY 18 /**< Item is a key */ +#define ITEM_FOOD 19 /**< Item is food */ +#define ITEM_MONEY 20 /**< Item is money (gold) */ +#define ITEM_PEN 21 /**< Item is a pen */ +#define ITEM_BOAT 22 /**< Item is a boat */ +#define ITEM_FOUNTAIN 23 /**< Item is a fountain */ +/** Total number of item types. + * @todo Should this be 23? */ +#define NUM_ITEM_TYPES 24 /* Take/Wear flags: used by obj_data.obj_flags.wear_flags */ -#define ITEM_WEAR_TAKE 0 /* Item can be taken */ -#define ITEM_WEAR_FINGER 1 /* Can be worn on finger */ -#define ITEM_WEAR_NECK 2 /* Can be worn around neck */ -#define ITEM_WEAR_BODY 3 /* Can be worn on body */ -#define ITEM_WEAR_HEAD 4 /* Can be worn on head */ -#define ITEM_WEAR_LEGS 5 /* Can be worn on legs */ -#define ITEM_WEAR_FEET 6 /* Can be worn on feet */ -#define ITEM_WEAR_HANDS 7 /* Can be worn on hands */ -#define ITEM_WEAR_ARMS 8 /* Can be worn on arms */ -#define ITEM_WEAR_SHIELD 9 /* Can be used as a shield */ -#define ITEM_WEAR_ABOUT 10 /* Can be worn about body */ -#define ITEM_WEAR_WAIST 11 /* Can be worn around waist */ -#define ITEM_WEAR_WRIST 12 /* Can be worn on wrist */ -#define ITEM_WEAR_WIELD 13 /* Can be wielded */ -#define ITEM_WEAR_HOLD 14 /* Can be held */ +#define ITEM_WEAR_TAKE 0 /**< Item can be taken */ +#define ITEM_WEAR_FINGER 1 /**< Item can be worn on finger */ +#define ITEM_WEAR_NECK 2 /**< Item can be worn around neck */ +#define ITEM_WEAR_BODY 3 /**< Item can be worn on body */ +#define ITEM_WEAR_HEAD 4 /**< Item can be worn on head */ +#define ITEM_WEAR_LEGS 5 /**< Item can be worn on legs */ +#define ITEM_WEAR_FEET 6 /**< Item can be worn on feet */ +#define ITEM_WEAR_HANDS 7 /**< Item can be worn on hands */ +#define ITEM_WEAR_ARMS 8 /**< Item can be worn on arms */ +#define ITEM_WEAR_SHIELD 9 /**< Item can be used as a shield */ +#define ITEM_WEAR_ABOUT 10 /**< Item can be worn about body */ +#define ITEM_WEAR_WAIST 11 /**< Item can be worn around waist */ +#define ITEM_WEAR_WRIST 12 /**< Item can be worn on wrist */ +#define ITEM_WEAR_WIELD 13 /**< Item can be wielded */ +#define ITEM_WEAR_HOLD 14 /**< Item can be held */ +/** Total number of item wears */ +#define NUM_ITEM_WEARS 15 /* Extra object flags: used by obj_data.obj_flags.extra_flags */ -#define ITEM_GLOW 0 /* Item is glowing */ -#define ITEM_HUM 1 /* Item is humming */ -#define ITEM_NORENT 2 /* Item cannot be rented */ -#define ITEM_NODONATE 3 /* Item cannot be donated */ -#define ITEM_NOINVIS 4 /* Item cannot be made invis */ -#define ITEM_INVISIBLE 5 /* Item is invisible */ -#define ITEM_MAGIC 6 /* Item is magical */ -#define ITEM_NODROP 7 /* Item is cursed: can't drop */ -#define ITEM_BLESS 8 /* Item is blessed */ -#define ITEM_ANTI_GOOD 9 /* Not usable by good people */ -#define ITEM_ANTI_EVIL 10 /* Not usable by evil people */ -#define ITEM_ANTI_NEUTRAL 11 /* Not usable by neutral people */ -#define ITEM_ANTI_MAGIC_USER 12 /* Not usable by mages */ -#define ITEM_ANTI_CLERIC 13 /* Not usable by clerics */ -#define ITEM_ANTI_THIEF 14 /* Not usable by thieves */ -#define ITEM_ANTI_WARRIOR 15 /* Not usable by warriors */ -#define ITEM_NOSELL 16 /* Shopkeepers won't touch it */ +#define ITEM_GLOW 0 /**< Item is glowing */ +#define ITEM_HUM 1 /**< Item is humming */ +#define ITEM_NORENT 2 /**< Item cannot be rented */ +#define ITEM_NODONATE 3 /**< Item cannot be donated */ +#define ITEM_NOINVIS 4 /**< Item cannot be made invis */ +#define ITEM_INVISIBLE 5 /**< Item is invisible */ +#define ITEM_MAGIC 6 /**< Item is magical */ +#define ITEM_NODROP 7 /**< Item is cursed: can't drop */ +#define ITEM_BLESS 8 /**< Item is blessed */ +#define ITEM_ANTI_GOOD 9 /**< Not usable by good people */ +#define ITEM_ANTI_EVIL 10 /**< Not usable by evil people */ +#define ITEM_ANTI_NEUTRAL 11 /**< Not usable by neutral people */ +#define ITEM_ANTI_MAGIC_USER 12 /**< Not usable by mages */ +#define ITEM_ANTI_CLERIC 13 /**< Not usable by clerics */ +#define ITEM_ANTI_THIEF 14 /**< Not usable by thieves */ +#define ITEM_ANTI_WARRIOR 15 /**< Not usable by warriors */ +#define ITEM_NOSELL 16 /**< Shopkeepers won't touch it */ +#define ITEM_QUEST 17 /**< Item is a quest item */ +/** Total number of item flags */ +#define NUM_ITEM_FLAGS 18 /* Modifier constants used with obj affects ('A' fields) */ -#define APPLY_NONE 0 /* No effect */ -#define APPLY_STR 1 /* Apply to strength */ -#define APPLY_DEX 2 /* Apply to dexterity */ -#define APPLY_INT 3 /* Apply to intelligence */ -#define APPLY_WIS 4 /* Apply to wisdom */ -#define APPLY_CON 5 /* Apply to constitution */ -#define APPLY_CHA 6 /* Apply to charisma */ -#define APPLY_CLASS 7 /* Reserved */ -#define APPLY_LEVEL 8 /* Reserved */ -#define APPLY_AGE 9 /* Apply to age */ -#define APPLY_CHAR_WEIGHT 10 /* Apply to weight */ -#define APPLY_CHAR_HEIGHT 11 /* Apply to height */ -#define APPLY_MANA 12 /* Apply to max mana */ -#define APPLY_HIT 13 /* Apply to max hit points */ -#define APPLY_MOVE 14 /* Apply to max move points */ -#define APPLY_GOLD 15 /* Reserved */ -#define APPLY_EXP 16 /* Reserved */ -#define APPLY_AC 17 /* Apply to Armor Class */ -#define APPLY_HITROLL 18 /* Apply to hitroll */ -#define APPLY_DAMROLL 19 /* Apply to damage roll */ -#define APPLY_SAVING_PARA 20 /* Apply to save throw: paralz */ -#define APPLY_SAVING_ROD 21 /* Apply to save throw: rods */ -#define APPLY_SAVING_PETRI 22 /* Apply to save throw: petrif */ -#define APPLY_SAVING_BREATH 23 /* Apply to save throw: breath */ -#define APPLY_SAVING_SPELL 24 /* Apply to save throw: spells */ +#define APPLY_NONE 0 /**< No effect */ +#define APPLY_STR 1 /**< Apply to strength */ +#define APPLY_DEX 2 /**< Apply to dexterity */ +#define APPLY_INT 3 /**< Apply to intelligence */ +#define APPLY_WIS 4 /**< Apply to wisdom */ +#define APPLY_CON 5 /**< Apply to constitution */ +#define APPLY_CHA 6 /**< Apply to charisma */ +#define APPLY_CLASS 7 /**< Reserved */ +#define APPLY_LEVEL 8 /**< Reserved */ +#define APPLY_AGE 9 /**< Apply to age */ +#define APPLY_CHAR_WEIGHT 10 /**< Apply to weight */ +#define APPLY_CHAR_HEIGHT 11 /**< Apply to height */ +#define APPLY_MANA 12 /**< Apply to max mana */ +#define APPLY_HIT 13 /**< Apply to max hit points */ +#define APPLY_MOVE 14 /**< Apply to max move points */ +#define APPLY_GOLD 15 /**< Reserved */ +#define APPLY_EXP 16 /**< Reserved */ +#define APPLY_AC 17 /**< Apply to Armor Class */ +#define APPLY_HITROLL 18 /**< Apply to hitroll */ +#define APPLY_DAMROLL 19 /**< Apply to damage roll */ +#define APPLY_SAVING_PARA 20 /**< Apply to save throw: paralysis */ +#define APPLY_SAVING_ROD 21 /**< Apply to save throw: rods */ +#define APPLY_SAVING_PETRI 22 /**< Apply to save throw: petrif */ +#define APPLY_SAVING_BREATH 23 /**< Apply to save throw: breath */ +#define APPLY_SAVING_SPELL 24 /**< Apply to save throw: spells */ +/** Total number of applies */ +#define NUM_APPLIES 25 /* Container flags - value[1] */ -#define CONT_CLOSEABLE (1 << 0) /* Container can be closed */ -#define CONT_PICKPROOF (1 << 1) /* Container is pickproof */ -#define CONT_CLOSED (1 << 2) /* Container is closed */ -#define CONT_LOCKED (1 << 3) /* Container is locked */ +#define CONT_CLOSEABLE (1 << 0) /**< Container can be closed */ +#define CONT_PICKPROOF (1 << 1) /**< Container is pickproof */ +#define CONT_CLOSED (1 << 2) /**< Container is closed */ +#define CONT_LOCKED (1 << 3) /**< Container is locked */ /* Some different kind of liquids for use in values of drink containers */ -#define LIQ_WATER 0 -#define LIQ_BEER 1 -#define LIQ_WINE 2 -#define LIQ_ALE 3 -#define LIQ_DARKALE 4 -#define LIQ_WHISKY 5 -#define LIQ_LEMONADE 6 -#define LIQ_FIREBRT 7 -#define LIQ_LOCALSPC 8 -#define LIQ_SLIME 9 -#define LIQ_MILK 10 -#define LIQ_TEA 11 -#define LIQ_COFFE 12 -#define LIQ_BLOOD 13 -#define LIQ_SALTWATER 14 -#define LIQ_CLEARWATER 15 +#define LIQ_WATER 0 /**< Liquid type water */ +#define LIQ_BEER 1 /**< Liquid type beer */ +#define LIQ_WINE 2 /**< Liquid type wine */ +#define LIQ_ALE 3 /**< Liquid type ale */ +#define LIQ_DARKALE 4 /**< Liquid type darkale */ +#define LIQ_WHISKY 5 /**< Liquid type whisky */ +#define LIQ_LEMONADE 6 /**< Liquid type lemonade */ +#define LIQ_FIREBRT 7 /**< Liquid type firebrt */ +#define LIQ_LOCALSPC 8 /**< Liquid type localspc */ +#define LIQ_SLIME 9 /**< Liquid type slime */ +#define LIQ_MILK 10 /**< Liquid type milk */ +#define LIQ_TEA 11 /**< Liquid type tea */ +#define LIQ_COFFE 12 /**< Liquid type coffee */ +#define LIQ_BLOOD 13 /**< Liquid type blood */ +#define LIQ_SALTWATER 14 /**< Liquid type saltwater */ +#define LIQ_CLEARWATER 15 /**< Liquid type clearwater */ +/** Total number of liquid types */ +#define NUM_LIQ_TYPES 16 /* other miscellaneous defines */ /* Player conditions */ -#define DRUNK 0 -#define HUNGER 1 -#define THIRST 2 +#define DRUNK 0 /**< Player drunk condition */ +#define HUNGER 1 /**< Player hunger condition */ +#define THIRST 2 /**< Player thirst condition */ /* Sun state for weather_data */ -#define SUN_DARK 0 -#define SUN_RISE 1 -#define SUN_LIGHT 2 -#define SUN_SET 3 +#define SUN_DARK 0 /**< Night time */ +#define SUN_RISE 1 /**< Dawn */ +#define SUN_LIGHT 2 /**< Day time */ +#define SUN_SET 3 /**< Dusk */ /* Sky conditions for weather_data */ -#define SKY_CLOUDLESS 0 -#define SKY_CLOUDY 1 -#define SKY_RAINING 2 -#define SKY_LIGHTNING 3 +#define SKY_CLOUDLESS 0 /**< Weather = No clouds */ +#define SKY_CLOUDY 1 /**< Weather = Cloudy */ +#define SKY_RAINING 2 /**< Weather = Rain */ +#define SKY_LIGHTNING 3 /**< Weather = Lightning storm */ /* Rent codes */ -#define RENT_UNDEF 0 -#define RENT_CRASH 1 -#define RENT_RENTED 2 -#define RENT_CRYO 3 -#define RENT_FORCED 4 -#define RENT_TIMEDOUT 5 +#define RENT_UNDEF 0 /**< Character inv save status = undefined */ +#define RENT_CRASH 1 /**< Character inv save status = game crash */ +#define RENT_RENTED 2 /**< Character inv save status = rented */ +#define RENT_CRYO 3 /**< Character inv save status = cryogenics */ +#define RENT_FORCED 4 /**< Character inv save status = forced rent */ +#define RENT_TIMEDOUT 5 /**< Character inv save status = timed out */ -/* 128 Bits */ -#define RF_ARRAY_MAX 4 -#define PM_ARRAY_MAX 4 -#define PR_ARRAY_MAX 4 -#define AF_ARRAY_MAX 4 -#define TW_ARRAY_MAX 4 -#define EF_ARRAY_MAX 4 +/* Settings for Bit Vectors */ +#define RF_ARRAY_MAX 4 /**< # Bytes in Bit vector - Room flags */ +#define PM_ARRAY_MAX 4 /**< # Bytes in Bit vector - Act and Player flags */ +#define PR_ARRAY_MAX 4 /**< # Bytes in Bit vector - Player Pref Flags */ +#define AF_ARRAY_MAX 4 /**< # Bytes in Bit vector - Affect flags */ +#define TW_ARRAY_MAX 4 /**< # Bytes in Bit vector - Obj Wear Locations */ +#define EF_ARRAY_MAX 4 /**< # Bytes in Bit vector - Obj Extra Flags */ /* other #defined constants */ /* **DO**NOT** blindly change the number of levels in your MUD merely by @@ -445,581 +495,712 @@ * LVL_IMPL should always be the HIGHEST possible immortal level, and * LVL_IMMORT should always be the LOWEST immortal level. The number of * mortal levels will always be LVL_IMMORT - 1. */ -#define LVL_IMPL 34 -#define LVL_GRGOD 33 -#define LVL_GOD 32 -#define LVL_IMMORT 31 +#define LVL_IMPL 34 /**< Level of Implementors */ +#define LVL_GRGOD 33 /**< Level of Greater Gods */ +#define LVL_GOD 32 /**< Level of Gods */ +#define LVL_IMMORT 31 /**< Level of Immortals */ -/* Builders that have access to the saveall command */ +/** Minimum level to build and to run the saveall command */ #define LVL_BUILDER LVL_IMMORT -#define NUM_OF_DIRS 6 /* number of directions in a room (nsewud) */ -#define MAGIC_NUMBER (0x06) /* Arbitrary number that won't be in a string */ +/** Arbitrary number that won't be in a string */ +#define MAGIC_NUMBER (0x06) -/* OPT_USEC determines how many commands will be processed by the MUD per +/** OPT_USEC determines how many commands will be processed by the MUD per * second and how frequently it does socket I/O. A low setting will cause * actions to be executed more frequently but will increase overhead due to * more cycling to check. A high setting (e.g. 1 Hz) may upset your players * as actions (such as large speedwalking chains) take longer to be executed. - * You shouldn't need to adjust this. */ -#define OPT_USEC 100000 /* 10 passes per second */ + * You shouldn't need to adjust this. + * This will equate to 10 passes per second. + * @see PASSES_PER_SEC + * @see RL_SEC + */ +#define OPT_USEC 100000 +/** How many heartbeats equate to one real second. + * @see OPT_USEC + * @see RL_SEC + */ #define PASSES_PER_SEC (1000000 / OPT_USEC) +/** Used with other macros to define at how many heartbeats a control loop + * gets executed. Helps to translate pulse counts to real seconds for + * human comprehension. + * @see PASSES_PER_SEC + */ #define RL_SEC * PASSES_PER_SEC +/** Controls when a zone update will occur. */ #define PULSE_ZONE (10 RL_SEC) +/** Controls when mobile (NPC) actions and updates will occur. */ #define PULSE_MOBILE (10 RL_SEC) +/** Controls the time between turns of combat. */ #define PULSE_VIOLENCE ( 2 RL_SEC) -#define PULSE_AUTOSAVE (60 RL_SEC) -#define PULSE_IDLEPWD (15 RL_SEC) -#define PULSE_SANITY (30 RL_SEC) -#define PULSE_USAGE (5 * 60 RL_SEC) /* 5 mins */ -#define PULSE_TIMESAVE (30 * 60 RL_SEC) /* should be >= SECS_PER_MUD_HOUR */ +/** Controls when characters and houses (if implemented) will be autosaved. + * @see CONFIG_AUTO_SAVE + */ +#define PULSE_AUTOSAVE (60 RL_SEC) +/** Controls when checks are made for idle name and password CON_ states */ +#define PULSE_IDLEPWD (15 RL_SEC) +/** Currently unused. */ +#define PULSE_SANITY (30 RL_SEC) +/** How often to log # connected sockets and # active players. + * Currently set for 5 minutes. + */ +#define PULSE_USAGE (5 * 60 RL_SEC) +/** Controls when to save the current ingame MUD time to disk. + * This should be set >= SECS_PER_MUD_HOUR */ +#define PULSE_TIMESAVE (30 * 60 RL_SEC) /* Variables for the output buffering system */ -#define MAX_SOCK_BUF (24 * 1024) /* Size of kernel's sock buf */ -#define MAX_PROMPT_LENGTH 96 /* Max length of prompt */ -#define GARBAGE_SPACE 32 /* Space for **OVERFLOW** etc */ -#define SMALL_BUFSIZE 1024 /* Static output buffer size */ -/* Max amount of output that can be buffered */ -#define LARGE_BUFSIZE (MAX_SOCK_BUF - GARBAGE_SPACE - MAX_PROMPT_LENGTH) +#define MAX_SOCK_BUF (24 * 1024) /**< Size of kernel's sock buf */ +#define MAX_PROMPT_LENGTH 96 /**< Max length of prompt */ +#define GARBAGE_SPACE 32 /**< Space for **OVERFLOW** etc */ +#define SMALL_BUFSIZE 1024 /**< Static output buffer size */ +/** Max amount of output that can be buffered */ +#define LARGE_BUFSIZE (MAX_SOCK_BUF - GARBAGE_SPACE - MAX_PROMPT_LENGTH) -#define HISTORY_SIZE 5 /* Keep last 5 commands. */ -#define MAX_STRING_LENGTH 49152 -#define MAX_INPUT_LENGTH 512 /* Max length per *line* of input */ -#define MAX_RAW_INPUT_LENGTH 1024 /* Max size of *raw* input */ -#define MAX_MESSAGES 60 -#define MAX_NAME_LENGTH 20 -#define MAX_PWD_LENGTH 30 -#define MAX_TITLE_LENGTH 80 -#define HOST_LENGTH 40 -#define PLR_DESC_LENGTH 4096 -#define MAX_SKILLS 200 -#define MAX_AFFECT 32 -#define MAX_OBJ_AFFECT 6 /* Used in obj_file_elem */ -#define MAX_NOTE_LENGTH 4000 /* arbitrary */ -#define MAX_LAST_ENTRIES 6000 /* arbitrary */ -#define MAX_HELP_KEYWORDS 256 -#define MAX_HELP_ENTRY MAX_STRING_LENGTH +#define MAX_STRING_LENGTH 49152 /**< Max length of string, as defined */ +#define MAX_INPUT_LENGTH 512 /**< Max length per *line* of input */ +#define MAX_RAW_INPUT_LENGTH 1024 /**< Max size of *raw* input */ +#define MAX_MESSAGES 60 /**< Max Different attack message types */ +#define MAX_NAME_LENGTH 20 /**< Max PC/NPC name length */ +#define MAX_PWD_LENGTH 30 /**< Max PC password length */ +#define MAX_TITLE_LENGTH 80 /**< Max PC title length */ +#define HOST_LENGTH 40 /**< Max hostname resolution length */ +#define PLR_DESC_LENGTH 4096 /**< Max length for PC description */ +#define MAX_SKILLS 200 /**< Max number of skills/spells */ +#define MAX_AFFECT 32 /**< Max number of player affections */ +#define MAX_OBJ_AFFECT 6 /**< Max object affects */ +#define MAX_NOTE_LENGTH 4000 /**< Max length of text on a note obj */ +#define MAX_LAST_ENTRIES 6000 /**< Max log entries?? */ +#define MAX_HELP_KEYWORDS 256 /**< Max length of help keyword string */ +#define MAX_HELP_ENTRY MAX_STRING_LENGTH /**< Max size of help entry */ +#define MAX_COMPLETED_QUESTS 1024 /**< Maximum number of completed quests allowed */ -/* define the largest set of commands for a trigger */ -#define MAX_CMD_LENGTH 16384 /* 16k should be plenty and then some */ +/** Define the largest set of commands for a trigger. + * 16k should be plenty and then some. */ +#define MAX_CMD_LENGTH 16384 -/* Structures */ -typedef signed char sbyte; -typedef unsigned char ubyte; -typedef signed short int sh_int; -typedef unsigned short int ush_int; +/* Type Definitions */ +typedef signed char sbyte; /**< 1 byte; vals = -127 to 127 */ +typedef unsigned char ubyte; /**< 1 byte; vals = 0 to 255 */ +typedef signed short int sh_int; /**< 2 bytes; vals = -32,768 to 32,767 */ +typedef unsigned short int ush_int; /**< 2 bytes; vals = 0 to 65,535 */ #if !defined(__cplusplus) /* Anyone know a portable method? */ -typedef char bool; +typedef char bool; /**< Technically 1 signed byte; vals should only = TRUE or FALSE. */ #endif #if !defined(CIRCLE_WINDOWS) || defined(LCC_WIN32) /* Hm, sysdep.h? */ -typedef signed char byte; +typedef signed char byte; /**< Technically 1 signed byte; vals should only = TRUE or FALSE. */ #endif /* Various virtual (human-reference) number types. */ -typedef IDXTYPE room_vnum; -typedef IDXTYPE obj_vnum; -typedef IDXTYPE mob_vnum; -typedef IDXTYPE zone_vnum; -typedef IDXTYPE shop_vnum; -typedef IDXTYPE trig_vnum; +typedef IDXTYPE room_vnum; /**< vnum specifically for room */ +typedef IDXTYPE obj_vnum; /**< vnum specifically for object */ +typedef IDXTYPE mob_vnum; /**< vnum specifically for mob (NPC) */ +typedef IDXTYPE zone_vnum; /**< vnum specifically for zone */ +typedef IDXTYPE shop_vnum; /**< vnum specifically for shop */ +typedef IDXTYPE trig_vnum; /**< vnum specifically for triggers */ +typedef IDXTYPE qst_vnum; /**< vnum specifically for quests */ /* Various real (array-reference) number types. */ -typedef IDXTYPE room_rnum; -typedef IDXTYPE obj_rnum; -typedef IDXTYPE mob_rnum; -typedef IDXTYPE zone_rnum; -typedef IDXTYPE shop_rnum; -typedef IDXTYPE trig_rnum; +typedef IDXTYPE room_rnum; /**< references an instance of a room */ +typedef IDXTYPE obj_rnum; /**< references an instance of a obj */ +typedef IDXTYPE mob_rnum; /**< references an instance of a mob (NPC) */ +typedef IDXTYPE zone_rnum; /**< references an instance of a zone */ +typedef IDXTYPE shop_rnum; /**< references an instance of a shop */ +typedef IDXTYPE trig_rnum; /**< references an instance of a trigger */ +typedef IDXTYPE qst_rnum; /**< references an instance of a quest */ -/* Bitvector type for 32 bit unsigned long bitvectors. 'unsigned long long' +/** Bitvector type for 32 bit unsigned long bitvectors. 'unsigned long long' * will give you at least 64 bits if you have GCC. You'll have to search * throughout the code for "bitvector_t" and change them yourself if you'd * like this extra flexibility. */ -typedef unsigned long int bitvector_t; +typedef unsigned long int bitvector_t; -/* Extra description: used in objects, mobiles, and rooms */ -struct extra_descr_data { - char *keyword; /* Keyword in look/examine */ - char *description; /* What to see */ - struct extra_descr_data *next; /* Next in list */ +/** Extra description: used in objects, mobiles, and rooms. For example, + * a 'look hair' might pull up an extra description (if available) for + * the mob, object or room. + * Multiple extra descriptions on the same object are implemented as a + * linked list. */ +struct extra_descr_data +{ + char *keyword; /**< Keyword for look/examine */ + char *description; /**< What is shown when this keyword is 'seen' */ + struct extra_descr_data *next; /**< Next description for this mob/obj/room */ }; /* object-related structures */ -#define NUM_OBJ_VAL_POSITIONS 4 -/* object flags; used in obj_data */ -struct obj_flag_data { - int value[NUM_OBJ_VAL_POSITIONS]; /* Values of the item (see list) */ - byte type_flag; /* Type of item */ - int level; /* Minimum level of object */ - int wear_flags[TW_ARRAY_MAX]; /* Where you can wear it */ - int extra_flags[EF_ARRAY_MAX]; /* If it hums, glows, etc. */ - int weight; /* Weight what else */ - int cost; /* Value when sold (gp.) */ - int cost_per_day; /* Cost to keep pr. real day */ - int timer; /* Timer for object */ - int bitvector[AF_ARRAY_MAX]; /* To set chars bits */ +/**< Number of elements in the object value array. Raising this will provide + * more configurability per object type, and shouldn't break anything. + * DO NOT LOWER from the default value of 4. */ +#define NUM_OBJ_VAL_POSITIONS 4 + +/** object flags used in obj_data. These represent the instance values for + * a real object, values that can change during gameplay. */ +struct obj_flag_data +{ + int value[NUM_OBJ_VAL_POSITIONS]; /**< Values of the item (see list) */ + byte type_flag; /**< Type of item */ + int level; /**< Minimum level to use object */ + int wear_flags[TW_ARRAY_MAX]; /**< Where you can wear it, if wearable */ + int extra_flags[EF_ARRAY_MAX]; /**< If it hums, glows, etc. */ + int weight; /**< Weight of the object */ + int cost; /**< Value when sold */ + int cost_per_day; /**< Rent cost per real day */ + int timer; /**< Timer for object */ + int bitvector[AF_ARRAY_MAX]; /**< Affects characters */ }; -/* Used in obj_file_elem *DO*NOT*CHANGE* */ -struct obj_affected_type { - byte location; /* Which ability to change (APPLY_XXX) */ - sbyte modifier; /* How much it changes by */ +/** Used in obj_file_elem. DO NOT CHANGE if you are using binary object files + * and already have a player base and don't want to do a player wipe. */ +struct obj_affected_type +{ + byte location; /**< Which ability to change (APPLY_XXX) */ + sbyte modifier; /**< How much it changes by */ }; -/* Memory Structure for Objects */ -struct obj_data { - obj_rnum item_number; /* Where in data-base */ - room_rnum in_room; /* In what room -1 when conta/carr */ +/** The Object structure. */ +struct obj_data +{ + obj_rnum item_number; /**< The unique id of this object instance. */ + room_rnum in_room; /**< What room is the object lying in, or -1? */ - struct obj_flag_data obj_flags;/* Object information */ - struct obj_affected_type affected[MAX_OBJ_AFFECT]; /* affects */ + struct obj_flag_data obj_flags; /**< Object information */ + struct obj_affected_type affected[MAX_OBJ_AFFECT]; /**< affects */ - char *name; /* Title of object :get etc. */ - char *description; /* When in room */ - char *short_description; /* when worn/carry/in cont. */ - char *action_description; /* What to write when used */ - struct extra_descr_data *ex_description; /* extra descriptions */ - struct char_data *carried_by; /* Carried by :NULL in room/conta */ - struct char_data *worn_by; /* Worn by? */ - sh_int worn_on; /* Worn where? */ + char *name; /**< Keyword reference(s) for object. */ + char *description; /**< Shown when the object is lying in a room. */ + char *short_description; /**< Shown when worn, carried, in a container */ + char *action_description; /**< Displays when (if) the object is used */ + struct extra_descr_data *ex_description; /**< List of extra descriptions */ + struct char_data *carried_by; /**< Points to PC/NPC carrying, or NULL */ + struct char_data *worn_by; /**< Points to PC/NPC wearing, or NULL */ + sh_int worn_on; /**< If the object can be worn, where can it be worn? */ - struct obj_data *in_obj; /* In what object NULL when none */ - struct obj_data *contains; /* Contains objects */ + struct obj_data *in_obj; /**< Points to carrying object, or NULL */ + struct obj_data *contains; /**< List of objects being carried, or NULL */ - long id; /* used by DG triggers - unique id */ - struct trig_proto_list *proto_script; /* list of default triggers */ - struct script_data *script; /* script info for the object */ + long id; /**< used by DG triggers - unique id */ + struct trig_proto_list *proto_script; /**< list of default triggers */ + struct script_data *script; /**< script info for the object */ - struct obj_data *next_content; /* For 'contains' lists */ - struct obj_data *next; /* For the object list */ - struct char_data *sitting_here;/* who is sitting in it */ + struct obj_data *next_content; /**< For 'contains' lists */ + struct obj_data *next; /**< For the object list */ + struct char_data *sitting_here; /**< For furniture, who is sitting in it */ }; -/* File Element for Objects BEWARE: Changing it will ruin rent files */ -struct obj_file_elem { - obj_vnum item_number; +/** Instance info for an object that gets saved to disk. + * DO NOT CHANGE if you are using binary object files + * and already have a player base and don't want to do a player wipe. */ +struct obj_file_elem +{ + obj_vnum item_number; /**< The prototype, non-unique info for this object. */ #if USE_AUTOEQ - sh_int location; + sh_int location; /**< If re-equipping objects on load, wear object here */ #endif - int value[NUM_OBJ_VAL_POSITIONS]; - int extra_flags[EF_ARRAY_MAX]; - int weight; - int timer; - int bitvector[AF_ARRAY_MAX]; - struct obj_affected_type affected[MAX_OBJ_AFFECT]; + int value[NUM_OBJ_VAL_POSITIONS]; /**< Current object values */ + int extra_flags[EF_ARRAY_MAX]; /**< Object extra flags */ + int weight; /**< Object weight */ + int timer; /**< Current object timer setting */ + int bitvector[AF_ARRAY_MAX]; /**< Object affects */ + struct obj_affected_type affected[MAX_OBJ_AFFECT]; /**< Affects to mobs */ }; -/* header block for rent files. BEWARE: Changing it will ruin rent files */ -struct rent_info { - int time; - int rentcode; - int net_cost_per_diem; - int gold; - int account; - int nitems; - int spare0; - int spare1; - int spare2; - int spare3; - int spare4; - int spare5; - int spare6; - int spare7; +/** Header block for rent files. + * DO NOT CHANGE the structure if you are using binary object files + * and already have a player base and don't want to do a player wipe. + * If you are using binary player files, feel free to turn the spare + * variables into something more meaningful, as long as you keep the + * int datatype. + * NOTE: This is *not* used with the ascii playerfiles. + * NOTE 2: This structure appears to be unused in this codebase? */ +struct rent_info +{ + int time; + int rentcode; /**< How this character rented */ + int net_cost_per_diem; /**< ? Appears to be unused ? */ + int gold; /**< ? Appears to be unused ? */ + int account; /**< ? Appears to be unused ? */ + int nitems; /**< ? Appears to be unused ? */ + int spare0; + int spare1; + int spare2; + int spare3; + int spare4; + int spare5; + int spare6; + int spare7; }; /* room-related structures */ -struct room_direction_data { - char *general_description; /* When look DIR. */ - char *keyword; /* for open/close */ +/** Direction (north, south, east...) information for rooms. */ +struct room_direction_data +{ + char *general_description; /**< Show to char looking in this direction. */ - sh_int /*bitvector_t*/ exit_info; /* Exit info */ - obj_vnum key; /* Key's number (-1 for no key) */ - room_rnum to_room; /* Where direction leads (NOWHERE) */ + char *keyword; /**< for interacting (open/close) this direction */ + + sh_int /*bitvector_t*/ exit_info; /**< Door, and what type? */ + obj_vnum key; /**< Key's vnum (-1 for no key) */ + room_rnum to_room; /**< Where direction leads, or NOWHERE if not defined */ }; -/* Memory Structure for room */ -struct room_data { - room_vnum number; /* Rooms number (vnum) */ - zone_rnum zone; /* Room zone (for resetting) */ - int sector_type; /* sector type (move/hide) */ - int room_flags[RF_ARRAY_MAX]; /* DEATH, DARK, etc */ - char *name; /* Rooms name */ - char *description; /* Shown when entered */ - struct extra_descr_data *ex_description; /* for look/examine */ - struct room_direction_data *dir_option[NUM_OF_DIRS]; /* Directions */ - byte light; /* Number of lightsources in room */ - SPECIAL(*func); - struct trig_proto_list *proto_script; /* list of default triggers */ - struct script_data *script; /* script info for the room */ - struct obj_data *contents; /* List of items in room */ - struct char_data *people; /* List of NPC / PC in room */ +/** The Room Structure. */ +struct room_data +{ + room_vnum number; /**< Rooms number (vnum) */ + zone_rnum zone; /**< Room zone (for resetting) */ + int sector_type; /**< sector type (move/hide) */ + int room_flags[RF_ARRAY_MAX]; /**< INDOORS, DARK, etc */ + char *name; /**< Room name */ + char *description; /**< Shown when entered, looked at */ + struct extra_descr_data *ex_description; /**< Additional things to look at */ + struct room_direction_data *dir_option[NUM_OF_DIRS]; /**< Directions */ + byte light; /**< Number of lightsources in room */ + SPECIAL(*func); /**< Points to special function attached to room */ + struct trig_proto_list *proto_script; /**< list of default triggers */ + struct script_data *script; /**< script info for the room */ + struct obj_data *contents; /**< List of items in room */ + struct char_data *people; /**< List of NPCs / PCs in room */ }; /* char-related structures */ -/* memory structure for characters */ -struct memory_rec_struct { - long id; - struct memory_rec_struct *next; +/** Memory structure used by NPCs to remember specific PCs. */ +struct memory_rec_struct +{ + long id; /**< The PC id to remember. */ + struct memory_rec_struct *next; /**< Next PC to remember */ }; +/** memory_rec_struct typedef */ typedef struct memory_rec_struct memory_rec; -/* This structure is purely intended to be an easy way to transfer and return +/** This structure is purely intended to be an easy way to transfer and return * information about time (real or mudwise). */ -struct time_info_data { - int hours, day, month; - sh_int year; +struct time_info_data +{ + int hours; /**< numeric hour */ + int day; /**< numeric day */ + int month; /**< numeric month */ + sh_int year; /**< numeric year */ }; -/* These data contain information about a players time data */ -struct time_data { - time_t birth; /* This represents the characters age */ - time_t logon; /* Time of the last logon (used to calculate played) */ - int played; /* This is the total accumulated time played in secs */ +/** Player specific time information. */ +struct time_data +{ + time_t birth; /**< Represents the PCs birthday, used to calculate age. */ + time_t logon; /**< Time of the last logon, used to calculate time played */ + int played; /**< This is the total accumulated time played in secs */ }; -/* The pclean_criteria_data is set up in config.c and used in db.c to determine +/** The pclean_criteria_data is set up in config.c and used in db.c to determine * the conditions which will cause a player character to be deleted from disk * if the automagic pwipe system is enabled (see config.c). */ -struct pclean_criteria_data { - int level; /* max level for this time limit */ - int days; /* time limit in days */ +struct pclean_criteria_data +{ + int level; /**< PC level and below to check for deletion */ + int days; /**< time limit in days, for this level of PC */ }; -/* general player-related info, usually PC's and NPC's */ -struct char_player_data { - char passwd[MAX_PWD_LENGTH+1]; /* character's password */ - char *name; /* PC / NPC s name (kill ... ) */ - char *short_descr; /* for NPC 'actions' */ - char *long_descr; /* for 'look' */ - char *description; /* Extra descriptions */ - char *title; /* PC / NPC's title */ - byte sex; /* PC / NPC's sex */ - byte chclass; /* PC / NPC's class */ - byte level; /* PC / NPC's level */ - struct time_data time; /* PC's AGE in days */ - ubyte weight; /* PC / NPC's weight */ - ubyte height; /* PC / NPC's height */ +/** General info used by PC's and NPC's. */ +struct char_player_data +{ + char passwd[MAX_PWD_LENGTH+1]; /**< PC's password */ + char *name; /**< PC / NPC name */ + char *short_descr; /**< NPC 'actions' */ + char *long_descr; /**< PC / NPC look description */ + char *description; /**< NPC Extra descriptions */ + char *title; /**< PC / NPC title */ + byte sex; /**< PC / NPC sex */ + byte chclass; /**< PC / NPC class */ + byte level; /**< PC / NPC level */ + struct time_data time; /**< PC AGE in days */ + ubyte weight; /**< PC / NPC weight */ + ubyte height; /**< PC / NPC height */ }; -/* Char's abilities. */ -struct char_ability_data { - sbyte str; - sbyte str_add; /* 000 - 100 if strength 18 */ - sbyte intel; - sbyte wis; - sbyte dex; - sbyte con; - sbyte cha; +/** Character abilities. Different instances of this structure are used for + * both inherent and current ability scores (like when poison affects the + * player strength). */ +struct char_ability_data +{ + sbyte str; /**< Strength. */ + sbyte str_add; /**< Strength multiplier if str = 18. Usually from 0 to 100 */ + sbyte intel; /**< Intelligence */ + sbyte wis; /**< Wisdom */ + sbyte dex; /**< Dexterity */ + sbyte con; /**< Constitution */ + sbyte cha; /**< Charisma */ }; -/* Char's points. */ -struct char_point_data { - sh_int mana; - sh_int max_mana; /* Max mana for PC/NPC */ - sh_int hit; - sh_int max_hit; /* Max hit for PC/NPC */ - sh_int move; - sh_int max_move; /* Max move for PC/NPC */ +/** Character 'points', or health statistics. */ +struct char_point_data +{ + sh_int mana; /**< Current mana level */ + sh_int max_mana; /**< Max mana level */ + sh_int hit; /**< Curent hit point, or health, level */ + sh_int max_hit; /**< Max hit point, or health, level */ + sh_int move; /**< Current move point, or stamina, level */ + sh_int max_move; /**< Max move point, or stamina, level */ - sh_int armor; /* Internal -100..100, external -10..10 AC */ - int gold; /* Money carried */ - int bank_gold; /* Gold the char has in a bank account */ - int exp; /* The experience of the player */ + /** Current armor class. Internal use goes from -100 (totally armored) to + * 100 (totally naked). Externally expressed as -10 (totally armored) to + * 10 (totally naked). Currently follows the old and decrepit Advanced + * Dungeons and Dragons method of dealing with character defense, or + * Armor class. */ + sh_int armor; + int gold; /**< Current gold carried on character */ + int bank_gold; /**< Gold the char has in a bank account */ + int exp; /**< The experience points, or value, of the character. */ - sbyte hitroll; /* Any bonus or penalty to the hit roll */ - sbyte damroll; /* Any bonus or penalty to the damage roll */ + sbyte hitroll; /**< Any bonus or penalty to the hit roll */ + sbyte damroll; /**< Any bonus or penalty to the damage roll */ }; -/* char_special_data_saved: specials which both a PC and an NPC have in +/** char_special_data_saved: specials which both a PC and an NPC have in * common, but which must be saved to the players file for PC's. */ -struct char_special_data_saved { - int alignment; /* +-1000 for alignments */ - long idnum; /* player's idnum; -1 for mobiles */ - int act[PM_ARRAY_MAX]; /* act flag for NPC's; player flag for PC's */ - int affected_by[AF_ARRAY_MAX]; /* Bitvector for spells/skills affected by */ - sh_int apply_saving_throw[5]; /* Saving throw (Bonuses) */ +struct char_special_data_saved +{ + int alignment; /**< -1000 (evil) to 1000 (good) range. */ + long idnum; /**< PC's idnum; -1 for mobiles. */ + int act[PM_ARRAY_MAX]; /**< act flags for NPC's; player flag for PC's */ + int affected_by[AF_ARRAY_MAX]; /**< Bitvector for spells/skills affected by */ + sh_int apply_saving_throw[5]; /**< Saving throw (Bonuses) */ }; -/* Special playing constants shared by PCs and NPCs which aren't in pfile */ -struct char_special_data { - struct char_data *fighting; /* Opponent */ - struct char_data *hunting; /* Char hunted by this char */ - struct obj_data *furniture; /* Object the char is sitting in */ - struct char_data *next_in_furniture; /* The next person sitting */ +/** Special playing constants shared by PCs and NPCs which aren't in pfile */ +struct char_special_data +{ + struct char_data *fighting; /**< Target of fight; else NULL */ + struct char_data *hunting; /**< Target of NPC hunt; else NULL */ + struct obj_data *furniture; /**< Object being sat on/in; else NULL */ + struct char_data *next_in_furniture; /**< Next person sitting, else NULL */ - byte position; /* Standing, fighting, sleeping, etc. */ + byte position; /**< Standing, fighting, sleeping, etc. */ - int carry_weight; /* Carried weight */ - byte carry_items; /* Number of items carried */ - int timer; /* Timer for update */ + int carry_weight; /**< Carried weight */ + byte carry_items; /**< Number of items carried */ + int timer; /**< Timer for update */ - struct char_special_data_saved saved; /* constants saved in plrfile */ + struct char_special_data_saved saved; /**< Constants saved for PCs. */ }; -struct player_special_data_saved { - byte skills[MAX_SKILLS+1]; /* array of skills plus skill 0 */ - int wimp_level; /* Below this # of hit points, flee! */ - byte freeze_level; /* Level of god who froze char, if any */ - sh_int invis_level; /* level of invisibility */ - room_vnum load_room; /* Which room to place char in */ - int pref[PR_ARRAY_MAX]; /* preference flags for players */ - ubyte bad_pws; /* number of bad password attemps */ - sbyte conditions[3]; /* Drunk, hunger, thirst */ - struct txt_block *comm_hist[NUM_HIST]; /* Player's comms history */ - ubyte page_length; /* How long a players page is */ - int spells_to_learn; /* How many spells you can learn */ - int olc_zone; /* A players olc access */ - int questpoints; /* A players questpoints earned */ +/** Data only needed by PCs, and needs to be saved to disk. */ +struct player_special_data_saved +{ + byte skills[MAX_SKILLS+1]; /**< Character skills. */ + int wimp_level; /**< Below this # of hit points, flee! */ + byte freeze_level; /**< Level of god who froze char, if any */ + sh_int invis_level; /**< level of invisibility */ + room_vnum load_room; /**< Which room to load PC into */ + int pref[PR_ARRAY_MAX]; /**< preference flags */ + ubyte bad_pws; /**< number of bad login attempts */ + sbyte conditions[3]; /**< Drunk, hunger, and thirst */ + struct txt_block *comm_hist[NUM_HIST]; /**< Communication history */ + ubyte page_length; /**< Max number of rows of text to send at once */ + ubyte screen_width; /**< How wide the display page is */ + int spells_to_learn; /**< Remaining number of practice sessions */ + int olc_zone; /**< Current olc permissions */ + int questpoints; /**< Number of quest points earned */ + qst_vnum *completed_quests; /**< Quests completed */ + int num_completed_quests; /**< Number completed */ + int current_quest; /**< vnum of current quest */ + int quest_time; /**< time left on current quest */ + int quest_counter; /**< Count of targets left to get */ }; -/* Specials needed only by PCs, not NPCs. Space for this structure is +/** Specials needed only by PCs, not NPCs. Space for this structure is * not allocated in memory for NPCs, but it is for PCs and the portion * of it labelled 'saved' is saved in the players file. */ -struct player_special_data { - struct player_special_data_saved saved; +struct player_special_data +{ + struct player_special_data_saved saved; /**< Information to be saved. */ - char *poofin; /* Description on arrival of a god. */ - char *poofout; /* Description upon a god's exit. */ - struct alias_data *aliases; /* Character's aliases */ - long last_tell; /* idnum of last tell from */ - void *last_olc_targ; /* olc control */ - int last_olc_mode; /* olc control */ - char *host; /* player host */ + char *poofin; /**< Description displayed to room on arrival of a god. */ + char *poofout; /**< Description displayed to room at a god's exit. */ + struct alias_data *aliases; /**< Command aliases */ + long last_tell; /**< idnum of PC who last told this PC, used to reply */ + void *last_olc_targ; /**< ? Currently Unused ? */ + int last_olc_mode; /**< ? Currently Unused ? */ + char *host; /**< Resolved hostname, or ip, for player. */ }; -/* Specials used by NPCs, not PCs */ -struct mob_special_data { - memory_rec *memory; /* List of attackers to remember */ - byte attack_type; /* The Attack Type Bitvector for NPC's */ - byte default_pos; /* Default position for NPC */ - byte damnodice; /* The number of damage dice's */ - byte damsizedice; /* The size of the damage dice's */ +/** Special data used by NPCs, not PCs */ +struct mob_special_data +{ + memory_rec *memory; /**< List of PCs to remember */ + byte attack_type; /**< The primary attack type (bite, sting, hit, etc.) */ + byte default_pos; /**< Default position (standing, sleeping, etc.) */ + byte damnodice; /**< The number of dice to roll for damage */ + byte damsizedice; /**< The size of each die rolled for damage. */ }; -/* An affect structure. */ -struct affected_type { - sh_int type; /* The type of spell that caused this */ - sh_int duration; /* For how long its effects will last */ - sbyte modifier; /* This is added to apropriate ability */ - byte location; /* Tells which ability to change(APPLY_XXX)*/ - long /*bitvector_t*/ bitvector; /* Tells which bits to set (AFF_XXX) */ +/** An affect structure. */ +struct affected_type +{ + sh_int type; /**< The type of spell that caused this */ + sh_int duration; /**< For how long its effects will last */ + sbyte modifier; /**< Added/subtracted to/from apropriate ability */ + byte location; /**< Tells which ability to change(APPLY_XXX). */ + long /*bitvector_t*/bitvector; /**< Tells which bits to set (AFF_XXX). */ - struct affected_type *next; + struct affected_type *next; /**< The next affect in the list of affects. */ }; -/* Structure used for chars following other chars */ -struct follow_type { - struct char_data *follower; - struct follow_type *next; +/** The list element that makes up a list of characters following this + * character. */ +struct follow_type +{ + struct char_data *follower; /**< Character directly following. */ + struct follow_type *next; /**< Next character following. */ }; -/* Structure for player/non-player */ -struct char_data { - int pfilepos; /* playerfile pos */ - mob_rnum nr; /* Mob's rnum */ - room_rnum in_room; /* Location (real room number) */ - room_rnum was_in_room; /* location for linkdead people */ - int wait; /* wait for how many loops */ +/** Master structure for PCs and NPCs. */ +struct char_data +{ + int pfilepos; /**< PC playerfile pos and id number */ + mob_rnum nr; /**< NPC real instance number */ + room_rnum in_room; /**< Current location (real room number) */ + room_rnum was_in_room; /**< Previous location for linkdead people */ + int wait; /**< wait for how many loops before taking action. */ - struct char_player_data player; /* Normal data */ - struct char_ability_data real_abils; /* Abilities without modifiers */ - struct char_ability_data aff_abils; /* Abils with spells/stones/etc */ - struct char_point_data points; /* Points */ - struct char_special_data char_specials; /* PC/NPC specials */ - struct player_special_data *player_specials; /* PC specials */ - struct mob_special_data mob_specials; /* NPC specials */ + struct char_player_data player; /**< General PC/NPC data */ + struct char_ability_data real_abils; /**< Abilities without modifiers */ + struct char_ability_data aff_abils; /**< Abilities with modifiers */ + struct char_point_data points; /**< Point/statistics */ + struct char_special_data char_specials; /**< PC/NPC specials */ + struct player_special_data *player_specials; /**< PC specials */ + struct mob_special_data mob_specials; /**< NPC specials */ - struct affected_type *affected; /* affected by what spells */ - struct obj_data *equipment[NUM_WEARS];/* Equipment array */ + struct affected_type *affected; /**< affected by what spells */ + struct obj_data *equipment[NUM_WEARS]; /**< Equipment array */ - struct obj_data *carrying; /* Head of list */ - struct descriptor_data *desc; /* NULL for mobiles */ + struct obj_data *carrying; /**< List head for objects in inventory */ + struct descriptor_data *desc; /**< Descriptor/connection info; NPCs = NULL */ - long id; /* used by DG triggers - unique id */ - struct trig_proto_list *proto_script; /* list of default triggers */ - struct script_data *script; /* script info for the object */ - struct script_memory *memory; /* for mob memory triggers */ + long id; /**< used by DG triggers - unique id */ + struct trig_proto_list *proto_script; /**< list of default triggers */ + struct script_data *script; /**< script info for the object */ + struct script_memory *memory; /**< for mob memory triggers */ - struct char_data *next_in_room; /* For room->people - list */ - struct char_data *next; /* For either monster or ppl-list */ - struct char_data *next_fighting; /* For fighting list */ + struct char_data *next_in_room; /**< Next PC in the room */ + struct char_data *next; /**< Next char_data in the room */ + struct char_data *next_fighting; /**< Next in line to fight */ - struct follow_type *followers; /* List of chars followers */ - struct char_data *master; /* Who is char following? */ + struct follow_type *followers; /**< List of characters following */ + struct char_data *master; /**< List of character being followed */ - long pref; /* unique session id */ + long pref; /**< unique session id */ }; -/* descriptor-related structures */ -struct txt_block { - char *text; - int aliased; - struct txt_block *next; +/** descriptor-related structures */ +struct txt_block +{ + char *text; /**< ? */ + int aliased; /**< ? */ + struct txt_block *next; /**< ? */ }; -struct txt_q { - struct txt_block *head; - struct txt_block *tail; +/** ? */ +struct txt_q +{ + struct txt_block *head; /**< ? */ + struct txt_block *tail; /**< ? */ }; -struct descriptor_data { - socket_t descriptor; /* file descriptor for socket */ - char host[HOST_LENGTH+1]; /* hostname */ - byte bad_pws; /* number of bad pw attemps this login */ - byte idle_tics; /* tics idle at password prompt */ - int connected; /* mode of 'connectedness' */ - int desc_num; /* unique num assigned to desc */ - time_t login_time; /* when the person connected */ - char *showstr_head; /* for keeping track of an internal str */ - char **showstr_vector; /* for paging through texts */ - int showstr_count; /* number of pages to page through */ - int showstr_page; /* which page are we currently showing? */ - char **str; /* for the modify-str system */ - char *backstr; /* backup string for modify-str system */ - size_t max_str; /* maximum size of string in modify-str */ - long mail_to; /* name for mail system */ - int has_prompt; /* is the user at a prompt? */ - char inbuf[MAX_RAW_INPUT_LENGTH]; /* buffer for raw input */ - char last_input[MAX_INPUT_LENGTH]; /* the last input */ - char small_outbuf[SMALL_BUFSIZE]; /* standard output buffer */ - char *output; /* ptr to the current output buffer */ - char **history; /* History of commands, for ! mostly. */ - int history_pos; /* Circular array position. */ - int bufptr; /* ptr to end of current output */ - int bufspace; /* space left in the output buffer */ - struct txt_block *large_outbuf; /* ptr to large buffer, if we need it */ - struct txt_q input; /* q of unprocessed input */ - struct char_data *character; /* linked to char */ - struct char_data *original; /* original char if switched */ - struct descriptor_data *snooping; /* Who is this char snooping */ - struct descriptor_data *snoop_by; /* And who is snooping this char */ - struct descriptor_data *next; /* link to next descriptor */ - struct oasis_olc_data *olc; /* OLC info */ +/** Master structure players. Holds the real players connection to the mud. + * An analogy is the char_data is the body of the character, the descriptor_data + * is the soul. */ +struct descriptor_data +{ + socket_t descriptor; /**< file descriptor for socket */ + char host[HOST_LENGTH+1]; /**< hostname */ + byte bad_pws; /**< number of bad pw attemps this login */ + byte idle_tics; /**< tics idle at password prompt */ + int connected; /**< mode of 'connectedness' */ + int desc_num; /**< unique num assigned to desc */ + time_t login_time; /**< when the person connected */ + char *showstr_head; /**< for keeping track of an internal str */ + char **showstr_vector; /**< for paging through texts */ + int showstr_count; /**< number of pages to page through */ + int showstr_page; /**< which page are we currently showing? */ + char **str; /**< for the modify-str system */ + char *backstr; /**< backup string for modify-str system */ + size_t max_str; /**< maximum size of string in modify-str */ + long mail_to; /**< name for mail system */ + int has_prompt; /**< is the user at a prompt? */ + char inbuf[MAX_RAW_INPUT_LENGTH]; /**< buffer for raw input */ + char last_input[MAX_INPUT_LENGTH]; /**< the last input */ + char small_outbuf[SMALL_BUFSIZE]; /**< standard output buffer */ + char *output; /**< ptr to the current output buffer */ + char **history; /**< History of commands, for ! mostly. */ + int history_pos; /**< Circular array position. */ + int bufptr; /**< ptr to end of current output */ + int bufspace; /**< space left in the output buffer */ + struct txt_block *large_outbuf; /**< ptr to large buffer, if we need it */ + struct txt_q input; /**< q of unprocessed input */ + struct char_data *character; /**< linked to char */ + struct char_data *original; /**< original char if switched */ + struct descriptor_data *snooping; /**< Who is this char snooping */ + struct descriptor_data *snoop_by; /**< And who is snooping this char */ + struct descriptor_data *next; /**< link to next descriptor */ + struct oasis_olc_data *olc; /**< OLC info */ }; /* other miscellaneous structures */ -struct msg_type { - char *attacker_msg; /* message to attacker */ - char *victim_msg; /* message to victim */ - char *room_msg; /* message to room */ +/** Fight message display. This structure is used to hold the information to + * be displayed for every different violent hit type. */ +struct msg_type +{ + char *attacker_msg; /**< Message displayed to attecker. */ + char *victim_msg; /**< Message displayed to victim. */ + char *room_msg; /**< Message displayed to rest of players in room. */ }; - -struct message_type { - struct msg_type die_msg; /* messages when death */ - struct msg_type miss_msg; /* messages when miss */ - struct msg_type hit_msg; /* messages when hit */ - struct msg_type god_msg; /* messages when hit on god */ - struct message_type *next; /* to next messages of this kind. */ +/** An entire message structure for a type of hit or spell or skill. */ +struct message_type +{ + struct msg_type die_msg; /**< Messages for death strikes. */ + struct msg_type miss_msg; /**< Messages for missed strikes. */ + struct msg_type hit_msg; /**< Messages for a succesful strike. */ + struct msg_type god_msg; /**< Messages when trying to hit a god. */ + struct message_type *next; /**< Next set of messages. */ }; -struct message_list { - int a_type; /* Attack type */ - int number_of_attacks; /* How many attack messages to chose from. */ - struct message_type *msg; /* List of messages. */ +/** Head of list of messages for an attack type. */ +struct message_list +{ + int a_type; /**< The id of this attack type. */ + int number_of_attacks; /**< How many attack messages to chose from. */ + struct message_type *msg; /**< List of messages. */ }; -/* used in the socials */ -struct social_messg { - int act_nr; - char *command; /* holds copy of activating command */ - char *sort_as; /* holds a copy of a similar command or - * abbreviation to sort by for the parser */ - int hide; /* ? */ - int min_victim_position; /* Position of victim */ - int min_char_position; /* Position of char */ - int min_level_char; /* Minimum level of socialing char */ +/** Social message data structure. */ +struct social_messg +{ + int act_nr; /**< The social id. */ + char *command; /**< The command to activate (smile, wave, etc.) */ + char *sort_as; /**< Priority of social sorted by this. */ + int hide; /**< If true, and target can't see actor, target doesn't see */ + int min_victim_position; /**< Required Position of victim */ + int min_char_position; /**< Required Position of char */ + int min_level_char; /**< Minimum PC level required to use this social. */ /* No argument was supplied */ - char *char_no_arg; - char *others_no_arg; + char *char_no_arg; /**< Displayed to char when no argument is supplied */ + char *others_no_arg; /**< Displayed to others when no arg is supplied */ /* An argument was there, and a victim was found */ - char *char_found; - char *others_found; - char *vict_found; + char *char_found; /**< Display to char when arg is supplied */ + char *others_found; /**< Display to others when arg is supplied */ + char *vict_found; /**< Display to target arg */ /* An argument was there, as well as a body part, and a victim was found */ - char *char_body_found; - char *others_body_found; - char *vict_body_found; + char *char_body_found; /**< Display to actor */ + char *others_body_found; /**< Display to others */ + char *vict_body_found; /**< Display to target argument */ /* An argument was there, but no victim was found */ - char *not_found; + char *not_found; /**< Display when no victim is found */ /* The victim turned out to be the character */ - char *char_auto; - char *others_auto; + char *char_auto; /**< Display when self is supplied */ + char *others_auto; /**< Display to others when self is supplied */ /* If the char cant be found search the char's inven and do these: */ - char *char_obj_found; - char *others_obj_found; + char *char_obj_found; /**< Social performed on object, display to char */ + char *others_obj_found; /**< Social performed on object, display to others */ }; -struct dex_skill_type { - sh_int p_pocket; - sh_int p_locks; - sh_int traps; - sh_int sneak; - sh_int hide; +/** Describes bonuses, or negatives, applied to thieves skills. In practice + * this list is tied to the character's dexterity attribute. */ +struct dex_skill_type +{ + sh_int p_pocket; /**< Alters the success rate of pick pockets */ + sh_int p_locks; /**< Alters the success of pick locks */ + sh_int traps; /**< Historically alters the success of trap finding. */ + sh_int sneak; /**< Alters the success of sneaking without being detected */ + sh_int hide; /**< Alters the success of hiding out of sight */ }; -struct dex_app_type { - sh_int reaction; - sh_int miss_att; - sh_int defensive; +/** Describes the bonuses applied for a specific value of a character's + * strength attribute. */ +struct dex_app_type +{ + sh_int reaction; /**< Historically affects reaction savings throws. */ + sh_int miss_att; /**< Historically affects missile attacks */ + sh_int defensive; /**< Alters character's inherent armor class */ }; -struct str_app_type { - sh_int tohit; /* To Hit (THAC0) Bonus/Penalty */ - sh_int todam; /* Damage Bonus/Penalty */ - sh_int carry_w; /* Maximum weight that can be carrried */ - sh_int wield_w; /* Maximum weight that can be wielded */ +/** Describes the bonuses applied for a specific value of a character's + * strength attribute. */ +struct str_app_type +{ + sh_int tohit; /**< To Hit (THAC0) Bonus/Penalty */ + sh_int todam; /**< Damage Bonus/Penalty */ + sh_int carry_w; /**< Maximum weight that can be carrried */ + sh_int wield_w; /**< Maximum weight that can be wielded */ }; -struct wis_app_type { - byte bonus; /* how many practices player gains per lev */ +/** Describes the bonuses applied for a specific value of a character's + * wisdom attribute. */ +struct wis_app_type +{ + byte bonus; /**< how many practices player gains per lev */ }; -struct int_app_type { - byte learn; /* how many % a player learns a spell/skill */ +/** Describes the bonuses applied for a specific value of a character's + * intelligence attribute. */ +struct int_app_type +{ + byte learn; /**< how many % a player learns a spell/skill */ }; -struct con_app_type { - sh_int hitp; - sh_int shock; +/** Describes the bonuses applied for a specific value of a + * character's constitution attribute. */ +struct con_app_type +{ + sh_int hitp; /**< Added to a character's new MAXHP at each new level. */ + sh_int shock; /**< Historically affects resurrection chances. */ }; -struct weather_data { - int pressure; /* How is the pressure ( Mb ) */ - int change; /* How fast and what way does it change. */ - int sky; /* How is the sky. */ - int sunlight; /* And how much sun. */ +/** Stores, and used to deliver, the current weather information + * in the mud world. */ +struct weather_data +{ + int pressure; /**< How is the pressure ( Mb )? */ + int change; /**< How fast and what way does it change? */ + int sky; /**< How is the sky? */ + int sunlight; /**< And how much sun? */ }; -/* Element in monster and object index-tables. - NOTE: Assumes sizeof(mob_vnum) >= sizeof(obj_vnum) */ -struct index_data { - mob_vnum vnum; /* virtual number of this mob/obj */ - int number; /* number of existing units of this mob/obj */ - SPECIAL(*func); +/** Element in monster and object index-tables. + NOTE: Assumes sizeof(mob_vnum) >= sizeof(obj_vnum) */ +struct index_data +{ + mob_vnum vnum; /**< virtual number of this mob/obj */ + int number; /**< number of existing units of this mob/obj */ + /** Point to any SPECIAL function assoicated with mob/obj. + * Note: These are not trigger scripts. They are functions hard coded in + * the source code. */ + SPECIAL(*func); - char *farg; /* string argument for special function */ - struct trig_data *proto; /* for triggers... the trigger */ + char *farg; /**< String argument for special function. */ + struct trig_data *proto; /**< Points to the trigger prototype. */ }; -/* linked list for mob/object prototype trigger lists */ -struct trig_proto_list { - int vnum; /* vnum of the trigger */ - struct trig_proto_list *next; /* next trigger */ +/** Master linked list for the mob/object prototype trigger lists. */ +struct trig_proto_list +{ + int vnum; /**< vnum of the trigger */ + struct trig_proto_list *next; /**< next trigger */ }; -struct guild_info_type { +struct guild_info_type +{ int pc_class; room_vnum guild_room; int direction; @@ -1027,87 +1208,113 @@ struct guild_info_type { /* Config structs */ - /* The game configuration structure used for configurating the game play - variables. */ -struct game_data { - int pk_allowed; /* Is player killing allowed? */ - int pt_allowed; /* Is player thieving allowed? */ - int level_can_shout; /* Level player must be to shout. */ - int holler_move_cost; /* Cost to holler in move points. */ - int tunnel_size; /* Number of people allowed in a tunnel.*/ - int max_exp_gain; /* Maximum experience gainable per kill.*/ - int max_exp_loss; /* Maximum experience losable per death.*/ - int max_npc_corpse_time;/* Num tics before NPC corpses decompose*/ - int max_pc_corpse_time; /* Num tics before PC corpse decomposes.*/ - int idle_void; /* Num tics before PC sent to void(idle)*/ - int idle_rent_time; /* Num tics before PC is autorented. */ - int idle_max_level; /* Level of players immune to idle. */ - int dts_are_dumps; /* Should items in dt's be junked? */ - int load_into_inventory;/* Objects load in immortals inventory. */ - int track_through_doors;/* Track through doors while closed? */ - int no_mort_to_immort; /* Prevent mortals leveling to imms? */ - int disp_closed_doors; /* Display closed doors in autoexit? */ - - char *OK; /* When player receives 'Okay.' text. */ - char *NOPERSON; /* 'No one by that name here.' */ - char *NOEFFECT; /* 'Nothing seems to happen.' */ +/** The game configuration structure used for configurating the game play + * variables. */ +struct game_data +{ + int pk_allowed; /**< Is player killing allowed? */ + int pt_allowed; /**< Is player thieving allowed? */ + int level_can_shout; /**< Level player must be to shout. */ + int holler_move_cost; /**< Cost to holler in move points. */ + int tunnel_size; /**< Number of people allowed in a tunnel.*/ + int max_exp_gain; /**< Maximum experience gainable per kill.*/ + int max_exp_loss; /**< Maximum experience losable per death.*/ + int max_npc_corpse_time; /**< Num tics before NPC corpses decompose*/ + int max_pc_corpse_time; /**< Num tics before PC corpse decomposes.*/ + int idle_void; /**< Num tics before PC sent to void(idle)*/ + int idle_rent_time; /**< Num tics before PC is autorented. */ + int idle_max_level; /**< Level of players immune to idle. */ + int dts_are_dumps; /**< Should items in dt's be junked? */ + int load_into_inventory; /**< Objects load in immortals inventory. */ + int track_through_doors; /**< Track through doors while closed? */ + int no_mort_to_immort; /**< Prevent mortals leveling to imms? */ + int disp_closed_doors; /**< Display closed doors in autoexit? */ + int map_option; /**< MAP_ON, MAP_OFF or MAP_IMM_ONLY */ + int map_size; /**< Default size for map command */ + int minimap_size; /**< Default size for mini-map (automap) */ + + char *OK; /**< When player receives 'Okay.' text. */ + char *NOPERSON; /**< 'No one by that name here.' */ + char *NOEFFECT; /**< 'Nothing seems to happen.' */ }; -/* The rent and crashsave options. */ -struct crash_save_data { - int free_rent; /* Should the MUD allow rent for free? */ - int max_obj_save; /* Max items players can rent. */ - int min_rent_cost; /* surcharge on top of item costs. */ - int auto_save; /* Does the game automatically save ppl?*/ - int autosave_time; /* if auto_save=TRUE, how often? */ - int crash_file_timeout; /* Life of crashfiles and idlesaves. */ - int rent_file_timeout; /* Lifetime of normal rent files in days*/ +/** The rent and crashsave options. */ +struct crash_save_data +{ + int free_rent; /**< Should the MUD allow rent for free? */ + int max_obj_save; /**< Max items players can rent. */ + int min_rent_cost; /**< surcharge on top of item costs. */ + int auto_save; /**< Does the game automatically save ppl? */ + int autosave_time; /**< if auto_save=TRUE, how often? */ + int crash_file_timeout; /**< Life of crashfiles and idlesaves. */ + int rent_file_timeout; /**< Lifetime of normal rent files in days */ }; -/* The room numbers. */ -struct room_numbers { - room_vnum mortal_start_room; /* vnum of room that mortals enter at. */ - room_vnum immort_start_room; /* vnum of room that immorts enter at. */ - room_vnum frozen_start_room; /* vnum of room that frozen ppl enter. */ - room_vnum donation_room_1; /* vnum of donation room #1. */ - room_vnum donation_room_2; /* vnum of donation room #2. */ - room_vnum donation_room_3; /* vnum of donation room #3. */ +/** Important room numbers. This structure stores vnums, not real array + * numbers. */ +struct room_numbers +{ + room_vnum mortal_start_room; /**< vnum of room that mortals enter at. */ + room_vnum immort_start_room; /**< vnum of room that immorts enter at. */ + room_vnum frozen_start_room; /**< vnum of room that frozen ppl enter. */ + room_vnum donation_room_1; /**< vnum of donation room #1. */ + room_vnum donation_room_2; /**< vnum of donation room #2. */ + room_vnum donation_room_3; /**< vnum of donation room #3. */ }; -/* The game operational constants. */ -struct game_operation { - ush_int DFLT_PORT; /* The default port to run the game. */ - char *DFLT_IP; /* Bind to all interfaces. */ - char *DFLT_DIR; /* The default directory (lib). */ - char *LOGNAME; /* The file to log messages to. */ - int max_playing; /* Maximum number of players allowed. */ - int max_filesize; /* Maximum size of misc files. */ - int max_bad_pws; /* Maximum number of pword attempts. */ - int siteok_everyone; /* Everyone from all sites are SITEOK.*/ - int nameserver_is_slow; /* Is the nameserver slow or fast? */ - int use_new_socials; /* Use new or old socials file ? */ - int auto_save_olc; /* Does OLC save to disk right away ? */ - char *MENU; /* The MAIN MENU. */ - char *WELC_MESSG; /* The welcome message. */ - char *START_MESSG; /* The start msg for new characters. */ +/** Operational game variables. */ +struct game_operation +{ + ush_int DFLT_PORT; /**< The default port to run the game. */ + char *DFLT_IP; /**< Bind to all interfaces. */ + char *DFLT_DIR; /**< The default directory (lib). */ + char *LOGNAME; /**< The file to log messages to. */ + int max_playing; /**< Maximum number of players allowed. */ + int max_filesize; /**< Maximum size of misc files. */ + int max_bad_pws; /**< Maximum number of pword attempts. */ + int siteok_everyone; /**< Everyone from all sites are SITEOK.*/ + int nameserver_is_slow; /**< Is the nameserver slow or fast? */ + int use_new_socials; /**< Use new or old socials file ? */ + int auto_save_olc; /**< Does OLC save to disk right away ? */ + char *MENU; /**< The MAIN MENU. */ + char *WELC_MESSG; /**< The welcome message. */ + char *START_MESSG; /**< The start msg for new characters. */ }; -/* The Autowizard options. */ -struct autowiz_data { - int use_autowiz; /* Use the autowiz feature? */ - int min_wizlist_lev; /* Minimun level to show on wizlist. */ +/** The Autowizard options. */ +struct autowiz_data +{ + int use_autowiz; /**< Use the autowiz feature? */ + int min_wizlist_lev; /**< Minimun level to show on wizlist. */ }; -/* The main configuration structure; */ -struct config_data { - char *CONFFILE; /* config file path */ - struct game_data play; /* play related config */ - struct crash_save_data csd; /* rent and save related */ - struct room_numbers room_nums; /* room numbers */ - struct game_operation operation; /* basic operation */ - struct autowiz_data autowiz; /* autowiz related stuff */ +/** + Main Game Configuration Structure. + Global variables that can be changed within the game are held within this + structure. During gameplay, elements within this structure can be altered, + thus affecting the gameplay immediately, and avoiding the need to recompile + the code. + If changes are made to values of the elements of this structure during game + play, the information will be saved to disk. + */ +struct config_data +{ + /** Path to on-disk file where the config_data structure gets written. */ + char *CONFFILE; + /** In-game specific global settings, such as allowing player killing. */ + struct game_data play; + /** How is renting, crash files, and object saving handled? */ + struct crash_save_data csd; + /** Special designated rooms, like start rooms, and donation rooms. */ + struct room_numbers room_nums; + /** Basic operational settings, like max file sizes and max players. */ + struct game_operation operation; + /** Autowiz specific settings, like turning it on and minimum level */ + struct autowiz_data autowiz; }; #ifdef MEMORY_DEBUG #include "zmalloc.h" #endif + +#endif /* _STRUCTS_H_ */ diff --git a/src/sysdep.h b/src/sysdep.h index 204ec72..79b510e 100644 --- a/src/sysdep.h +++ b/src/sysdep.h @@ -1,12 +1,16 @@ -/************************************************************************** -* File: sysdep.h Part of tbaMUD * -* Usage: Machine-specific defs based on values in conf.h (from configure)* -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file sysdep.h +* Machine-specific defs based on values in conf.h (from configure) +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ +#ifndef _SYSDEP_H_ +#define _SYSDEP_H_ /* Configurables: tbaMUD uses the crypt(3) function to encrypt player passwords * in the players file so that they are never stored in plaintext form. However, @@ -571,3 +575,6 @@ struct in_addr { #endif /* __COMM_C__ */ #endif /* NO_LIBRARY_PROTOTYPES */ + +#endif /* _SYSDEP_H_ */ + diff --git a/src/tedit.c b/src/tedit.c index b738bfa..556c4e6 100644 --- a/src/tedit.c +++ b/src/tedit.c @@ -15,20 +15,8 @@ #include "genolc.h" #include "oasis.h" #include "improved-edit.h" +#include "modify.h" -extern const char *credits; -extern const char *news; -extern const char *motd; -extern const char *imotd; -extern const char *GREETINGS; -extern const char *help; -extern const char *ihelp; -extern const char *info; -extern const char *background; -extern const char *handbook; -extern const char *policies; -extern const char *wizlist; -extern const char *immlist; void tedit_string_cleanup(struct descriptor_data *d, int terminator) { @@ -75,7 +63,7 @@ ACMD(do_tedit) struct { char *cmd; char level; - const char **buffer; + char **buffer; int size; char *filename; } fields[] = { diff --git a/src/telnet.h b/src/telnet.h index 25085b8..63a98b8 100644 --- a/src/telnet.h +++ b/src/telnet.h @@ -1,3 +1,11 @@ +/** +* @file telnet.h +* Function prototypes, defines and macros to handle socket connections. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +*/ + /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. diff --git a/src/util/Makefile.in b/src/util/Makefile.in index 3571aec..9c617fe 100755 --- a/src/util/Makefile.in +++ b/src/util/Makefile.in @@ -23,16 +23,18 @@ CFLAGS = @CFLAGS@ $(MYFLAGS) $(PROFILE) -I$(INCDIR) default: all -all: $(BINDIR)/asciipasswd $(BINDIR)/autowiz $(BINDIR)/listrent \ - $(BINDIR)/plrtoascii $(BINDIR)/shopconv $(BINDIR)/sign \ - $(BINDIR)/split $(BINDIR)/wld2html +all: $(BINDIR)/asciipasswd \ + $(BINDIR)/autowiz \ + $(BINDIR)/plrtoascii \ + $(BINDIR)/shopconv \ + $(BINDIR)/sign \ + $(BINDIR)/split \ + $(BINDIR)/wld2html asciipasswd: $(BINDIR)/asciipasswd autowiz: $(BINDIR)/autowiz -listrent: $(BINDIR)/listrent - plrtoascii: $(BINDIR)/plrtoascii shopconv: $(BINDIR)/shopconv @@ -45,34 +47,34 @@ wld2html: $(BINDIR)/wld2html webster: $(BINDIR)/webster -$(BINDIR)/asciipasswd: asciipasswd.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \ - $(INCDIR)/structs.h $(INCDIR)/utils.h +$(BINDIR)/asciipasswd: asciipasswd.c $(CC) $(CFLAGS) -o $(BINDIR)/asciipasswd asciipasswd.c @CRYPTLIB@ -$(BINDIR)/autowiz: autowiz.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \ - $(INCDIR)/structs.h $(INCDIR)/utils.h $(INCDIR)/db.h +$(BINDIR)/autowiz: autowiz.c $(CC) $(CFLAGS) -o $(BINDIR)/autowiz autowiz.c -$(BINDIR)/listrent: listrent.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \ - $(INCDIR)/structs.h - $(CC) $(CFLAGS) -o $(BINDIR)/listrent listrent.c - -$(BINDIR)/plrtoascii: plrtoascii.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \ - $(INCDIR)/db.h $(INCDIR)/pfdefaults.h +$(BINDIR)/plrtoascii: plrtoascii.c $(CC) $(CFLAGS) -o $(BINDIR)/plrtoascii plrtoascii.c -$(BINDIR)/shopconv: shopconv.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \ - $(INCDIR)/structs.h $(INCDIR)/db.h $(INCDIR)/utils.h $(INCDIR)/shop.h +$(BINDIR)/shopconv: shopconv.c $(CC) $(CFLAGS) -o $(BINDIR)/shopconv shopconv.c -$(BINDIR)/sign: sign.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h +$(BINDIR)/sign: sign.c $(CC) $(CFLAGS) -o $(BINDIR)/sign sign.c @NETLIB@ -$(BINDIR)/split: split.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h +$(BINDIR)/split: split.c $(CC) $(CFLAGS) -o $(BINDIR)/split split.c -$(BINDIR)/wld2html: wld2html.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h +$(BINDIR)/wld2html: wld2html.c $(CC) $(CFLAGS) -o $(BINDIR)/wld2html wld2html.c -$(BINDIR)/webster: webster.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h +$(BINDIR)/webster: webster.c $(CC) $(CFLAGS) -o $(BINDIR)/webster webster.c + +# Dependencies for the object files (automagically generated with +# gcc -MM) + +depend: + $(CC) -I$(INCDIR) -MM *.c > depend + +-include depend diff --git a/src/util/listrent.c b/src/util/listrent.c deleted file mode 100755 index 6a0573c..0000000 --- a/src/util/listrent.c +++ /dev/null @@ -1,71 +0,0 @@ -/* ************************************************************************ -* file: listrent.c Part of tbaMUD * -* Usage: list player rent files * -* Written by Jeremy Elson * -* All Rights Reserved * -* Copyright (C) 1993 The Trustees of The Johns Hopkins University * -************************************************************************* */ - -#include "conf.h" -#include "sysdep.h" - -#include "structs.h" - -void Crash_listrent(char *fname); - -int main(int argc, char **argv) -{ - int x; - - for (x = 1; x < argc; x++) - Crash_listrent(argv[x]); - - return (0); -} - - -void Crash_listrent(char *fname) -{ - FILE *fl; - char buf[MAX_STRING_LENGTH]; - struct obj_file_elem object; - struct rent_info rent; - - if (!(fl = fopen(fname, "rb"))) { - sprintf(buf, "%s has no rent file.\r\n", fname); - printf("%s", buf); - return; - } - sprintf(buf, "%s\r\n", fname); - if (!feof(fl)) - fread(&rent, sizeof(struct rent_info), 1, fl); - switch (rent.rentcode) { - case RENT_RENTED: - strcat(buf, "Rent\r\n"); - break; - case RENT_CRASH: - strcat(buf, "Crash\r\n"); - break; - case RENT_CRYO: - strcat(buf, "Cryo\r\n"); - break; - case RENT_TIMEDOUT: - case RENT_FORCED: - strcat(buf, "TimedOut\r\n"); - break; - default: - strcat(buf, "Undef\r\n"); - break; - } - while (!feof(fl)) { - fread(&object, sizeof(struct obj_file_elem), 1, fl); - if (ferror(fl)) { - fclose(fl); - return; - } - if (!feof(fl)) - sprintf(buf, "%s[%5d] %s\n", buf, object.item_number, fname); - } - printf("%s", buf); - fclose(fl); -} diff --git a/src/util/plrtoascii.c b/src/util/plrtoascii.c index 1a00e31..173453c 100755 --- a/src/util/plrtoascii.c +++ b/src/util/plrtoascii.c @@ -4,13 +4,13 @@ * All Rights Reserved * ************************************************************************* */ -#include "../conf.h" -#include "../sysdep.h" +#include "conf.h" +#include "sysdep.h" -#include "../structs.h" -#include "../utils.h" -#include "../db.h" -#include "../pfdefaults.h" +#include "structs.h" +#include "utils.h" +#include "db.h" +#include "pfdefaults.h" // first some stock circle 3.0 defines. Change where appropriate. @@ -188,7 +188,7 @@ void convert(char *filename) fprintf(index_file, "%ld %s %d 0 %ld\n", player.char_specials_saved.idnum, bits, player.level, - player.last_logon); + (long)player.last_logon); if (!(outfile = fopen(outname, "w"))) { printf("error opening output file"); diff --git a/src/util/shopconv.c b/src/util/shopconv.c index 06f8bc2..a5dff2c 100755 --- a/src/util/shopconv.c +++ b/src/util/shopconv.c @@ -8,8 +8,8 @@ #include "sysdep.h" #include "structs.h" -#include "db.h" #include "utils.h" +#include "db.h" #include "shop.h" void basic_mud_log(const char *x, ...) @@ -104,7 +104,7 @@ void do_string(FILE * shop_f, FILE * newshop_f, char *msg) } -int boot_the_shops(FILE * shop_f, FILE * newshop_f, char *filename) +static int boot_the_shops_conv(FILE * shop_f, FILE * newshop_f, char *filename) { char *buf, buf2[150]; int temp, count; @@ -176,7 +176,7 @@ int main(int argc, char *argv[]) continue; } printf("%s:\n", fn); - result = boot_the_shops(sfp, nsfp, fn); + result = boot_the_shops_conv(sfp, nsfp, fn); fclose(nsfp); fclose(sfp); if (result) { diff --git a/src/utils.c b/src/utils.c index d241749..928e60e 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,12 +1,14 @@ -/************************************************************************** -* File: utils.c Part of tbaMUD * -* Usage: Various internal functions of a utility nature. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file utils.c +* Various utility functions used within the core mud code. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ #include "conf.h" #include "sysdep.h" @@ -19,15 +21,11 @@ #include "handler.h" #include "interpreter.h" -/* external globals */ -extern struct time_data time_info; -/* local functions */ -struct time_info_data *real_time_passed(time_t t2, time_t t1); -struct time_info_data *mud_time_passed(time_t t2, time_t t1); -void prune_crlf(char *txt); - -/* creates a random number in interval [from;to] */ +/** Aportable random number function. + * @param from The lower bounds of the random number. + * @param to The upper bounds of the random number. + * @retval int The resulting randomly generated number. */ int rand_number(int from, int to) { /* error checking in case people call this incorrectly */ @@ -47,7 +45,11 @@ int rand_number(int from, int to) return ((circle_random() % (to - from + 1)) + from); } -/* simulates dice roll */ +/** Simulates a single dice roll from one to many of a certain sized die. + * @param num The number of dice to roll. + * @param size The number of sides each die has, and hence the number range + * of the die. + * @retval int The sum of all the dice rolled. A random number. */ int dice(int num, int size) { int sum = 0; @@ -61,19 +63,27 @@ int dice(int num, int size) return (sum); } -/* Be wary of sign issues with this. */ +/** Return the smaller number. Original note: Be wary of sign issues with this. + * @param a The first number. + * @param b The second number. + * @retval int The smaller of the two, a or b. */ int MIN(int a, int b) { return (a < b ? a : b); } -/* Be wary of sign issues with this. */ +/** Return the larger number. Original note: Be wary of sign issues with this. + * @param a The first number. + * @param b The second number. + * @retval int The larger of the two, a or b. */ int MAX(int a, int b) { return (a > b ? a : b); } -/* color issue fix -- skip color codes, _then_ capitalize */ +/** Used to capitalize a string. Will not change any mud specific color codes. + * @param txt The string to capitalize. + * @retval char* Pointer to the capitalized string. */ char *CAP(char *txt) { char *p = txt; @@ -86,12 +96,13 @@ char *CAP(char *txt) } #if !defined(HAVE_STRLCPY) -/* A 'strlcpy' function in the same fashion as 'strdup' below. This copies up +/** A 'strlcpy' function in the same fashion as 'strdup' below. This copies up * to totalsize - 1 bytes from the source string, placing them and a trailing * NUL into the destination string. Returns the total length of the string it * tried to copy, not including the trailing NUL. So a '>= totalsize' test * says it was truncated. (Note that you may have _expected_ truncation - * because you only wanted a few characters from the source string.) */ + * because you only wanted a few characters from the source string.) Portable + * function, in case your system does not have strlcpy. */ size_t strlcpy(char *dest, const char *source, size_t totalsize) { strncpy(dest, source, totalsize - 1); /* strncpy: OK (we must assume 'totalsize' is correct) */ @@ -101,7 +112,7 @@ size_t strlcpy(char *dest, const char *source, size_t totalsize) #endif #if !defined(HAVE_STRDUP) -/* Create a duplicate of a string */ +/** Create a duplicate of a string function. Portable. */ char *strdup(const char *source) { char *new_z; @@ -111,7 +122,10 @@ char *strdup(const char *source) } #endif -/* Strips \r\n from end of string. */ +/** Strips "\r\n" from just the end of a string. Will not remove internal + * "\r\n" values to the string. + * @post Replaces any "\r\n" values at the end of the string with null. + * @param txt The writable string to prune. */ void prune_crlf(char *txt) { int i = strlen(txt) - 1; @@ -121,7 +135,7 @@ void prune_crlf(char *txt) } #ifndef str_cmp -/* str_cmp: a case-insensitive version of strcmp(). Returns: 0 if equal, > 0 +/** a portable, case-insensitive version of strcmp(). Returns: 0 if equal, > 0 * if arg1 > arg2, or < 0 if arg1 < arg2. Scan until strings are found * different or we reach the end of both. */ int str_cmp(const char *arg1, const char *arg2) @@ -142,7 +156,7 @@ int str_cmp(const char *arg1, const char *arg2) #endif #ifndef strn_cmp -/* strn_cmp: a case-insensitive version of strncmp(). Returns: 0 if equal, > 0 +/** a portable, case-insensitive version of strncmp(). Returns: 0 if equal, > 0 * if arg1 > arg2, or < 0 if arg1 < arg2. Scan until strings are found * different, the end of both, or n is reached. */ int strn_cmp(const char *arg1, const char *arg2, int n) @@ -162,8 +176,13 @@ int strn_cmp(const char *arg1, const char *arg2, int n) } #endif -/* New variable argument log() function. Works the same as the old for - * previously written code but is very nice for new code. */ +/** New variable argument log() function; logs messages to disk. + * Works the same as the old for previously written code but is very nice + * if new code wishes to implment printf style log messages without the need + * to make prior sprintf calls. + * @param format The message to log. Standard printf formatting and variable + * arguments are allowed. + * @param args The comma delimited, variable substitutions to make in str. */ void basic_mud_vlog(const char *format, va_list args) { time_t ct = time(0); @@ -185,7 +204,13 @@ void basic_mud_vlog(const char *format, va_list args) fflush(logfile); } -/* So mudlog() can use the same function. */ +/** Log messages directly to syslog on disk, no display to in game immortals. + * Supports variable string modification arguments, a la printf. Most likely + * any calls to plain old log() have been redirected, via macro, to this + * function. + * @param format The message to log. Standard printf formatting and variable + * arguments are allowed. + * @param ... The comma delimited, variable substitutions to make in str. */ void basic_mud_log(const char *format, ...) { va_list args; @@ -195,7 +220,12 @@ void basic_mud_log(const char *format, ...) va_end(args); } -/* the "touch" command, essentially. */ +/** Essentially the touch command. Create an empty file or update the modified + * time of a file. + * @param path The filepath to "touch." This filepath is relative to the /lib + * directory relative to the root of the mud distribution. + * @retval int 0 on a success, -1 on a failure; standard system call exit + * values. */ int touch(const char *path) { FILE *fl; @@ -209,7 +239,16 @@ int touch(const char *path) } } -/* Log mud messages to a file & to online imm's syslogs. - Fen */ +/** Log mud messages to a file & to online imm's syslogs. + * @param type The minimum syslog level that needs be set to see this message. + * OFF, BRF, NRM and CMP are the values from lowest to highest. Using mudlog + * with type = OFF should be avoided as every imm will see the message even + * if they have syslog turned off. + * @param level Minimum character level needed to see this message. + * @param file TRUE log this to the syslog file, FALSE do not log this to disk. + * @param str The message to log. Standard printf formatting and variable + * arguments are allowed. + * @param ... The comma delimited, variable substitutions to make in str. */ void mudlog(int type, int level, int file, const char *str, ...) { char buf[MAX_STRING_LENGTH]; @@ -250,9 +289,24 @@ void mudlog(int type, int level, int file, const char *str, ...) -/* If you don't have a 'const' array, just cast it as such. It's safer to cast - * a non-const array as const than to cast a const one as non-const. Doesn't - * really matter since this function doesn't change the array though. */ +/** Take a bitvector and return a human readable + * description of which bits are set in it. + * @pre The final element in the names array must contain a one character + * string consisting of a single newline character "\n". Caller of function is + * responsible for creating the memory buffer for the result string. + * @param[in] bitvector The bitvector to test for set bits. + * @param[in] names An array of human readable strings describing each possible + * bit. The final element in this array must be a string made of a single + * newline character (eg "\n"). + * If you don't have a 'const' array for the names param, cast it as such. + * @param[out] result Holds the names of the set bits in bitvector. The bit + * names will be delimited by a single space. + * Caller of sprintbit is responsible for creating the buffer for result. + * Will be set to "NOBITS" if no bits are set in bitvector (ie bitvector = 0). + * @param[in] reslen The length of the available memory in the result buffer. + * Ideally, results will be large enough to hold the description of every bit + * that could possibly be set in bitvector. + * @retval size_t The length of the string copied into result. */ size_t sprintbit(bitvector_t bitvector, const char *names[], char *result, size_t reslen) { size_t len = 0; @@ -279,6 +333,20 @@ size_t sprintbit(bitvector_t bitvector, const char *names[], char *result, size_ return (len); } +/** Return the human readable name of a defined type. + * @pre The final element in the names array must contain a one character + * string consisting of a single newline character "\n". Caller of function is + * responsible for creating the memory buffer for the result string. + * @param[in] type The type number to be translated. + * @param[in] names An array of human readable strings describing each possible + * bit. The final element in this array must be a string made of a single + * newline character (eg "\n"). + * @param[out] result Holds the translated name of the type. + * Caller of sprintbit is responsible for creating the buffer for result. + * Will be set to "UNDEFINED" if the type is greater than the number of names + * available. + * @param[in] reslen The length of the available memory in the result buffer. + * @retval size_t The length of the string copied into result. */ size_t sprinttype(int type, const char *names[], char *result, size_t reslen) { int nr = 0; @@ -291,6 +359,26 @@ size_t sprinttype(int type, const char *names[], char *result, size_t reslen) return strlcpy(result, *names[nr] != '\n' ? names[nr] : "UNDEFINED", reslen); } +/** Take a bitarray and return a human readable description of which bits are + * set in it. + * @pre The final element in the names array must contain a one character + * string consisting of a single newline character "\n". Caller of function is + * responsible for creating the memory buffer for the result string large enough + * to hold all possible bit translations. There is no error checking for + * possible array overflow for result. + * @param[in] bitvector The bitarray in which to test for set bits. + * @param[in] names An array of human readable strings describing each possible + * bit. The final element in this array must be a string made of a single + * newline character (eg "\n"). + * If you don't have a 'const' array for the names param, cast it as such. + * @param[in] maxar The number of 'bytes' in the bitarray. This number will + * usually be pre-defined for the particular bitarray you are using. + * @param[out] result Holds the names of the set bits in bitarray. The bit + * names are delimited by a single space. Ideally, results will be large enough + * to hold the description of every bit that could possibly be set in bitvector. + * Will be set to "NOBITS" if no bits are set in bitarray (ie all bits in the + * bitarray are equal to 0). + */ void sprintbitarray(int bitvector[], const char *names[], int maxar, char *result) { int nr, teller, found = FALSE; @@ -298,26 +386,41 @@ void sprintbitarray(int bitvector[], const char *names[], int maxar, char *resul *result = '\0'; for(teller = 0; teller < maxar && !found; teller++) - for (nr = 0; nr < 32 && !found; nr++) { - if (IS_SET_AR(bitvector, (teller*32)+nr)) { - if (*names[(teller*32)+nr] != '\n') { - if (*names[(teller*32)+nr] != '\0') { + { + for (nr = 0; nr < 32 && !found; nr++) + { + if (IS_SET_AR(bitvector, (teller*32)+nr)) + { + if (*names[(teller*32)+nr] != '\n') + { + if (*names[(teller*32)+nr] != '\0') + { strcat(result, names[(teller*32)+nr]); strcat(result, " "); } - } else { + } + else + { strcat(result, "UNDEFINED "); } } if (*names[(teller*32)+nr] == '\n') found = TRUE; } + } if (!*result) strcpy(result, "NOBITS "); } -/* Calculate the REAL time passed over the last t2-t1 centuries (secs) */ +/** Calculate the REAL time passed between two time invervals. + * @todo Recommend making this function foresightedly useful by calculating + * real months and years, too. + * @param t2 The later time. + * @param t1 The earlier time. + * @retval time_info_data The real hours and days passed between t2 and t1. Only + * the hours and days are returned, months and years are ignored and returned + * as -1 values. */ struct time_info_data *real_time_passed(time_t t2, time_t t1) { long secs; @@ -337,7 +440,12 @@ struct time_info_data *real_time_passed(time_t t2, time_t t1) return (&now); } -/* Calculate the MUD time passed over the last t2-t1 centuries (secs) */ +/** Calculate the MUD time passed between two time invervals. + * @param t2 The later time. + * @param t1 The earlier time. + * @retval time_info_data A pointer to the mud hours, days, months and years + * that have passed between the two time intervals. DO NOT FREE the structure + * pointed to by the return value. */ struct time_info_data *mud_time_passed(time_t t2, time_t t1) { long secs; @@ -359,6 +467,10 @@ struct time_info_data *mud_time_passed(time_t t2, time_t t1) return (&now); } +/** Translate the current mud time to real seconds (in type time_t). + * @param now The current mud time to translate into a real time unit. + * @retval time_t The real time that would have had to have passed + * to represent the mud time represented by the now parameter. */ time_t mud_time_to_secs(struct time_info_data *now) { time_t when = 0; @@ -370,6 +482,12 @@ time_t mud_time_to_secs(struct time_info_data *now) return (time(NULL) - when); } +/** Calculate a player's MUD age. + * @todo The minimum starting age of 17 is hardcoded in this function. Recommend + * changing the minimum age to a property (variable) external to this function. + * @param ch A valid player character. + * @retval time_info_data A pointer to the mud age in years of the player + * character. DO NOT FREE the structure pointed to by the return value. */ struct time_info_data *age(struct char_data *ch) { static struct time_info_data player_age; @@ -381,7 +499,13 @@ struct time_info_data *age(struct char_data *ch) return (&player_age); } -/* Check if making CH follow VICTIM will create an illegal Follow Loop. */ +/** Check if making ch follow victim will create an illegal follow loop. In + * essence, this prevents someone from following a character in a group that + * is already being lead by the character. + * @param ch The character trying to follow. + * @param victim The character being followed. + * @retval bool TRUE if ch is already leading someone in victims group, FALSE + * if it is okay for ch to follow victim. */ bool circle_follow(struct char_data *ch, struct char_data *victim) { struct char_data *k; @@ -394,12 +518,20 @@ bool circle_follow(struct char_data *ch, struct char_data *victim) return (FALSE); } -/* Called when stop following persons, or stopping charm. This will NOT do if - * a character quits or dies. */ +/** Call on a character (NPC or PC) to stop them from following someone and + * to break any charm affect. + * @todo Make the messages returned from the broken charm affect more + * understandable. + * @pre ch MUST be following someone, else core dump. + * @post The charm affect (AFF_CHARM) will be removed from the character and + * the character will stop following the "master" they were following. + * @param ch The character (NPC or PC) to stop from following. + * */ void stop_follower(struct char_data *ch) { struct follow_type *j, *k; + /* Makes sure this function is not called when it shouldn't be called. */ if (ch->master == NULL) { core_dump(); return; @@ -434,6 +566,11 @@ void stop_follower(struct char_data *ch) REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_GROUP); } +/** Finds the number of follows that are following, and charmed by, the + * character (PC or NPC). + * @param ch The character to check for charmed followers. + * @retval int The number of followers that are also charmed by the character. + */ int num_followers_charmed(struct char_data *ch) { struct follow_type *lackey; @@ -446,7 +583,12 @@ int num_followers_charmed(struct char_data *ch) return (total); } -/* Called when a character that follows/is followed dies */ +/** Called when a character that follows/is followed dies. If the character + * is the leader of a group, it stops everyone in the group from following + * them. Despite the title, this function does not actually perform the kill on + * the character passed in as the argument. + * @param ch The character (NPC or PC) to stop from following. + * */ void die_follower(struct char_data *ch) { struct follow_type *j, *k; @@ -460,8 +602,12 @@ void die_follower(struct char_data *ch) } } -/* Do NOT call this before having checked if a circle of followers will arise. - * CH will follow leader. */ +/** Adds a new follower to a group. + * @todo Maybe make circle_follow an inherent part of this function? + * @pre Make sure to call circle_follow first. ch may also not already + * be following anyone, otherwise core dump. + * @param ch The character to follow. + * @param leader The character to be followed. */ void add_follower(struct char_data *ch, struct char_data *leader) { struct follow_type *k; @@ -485,10 +631,17 @@ void add_follower(struct char_data *ch, struct char_data *leader) act("$n starts to follow $N.", TRUE, ch, 0, leader, TO_NOTVICT); } -/* get_line reads the next non-blank line off of the input stream. The newline - * character is removed from the input. Lines which begin with '*' are - * considered to be comments. Returns the number of lines advanced in the file. - * Buffer given must be at least READ_SIZE (256) characters large. */ +/** Reads the next non-blank line off of the input stream. Empty lines are + * skipped. Lines which begin with '*' are considered to be comments and are + * skipped. + * @pre Caller must allocate memory for buf. + * @post If a there is a line to be read, the newline character is removed from + * the file line ending and the string is returned. Else a null string is + * returned in buf. + * @param[in] fl The file to be read from. + * @param[out] buf The next non-blank line read from the file. Buffer given must + * be at least READ_SIZE (256) characters large. + * @retval int The number of lines advanced in the file. */ int get_line(FILE *fl, char *buf) { char temp[READ_SIZE]; @@ -510,6 +663,21 @@ int get_line(FILE *fl, char *buf) return (lines); } +/** Create the full path, relative to the library path, of the player type + * file to open. + * @todo Make the return type bool. + * @pre Caller is responsible for allocating memory buffer for the created + * file name. + * @post The potential file path to open is created. This function does not + * actually open any file descriptors. + * @param[out] filename Buffer to store the full path of the file to open. + * @param[in] fbufsize The maximum size of filename, and the maximum size + * of the path that can be written to it. + * @param[in] mode What type of files can be created. Currently, recognized + * modes are CRASH_FILE, ETEXT_FILE, SCRIPT_VARS_FILE and PLR_FILE. + * @param[in] orig_name The player name to create the filepath (of type mode) + * for. + * @retval int 0 if filename cannot be created, 1 if it can. */ int get_filename(char *filename, size_t fbufsize, int mode, const char *orig_name) { const char *prefix, *middle, *suffix; @@ -571,6 +739,9 @@ int get_filename(char *filename, size_t fbufsize, int mode, const char *orig_nam return (1); } +/** Calculate the number of player characters (PCs) in the room. Any NPC (mob) + * is not returned in the count. + * @param room The room to check for PCs. */ int num_pc_in_room(struct room_data *room) { int i = 0; @@ -583,14 +754,16 @@ int num_pc_in_room(struct room_data *room) return (i); } -/* This function (derived from basic fork() abort() idea by Erwin S. Andreasen) + +/** This function (derived from basic fork() abort() idea by Erwin S Andreasen) * causes your MUD to dump core (assuming you can) but continue running. The * core dump will allow post-mortem debugging that is less severe than assert(); * Don't call this directly as core_dump_unix() but as simply 'core_dump()' so * that it will be excluded from systems not supporting them. You still want to * call abort() or exit(1) for non-recoverable errors, of course. Wonder if - * flushing streams includes sockets? */ -extern FILE *player_fl; + * flushing streams includes sockets? + * @param who The file in which this call was made. + * @param line The line at which this call was made. */ void core_dump_real(const char *who, int line) { log("SYSERR: Assertion failed at %s:%d!", who, line); @@ -612,6 +785,10 @@ void core_dump_real(const char *who, int line) #endif } +/** Count the number bytes taken up by color codes in a string that will be + * empty space once the color codes are converted and made non-printable. + * @param string The string in which to check for color codes. + * @retval int the number of color codes found. */ int count_color_chars(char *string) { int i, len; @@ -633,8 +810,12 @@ int count_color_chars(char *string) return num; } -/* Rules (unless overridden by ROOM_DARK): Inside and City rooms are always - * lit. Outside rooms are dark at sunset and night. */ +/** Tests to see if a room is dark. Rules (unless overridden by ROOM_DARK): + * Inside and City rooms are always lit. Outside rooms are dark at sunset and + * night. + * @todo Make the return value a bool. + * @param room The real room to test for. + * @retval int FALSE if the room is lit, TRUE if the room is dark. */ int room_is_dark(room_rnum room) { if (!VALID_ROOM_RNUM(room)) { @@ -657,6 +838,15 @@ int room_is_dark(room_rnum room) return (FALSE); } +/** Calculates the Levenshtein distance between two strings. Currently used + * by the mud to make suggestions to the player when commands are mistyped. + * This function is most useful when an index of possible choices are available + * and the results of this function are constrained and used to help narrow + * down the possible choices. For more information about Levenshtein distance, + * recommend doing an internet or wikipedia search. + * @param s1 The input string. + * @param s2 The string to be compared to. + * @retval int The Levenshtein distance between s1 and s2. */ int levenshtein_distance(char *s1, char *s2) { int s1_len = strlen(s1), s2_len = strlen(s2); @@ -685,6 +875,11 @@ int levenshtein_distance(char *s1, char *s2) return i; } +/** Removes a character from a piece of furniture. Unlike some of the other + * _from_ functions, this does not place the character into NOWHERE. + * @post ch is unattached from the furniture object. + * @param ch The character to remove from the furniture object. + */ void char_from_furniture(struct char_data *ch) { struct obj_data *furniture; @@ -735,3 +930,643 @@ void char_from_furniture(struct char_data *ch) return; } + + +/* Helper function for column_list. */ +void process_column_list_format(char **out_buffer, const char *format, + int buf_left, int index, + const char *item) +{ + /* Initialize the index format with a % */ + char index_format[80] = {'%'}; + int i; + + /* Copy the format to the output buffer character by character. */ + while (*format && buf_left >= 2) { + + /* A '$' signifies a 'control-code'. */ + if (*format == '$') { + ++format; + + /* + * Begin by assuming the caller has supplied a number here + * (something that looks like $3i). Then collect this number + * into the index_format after the %. + */ + i = 1; + while (isdigit(*format) && i < 78) + index_format[i++] = *(format++); + index_format[i++] = 'd'; + index_format[i] = '\0'; + + /* There may not be enough space left for the index. */ + if (buf_left < 12) + break; + + /* + * Okay, output the current index using the index format + * we already constructed above. + */ + else if (*format == 'i') + *out_buffer += sprintf(*out_buffer, index_format, index); + + /* + * Or output the current list item. Use part of the + * index format collected above to decide how wide the + * list item should be displayed. + */ + else if (*format == 'l') { + /* skip the %. atoi ignores the d too */ + i = atoi(index_format + 1); + /* if no width, set to -1 (any width) */ + if (!i) --i; + + /* copy the list item to the output buffer */ + while (*item && buf_left >= 2 && i != 0) { + *((*out_buffer)++) = *(item++); + --buf_left; + --i; + } + + /* if width was specified above, pad the list item */ + while (i-- > 0 && buf_left >= 2) { + *((*out_buffer)++) = ' '; + --buf_left; + } + } + + /* Or just output a $ */ + else if (*format == '$') { + *((*out_buffer)++) = '$'; + --buf_left; + } + + /* Whoa, at the end of the format already? */ + else if (!*format) + break; + + ++format; + } + + /* Not a '$' control code. Simply copy the character. */ + else { + *((*out_buffer)++) = *(format++); + --buf_left; + } + } + + /* Make sure it's nul-terminated. */ + **out_buffer = '\0'; +} + +/** + * Takes a list of strings and a display format, and formats them + * in a list by column (sequential items in the list are aligned + * vertically, then horizontally). This function supports varargs + * for the format string that describes how each item should look. + * @param[out] out_buffer The buffer to write to. + * @param[in] buf_left The size of the buffer. + * @param[in] page_length How many lines per page? 0 means no paging. + * @param[in] skip_lines How many lines to skip on the first page? + * @param[in] columns How many columns should be displayed? + * @param[in] list The array of strings to format. + * @param[in] list_length How many elements are in the list? We won't rely on + * lists ending with a newline element. + * @param[in] list_offset Is the list offset and by how much? For instance, + * affect flags are offset by one when displayed in medit. + * @param[in] format The format string for displaying each + * item in the list. Use "$#i" and "$#l" in the format string to determine + * how wide the index position and list item should be. For instance, + * "$2i $20l" would be equivalent to a printf "%2d %-20.20s". + * @param[in] ... Additional args for formatting the list display. + */ +void column_list(char *out_buffer, int buf_left, int page_length, + int skip_lines, int columns, const char **list, + int list_length, int list_offset, + const char *format, ...) +{ + int i, j = 0, k, rows, visited = 0; + char line[80]; + va_list args; + + --buf_left; + + /* We only need to parse the given format string for %'s once. */ + va_start(args, format); + vsnprintf(line, sizeof(line), format, args); + va_end(args); + + /* A page_length <= 0 means don't page output. */ + if (page_length <= 0) + page_length = list_length; + + /* + * The list index jumps around, since we want to display + * the list items by columns. For instance, in the first + * row, the second column's item will be approximately + * page_length positions in the list away from the item + * in the first column of the same row. + * So we use this macro. + */ + #define LIST_INDEX (page_length * columns * k + rows * j + i - \ + (k == 0 ? 0 : skip_lines * columns)) + + /* Traverse by page... */ + for (k = 0; k <= list_length / (page_length * columns); ++k) { + rows = MIN(page_length, (list_length - visited) / columns + 1); + if (k == 0) + rows -= skip_lines; + /* And then by row... */ + for (i = 0; i < rows; ++i) { + /* And then by column... */ + for (j = 0; j < columns; ++j) { + /* If the index is too high, break out. */ + if (LIST_INDEX >= list_length) + break; + + /* + * If space still remains in the buffer, process the next + * list item and print it to the buffer. Otherwise, + * complain about an overflow. + */ + if (buf_left > sizeof(line)) { + /* + * Now the real magic. Replace $i and $l with the index + * and list item. Don't let each displayed list item be wider + * than (an arbitrary) 80 characters. Also, allow a list + * offset in case we want to skip the first list item or + * something (like for affection flags). + */ + process_column_list_format(&out_buffer, line, sizeof(line), + LIST_INDEX + 1, + list[LIST_INDEX + list_offset]); + ++visited; + } + else { + strcpy(out_buffer + (buf_left < 17 ? buf_left - 17 : 0), + "\r\n**OVERFLOW**\r\n"); + return; + } + } + /* + * We're at the end of a row. Print a newline, advance the + * buffer, and decrement the amount of space left in the buffer. + */ + strcpy(out_buffer, "\r\n"); + out_buffer += 2; + buf_left -= 2; + } + } + + #undef LIST_INDEX + +} + +/** + * Search through a string array of flags for a particular flag. + * @param flag_list An array of flag name strings. The final element must + * be a string made up of a single newline. + * @param flag_name The name to search in flag_list. + * @retval int Returns the element number in flag_list of flag_name or + * NOFLAG (-1) if no match. + */ +int get_flag_by_name(const char *flag_list[], char *flag_name) +{ + int i=0; + for (;flag_list[i] && *flag_list[i] && strcmp(flag_list[i], "\n") != 0; i++) + if (!strcmp(flag_list[i], flag_name)) + return (i); + return (NOFLAG); +} + +/** + * Reads a certain number of lines from the begining of a file, like performing + * a 'head'. + * @pre Expects an already open file and the user to supply enough memory + * in the output buffer to hold the lines read from the file. Assumes the + * file is a text file. Expects buf to be nulled out if the entire buf is + * to be used, otherwise, appends file information beyond the first null + * character. lines_to_read is assumed to be a positive number. + * @post Rewinds the file pointer to the beginning of the file. If buf is + * too small to handle the requested output, **OVERFLOW** is appended to the + * buffer. + * @param[in] file A pointer to an already successfully opened file. + * @param[out] buf Buffer to hold the data read from the file. Will not + * overwrite preexisting information in a non-null string. + * @param[in] bufsize The total size of the buffer. + * @param[in] lines_to_read The number of lines to be read from the front of + * the file. + * @retval int The number of lines actually read from the file. Can be used + * the compare with the number of lines requested to be read to determine if the + * entire file was read. If lines_to_read is <= 0, no processing occurs + * and lines_to_read is returned. + */ +int file_head( FILE *file, char *buf, size_t bufsize, int lines_to_read ) +{ + /* Local variables */ + int lines_read = 0; /* The number of lines read so far. */ + char line[READ_SIZE]; /* Retrieval buffer for file. */ + size_t buflen; /* Amount of previous existing data in buffer. */ + int readstatus = 1; /* Are we at the end of the file? */ + int n = 0; /* Return value from snprintf. */ + const char *overflow = "\r\n**OVERFLOW**\r\n"; /* Appended if overflow. */ + + /* Quick check for bad arguments. */ + if (lines_to_read <= 0) + { + return lines_to_read; + } + + /* Initialize local variables not already initialized. */ + buflen = strlen(buf); + + /* Read from the front of the file. */ + rewind(file); + + while ( (lines_read < lines_to_read) && + (readstatus > 0) && (buflen < bufsize) ) + { + /* Don't use get_line to set lines_read because get_line will return + * the number of comments skipped during reading. */ + readstatus = get_line( file, line ); + + if (readstatus > 0) + { + n = snprintf( buf + buflen, bufsize - buflen, "%s\r\n", line); + buflen += n; + lines_read++; + } + } + + /* Check to see if we had a potential buffer overflow. */ + if (buflen >= bufsize) + { + /* We should never see this case, but... */ + if ( (strlen(overflow) + 1) >= bufsize ) + { + core_dump(); + snprintf( buf, bufsize, "%s", overflow); + } + else + { + /* Append the overflow statement to the buffer. */ + snprintf( buf + buflen - strlen(overflow) - 1, strlen(overflow) + 1, "%s", overflow); + } + } + + rewind(file); + + /* Return the number of lines. */ + return lines_read; +} + +/** + * Reads a certain number of lines from the end of the file, like performing + * a 'tail'. + * @pre Expects an already open file and the user to supply enough memory + * in the output buffer to hold the lines read from the file. Assumes the + * file is a text file. Expects buf to be nulled out if the entire buf is + * to be used, otherwise, appends file information beyond the first null + * character in buf. lines_to_read is assumed to be a positive number. + * @post Rewinds the file pointer to the beginning of the file. If buf is + * too small to handle the requested output, **OVERFLOW** is appended to the + * buffer. + * @param[in] file A pointer to an already successfully opened file. + * @param[out] buf Buffer to hold the data read from the file. Will not + * overwrite preexisting information in a non-null string. + * @param[in] bufsize The total size of the buffer. + * @param[in] lines_to_read The number of lines to be read from the back of + * the file. + * @retval int The number of lines actually read from the file. Can be used + * the compare with the number of lines requested to be read to determine if the + * entire file was read. If lines_to_read is <= 0, no processing occurs + * and lines_to_read is returned. + */ +int file_tail( FILE *file, char *buf, size_t bufsize, int lines_to_read ) +{ + /* Local variables */ + int lines_read = 0; /* The number of lines read so far. */ + int total_lines = 0; /* The total number of lines in the file. */ + char c; /* Used to fast forward the file. */ + char line[READ_SIZE]; /* Retrieval buffer for file. */ + size_t buflen; /* Amount of previous existing data in buffer. */ + int readstatus = 1; /* Are we at the end of the file? */ + int n = 0; /* Return value from snprintf. */ + const char *overflow = "\r\n**OVERFLOW**\r\n"; /* Appended if overflow. */ + + /* Quick check for bad arguments. */ + if (lines_to_read <= 0) + { + return lines_to_read; + } + + /* Initialize local variables not already initialized. */ + buflen = strlen(buf); + total_lines = file_numlines(file); /* Side effect: file is rewound. */ + + /* Fast forward to the location we should start reading from */ + while (((lines_to_read + lines_read) < total_lines)) + { + do { + c = fgetc(file); + } while(c != '\n'); + + lines_read++; + } + + /* We reuse the lines_read counter. */ + lines_read = 0; + + /** From here on, we perform just like file_head */ + while ( (lines_read < lines_to_read) && + (readstatus > 0) && (buflen < bufsize) ) + { + /* Don't use get_line to set lines_read because get_line will return + * the number of comments skipped during reading. */ + readstatus = get_line( file, line ); + + if (readstatus > 0) + { + n = snprintf( buf + buflen, bufsize - buflen, "%s\r\n", line); + buflen += n; + lines_read++; + } + } + + /* Check to see if we had a potential buffer overflow. */ + if (buflen >= bufsize) + { + /* We should never see this case, but... */ + if ( (strlen(overflow) + 1) >= bufsize ) + { + core_dump(); + snprintf( buf, bufsize, "%s", overflow); + } + else + { + /* Append the overflow statement to the buffer. */ + snprintf( buf + buflen - strlen(overflow) - 1, strlen(overflow) + 1, "%s", overflow); + } + } + + rewind(file); + + /* Return the number of lines read. */ + return lines_read; + +} + +/** Returns the byte size of a file. We assume size_t to be a large enough type + * to handle all of the file sizes in the mud, and so do not make SIZE_MAX + * checks. + * @pre file parameter must already be opened. + * @post file will be rewound. + * @param file The file to determine the size of. + * @retval size_t The byte size of the file (we assume no errors will be + * encountered in this function). + */ +size_t file_sizeof( FILE *file ) +{ + size_t numbytes = 0; + + rewind(file); + + /* It would be so much easier to do a byte count if an fseek SEEK_END and + * ftell pair of calls was portable for text files, but all information + * I've found says that getting a file size from ftell for text files is + * not portable. Oh well, this method should be extremely fast for the + * relatively small filesizes in the mud, and portable, too. */ + while (!feof(file)) + { + fgetc(file); + numbytes++; + } + + rewind(file); + + return numbytes; +} + +/** Returns the number of newlines '\n' in a file, which we equate to number of + * lines. We assume the int type more than adequate to count the number of lines + * and do not make checks for overrunning INT_MAX. + * @pre file parameter must already be opened. + * @post file will be rewound. + * @param file The file to determine the size of. + * @retval size_t The byte size of the file (we assume no errors will be + * encountered in this function). + */ +int file_numlines( FILE *file ) +{ + int numlines = 0; + char c; + + rewind(file); + + while (!feof(file)) + { + c = fgetc(file); + if (c == '\n') + { + numlines++; + } + } + + rewind(file); + + return numlines; +} + + +/** A string converter designed to deal with the compile sensitive IDXTYPE. + * Relies on the friendlier strtol function. + * @pre Assumes that NOWHERE, NOTHING, NOBODY, NOFLAG, etc are all equal. + * @param str_to_conv A string of characters to attempt to convert to an + * IDXTYPE number. + * @retval IDXTYPE A valid index number, or NOWHERE if not valid. + */ +IDXTYPE atoidx( const char *str_to_conv ) +{ + long int result; + + /* Check for errors */ + errno = 0; + + result = strtol(str_to_conv, NULL, 10); + + if ( errno || (result > IDXTYPE_MAX) || (result < 0) ) + return NOWHERE; /* All of the NO* settings should be the same */ + else + return (IDXTYPE) result; +} + + +/* + strfrmt (String Format) function + Used by automap/map system + Re-formats a string to fit within a particular size box. + Recognises @ color codes, and if a line ends in one color, the + next line will start with the same color. + Ends every line with @n to prevent color bleeds. +*/ +char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad) +{ + static char ret[MAX_STRING_LENGTH]; + char line[MAX_INPUT_LENGTH]; + char *sp = str; + char *lp = line; + char *rp = ret; + char *wp; + int wlen = 0, llen = 0, lcount = 0; + char last_color='n'; + bool new_line_started = FALSE; + + memset(line, '\0', MAX_INPUT_LENGTH); + /* Nomalize spaces and newlines */ + /* Split into lines, including convert \\ into \r\n */ + while(*sp) { + /* eat leading space */ + while(*sp && isspace(*sp)) sp++; + /* word begins */ + wp = sp; + wlen = 0; + while(*sp) { /* Find the end of the word */ + if(isspace(*sp)) break; + if(*sp=='\\' && sp[1] && sp[1]=='\\') { + if(sp!=wp) + break; /* Finish dealing with the current word */ + sp += 2; /* Eat the marker and any trailing space */ + while(*sp && isspace(*sp)) sp++; + wp = sp; + /* Start a new line */ + if(hpad) + for(; llen < w; llen++) + *lp++ = ' '; + *lp++ = '\r'; + *lp++ = '\n'; + *lp++ = '\0'; + rp += sprintf(rp, "%s", line); + llen = 0; + lcount++; + lp = line; + } else if (*sp=='`'||*sp=='$'||*sp=='#'||*sp=='@') { + if (sp[1] && (sp[1]==*sp)) + wlen++; /* One printable char here */ + if (*sp=='@' && (sp[1]!=*sp)) /* Color code, not @@ */ + last_color = sp[1]; + sp += 2; /* Eat the whole code regardless */ + } else { + wlen++; + sp++; + } + } + if(llen + wlen + (lp==line ? 0 : 1) > w) { + /* Start a new line */ + if(hpad) + for(; llen < w; llen++) + *lp++ = ' '; + *lp++ = '@'; /* 'normal' color */ + *lp++ = 'n'; + *lp++ = '\r'; /* New line */ + *lp++ = '\n'; + *lp++ = '\0'; + sprintf(rp, "%s", line); + rp += strlen(line); + llen = 0; + lcount++; + lp = line; + if (last_color != 'n') { + *lp++ = '@'; /* restore previous color */ + *lp++ = last_color; + new_line_started = TRUE; + } + } + /* add word to line */ + if (lp!=line && new_line_started!=TRUE) { + *lp++ = ' '; + llen++; + } + new_line_started = FALSE; + llen += wlen ; + for( ; wp!=sp ; *lp++ = *wp++); + } + /* Copy over the last line */ + if(lp!=line) { + if(hpad) + for(; llen < w; llen++) + *lp++ = ' '; + *lp++ = '\r'; + *lp++ = '\n'; + *lp++ = '\0'; + sprintf(rp, "%s", line); + rp += strlen(line); + lcount++; + } + if(vpad) { + while(lcount < h) { + if(hpad) { + memset(rp, ' ', w); + rp += w; + } + *rp++ = '\r'; + *rp++ = '\n'; + lcount++; + } + *rp = '\0'; + } + return ret; +} + +/** + Takes two long strings (multiple lines) and joins them side-by-side. + Used by the automap/map system + @param str1 The string to be displayed on the left. + @param str2 The string to be displayed on the right. + @param joiner ???. + @retval char * Pointer to the output to be displayed? +*/ +char *strpaste(char *str1, char *str2, char *joiner) +{ + static char ret[MAX_STRING_LENGTH+1]; + char *sp1 = str1; + char *sp2 = str2; + char *rp = ret; + int jlen = strlen(joiner); + + while((rp - ret) < MAX_STRING_LENGTH && (*sp1 || *sp2)) { + /* Copy line from str1 */ + while((rp - ret) < MAX_STRING_LENGTH && *sp1 && !ISNEWL(*sp1)) + *rp++ = *sp1++; + /* Eat the newline */ + if(*sp1) { + if(sp1[1] && sp1[1]!=sp1[0] && ISNEWL(sp1[1])) + sp1++; + sp1++; + } + + /* Add the joiner */ + if((rp - ret) + jlen >= MAX_STRING_LENGTH) + break; + strcpy(rp, joiner); + rp += jlen; + + /* Copy line from str2 */ + while((rp - ret) < MAX_STRING_LENGTH && *sp2 && !ISNEWL(*sp2)) + *rp++ = *sp2++; + /* Eat the newline */ + if(*sp2) { + if(sp2[1] && sp2[1]!=sp2[0] && ISNEWL(sp2[1])) + sp2++; + sp2++; + } + + /* Add the newline */ + if((rp - ret) + 2 >= MAX_STRING_LENGTH) + break; + *rp++ = '\r'; + *rp++ = '\n'; + } + /* Close off the string */ + *rp = '\0'; + return ret; +} diff --git a/src/utils.h b/src/utils.h index 235b7dc..4d4d858 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,43 +1,83 @@ -/************************************************************************** -* File: utils.h Part of tbaMUD * -* Usage: Header file, utility macros and prototypes of utility funcs. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -**************************************************************************/ +/** +* @file utils.h +* Utility macros and prototypes of utility functions. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* @todo Merge structs, random and other very generic functions and macros into +* the utils module. +* @todo Take more mud specific functions and function prototypes (follower +* functions, move functions, char_from_furniture) out of utils and declare / +* define elsewhere. +*/ +#ifndef _UTILS_H_ /* Begin header file protection */ +#define _UTILS_H_ + +/** Definition of the action command, for the do_ series of in game functions. + * This macro is placed here (for now) because it's too general of a macro + * to be first defined in interpreter.h. The reason for using a macro is + * to allow for easier addition of parameters to the otherwise generic and + * static function structure. */ +#define ACMD(name) \ + void name(struct char_data *ch, char *argument, int cmd, int subcmd) /* external declarations and prototypes */ -extern struct weather_data weather_info; -extern FILE *logfile; -#define log basic_mud_log +/** direct all log() references to basic_mud_log() function. */ +#define log basic_mud_log +/** Standard line size, used for many string limits. */ #define READ_SIZE 256 -/* public functions in utils.c */ -void basic_mud_log(const char *format, ...) __attribute__ ((format (printf, 1, 2))); -void basic_mud_vlog(const char *format, va_list args); -int touch(const char *path); -void mudlog(int type, int level, int file, const char *str, ...) __attribute__ ((format (printf, 4, 5))); -void log_death_trap(struct char_data *ch); +/* Public functions made available from utils.c. Documentation for all functions + * are made available with the function definition. */ +void basic_mud_log(const char *format, ...) __attribute__ ((format (printf, 1, 2))); +void basic_mud_vlog(const char *format, va_list args); +int touch(const char *path); +void mudlog(int type, int level, int file, const char *str, ...) __attribute__ ((format (printf, 4, 5))); +void log_death_trap(struct char_data *ch); int rand_number(int from, int to); int dice(int number, int size); size_t sprintbit(bitvector_t vektor, const char *names[], char *result, size_t reslen); size_t sprinttype(int type, const char *names[], char *result, size_t reslen); void sprintbitarray(int bitvector[], const char *names[], int maxar, char *result); -int get_line(FILE *fl, char *buf); -int get_filename(char *filename, size_t fbufsize, int mode, const char *orig_name); -time_t mud_time_to_secs(struct time_info_data *now); -struct time_info_data *age(struct char_data *ch); -int num_pc_in_room(struct room_data *room); -void core_dump_real(const char *who, int line); -int count_color_chars(char *string); -int room_is_dark(room_rnum room); -int levenshtein_distance(char *s1, char *s2); +int get_line(FILE *fl, char *buf); +int get_filename(char *filename, size_t fbufsize, int mode, const char *orig_name); +time_t mud_time_to_secs(struct time_info_data *now); +struct time_info_data *age(struct char_data *ch); +int num_pc_in_room(struct room_data *room); +void core_dump_real(const char *who, int line); +int count_color_chars(char *string); +int room_is_dark(room_rnum room); +int levenshtein_distance(char *s1, char *s2); +struct time_info_data *real_time_passed(time_t t2, time_t t1); +struct time_info_data *mud_time_passed(time_t t2, time_t t1); +void prune_crlf(char *txt); +void column_list(char *out_buffer, int buf_left, int page_length, + int skip_lines, int columns, const char **list, + int list_length, int list_offset, const char *format, + ...) __attribute__ ((format (printf, 9, 10))); +int get_flag_by_name(const char *flag_list[], char *flag_name); +int file_head( FILE *file, char *buf, size_t bufsize, int lines_to_read ); +int file_tail( FILE *file, char *buf, size_t bufsize, int lines_to_read ); +size_t file_sizeof( FILE *file ); +int file_numlines( FILE *file ); +IDXTYPE atoidx( const char *str_to_conv ); +char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad); +char *strpaste(char *str1, char *str2, char *joiner); -#define core_dump() core_dump_real(__FILE__, __LINE__) +/* Public functions made available form weather.c */ +void weather_and_time(int mode); + +/** Creates a core dump for diagnostic purposes, but will keep (if it can) + * the mud running after the core has been dumped. Call this in the place + * of calling core_dump_real. */ +#define core_dump() core_dump_real(__FILE__, __LINE__) /* Only provide our versions if one isn't in the C library. These macro names * will be defined by sysdep.h if a strcasecmp or stricmp exists. */ @@ -74,7 +114,7 @@ bool circle_follow(struct char_data *ch, struct char_data *victim); /* in act.informative.c */ void look_at_room(struct char_data *ch, int mode); -void add_history(struct char_data *ch, char *msg, int type); +void add_history(struct char_data *ch, char *msg, int type); /* in act.movmement.c */ int do_simple_move(struct char_data *ch, int dir, int following); @@ -91,75 +131,113 @@ void gain_exp_regardless(struct char_data *ch, int gain); void gain_condition(struct char_data *ch, int condition, int value); void point_update(void); void update_pos(struct char_data *victim); +void run_autowiz(void); void char_from_furniture(struct char_data *ch); +/** What ch is currently sitting on. */ #define SITTING(ch) ((ch)->char_specials.furniture) +/** Who is sitting next to ch, if anyone. */ #define NEXT_SITTING(ch) ((ch)->char_specials.next_in_furniture) +/** Who is sitting on this obj */ #define OBJ_SAT_IN_BY(obj) ((obj)->sitting_here) /* various constants */ /* defines for mudlog() */ -#define OFF 0 -#define BRF 1 -#define NRM 2 -#define CMP 3 +#define OFF 0 /**< Receive no mudlog messages. */ +#define BRF 1 /**< Receive only the most important mudlog messages. */ +#define NRM 2 /**< Receive the standard mudlog messages. */ +#define CMP 3 /**< Receive every mudlog message. */ -/* get_filename() */ -#define CRASH_FILE 0 -#define ETEXT_FILE 1 -#define SCRIPT_VARS_FILE 2 -#define PLR_FILE 3 -#define MAX_FILES 4 +/* get_filename() types of files to open */ +#define CRASH_FILE 0 /**< Open up a player crash save file */ +#define ETEXT_FILE 1 /**< ???? */ +#define SCRIPT_VARS_FILE 2 /**< Reference to a global variable file. */ +#define PLR_FILE 3 /**< The standard player file */ -/* breadth-first searching */ -#define BFS_ERROR (-1) -#define BFS_ALREADY_THERE (-2) -#define BFS_NO_PATH (-3) +#define MAX_FILES 4 /**< Max number of files types vailable */ -/* These constants should be configurable. See act.informative.c and utils.c - * for other places to change. */ -/* mud-life time */ +/* breadth-first searching for graph function (tracking, etc) */ +#define BFS_ERROR (-1) /**< Error in the search. */ +#define BFS_ALREADY_THERE (-2) /**< Area traversed already. */ +#define BFS_NO_PATH (-3) /**< No path through here. */ + +/** Number of real life seconds per mud hour. + * @todo The definitions based on SECS_PER_MUD_HOUR should be configurable. + * See act.informative.c and utils.c for other places to change. */ #define SECS_PER_MUD_HOUR 75 +/** Real life seconds in one mud day. + * Current calculation = 30 real life minutes. */ #define SECS_PER_MUD_DAY (24*SECS_PER_MUD_HOUR) +/** Real life seconds per mud month. + * Current calculation = 17.5 real life hours */ #define SECS_PER_MUD_MONTH (35*SECS_PER_MUD_DAY) +/** Real life seconds per mud month. + * Current calculation ~= 12.4 real life days */ #define SECS_PER_MUD_YEAR (17*SECS_PER_MUD_MONTH) -/* real-life time (remember Real Life?) */ +/** The number of seconds in a real minute. */ #define SECS_PER_REAL_MIN 60 +/** The number of seconds in a real hour. */ #define SECS_PER_REAL_HOUR (60*SECS_PER_REAL_MIN) +/** The number of seconds in a real day. */ #define SECS_PER_REAL_DAY (24*SECS_PER_REAL_HOUR) +/** The number of seconds in a real year. */ #define SECS_PER_REAL_YEAR (365*SECS_PER_REAL_DAY) -/* string utils */ +/* integer utils */ +#define URANGE(a, b, c) ((b) < (a) ? (a) : ((b) > (c) ? (c) : (b))) + +/* Various string utils. */ +/** If a is not null, FALSE or '0', return "YES"; if it is, return "NO" */ #define YESNO(a) ((a) ? "YES" : "NO") +/** If a is not null, FALSE or '0', return "ON"; if it is, return "OFF" */ #define ONOFF(a) ((a) ? "ON" : "OFF") +/** If c is an upper case letter, return the upper case. */ #define LOWER(c) (((c)>='A' && (c) <= 'Z') ? ((c)+('a'-'A')) : (c)) +/** If c is a lower case letter, return the upper case. */ #define UPPER(c) (((c)>='a' && (c) <= 'z') ? ((c)+('A'-'a')) : (c) ) +/** If ch is equal to either a newline or a carriage return, return 1, + * else 0. + * @todo Recommend using the ? operator for clarity. */ #define ISNEWL(ch) ((ch) == '\n' || (ch) == '\r') -/* See also: ANA, SANA */ +/** If string begins a vowel (upper or lower case), return "an"; else return + * "a". */ #define AN(string) (strchr("aeiouAEIOU", *string) ? "an" : "a") -/* memory utils */ +/** A calloc based memory allocation macro. + * @param result Pointer to created memory. + * @param type The type of memory (int, struct char_data, etc.). + * @param number How many of type to make. */ #define CREATE(result, type, number) do {\ if ((number) * sizeof(type) <= 0) \ log("SYSERR: Zero bytes or less requested at %s:%d.", __FILE__, __LINE__); \ if (!((result) = (type *) calloc ((number), sizeof(type)))) \ { perror("SYSERR: malloc failure"); abort(); } } while(0) -#define RECREATE(result,type,number) do {\ +/** A realloc based memory reallocation macro. Reminder: realloc can reduce + * the size of an array as well as increase it. + * @param result Pointer to created memory. + * @param type The type of memory (int, struct char_data, etc.). + * @param number How many of type to make. */ +#define RECREATE(result, type, number) do {\ if (!((result) = (type *) realloc ((result), sizeof(type) * (number))))\ { perror("SYSERR: realloc failure"); abort(); } } while(0) -/* the source previously used the same code in many places to remove an item - * from a list: if it's the list head, change the head, else traverse the - * list looking for the item before the one to be removed. Now, we have a - * macro to do this. To use, just make sure that there is a variable 'temp' - * declared as the same type as the list to be manipulated. BTW, this is - * a great application for C++ templates but, alas, this is not C++. */ +/** Remove an item from a linked list and reset the links. + * If item is at the list head, change the head, else traverse the + * list looking for the item before the one to be removed. + * @pre Requires that a variable 'temp' be declared as the same type as the + * list to be manipulated. + * @post List pointers are correctly reset and item is no longer in the list. + * item can now be changed, removed, etc independently from the list it was in. + * @param item Pointer to item to remove from the list. + * @param head Pointer to the head of the linked list. + * @param next The variable name pointing to the next in the list. + * */ #define REMOVE_FROM_LIST(item, head, next) \ if ((item) == (head)) \ head = (item)->next; \ @@ -172,15 +250,27 @@ void char_from_furniture(struct char_data *ch); } \ /* basic bitvector utils */ +/** Return the bitarray field number x is in. */ #define Q_FIELD(x) ((int) (x) / 32) +/** Return the bit to set in a bitarray field. */ #define Q_BIT(x) (1 << ((x) % 32)) +/** 1 if bit is set in the bitarray represented by var, 0 if not. */ #define IS_SET_AR(var, bit) ((var)[Q_FIELD(bit)] & Q_BIT(bit)) +/** Set a specific bit in the bitarray represented by var to 1. */ #define SET_BIT_AR(var, bit) ((var)[Q_FIELD(bit)] |= Q_BIT(bit)) +/** Unset a specific bit in the bitarray represented by var to 0. */ #define REMOVE_BIT_AR(var, bit) ((var)[Q_FIELD(bit)] &= ~Q_BIT(bit)) +/** If bit is on in bitarray var, turn it off; if it is off, turn it on. */ #define TOGGLE_BIT_AR(var, bit) ((var)[Q_FIELD(bit)] = (var)[Q_FIELD(bit)] ^ Q_BIT(bit)) + +/* Older, stock tbaMUD bit settings. */ +/** 1 if bit is set in flag, 0 if it is not set. */ #define IS_SET(flag,bit) ((flag) & (bit)) +/** Set a specific bit in var to 1. */ #define SET_BIT(var,bit) ((var) |= (bit)) +/** Set a specific bit bit in var to 0. */ #define REMOVE_BIT(var,bit) ((var) &= ~(bit)) +/** If bit in var is off, turn it on; if it is on, turn it off. */ #define TOGGLE_BIT(var,bit) ((var) ^= (bit)) /* Accessing player specific data structures on a mobile is a very bad thing @@ -189,148 +279,271 @@ void char_from_furniture(struct char_data *ch); * for it, 'wimpy' would be an extremely bad thing for a mob to do, as an * example. If you really couldn't care less, change this to a '#if 0'. */ #if 1 -/* Subtle bug in the '#var', but works well for now. */ +/** Warn if accessing player_specials on a mob. + * @todo Subtle bug in the var reporting, but works well for now. */ #define CHECK_PLAYER_SPECIAL(ch, var) \ (*(((ch)->player_specials == &dummy_mob) ? (log("SYSERR: Mob using '"#var"' at %s:%d.", __FILE__, __LINE__), &(var)) : &(var))) #else #define CHECK_PLAYER_SPECIAL(ch, var) (var) #endif +/** The act flags on a mob. Synonomous with PLR_FLAGS. */ #define MOB_FLAGS(ch) ((ch)->char_specials.saved.act) +/** Player flags on a PC. Synonomous with MOB_FLAGS. */ #define PLR_FLAGS(ch) ((ch)->char_specials.saved.act) +/** Preference flags on a player (not to be used on mobs). */ #define PRF_FLAGS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.pref)) +/** Affect flags on the NPC or PC. */ #define AFF_FLAGS(ch) ((ch)->char_specials.saved.affected_by) +/** Room flags. + * @param loc The real room number. */ #define ROOM_FLAGS(loc) (world[(loc)].room_flags) + +/** References the routine element for a spell. Currently unused. */ #define SPELL_ROUTINES(spl) (spell_info[spl].routines) /* IS_MOB() acts as a VALID_MOB_RNUM()-like function.*/ +/** 1 if the character has the NPC bit set, 0 if the character does not. + * Used to prevents NPCs and mobs from doing things they shouldn't, even + * when mobs are possessed or charmed by a player. */ #define IS_NPC(ch) (IS_SET_AR(MOB_FLAGS(ch), MOB_ISNPC)) +/** 1 if the character is a real NPC, 0 if the character is not. */ #define IS_MOB(ch) (IS_NPC(ch) && GET_MOB_RNUM(ch) <= top_of_mobt && \ GET_MOB_RNUM(ch) != NOBODY) +/** 1 if ch is flagged an NPC and flag is set in the act bitarray, 0 if not. */ #define MOB_FLAGGED(ch, flag) (IS_NPC(ch) && IS_SET_AR(MOB_FLAGS(ch), (flag))) +/** 1 if ch is not flagged an NPC and flag is set in the act bitarray, 0 if + * not. */ #define PLR_FLAGGED(ch, flag) (!IS_NPC(ch) && IS_SET_AR(PLR_FLAGS(ch), (flag))) +/** 1 if flag is set in the affect bitarray, 0 if not. */ #define AFF_FLAGGED(ch, flag) (IS_SET_AR(AFF_FLAGS(ch), (flag))) +/** 1 if flag is set in the preferences bitarray, 0 if not. */ #define PRF_FLAGGED(ch, flag) (IS_SET_AR(PRF_FLAGS(ch), (flag))) +/** 1 if flag is set in the room of loc, 0 if not. */ #define ROOM_FLAGGED(loc, flag) (IS_SET_AR(ROOM_FLAGS(loc), (flag))) +/** 1 if flag is set in the exit, 0 if not. */ #define EXIT_FLAGGED(exit, flag) (IS_SET((exit)->exit_info, (flag))) +/** 1 if flag is set in the affects bitarray of obj, 0 if not. */ #define OBJAFF_FLAGGED(obj, flag) (IS_SET_AR(GET_OBJ_AFFECT(obj), (flag))) +/** 1 if flag is set in the element of obj value, 0 if not. */ #define OBJVAL_FLAGGED(obj, flag) (IS_SET(GET_OBJ_VAL((obj), 1), (flag))) +/** 1 if flag is set in the wear bits of obj, 0 if not. */ #define OBJWEAR_FLAGGED(obj, flag) (IS_SET_AR(GET_OBJ_WEAR(obj), (flag))) +/** 1 if flag is set in the extra bits of obj, 0 if not. */ #define OBJ_FLAGGED(obj, flag) (IS_SET_AR(GET_OBJ_EXTRA(obj), (flag))) + +/** 1 if spl has a flag set in routines, 0 if not. */ #define HAS_SPELL_ROUTINE(spl, flag) (IS_SET(SPELL_ROUTINES(spl), (flag))) -/* IS_AFFECTED for backwards compatibility */ +/** IS_AFFECTED for backwards compatibility */ #define IS_AFFECTED(ch, skill) (AFF_FLAGGED((ch), (skill))) +/** Toggle flag in ch PLR_FLAGS' turns on if off, or off if on. */ #define PLR_TOG_CHK(ch,flag) ((TOGGLE_BIT_AR(PLR_FLAGS(ch), (flag))) & Q_BIT(flag)) +/** Toggle flag in ch PRF_FLAGS; turns on if off, or off if on. */ #define PRF_TOG_CHK(ch,flag) ((TOGGLE_BIT_AR(PRF_FLAGS(ch), (flag))) & Q_BIT(flag)) -/* new define for quick check */ +/** Checks to see if a PC or NPC is dead. */ #define DEAD(ch) (PLR_FLAGGED((ch), PLR_NOTDEADYET) || MOB_FLAGGED((ch), MOB_NOTDEADYET)) /* room utils */ + +/** Return the sector type for the room. If there is no sector type, return + * SECT_INSIDE. */ #define SECT(room) (VALID_ROOM_RNUM(room) ? \ world[(room)].sector_type : SECT_INSIDE) +/** TRUE if the room has no light, FALSE if not. */ #define IS_DARK(room) room_is_dark((room)) +/** TRUE if the room has light, FALSE if not. */ #define IS_LIGHT(room) (!IS_DARK(room)) +/** 1 if this is a valid room number, 0 if not. */ #define VALID_ROOM_RNUM(rnum) ((rnum) != NOWHERE && (rnum) <= top_of_world) +/** The room number if this is a valid room, NOWHERE if it is not */ #define GET_ROOM_VNUM(rnum) \ ((room_vnum)(VALID_ROOM_RNUM(rnum) ? world[(rnum)].number : NOWHERE)) +/** Pointer to the room function, NULL if there is not one. */ #define GET_ROOM_SPEC(room) \ (VALID_ROOM_RNUM(room) ? world[(room)].func : NULL) /* char utils */ +/** What room is PC/NPC in? */ #define IN_ROOM(ch) ((ch)->in_room) +/** What room was PC/NPC previously in? */ #define GET_WAS_IN(ch) ((ch)->was_in_room) +/** How old is PC/NPC, at last recorded time? */ #define GET_AGE(ch) (age(ch)->year) +/** Name of PC. */ #define GET_PC_NAME(ch) ((ch)->player.name) +/** Name of PC or short_descr of NPC. */ #define GET_NAME(ch) (IS_NPC(ch) ? \ (ch)->player.short_descr : GET_PC_NAME(ch)) +/** Title of PC */ #define GET_TITLE(ch) ((ch)->player.title) +/** Level of PC or NPC. */ #define GET_LEVEL(ch) ((ch)->player.level) +/** Password of PC. */ #define GET_PASSWD(ch) ((ch)->player.passwd) +/** The player file position of PC. */ #define GET_PFILEPOS(ch)((ch)->pfilepos) -/* I wonder if this definition of GET_REAL_LEVEL should be the definition of - * GET_LEVEL? JE */ +/** Gets the level of a player even if the player is switched. + * @todo Make this the definition of GET_LEVEL. */ #define GET_REAL_LEVEL(ch) \ (ch->desc && ch->desc->original ? GET_LEVEL(ch->desc->original) : \ GET_LEVEL(ch)) +/** Class of ch. */ #define GET_CLASS(ch) ((ch)->player.chclass) +/** Height of ch. */ #define GET_HEIGHT(ch) ((ch)->player.height) +/** Weight of ch. */ #define GET_WEIGHT(ch) ((ch)->player.weight) +/** Sex of ch. */ #define GET_SEX(ch) ((ch)->player.sex) +/** Current strength of ch. */ #define GET_STR(ch) ((ch)->aff_abils.str) +/** Current strength modifer of ch. */ #define GET_ADD(ch) ((ch)->aff_abils.str_add) +/** Current dexterity of ch. */ #define GET_DEX(ch) ((ch)->aff_abils.dex) +/** Current intelligence of ch. */ #define GET_INT(ch) ((ch)->aff_abils.intel) +/** Current wisdom of ch. */ #define GET_WIS(ch) ((ch)->aff_abils.wis) +/** Current constitution of ch. */ #define GET_CON(ch) ((ch)->aff_abils.con) +/** Current charisma of ch. */ #define GET_CHA(ch) ((ch)->aff_abils.cha) +/** Experience points of ch. */ #define GET_EXP(ch) ((ch)->points.exp) +/** Armor class of ch. */ #define GET_AC(ch) ((ch)->points.armor) +/** Current hit points (health) of ch. */ #define GET_HIT(ch) ((ch)->points.hit) +/** Maximum hit points of ch. */ #define GET_MAX_HIT(ch) ((ch)->points.max_hit) +/** Current move points (stamina) of ch. */ #define GET_MOVE(ch) ((ch)->points.move) +/** Maximum move points (stamina) of ch. */ #define GET_MAX_MOVE(ch) ((ch)->points.max_move) +/** Current mana points (magic) of ch. */ #define GET_MANA(ch) ((ch)->points.mana) +/** Maximum mana points (magic) of ch. */ #define GET_MAX_MANA(ch) ((ch)->points.max_mana) +/** Gold on ch. */ #define GET_GOLD(ch) ((ch)->points.gold) +/** Gold in bank of ch. */ #define GET_BANK_GOLD(ch) ((ch)->points.bank_gold) +/** Current to-hit roll modifier for ch. */ #define GET_HITROLL(ch) ((ch)->points.hitroll) +/** Current damage roll modifier for ch. */ #define GET_DAMROLL(ch) ((ch)->points.damroll) +/** Current position (standing, sitting) of ch. */ #define GET_POS(ch) ((ch)->char_specials.position) +/** Unique ID of ch. */ #define GET_IDNUM(ch) ((ch)->char_specials.saved.idnum) +/** Returns contents of id field from x. */ #define GET_ID(x) ((x)->id) +/** Weight carried by ch. */ #define IS_CARRYING_W(ch) ((ch)->char_specials.carry_weight) +/** Number of items carried by ch. */ #define IS_CARRYING_N(ch) ((ch)->char_specials.carry_items) +/** Who or what ch is fighting. */ #define FIGHTING(ch) ((ch)->char_specials.fighting) +/** Who or what the ch is hunting. */ #define HUNTING(ch) ((ch)->char_specials.hunting) +/** Saving throw i for character ch. */ #define GET_SAVE(ch, i) ((ch)->char_specials.saved.apply_saving_throw[i]) +/** Alignment value for ch. */ #define GET_ALIGNMENT(ch) ((ch)->char_specials.saved.alignment) +/** Return condition i (DRUNK, HUNGER, THIRST) of ch. */ #define GET_COND(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.conditions[(i)])) +/** The room to load player ch into. */ #define GET_LOADROOM(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.load_room)) +/** Number of skill practice sessions remaining for ch. */ #define GET_PRACTICES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.spells_to_learn)) +/** Current invisibility level of ch. */ #define GET_INVIS_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.invis_level)) +/** Current wimpy level of ch. */ #define GET_WIMP_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.wimp_level)) +/** Current freeze level (god command) inflicted upon ch. */ #define GET_FREEZE_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.freeze_level)) +/** Current number of bad password attempts at logon. */ #define GET_BAD_PWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.bad_pws)) +/** Not used? + * @deprecated Should not be used, as the talks field has been removed. */ #define GET_TALK(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.talks[i])) +/** The poofin string for the ch. */ #define POOFIN(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofin)) +/** The poofout string for the ch. */ #define POOFOUT(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofout)) +/** The OLC zoon permission for ch. + * @deprecated Currently unused? */ #define GET_OLC_ZONE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.olc_zone)) +/** Currently unused? + * @deprecated Currently unused? */ #define GET_LAST_OLC_TARG(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_targ)) +/** Currently unused? + * @deprecated Currently unused? */ #define GET_LAST_OLC_MODE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_mode)) +/** Retrieve command aliases for ch. */ #define GET_ALIASES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->aliases)) +/** Who ch last spoke to with the 'tell' command. */ #define GET_LAST_TELL(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_tell)) +/** Get unique session id for ch. */ #define GET_PREF(ch) ((ch)->pref) +/** Get host name or ip of ch. */ #define GET_HOST(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->host)) +/** Get channel history i for ch. */ #define GET_HISTORY(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.comm_hist[i])) +/** Return the page length (height) for ch. */ #define GET_PAGE_LENGTH(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.page_length)) +/** Return the page width for ch */ +#define GET_SCREEN_WIDTH(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.screen_width)) +/* Autoquests data */ +/** Return the number of questpoints ch has. */ #define GET_QUESTPOINTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.questpoints)) +/** Return the current quest that a player has assigned */ +#define GET_QUEST(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.current_quest)) +/** Number of goals completed for this quest. */ +#define GET_QUEST_COUNTER(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_counter)) +/** Time remaining to complete the quest ch is currently on. */ +#define GET_QUEST_TIME(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_time)) +/** The number of quests completed by ch. */ +#define GET_NUM_QUESTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.num_completed_quests)) +/** The type of quest ch is currently participating in. */ +#define GET_QUEST_TYPE(ch) (real_quest(GET_QUEST((ch))) != NOTHING ? aquest_table[real_quest(GET_QUEST((ch)))].type : AQ_UNDEFINED ) +/** The current skill level of ch for skill i. */ #define GET_SKILL(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.skills[i])) +/** Copy the current skill level i of ch to pct. */ #define SET_SKILL(ch, i, pct) do { CHECK_PLAYER_SPECIAL((ch), (ch)->player_specials->saved.skills[i]) = pct; } while(0) +/** Get obj worn in position i on ch. */ #define GET_EQ(ch, i) ((ch)->equipment[i]) +/** If ch is a mob, return the special function, else return NULL. */ #define GET_MOB_SPEC(ch) (IS_MOB(ch) ? mob_index[(ch)->nr].func : NULL) +/** Get the real number of the mob instance. */ #define GET_MOB_RNUM(mob) ((mob)->nr) +/** If mob is a mob, return the virtual number of it. */ #define GET_MOB_VNUM(mob) (IS_MOB(mob) ? \ mob_index[GET_MOB_RNUM(mob)].vnum : NOBODY) +/** Return the default position of ch. */ #define GET_DEFAULT_POS(ch) ((ch)->mob_specials.default_pos) +/** Return the memory of ch. */ #define MEMORY(ch) ((ch)->mob_specials.memory) +/** Return the equivalent strength of ch if ch has level 18 strength. */ #define STRENGTH_APPLY_INDEX(ch) \ ( ((GET_ADD(ch) ==0) || (GET_STR(ch) != 18)) ? GET_STR(ch) :\ (GET_ADD(ch) <= 50) ? 26 :( \ @@ -339,26 +552,40 @@ void char_from_furniture(struct char_data *ch); (GET_ADD(ch) <= 99) ? 29 : 30 ) ) ) \ ) +/** Return how much weight ch can carry. */ #define CAN_CARRY_W(ch) (str_app[STRENGTH_APPLY_INDEX(ch)].carry_w) +/** Return how many items ch can carry. */ #define CAN_CARRY_N(ch) (5 + (GET_DEX(ch) >> 1) + (GET_LEVEL(ch) >> 1)) +/** Return whether or not ch is awake. */ #define AWAKE(ch) (GET_POS(ch) > POS_SLEEPING) +/** Defines if ch can see in general in the dark. */ #define CAN_SEE_IN_DARK(ch) \ (AFF_FLAGGED(ch, AFF_INFRAVISION) || (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT))) +/** Defines if ch is good. */ #define IS_GOOD(ch) (GET_ALIGNMENT(ch) >= 350) +/** Defines if ch is evil. */ #define IS_EVIL(ch) (GET_ALIGNMENT(ch) <= -350) +/** Defines if ch is neither good nor evil. */ #define IS_NEUTRAL(ch) (!IS_GOOD(ch) && !IS_EVIL(ch)) -/* These three deprecated. */ +/** Old wait state function. + * @deprecated Use GET_WAIT_STATE */ #define WAIT_STATE(ch, cycle) do { GET_WAIT_STATE(ch) = (cycle); } while(0) +/** Old check wait. + * @deprecated Use GET_WAIT_STATE */ #define CHECK_WAIT(ch) ((ch)->wait > 0) +/** Old mob wait check. + * @deprecated Use GET_WAIT_STATE */ #define GET_MOB_WAIT(ch) GET_WAIT_STATE(ch) -/* New, preferred macro. */ +/** Use this macro to check the wait state of ch. */ #define GET_WAIT_STATE(ch) ((ch)->wait) -/* descriptor-based utils. We should make more. -gg */ +/* Descriptor-based utils. */ +/** Connected state of d. */ #define STATE(d) ((d)->connected) +/** Defines whether d is playing or not. */ #define IS_PLAYING(d) (STATE(d) == CON_TEDIT || STATE(d) == CON_REDIT || \ STATE(d) == CON_MEDIT || STATE(d) == CON_OEDIT || \ STATE(d) == CON_ZEDIT || STATE(d) == CON_SEDIT || \ @@ -366,153 +593,210 @@ void char_from_furniture(struct char_data *ch); STATE(d) == CON_TRIGEDIT || STATE(d) == CON_AEDIT || \ STATE(d) == CON_HEDIT) +/** Defines if it is ok to send a message to ch. */ #define SENDOK(ch) (((ch)->desc || SCRIPT_CHECK((ch), MTRIG_ACT)) && \ (to_sleeping || AWAKE(ch)) && \ !PLR_FLAGGED((ch), PLR_WRITING)) /* object utils */ -/* Check for NOWHERE or the top array index? If using unsigned types, the top +/** Check for NOWHERE or the top array index? If using unsigned types, the top * array index will catch everything. If using signed types, NOTHING will * catch the majority of bad accesses. */ #define VALID_OBJ_RNUM(obj) (GET_OBJ_RNUM(obj) <= top_of_objt && \ GET_OBJ_RNUM(obj) != NOTHING) +/** Level of obj. */ #define GET_OBJ_LEVEL(obj) ((obj)->obj_flags.level) +/** Permanent affects on obj. */ #define GET_OBJ_PERM(obj) ((obj)->obj_flags.bitvector) +/** Type of obj. */ #define GET_OBJ_TYPE(obj) ((obj)->obj_flags.type_flag) +/** Cost of obj. */ #define GET_OBJ_COST(obj) ((obj)->obj_flags.cost) +/** Cost per day to rent obj, if rent is turned on. */ #define GET_OBJ_RENT(obj) ((obj)->obj_flags.cost_per_day) +/** Affect flags on obj. */ #define GET_OBJ_AFFECT(obj) ((obj)->obj_flags.bitvector) +/** Extra flags bit array on obj. */ #define GET_OBJ_EXTRA(obj) ((obj)->obj_flags.extra_flags) +/** Extra flags field bit array field i on obj. */ #define GET_OBJ_EXTRA_AR(obj, i) ((obj)->obj_flags.extra_flags[(i)]) +/** Wear flags on obj. */ #define GET_OBJ_WEAR(obj) ((obj)->obj_flags.wear_flags) +/** Return value val for obj. */ #define GET_OBJ_VAL(obj, val) ((obj)->obj_flags.value[(val)]) +/** Weight of obj. */ #define GET_OBJ_WEIGHT(obj) ((obj)->obj_flags.weight) +/** Current timer of obj. */ #define GET_OBJ_TIMER(obj) ((obj)->obj_flags.timer) +/** Real number of obj instance. */ #define GET_OBJ_RNUM(obj) ((obj)->item_number) +/** Virtual number of obj, or NOTHING if not a real obj. */ #define GET_OBJ_VNUM(obj) (VALID_OBJ_RNUM(obj) ? \ obj_index[GET_OBJ_RNUM(obj)].vnum : NOTHING) +/** Special function attached to obj, or NULL if nothing attached. */ #define GET_OBJ_SPEC(obj) (VALID_OBJ_RNUM(obj) ? \ obj_index[GET_OBJ_RNUM(obj)].func : NULL) +/** Defines if an obj is a corpse. */ #define IS_CORPSE(obj) (GET_OBJ_TYPE(obj) == ITEM_CONTAINER && \ GET_OBJ_VAL((obj), 3) == 1) +/** Can the obj be worn on body part? */ #define CAN_WEAR(obj, part) OBJWEAR_FLAGGED((obj), (part)) +/** Return short description of obj. */ #define GET_OBJ_SHORT(obj) ((obj)->short_description) /* Compound utilities and other macros. */ -/* Used to compute version. To see if the code running is newer than 3.0pl13, - * you would use: #if _CIRCLEMUD > CIRCLEMUD_VERSION(3,0,13) */ +/** Used to compute version. To see if the code running is newer than 3.0pl13, + * you would use: if _CIRCLEMUD > CIRCLEMUD_VERSION(3,0,13) */ #define CIRCLEMUD_VERSION(major, minor, patchlevel) \ (((major) << 16) + ((minor) << 8) + (patchlevel)) +/** Figures out possessive pronoun for ch. */ #define HSHR(ch) (GET_SEX(ch) ? (GET_SEX(ch)==SEX_MALE ? "his":"her") :"its") +/** Figures out third person, singular pronoun for ch. */ #define HSSH(ch) (GET_SEX(ch) ? (GET_SEX(ch)==SEX_MALE ? "he" :"she") : "it") +/** Figures out third person, objective pronoun for ch. */ #define HMHR(ch) (GET_SEX(ch) ? (GET_SEX(ch)==SEX_MALE ? "him":"her") : "it") +/** "An" or "A" for object (uppercased) */ #define ANA(obj) (strchr("aeiouAEIOU", *(obj)->name) ? "An" : "A") +/** "an" or "a" for object (lowercased) */ #define SANA(obj) (strchr("aeiouAEIOU", *(obj)->name) ? "an" : "a") /* Various macros building up to CAN_SEE */ +/** Defines if there is enough light for sub to see in. */ #define LIGHT_OK(sub) (!AFF_FLAGGED(sub, AFF_BLIND) && \ (IS_LIGHT(IN_ROOM(sub)) || AFF_FLAGGED((sub), AFF_INFRAVISION))) +/** Defines if sub character can see the invisible obj character. */ #define INVIS_OK(sub, obj) \ ((!AFF_FLAGGED((obj),AFF_INVISIBLE) || AFF_FLAGGED(sub,AFF_DETECT_INVIS)) && \ (!AFF_FLAGGED((obj), AFF_HIDE) || AFF_FLAGGED(sub, AFF_SENSE_LIFE))) +/** Defines if sub character can see obj character, assuming mortal only + * settings. */ #define MORT_CAN_SEE(sub, obj) (LIGHT_OK(sub) && INVIS_OK(sub, obj)) +/** Defines if sub character can see obj character, assuming immortal + * and mortal settings. */ #define IMM_CAN_SEE(sub, obj) \ (MORT_CAN_SEE(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED(sub, PRF_HOLYLIGHT))) +/** Is obj character the same as sub character? */ #define SELF(sub, obj) ((sub) == (obj)) -/* Can subject see character "obj"? */ +/** Can sub character see obj character? */ #define CAN_SEE(sub, obj) (SELF(sub, obj) || \ ((GET_REAL_LEVEL(sub) >= (IS_NPC(obj) ? 0 : GET_INVIS_LEV(obj))) && \ IMM_CAN_SEE(sub, obj))) /* End of CAN_SEE */ +/** Can the sub character see the obj if it is invisible? */ #define INVIS_OK_OBJ(sub, obj) \ (!OBJ_FLAGGED((obj), ITEM_INVISIBLE) || AFF_FLAGGED((sub), AFF_DETECT_INVIS)) -/* Is anyone carrying this object and if so, are they visible? */ +/** Is anyone carrying this object and if so, are they visible? */ #define CAN_SEE_OBJ_CARRIER(sub, obj) \ ((!obj->carried_by || CAN_SEE(sub, obj->carried_by)) && \ (!obj->worn_by || CAN_SEE(sub, obj->worn_by))) +/** Can sub character see the obj, using mortal only checks? */ #define MORT_CAN_SEE_OBJ(sub, obj) \ (LIGHT_OK(sub) && INVIS_OK_OBJ(sub, obj) && CAN_SEE_OBJ_CARRIER(sub, obj)) +/** Can sub character see the obj, using mortal and immortal checks? */ #define CAN_SEE_OBJ(sub, obj) \ (MORT_CAN_SEE_OBJ(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED((sub), PRF_HOLYLIGHT))) +/** Can ch carry obj? */ #define CAN_CARRY_OBJ(ch,obj) \ (((IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj)) <= CAN_CARRY_W(ch)) && \ ((IS_CARRYING_N(ch) + 1) <= CAN_CARRY_N(ch))) +/** Can ch pick up obj? */ #define CAN_GET_OBJ(ch, obj) \ (CAN_WEAR((obj), ITEM_WEAR_TAKE) && CAN_CARRY_OBJ((ch),(obj)) && \ CAN_SEE_OBJ((ch),(obj))) +/** If vict can see ch, return ch name, else return "someone". */ #define PERS(ch, vict) (CAN_SEE(vict, ch) ? GET_NAME(ch) : "someone") +/** If vict can see obj, return obj short description, else return + * "something". */ #define OBJS(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? \ (obj)->short_description : "something") +/** If vict can see obj, return obj name, else return "something". */ #define OBJN(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? \ fname((obj)->name) : "something") +/** Does direction door exist in the same room as ch? */ #define EXIT(ch, door) (world[IN_ROOM(ch)].dir_option[door]) +/** Does room number have direction num? */ #define W_EXIT(room, num) (world[(room)].dir_option[(num)]) +/** Does room pointer have direction option num? */ #define R_EXIT(room, num) ((room)->dir_option[(num)]) +/** Can ch walk through direction door. */ #define CAN_GO(ch, door) (EXIT(ch,door) && \ (EXIT(ch,door)->to_room != NOWHERE) && \ !IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)) +/** Return the class abbreviation for ch. */ #define CLASS_ABBR(ch) (IS_NPC(ch) ? "--" : class_abbrevs[(int)GET_CLASS(ch)]) +/** 1 if ch is magic user class, 0 if not. */ #define IS_MAGIC_USER(ch) (!IS_NPC(ch) && \ - (GET_CLASS(ch) == CLASS_MAGIC_USER)) + (GET_CLASS(ch) == CLASS_MAGIC_USER)) +/** 1 if ch is cleric class, 0 if not. */ #define IS_CLERIC(ch) (!IS_NPC(ch) && \ - (GET_CLASS(ch) == CLASS_CLERIC)) + (GET_CLASS(ch) == CLASS_CLERIC)) +/** 1 if ch is thief class, 0 if not. */ #define IS_THIEF(ch) (!IS_NPC(ch) && \ - (GET_CLASS(ch) == CLASS_THIEF)) + (GET_CLASS(ch) == CLASS_THIEF)) +/** 1 if ch is warrior class, 0 if not. */ #define IS_WARRIOR(ch) (!IS_NPC(ch) && \ - (GET_CLASS(ch) == CLASS_WARRIOR)) + (GET_CLASS(ch) == CLASS_WARRIOR)) +/** Defines if ch is outdoors or not. */ #define OUTSIDE(ch) (!ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS)) /* OS compatibility */ -/* there could be some strange OS which doesn't have NULL... */ #ifndef NULL +/** Just in case NULL is not defined. */ #define NULL (void *)0 #endif #if !defined(FALSE) +/** Just in case FALSE is not defined. */ #define FALSE 0 #endif #if !defined(TRUE) +/** Just in case TRUE is not defined. */ #define TRUE (!FALSE) #endif #if !defined(YES) +/** In case YES is not defined. */ #define YES 1 #endif #if !defined(NO) +/** In case NO is not defined. */ #define NO 0 #endif /* defines for fseek */ #ifndef SEEK_SET +/** define for fseek */ #define SEEK_SET 0 +/** define for fseek */ #define SEEK_CUR 1 +/** define for fseek */ #define SEEK_END 2 #endif @@ -520,69 +804,129 @@ void char_from_furniture(struct char_data *ch); * is a variable that the 'configure' script automatically sets when it * determines whether or not the system is capable of encrypting. */ #if defined(NOCRYPT) || !defined(CIRCLE_CRYPT) +/** When crypt is not defined. (NOTE: Player passwords will be plain text.) */ #define CRYPT(a,b) (a) #else +/** When crypt is defined. Player passwords stored encrypted. */ #define CRYPT(a,b) ((char *) crypt((a),(b))) #endif /* Config macros */ -#define CONFIG_CONFFILE config_info.CONFFILE +/** Pointer to the config file. */ +#define CONFIG_CONFFILE config_info.CONFFILE + +/** Player killing allowed or not? */ #define CONFIG_PK_ALLOWED config_info.play.pk_allowed +/** Player thieving allowed or not? */ #define CONFIG_PT_ALLOWED config_info.play.pt_allowed +/** What level to use the shout command? */ #define CONFIG_LEVEL_CAN_SHOUT config_info.play.level_can_shout +/** How many move points does holler cost? */ #define CONFIG_HOLLER_MOVE_COST config_info.play.holler_move_cost +/** How many characters can fit in a room marked as tunnel? */ #define CONFIG_TUNNEL_SIZE config_info.play.tunnel_size +/** What is the max experience that can be gained at once? */ #define CONFIG_MAX_EXP_GAIN config_info.play.max_exp_gain +/** What is the max experience that can be lost at once? */ #define CONFIG_MAX_EXP_LOSS config_info.play.max_exp_loss +/** How long will npc corpses last before decomposing? */ #define CONFIG_MAX_NPC_CORPSE_TIME config_info.play.max_npc_corpse_time -#define CONFIG_MAX_PC_CORPSE_TIME config_info.play.max_pc_corpse_time +/** How long will pc corpses last before decomposing? */ +#define CONFIG_MAX_PC_CORPSE_TIME config_info.play.max_pc_corpse_time +/** How long can a pc be idled before being pulled into the void? */ #define CONFIG_IDLE_VOID config_info.play.idle_void +/** How long until the idle pc is force rented? */ #define CONFIG_IDLE_RENT_TIME config_info.play.idle_rent_time +/** What level and above is immune to idle outs? */ #define CONFIG_IDLE_MAX_LEVEL config_info.play.idle_max_level +/** Are death traps dumps? */ #define CONFIG_DTS_ARE_DUMPS config_info.play.dts_are_dumps +/** Should items crated with the load command be placed on ground or + * in the creator's inventory? */ #define CONFIG_LOAD_INVENTORY config_info.play.load_into_inventory +/** Get the track through doors setting. */ #define CONFIG_TRACK_T_DOORS config_info.play.track_through_doors +/** Get the permission to level up from mortal to immortal. */ #define CONFIG_NO_MORT_TO_IMMORT config_info.play.no_mort_to_immort +/** Get the 'OK' message. */ #define CONFIG_OK config_info.play.OK +/** Get the NOPERSON message. */ #define CONFIG_NOPERSON config_info.play.NOPERSON +/** Get the NOEFFECT message. */ #define CONFIG_NOEFFECT config_info.play.NOEFFECT +/** Get the display closed doors setting. */ #define CONFIG_DISP_CLOSED_DOORS config_info.play.disp_closed_doors +/* Map/Automap options */ +#define CONFIG_MAP config_info.play.map_option +#define CONFIG_MAP_SIZE config_info.play.map_size +#define CONFIG_MINIMAP_SIZE config_info.play.minimap_size + /* Crash Saves */ +/** Get free rent setting. */ #define CONFIG_FREE_RENT config_info.csd.free_rent +/** Get max number of objects to save. */ #define CONFIG_MAX_OBJ_SAVE config_info.csd.max_obj_save +/** Get minimum cost to rent. */ #define CONFIG_MIN_RENT_COST config_info.csd.min_rent_cost +/** Get the auto save setting. */ #define CONFIG_AUTO_SAVE config_info.csd.auto_save +/** Get the auto save frequency. */ #define CONFIG_AUTOSAVE_TIME config_info.csd.autosave_time +/** Get the length of time to hold crash files. */ #define CONFIG_CRASH_TIMEOUT config_info.csd.crash_file_timeout +/** Get legnth of time to hold rent files. */ #define CONFIG_RENT_TIMEOUT config_info.csd.rent_file_timeout /* Room Numbers */ +/** Get the mortal start room. */ #define CONFIG_MORTAL_START config_info.room_nums.mortal_start_room +/** Get the immortal start room. */ #define CONFIG_IMMORTAL_START config_info.room_nums.immort_start_room +/** Get the frozen character start room. */ #define CONFIG_FROZEN_START config_info.room_nums.frozen_start_room +/** Get the 1st donation room. */ #define CONFIG_DON_ROOM_1 config_info.room_nums.donation_room_1 +/** Get the second donation room. */ #define CONFIG_DON_ROOM_2 config_info.room_nums.donation_room_2 +/** Ge the third dontation room. */ #define CONFIG_DON_ROOM_3 config_info.room_nums.donation_room_3 /* Game Operation */ +/** Get the default mud connection port. */ #define CONFIG_DFLT_PORT config_info.operation.DFLT_PORT +/** Get the default mud ip address. */ #define CONFIG_DFLT_IP config_info.operation.DFLT_IP +/** Get the max number of players allowed. */ #define CONFIG_MAX_PLAYING config_info.operation.max_playing +/** Get the max filesize allowed. */ #define CONFIG_MAX_FILESIZE config_info.operation.max_filesize +/** Get the max bad password attempts. */ #define CONFIG_MAX_BAD_PWS config_info.operation.max_bad_pws +/** Get the siteok setting. */ #define CONFIG_SITEOK_ALL config_info.operation.siteok_everyone +/** Get the auto-save-to-disk settings for OLC. */ #define CONFIG_OLC_SAVE config_info.operation.auto_save_olc +/** Get the ability to use aedit or not. */ #define CONFIG_NEW_SOCIALS config_info.operation.use_new_socials +/** Get the setting to resolve IPs or not. */ #define CONFIG_NS_IS_SLOW config_info.operation.nameserver_is_slow +/** Default data directory. */ #define CONFIG_DFLT_DIR config_info.operation.DFLT_DIR +/** Where is the default log file? */ #define CONFIG_LOGNAME config_info.operation.LOGNAME +/** Get the text displayed in the opening menu. */ #define CONFIG_MENU config_info.operation.MENU +/** Get the standard welcome message. */ #define CONFIG_WELC_MESSG config_info.operation.WELC_MESSG +/** Get the standard new character message. */ #define CONFIG_START_MESSG config_info.operation.START_MESSG /* Autowiz */ +/** Use autowiz or not? */ #define CONFIG_USE_AUTOWIZ config_info.autowiz.use_autowiz +/** What is the minimum level character to put on the wizlist? */ #define CONFIG_MIN_WIZLIST_LEV config_info.autowiz.min_wizlist_lev +#endif /* _UTILS_H_ */ diff --git a/src/weather.c b/src/weather.c index 50be4c9..1d2db3e 100644 --- a/src/weather.c +++ b/src/weather.c @@ -1,28 +1,32 @@ -/************************************************************************** -* File: weather.c Part of tbaMUD * -* Usage: Functions handling time and the weather. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -************************************************************************ */ +/** +* @file weather.c +* Functions that handle the in game progress of time and weather changes. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +*/ #include "conf.h" #include "sysdep.h" #include "structs.h" #include "utils.h" #include "comm.h" -#include "handler.h" -#include "interpreter.h" #include "db.h" -extern struct time_info_data time_info; - -void weather_and_time(int mode); -void another_hour(int mode); -void weather_change(void); +static void another_hour(int mode); +static void weather_change(void); +/** Call this function every mud hour to increment the gametime (by one hour) + * and the weather patterns. + * @param mode Really, this parameter has the effect of a boolean. In the + * current incarnation of the function and utility functions, as long as mode + * is non-zero, the gametime will increment one hour and the weather will be + * changed. + */ void weather_and_time(int mode) { another_hour(mode); @@ -30,7 +34,12 @@ void weather_and_time(int mode) weather_change(); } -void another_hour(int mode) +/** Increment the game time by one hour (no matter what) and display any time + * dependent messages via send_to_outdoors() (if parameter is non-zero). + * @param mode Really, this parameter has the effect of a boolean. If non-zero, + * display day/night messages to all eligible players. + */ +static void another_hour(int mode) { time_info.hours++; @@ -72,9 +81,15 @@ void another_hour(int mode) } } -void weather_change(void) +/** Controls the in game weather system. If the weather changes, an information + * update is sent via send_to_outdoors(). + * @todo There are some hard coded values that could be extracted to make + * customizing the weather patterns easier. + */ +static void weather_change(void) { int diff, change; + if ((time_info.month >= 9) && (time_info.month <= 16)) diff = (weather_info.pressure > 985 ? -2 : 2); else diff --git a/src/zedit.c b/src/zedit.c index e515df9..3ef0b14 100644 --- a/src/zedit.c +++ b/src/zedit.c @@ -8,9 +8,9 @@ #include "conf.h" #include "sysdep.h" #include "structs.h" +#include "utils.h" #include "comm.h" #include "interpreter.h" -#include "utils.h" #include "db.h" #include "constants.h" #include "genolc.h" @@ -24,16 +24,16 @@ #define MAX_DUPLICATES 100 /* local functions */ -int start_change_command(struct descriptor_data *d, int pos); -void zedit_setup(struct descriptor_data *d, int room_num); -void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, room_vnum top); -void zedit_save_internally(struct descriptor_data *d); -void zedit_save_to_disk(int zone_num); -void zedit_disp_menu(struct descriptor_data *d); -void zedit_disp_comtype(struct descriptor_data *d); -void zedit_disp_arg1(struct descriptor_data *d); -void zedit_disp_arg2(struct descriptor_data *d); -void zedit_disp_arg3(struct descriptor_data *d); +static int start_change_command(struct descriptor_data *d, int pos); +static void zedit_setup(struct descriptor_data *d, int room_num); +static void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, room_vnum top); +static void zedit_save_internally(struct descriptor_data *d); +static void zedit_save_to_disk(int zone_num); +static void zedit_disp_menu(struct descriptor_data *d); +static void zedit_disp_comtype(struct descriptor_data *d); +static void zedit_disp_arg1(struct descriptor_data *d); +static void zedit_disp_arg2(struct descriptor_data *d); +static void zedit_disp_arg3(struct descriptor_data *d); ACMD(do_oasis_zedit) { @@ -58,7 +58,7 @@ ACMD(do_oasis_zedit) save = TRUE; if (is_number(buf2)) - number = atoi(buf2); + number = atoidx(buf2); else if (GET_OLC_ZONE(ch) > 0) { zone_rnum zlok; @@ -83,11 +83,11 @@ ACMD(do_oasis_zedit) skip_spaces(&buf3); two_arguments(buf3, sbot, stop); - number = atoi(buf2); + number = atoidx(buf2); if (number < 0) number = NOWHERE; - bottom = atoi(sbot); - top = atoi(stop); + bottom = atoidx(sbot); + top = atoidx(stop); /* Setup the new zone (displays the menu to the builder). */ zedit_new_zone(ch, number, bottom, top); @@ -104,7 +104,7 @@ ACMD(do_oasis_zedit) /* If a numeric argumentwas given, retrieve it. */ if (number == NOWHERE) - number = atoi(buf1); + number = atoidx(buf1); /* Check that nobody is currently editing this zone. */ for (d = descriptor_list; d; d = d->next) { @@ -187,7 +187,7 @@ ACMD(do_oasis_zedit) GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); } -void zedit_setup(struct descriptor_data *d, int room_num) +static void zedit_setup(struct descriptor_data *d, int room_num) { struct zone_data *zone; int subcmd = 0, count = 0, cmd_room = NOWHERE; @@ -242,7 +242,7 @@ void zedit_setup(struct descriptor_data *d, int room_num) } /* Create a new zone. */ -void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, room_vnum top) +static void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, room_vnum top) { int result; const char *error; @@ -263,6 +263,7 @@ void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, case CON_SEDIT: case CON_OEDIT: case CON_TRIGEDIT: + case CON_QEDIT: OLC_ZNUM(dsc) += (OLC_ZNUM(dsc) >= result); break; default: @@ -278,7 +279,7 @@ void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, /* Save all the information in the player's temporary buffer back into * the current zone table. */ -void zedit_save_internally(struct descriptor_data *d) +static void zedit_save_internally(struct descriptor_data *d) { int mobloaded = FALSE, objloaded = FALSE, @@ -343,13 +344,13 @@ void zedit_save_internally(struct descriptor_data *d) add_to_save_list(zone_table[OLC_ZNUM(d)].number, SL_ZON); } -void zedit_save_to_disk(int zone) +static void zedit_save_to_disk(int zone) { save_zone(zone); } /* Error check user input and then setup change */ -int start_change_command(struct descriptor_data *d, int pos) +static int start_change_command(struct descriptor_data *d, int pos) { if (pos < 0 || pos >= count_commands(OLC_ZONE(d)->cmd)) return 0; @@ -361,7 +362,7 @@ int start_change_command(struct descriptor_data *d, int pos) /* Menu functions */ /* the main menu */ -void zedit_disp_menu(struct descriptor_data *d) +static void zedit_disp_menu(struct descriptor_data *d) { int subcmd = 0, room, counter = 0; @@ -493,7 +494,7 @@ void zedit_disp_menu(struct descriptor_data *d) } /* Print the command type menu and setup response catch. */ -void zedit_disp_comtype(struct descriptor_data *d) +static void zedit_disp_comtype(struct descriptor_data *d) { get_char_colors(d->character); clear_screen(d); @@ -514,7 +515,7 @@ void zedit_disp_comtype(struct descriptor_data *d) /* Print the appropriate message for the command type for arg1 and set up the input catch clause */ -void zedit_disp_arg1(struct descriptor_data *d) +static void zedit_disp_arg1(struct descriptor_data *d) { write_to_output(d, "\r\n"); @@ -552,7 +553,7 @@ void zedit_disp_arg1(struct descriptor_data *d) /* Print the appropriate message for the command type for arg2 and set up the input catch clause. */ -void zedit_disp_arg2(struct descriptor_data *d) +static void zedit_disp_arg2(struct descriptor_data *d) { int i; @@ -593,7 +594,7 @@ void zedit_disp_arg2(struct descriptor_data *d) /* Print the appropriate message for the command type for arg3 and set up the input catch clause. */ -void zedit_disp_arg3(struct descriptor_data *d) +static void zedit_disp_arg3(struct descriptor_data *d) { int i = 0; diff --git a/src/zmalloc.h b/src/zmalloc.h index ce4969a..37860a7 100644 --- a/src/zmalloc.h +++ b/src/zmalloc.h @@ -1,12 +1,17 @@ -/************************************************************************** -* File: zmalloc.h Part of tbaMUD * -* Usage: A simple memory allocation monitor, header. * -* * -* Version 1.1 Copyright 1996, 1998, 1999, 2000 Eric Murray ericm@lne.com * -**************************************************************************/ +/** +* @file zmalloc.h +* A simple memory allocation monitor, header. +* +* Part of the core tbaMUD source code distribution, which is a derivative +* of, and continuation of, CircleMUD. +* +* This code was not part of the original CircleMUD distribution. It has been +* included in tbaMUD and is attributed to: +* Version 1.1 Copyright 1996, 1998, 1999, 2000 Eric Murray ericm@lne.com +*/ -#ifndef ZMALLOC_H -#define ZMALLOC_H +#ifndef _ZMALLOC_H_ +#define _ZMALLOC_H_ unsigned char *zmalloc(int, char *, int); unsigned char *zrealloc(unsigned char *, int, char *, int); @@ -22,4 +27,4 @@ char *zstrdup(const char *, char *, int); #undef strdup #define strdup(x) zstrdup((x), __FILE__, __LINE__) -#endif /* ZMALLOC_H */ +#endif /* _ZMALLOC_H_ */