003-005.diff.bz2
patches · 9.7 KB · 2010-03-30
Download « Back to the patches list
diff -buraP 003/HACKLOG 005/HACKLOG
--- 003/HACKLOG 1969-12-31 19:00:00.000000000 -0500
+++ 005/HACKLOG 2008-10-08 12:32:02.000000000 -0400
@@ -0,0 +1,177 @@
+081004 Quixadhal
+ 2031 Started this HACKLOG file!
+
+ Removed the multiple Makefiles and merged their diffrences into
+ a single Makefile. The user can simply comment and uncomment
+ the correct lines for their platform.
+
+ Removed the "make" rule from "make clean", since many times
+ we just want to get rid of the object files and not rebuild.
+
+ Replaced the old .c.o suffix rule with a modern one, and
+ removed the generic "merc.h" prerequisite. Instead, I've
+ had gcc generate dependancy information and appended that
+ to the Makefile. This could be automated, but for simplicity
+ I won't do so.
+ 2107 Changed the function name weapon_type() to be weapon_type_lookup().
+
+ merc.h:2194: warning: 'int weapon_type(const char*)' hides
+ constructor for 'struct weapon_type'
+
+ Fixed a variable scope issue in act_obj.c.
+
+ act_obj.c: In function 'void do_buy(CHAR_DATA*, char*)':
+ act_obj.c:2518: warning: declaration of 'buf' shadows a previous local
+ act_obj.c:2506: warning: shadowed declaration is here
+
+ Same thing here.
+
+ act_wiz.c: In function 'void do_mset(CHAR_DATA*, char*)':
+ act_wiz.c:3466: warning: declaration of 'buf' shadows a previous local
+ act_wiz.c:3329: warning: shadowed declaration is here
+
+ This is a local re-declarations of a global variable.
+
+ comm.c: In function 'void bust_a_prompt(CHAR_DATA*)':
+ comm.c:1328: warning: declaration of 'dir_name' shadows a global declaration
+ merc.h:1904: warning: shadowed declaration is here
+
+ In this case, I think the correct answer is to move the local
+ declaration up to act_move.c, and rename it to be dir_abbrev[],
+ since it really needs to always stay in sync with dir_name[].
+
+ And this is just another shadowed global.
+
+ comm.c: In function 'void nanny(DESCRIPTOR_DATA*, char*)':
+ comm.c:1546: warning: declaration of 'd_next' shadows a global declaration
+ comm.c:301: warning: shadowed declaration is here
+
+ Let's try commenting out the global and see if it's really used
+ anywhere. Hmmmm, mostly just as a local loop variable, only one
+ place seems to want it global, and that doesn't appear to have any
+ effect.
+
+ /* if ( d_next == dclose )
+ d_next = d_next->next; */
+
+ That keeps d_next set, but it isn't ever used anywhere else.
+
+ 2133 Another shadow...
+
+ db.c: In function 'void load_old_obj(FILE*)':
+ db.c:655: warning: declaration of 'letter' shadows a previous local
+ db.c:595: warning: shadowed declaration is here
+
+ A quick change to is_name() to make it also const char *, and this
+ is fine.
+
+ db.c: In function 'char* get_extra_descr(const char*, EXTRA_DESCR_DATA*)':
+ db.c:2055: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ This one is a bit ugly. str_dup() accepts a const char *, but
+ returns a char *. Normally, not a big deal, but because of the
+ shared string space, it wants to return the source pointer sometimes.
+ THAT now has to be declared without the const, because we won't know
+ ahead of time if it IS const or not.
+
+ db.c: In function 'char* str_dup(const char*)':
+ db.c:2693: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ Another local shadow...
+
+ db2.c: In function 'void load_objects(FILE*)':
+ db2.c:458: warning: declaration of 'letter' shadows a previous local
+ db2.c:354: warning: shadowed declaration is here
+
+ 2159 Meeeeee, and my shaaaaadow!
+
+ You'd think -Wshadow would be part of -Wall by now.... *sigh*
+
+ fight.c: In function 'void one_hit(CHAR_DATA*, CHAR_DATA*, int)':
+ fight.c:587: warning: declaration of 'dam' shadows a previous local
+ fight.c:392: warning: shadowed declaration is here
+
+ fight.c: In function 'void check_killer(CHAR_DATA*, CHAR_DATA*)':
+ fight.c:1218: warning: declaration of 'buf' shadows a previous local
+ fight.c:1194: warning: shadowed declaration is here
+
+ Wheeeee! handler.c is unhappy!
+
+ handler.c: In function 'bool is_name(const char*, char*)':
+ handler.c:822: error: invalid conversion from 'const char*' to 'char*'
+ handler.c:826: error: invalid conversion from 'const char*' to 'char*'
+ handler.c:826: error: initializing argument 1 of 'char* one_argument(char*, char*)'
+ cc1plus: warnings being treated as errors
+
+ handler.c: In function 'char* affect_bit_name(int)':
+ handler.c:2614: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ handler.c: In function 'char* extra_bit_name(int)':
+ handler.c:2622: warning: declaration of 'extra_flags' shadows a global declaration
+ tables.h:74: warning: shadowed declaration is here
+ handler.c:2648: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ handler.c: In function 'char* act_bit_name(int)':
+ handler.c:2652: warning: declaration of 'act_flags' shadows a global declaration
+ tables.h:66: warning: shadowed declaration is here
+ handler.c:2698: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ handler.c: In function 'char* comm_bit_name(int)':
+ handler.c:2701: warning: declaration of 'comm_flags' shadows a global declaration
+ tables.h:73: warning: shadowed declaration is here
+ handler.c:2725: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ handler.c: In function 'char* imm_bit_name(int)':
+ handler.c:2728: warning: declaration of 'imm_flags' shadows a global declaration
+ tables.h:70: warning: shadowed declaration is here
+ handler.c:2757: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ handler.c: In function 'char* wear_bit_name(int)':
+ handler.c:2760: warning: declaration of 'wear_flags' shadows a global declaration
+ tables.h:75: warning: shadowed declaration is here
+ handler.c:2783: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ handler.c: In function 'char* form_bit_name(int)':
+ handler.c:2786: warning: declaration of 'form_flags' shadows a global declaration
+ tables.h:71: warning: shadowed declaration is here
+ handler.c:2818: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ handler.c: In function 'char* part_bit_name(int)':
+ handler.c:2821: warning: declaration of 'part_flags' shadows a global declaration
+ tables.h:72: warning: shadowed declaration is here
+ handler.c:2848: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ handler.c: In function 'char* weapon_bit_name(int)':
+ handler.c:2851: warning: declaration of 'weapon_flags' shadows a global declaration
+ tables.h:76: warning: shadowed declaration is here
+ handler.c:2865: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ handler.c: In function 'char* cont_bit_name(int)':
+ handler.c:2879: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ handler.c: In function 'char* off_bit_name(int)':
+ handler.c:2883: warning: declaration of 'off_flags' shadows a global declaration
+ tables.h:69: warning: shadowed declaration is here
+ handler.c:2911: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ These were all fixed by redoing the return values so it always
+ returns the buffer, but copies "none" into it where there were no
+ flags. Also, renamed all the local variables to "vector", since it
+ made sense and eliminated the conflicts.
+
+ 2312 Undid the change to is_name(), and also removed the const modifier
+ from get_extra_descr(). Adding proper const flags will need some
+ more carful work.
+
+ save.c: In function 'void fread_char(CHAR_DATA*, FILE*)':
+ save.c:743: warning: cast from type 'const char*' to type 'char*' casts away constness
+ save.c: In function 'void fread_pet(CHAR_DATA*, FILE*)':
+ save.c:1140: warning: cast from type 'const char*' to type 'char*' casts away constness
+ save.c:1162: warning: cast from type 'const char*' to type 'char*' casts away constness
+ save.c: In function 'void fread_obj(CHAR_DATA*, FILE*)':
+ save.c:1364: warning: cast from type 'const char*' to type 'char*' casts away constness
+ save.c:1400: warning: cast from type 'const char*' to type 'char*' casts away constness
+
+ Fixed those by adding a static char buffer which is set to
+ "End" or "END" and returned instead of a constant string.
+
diff -buraP 003/src/Makefile 005/src/Makefile
--- 003/src/Makefile 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/Makefile 2008-10-08 12:32:02.000000000 -0400
@@ -1,22 +1,71 @@
CC = g++
-PROF = -O -g
-NOCRYPT =
-C_FLAGS = -Wall $(PROF) $(NOCRYPT)
-L_FLAGS = $(PROF)
+
+W_FORMAT = -Wformat -Wformat-security -Wmissing-format-attribute
+W_NITPICK = -Wpointer-arith -Winline
+W_MESSY = -Wmissing-braces -Wparentheses -Wshadow #-Wredundant-decls
+W_TYPE = -Wcast-qual -Wcast-align -Wchar-subscripts -Wreturn-type -Wswitch #-Wwrite-strings
+W_EXTRA = -Wunused #-Wunreachable-code
+W_ANSI = #-pedantic
+W_UBER = -Wall #-W
+W_ERROR = -Werror
+
+WARN = $(W_ANSI) $(W_UBER) $(W_FORMAT) $(W_MESSY) $(W_FUNC) $(W_TYPE) $(W_EXTRA) $(W_NITPICK) $(W_ERROR)
+OPT = -O
+DEBUG = -g
+
+C_FLAGS = $(WARN) $(OPT) $(DEBUG)
+L_FLAGS = $(DEBUG)
+SOLARIS_LIBS = -lsocket -lresolv -lnsl
+LINUX_LIBS = -lcrypt
+
+LIBS = $(LINUX_LIBS)
O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \
alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \
handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \
music.o recycle.o save.o scan.o skills.o special.o tables.o \
- update.o -lcrypt
+ update.o
rom: $(O_FILES)
rm -f rom
- $(CC) $(L_FLAGS) -o rom $(O_FILES)
+ $(CC) $(L_FLAGS) -o rom $(O_FILES) $(LIBS)
-.c.o: merc.h
- $(CC) -c $(C_FLAGS) $<
+%o : %c
+ $(CC) $(C_FLAGS) -c $< -o $@
clean:
@rm -f *.o
- make
+
+# find . -name \*.c -a -type f -print0 | xargs -0 -P 1 -r g++ -O -g -MM
+
+act_enter.o: act_enter.c merc.h interp.h
+effects.o: effects.c merc.h recycle.h
+act_obj.o: act_obj.c merc.h interp.h
+scan.o: scan.c merc.h
+note.o: note.c merc.h recycle.h tables.h
+update.o: update.c merc.h interp.h music.h
+alias.o: alias.c merc.h
+music.o: music.c merc.h music.h recycle.h
+db2.o: db2.c merc.h db.h lookup.h
+db.o: db.c merc.h db.h recycle.h music.h lookup.h
+recycle.o: recycle.c merc.h recycle.h
+magic.o: magic.c merc.h interp.h magic.h recycle.h
+act_comm.o: act_comm.c merc.h interp.h recycle.h tables.h
+tables.o: tables.c merc.h tables.h
+lookup.o: lookup.c merc.h tables.h
+magic2.o: magic2.c merc.h interp.h magic.h
+act_move.o: act_move.c merc.h interp.h
+save.o: save.c merc.h recycle.h lookup.h tables.h
+interp.o: interp.c merc.h interp.h
+special.o: special.c merc.h interp.h magic.h
+skills.o: skills.c merc.h interp.h magic.h recycle.h
+fight.o: fight.c merc.h interp.h
+comm.o: comm.c merc.h interp.h recycle.h tables.h telnet.h
+healer.o: healer.c merc.h magic.h
+const.o: const.c merc.h magic.h interp.h
+flags.o: flags.c merc.h tables.h
+act_wiz.o: act_wiz.c merc.h interp.h recycle.h tables.h lookup.h
+act_info.o: act_info.c merc.h interp.h magic.h recycle.h tables.h \
+ lookup.h
+ban.o: ban.c merc.h recycle.h
+handler.o: handler.c merc.h interp.h magic.h recycle.h tables.h
Only in 003/src: Makefile.linux
Only in 003/src: Makefile.normal
Only in 003/src: Makefile.solaris
diff -buraP 003/src/act_move.c 005/src/act_move.c
--- 003/src/act_move.c 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/act_move.c 2008-10-08 12:32:02.000000000 -0400
@@ -41,6 +41,7 @@
{
"north", "east", "south", "west", "up", "down"
};
+char * const dir_abbrev[] = {"N","E","S","W","U","D"};
const sh_int rev_dir [] =
{
diff -buraP 003/src/act_obj.c 005/src/act_obj.c
--- 003/src/act_obj.c 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/act_obj.c 2008-10-08 12:32:02.000000000 -0400
@@ -2503,6 +2503,7 @@
void do_buy( CHAR_DATA *ch, char *argument )
{
+ char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int cost,roll;
@@ -2514,8 +2515,6 @@
if ( IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP) )
{
- char arg[MAX_INPUT_LENGTH];
- char buf[MAX_STRING_LENGTH];
CHAR_DATA *pet;
ROOM_INDEX_DATA *pRoomIndexNext;
ROOM_INDEX_DATA *in_room;
@@ -2613,7 +2612,6 @@
{
CHAR_DATA *keeper;
OBJ_DATA *obj,*t_obj;
- char arg[MAX_INPUT_LENGTH];
int number, count = 1;
if ( ( keeper = find_keeper( ch ) ) == NULL )
diff -buraP 003/src/act_wiz.c 005/src/act_wiz.c
--- 003/src/act_wiz.c 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/act_wiz.c 2008-10-08 12:32:02.000000000 -0400
@@ -3326,7 +3326,7 @@
char arg1 [MAX_INPUT_LENGTH];
char arg2 [MAX_INPUT_LENGTH];
char arg3 [MAX_INPUT_LENGTH];
- char buf[100];
+ char buf [MAX_STRING_LENGTH];
CHAR_DATA *victim;
int value;
@@ -3463,8 +3463,6 @@
iclass = class_lookup(arg3);
if ( iclass == -1 )
{
- char buf[MAX_STRING_LENGTH];
-
strcpy( buf, "Possible classes are: " );
for ( iclass = 0; iclass < MAX_CLASS; iclass++ )
{
diff -buraP 003/src/comm.c 005/src/comm.c
--- 003/src/comm.c 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/comm.c 2008-10-08 12:32:02.000000000 -0400
@@ -298,7 +298,7 @@
* Global variables.
*/
DESCRIPTOR_DATA * descriptor_list; /* All open descriptors */
-DESCRIPTOR_DATA * d_next; /* Next descriptor in loop */
+/* DESCRIPTOR_DATA * d_next; *//* Next descriptor in loop */
FILE * fpReserve; /* Reserved file handle */
bool god; /* All new chars are gods! */
bool merc_down; /* Shutdown */
@@ -502,6 +502,7 @@
struct timeval last_time;
struct timeval now_time;
static DESCRIPTOR_DATA dcon;
+ DESCRIPTOR_DATA * d_next;
gettimeofday( &last_time, NULL );
current_time = (time_t) last_time.tv_sec;
@@ -661,6 +662,7 @@
{
static struct timeval null_time;
struct timeval last_time;
+ DESCRIPTOR_DATA * d_next;
signal( SIGPIPE, SIG_IGN );
gettimeofday( &last_time, NULL );
@@ -1001,8 +1003,8 @@
}
}
- if ( d_next == dclose )
- d_next = d_next->next;
+ /* if ( d_next == dclose )
+ d_next = d_next->next; */
if ( dclose == descriptor_list )
{
@@ -1325,7 +1327,6 @@
char doors[MAX_INPUT_LENGTH];
EXIT_DATA *pexit;
bool found;
- const char *dir_name[] = {"N","E","S","W","U","D"};
int door;
point = buf;
@@ -1369,7 +1370,7 @@
&& !IS_SET(pexit->exit_info,EX_CLOSED))
{
found = TRUE;
- strcat(doors,dir_name[door]);
+ strcat(doors,dir_abbrev[door]);
}
}
if (!found)
diff -buraP 003/src/db.c 005/src/db.c
--- 003/src/db.c 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/db.c 2008-10-08 12:32:02.000000000 -0400
@@ -652,11 +652,11 @@
for ( ; ; )
{
- char letter;
+ char another_letter;
- letter = fread_letter( fp );
+ another_letter = fread_letter( fp );
- if ( letter == 'A' )
+ if ( another_letter == 'A' )
{
AFFECT_DATA *paf;
@@ -673,7 +673,7 @@
top_affect++;
}
- else if ( letter == 'E' )
+ else if ( another_letter == 'E' )
{
EXTRA_DESCR_DATA *ed;
@@ -687,7 +687,7 @@
else
{
- ungetc( letter, fp );
+ ungetc( another_letter, fp );
break;
}
}
@@ -2048,11 +2048,11 @@
/*
* Get an extra description from a list.
*/
-char *get_extra_descr( const char *name, EXTRA_DESCR_DATA *ed )
+char *get_extra_descr( char *name, EXTRA_DESCR_DATA *ed )
{
for ( ; ed != NULL; ed = ed->next )
{
- if ( is_name( (char *) name, ed->keyword ) )
+ if ( is_name( name, ed->keyword ) )
return ed->description;
}
return NULL;
@@ -2682,7 +2682,7 @@
* Duplicate a string into dynamic memory.
* Fread_strings are read-only and shared.
*/
-char *str_dup( const char *str )
+char *str_dup( char *str )
{
char *str_new;
@@ -2690,7 +2690,7 @@
return &str_empty[0];
if ( str >= string_space && str < top_string )
- return (char *) str;
+ return str;
str_new = (char *)alloc_mem( strlen(str) + 1 );
strcpy( str_new, str );
diff -buraP 003/src/db2.c 005/src/db2.c
--- 003/src/db2.c 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/db2.c 2008-10-08 12:32:02.000000000 -0400
@@ -389,7 +389,7 @@
switch(pObjIndex->item_type)
{
case ITEM_WEAPON:
- pObjIndex->value[0] = weapon_type(fread_word(fp));
+ pObjIndex->value[0] = weapon_type_lookup(fread_word(fp));
pObjIndex->value[1] = fread_number(fp);
pObjIndex->value[2] = fread_number(fp);
pObjIndex->value[3] = attack_lookup(fread_word(fp));
@@ -455,11 +455,11 @@
for ( ; ; )
{
- char letter;
+ char another_letter;
- letter = fread_letter( fp );
+ another_letter = fread_letter( fp );
- if ( letter == 'A' )
+ if ( another_letter == 'A' )
{
AFFECT_DATA *paf;
@@ -476,13 +476,13 @@
top_affect++;
}
- else if (letter == 'F')
+ else if (another_letter == 'F')
{
AFFECT_DATA *paf;
paf = (AFFECT_DATA *)alloc_perm( sizeof(*paf) );
- letter = fread_letter(fp);
- switch (letter)
+ another_letter = fread_letter(fp);
+ switch (another_letter)
{
case 'A':
paf->where = TO_AFFECTS;
@@ -511,7 +511,7 @@
top_affect++;
}
- else if ( letter == 'E' )
+ else if ( another_letter == 'E' )
{
EXTRA_DESCR_DATA *ed;
@@ -525,7 +525,7 @@
else
{
- ungetc( letter, fp );
+ ungetc( another_letter, fp );
break;
}
}
diff -buraP 003/src/fight.c 005/src/fight.c
--- 003/src/fight.c 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/fight.c 2008-10-08 12:32:02.000000000 -0400
@@ -584,8 +584,6 @@
/* but do we have a funky weapon? */
if (result && wield != NULL)
{
- int dam;
-
if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_POISON))
{
int level;
@@ -1215,11 +1213,11 @@
{
if ( ch->master == NULL )
{
- char buf[MAX_STRING_LENGTH];
+ char buf2[MAX_STRING_LENGTH];
- sprintf( buf, "Check_killer: %s bad AFF_CHARM",
+ sprintf( buf2, "Check_killer: %s bad AFF_CHARM",
IS_NPC(ch) ? ch->short_descr : ch->name );
- bug( buf, 0 );
+ bug( buf2, 0 );
affect_strip( ch, gsn_charm_person );
REMOVE_BIT( ch->affected_by, AFF_CHARM );
return;
diff -buraP 003/src/handler.c 005/src/handler.c
--- 003/src/handler.c 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/handler.c 2008-10-08 12:32:02.000000000 -0400
@@ -155,7 +155,7 @@
return -1;
}
-int weapon_type (const char *name)
+int weapon_type_lookup (const char *name)
{
int type;
@@ -2611,7 +2611,10 @@
if ( vector & AFF_SLOW ) strcat( buf, " slow" );
if ( vector & AFF_PLAGUE ) strcat( buf, " plague" );
if ( vector & AFF_DARK_VISION ) strcat( buf, " dark_vision" );
- return (char *)(( buf[0] != '\0' ) ? buf+1 : "none");
+ if ( !*buf )
+ strcat( buf, " none" );
+
+ return (char *)(buf+1);
}
@@ -2619,294 +2622,310 @@
/*
* Return ascii name of extra flags vector.
*/
-char *extra_bit_name( int extra_flags )
+char *extra_bit_name( int vector )
{
static char buf[512];
buf[0] = '\0';
- if ( extra_flags & ITEM_GLOW ) strcat( buf, " glow" );
- if ( extra_flags & ITEM_HUM ) strcat( buf, " hum" );
- if ( extra_flags & ITEM_DARK ) strcat( buf, " dark" );
- if ( extra_flags & ITEM_LOCK ) strcat( buf, " lock" );
- if ( extra_flags & ITEM_EVIL ) strcat( buf, " evil" );
- if ( extra_flags & ITEM_INVIS ) strcat( buf, " invis" );
- if ( extra_flags & ITEM_MAGIC ) strcat( buf, " magic" );
- if ( extra_flags & ITEM_NODROP ) strcat( buf, " nodrop" );
- if ( extra_flags & ITEM_BLESS ) strcat( buf, " bless" );
- if ( extra_flags & ITEM_ANTI_GOOD ) strcat( buf, " anti-good" );
- if ( extra_flags & ITEM_ANTI_EVIL ) strcat( buf, " anti-evil" );
- if ( extra_flags & ITEM_ANTI_NEUTRAL ) strcat( buf, " anti-neutral" );
- if ( extra_flags & ITEM_NOREMOVE ) strcat( buf, " noremove" );
- if ( extra_flags & ITEM_INVENTORY ) strcat( buf, " inventory" );
- if ( extra_flags & ITEM_NOPURGE ) strcat( buf, " nopurge" );
- if ( extra_flags & ITEM_VIS_DEATH ) strcat( buf, " vis_death" );
- if ( extra_flags & ITEM_ROT_DEATH ) strcat( buf, " rot_death" );
- if ( extra_flags & ITEM_NOLOCATE ) strcat( buf, " no_locate" );
- if ( extra_flags & ITEM_SELL_EXTRACT ) strcat( buf, " sell_extract" );
- if ( extra_flags & ITEM_BURN_PROOF ) strcat( buf, " burn_proof" );
- if ( extra_flags & ITEM_NOUNCURSE ) strcat( buf, " no_uncurse" );
- return (char *)(( buf[0] != '\0' ) ? buf+1 : "none");
+ if ( vector & ITEM_GLOW ) strcat( buf, " glow" );
+ if ( vector & ITEM_HUM ) strcat( buf, " hum" );
+ if ( vector & ITEM_DARK ) strcat( buf, " dark" );
+ if ( vector & ITEM_LOCK ) strcat( buf, " lock" );
+ if ( vector & ITEM_EVIL ) strcat( buf, " evil" );
+ if ( vector & ITEM_INVIS ) strcat( buf, " invis" );
+ if ( vector & ITEM_MAGIC ) strcat( buf, " magic" );
+ if ( vector & ITEM_NODROP ) strcat( buf, " nodrop" );
+ if ( vector & ITEM_BLESS ) strcat( buf, " bless" );
+ if ( vector & ITEM_ANTI_GOOD ) strcat( buf, " anti-good" );
+ if ( vector & ITEM_ANTI_EVIL ) strcat( buf, " anti-evil" );
+ if ( vector & ITEM_ANTI_NEUTRAL ) strcat( buf, " anti-neutral" );
+ if ( vector & ITEM_NOREMOVE ) strcat( buf, " noremove" );
+ if ( vector & ITEM_INVENTORY ) strcat( buf, " inventory" );
+ if ( vector & ITEM_NOPURGE ) strcat( buf, " nopurge" );
+ if ( vector & ITEM_VIS_DEATH ) strcat( buf, " vis_death" );
+ if ( vector & ITEM_ROT_DEATH ) strcat( buf, " rot_death" );
+ if ( vector & ITEM_NOLOCATE ) strcat( buf, " no_locate" );
+ if ( vector & ITEM_SELL_EXTRACT ) strcat( buf, " sell_extract" );
+ if ( vector & ITEM_BURN_PROOF ) strcat( buf, " burn_proof" );
+ if ( vector & ITEM_NOUNCURSE ) strcat( buf, " no_uncurse" );
+ if ( !*buf )
+ strcat( buf, " none" );
+
+ return (char *)(buf+1);
}
/* return ascii name of an act vector */
-char *act_bit_name( int act_flags )
+char *act_bit_name( int vector )
{
static char buf[512];
buf[0] = '\0';
-
- if (IS_SET(act_flags,ACT_IS_NPC))
+ if (IS_SET(vector,ACT_IS_NPC))
{
strcat(buf," npc");
- if (act_flags & ACT_SENTINEL ) strcat(buf, " sentinel");
- if (act_flags & ACT_SCAVENGER ) strcat(buf, " scavenger");
- if (act_flags & ACT_AGGRESSIVE ) strcat(buf, " aggressive");
- if (act_flags & ACT_STAY_AREA ) strcat(buf, " stay_area");
- if (act_flags & ACT_WIMPY ) strcat(buf, " wimpy");
- if (act_flags & ACT_PET ) strcat(buf, " pet");
- if (act_flags & ACT_TRAIN ) strcat(buf, " train");
- if (act_flags & ACT_PRACTICE ) strcat(buf, " practice");
- if (act_flags & ACT_UNDEAD ) strcat(buf, " undead");
- if (act_flags & ACT_CLERIC ) strcat(buf, " cleric");
- if (act_flags & ACT_MAGE ) strcat(buf, " mage");
- if (act_flags & ACT_THIEF ) strcat(buf, " thief");
- if (act_flags & ACT_WARRIOR ) strcat(buf, " warrior");
- if (act_flags & ACT_NOALIGN ) strcat(buf, " no_align");
- if (act_flags & ACT_NOPURGE ) strcat(buf, " no_purge");
- if (act_flags & ACT_IS_HEALER ) strcat(buf, " healer");
- if (act_flags & ACT_IS_CHANGER ) strcat(buf, " changer");
- if (act_flags & ACT_GAIN ) strcat(buf, " skill_train");
- if (act_flags & ACT_UPDATE_ALWAYS) strcat(buf," update_always");
+ if (vector & ACT_SENTINEL ) strcat(buf, " sentinel");
+ if (vector & ACT_SCAVENGER ) strcat(buf, " scavenger");
+ if (vector & ACT_AGGRESSIVE ) strcat(buf, " aggressive");
+ if (vector & ACT_STAY_AREA ) strcat(buf, " stay_area");
+ if (vector & ACT_WIMPY ) strcat(buf, " wimpy");
+ if (vector & ACT_PET ) strcat(buf, " pet");
+ if (vector & ACT_TRAIN ) strcat(buf, " train");
+ if (vector & ACT_PRACTICE ) strcat(buf, " practice");
+ if (vector & ACT_UNDEAD ) strcat(buf, " undead");
+ if (vector & ACT_CLERIC ) strcat(buf, " cleric");
+ if (vector & ACT_MAGE ) strcat(buf, " mage");
+ if (vector & ACT_THIEF ) strcat(buf, " thief");
+ if (vector & ACT_WARRIOR ) strcat(buf, " warrior");
+ if (vector & ACT_NOALIGN ) strcat(buf, " no_align");
+ if (vector & ACT_NOPURGE ) strcat(buf, " no_purge");
+ if (vector & ACT_IS_HEALER ) strcat(buf, " healer");
+ if (vector & ACT_IS_CHANGER ) strcat(buf, " changer");
+ if (vector & ACT_GAIN ) strcat(buf, " skill_train");
+ if (vector & ACT_UPDATE_ALWAYS ) strcat(buf, " update_always");
}
else
{
strcat(buf," player");
- if (act_flags & PLR_AUTOASSIST ) strcat(buf, " autoassist");
- if (act_flags & PLR_AUTOEXIT ) strcat(buf, " autoexit");
- if (act_flags & PLR_AUTOLOOT ) strcat(buf, " autoloot");
- if (act_flags & PLR_AUTOSAC ) strcat(buf, " autosac");
- if (act_flags & PLR_AUTOGOLD ) strcat(buf, " autogold");
- if (act_flags & PLR_AUTOSPLIT ) strcat(buf, " autosplit");
- if (act_flags & PLR_HOLYLIGHT ) strcat(buf, " holy_light");
- if (act_flags & PLR_CANLOOT ) strcat(buf, " loot_corpse");
- if (act_flags & PLR_NOSUMMON ) strcat(buf, " no_summon");
- if (act_flags & PLR_NOFOLLOW ) strcat(buf, " no_follow");
- if (act_flags & PLR_FREEZE ) strcat(buf, " frozen");
- if (act_flags & PLR_THIEF ) strcat(buf, " thief");
- if (act_flags & PLR_KILLER ) strcat(buf, " killer");
+ if (vector & PLR_AUTOASSIST ) strcat(buf, " autoassist");
+ if (vector & PLR_AUTOEXIT ) strcat(buf, " autoexit");
+ if (vector & PLR_AUTOLOOT ) strcat(buf, " autoloot");
+ if (vector & PLR_AUTOSAC ) strcat(buf, " autosac");
+ if (vector & PLR_AUTOGOLD ) strcat(buf, " autogold");
+ if (vector & PLR_AUTOSPLIT ) strcat(buf, " autosplit");
+ if (vector & PLR_HOLYLIGHT ) strcat(buf, " holy_light");
+ if (vector & PLR_CANLOOT ) strcat(buf, " loot_corpse");
+ if (vector & PLR_NOSUMMON ) strcat(buf, " no_summon");
+ if (vector & PLR_NOFOLLOW ) strcat(buf, " no_follow");
+ if (vector & PLR_FREEZE ) strcat(buf, " frozen");
+ if (vector & PLR_THIEF ) strcat(buf, " thief");
+ if (vector & PLR_KILLER ) strcat(buf, " killer");
}
- return (char *)(( buf[0] != '\0' ) ? buf+1 : "none");
+ if ( !*buf )
+ strcat( buf, " none" );
+
+ return (char *)(buf+1);
}
-char *comm_bit_name(int comm_flags)
+char *comm_bit_name(int vector)
{
static char buf[512];
buf[0] = '\0';
+ if (vector & COMM_QUIET ) strcat(buf, " quiet");
+ if (vector & COMM_DEAF ) strcat(buf, " deaf");
+ if (vector & COMM_NOWIZ ) strcat(buf, " no_wiz");
+ if (vector & COMM_NOAUCTION ) strcat(buf, " no_auction");
+ if (vector & COMM_NOGOSSIP ) strcat(buf, " no_gossip");
+ if (vector & COMM_NOQUESTION ) strcat(buf, " no_question");
+ if (vector & COMM_NOMUSIC ) strcat(buf, " no_music");
+ if (vector & COMM_NOQUOTE ) strcat(buf, " no_quote");
+ if (vector & COMM_COMPACT ) strcat(buf, " compact");
+ if (vector & COMM_BRIEF ) strcat(buf, " brief");
+ if (vector & COMM_PROMPT ) strcat(buf, " prompt");
+ if (vector & COMM_COMBINE ) strcat(buf, " combine");
+ if (vector & COMM_NOEMOTE ) strcat(buf, " no_emote");
+ if (vector & COMM_NOSHOUT ) strcat(buf, " no_shout");
+ if (vector & COMM_NOTELL ) strcat(buf, " no_tell");
+ if (vector & COMM_NOCHANNELS ) strcat(buf, " no_channels");
+ if ( !*buf )
+ strcat( buf, " none" );
- if (comm_flags & COMM_QUIET ) strcat(buf, " quiet");
- if (comm_flags & COMM_DEAF ) strcat(buf, " deaf");
- if (comm_flags & COMM_NOWIZ ) strcat(buf, " no_wiz");
- if (comm_flags & COMM_NOAUCTION ) strcat(buf, " no_auction");
- if (comm_flags & COMM_NOGOSSIP ) strcat(buf, " no_gossip");
- if (comm_flags & COMM_NOQUESTION ) strcat(buf, " no_question");
- if (comm_flags & COMM_NOMUSIC ) strcat(buf, " no_music");
- if (comm_flags & COMM_NOQUOTE ) strcat(buf, " no_quote");
- if (comm_flags & COMM_COMPACT ) strcat(buf, " compact");
- if (comm_flags & COMM_BRIEF ) strcat(buf, " brief");
- if (comm_flags & COMM_PROMPT ) strcat(buf, " prompt");
- if (comm_flags & COMM_COMBINE ) strcat(buf, " combine");
- if (comm_flags & COMM_NOEMOTE ) strcat(buf, " no_emote");
- if (comm_flags & COMM_NOSHOUT ) strcat(buf, " no_shout");
- if (comm_flags & COMM_NOTELL ) strcat(buf, " no_tell");
- if (comm_flags & COMM_NOCHANNELS ) strcat(buf, " no_channels");
-
-
- return (char *)(( buf[0] != '\0' ) ? buf+1 : "none");
+ return (char *)(buf+1);
}
-char *imm_bit_name(int imm_flags)
+char *imm_bit_name(int vector)
{
static char buf[512];
buf[0] = '\0';
+ if (vector & IMM_SUMMON ) strcat(buf, " summon");
+ if (vector & IMM_CHARM ) strcat(buf, " charm");
+ if (vector & IMM_MAGIC ) strcat(buf, " magic");
+ if (vector & IMM_WEAPON ) strcat(buf, " weapon");
+ if (vector & IMM_BASH ) strcat(buf, " blunt");
+ if (vector & IMM_PIERCE ) strcat(buf, " piercing");
+ if (vector & IMM_SLASH ) strcat(buf, " slashing");
+ if (vector & IMM_FIRE ) strcat(buf, " fire");
+ if (vector & IMM_COLD ) strcat(buf, " cold");
+ if (vector & IMM_LIGHTNING ) strcat(buf, " lightning");
+ if (vector & IMM_ACID ) strcat(buf, " acid");
+ if (vector & IMM_POISON ) strcat(buf, " poison");
+ if (vector & IMM_NEGATIVE ) strcat(buf, " negative");
+ if (vector & IMM_HOLY ) strcat(buf, " holy");
+ if (vector & IMM_ENERGY ) strcat(buf, " energy");
+ if (vector & IMM_MENTAL ) strcat(buf, " mental");
+ if (vector & IMM_DISEASE ) strcat(buf, " disease");
+ if (vector & IMM_DROWNING ) strcat(buf, " drowning");
+ if (vector & IMM_LIGHT ) strcat(buf, " light");
+ if (vector & VULN_IRON ) strcat(buf, " iron");
+ if (vector & VULN_WOOD ) strcat(buf, " wood");
+ if (vector & VULN_SILVER ) strcat(buf, " silver");
+ if ( !*buf )
+ strcat( buf, " none" );
- if (imm_flags & IMM_SUMMON ) strcat(buf, " summon");
- if (imm_flags & IMM_CHARM ) strcat(buf, " charm");
- if (imm_flags & IMM_MAGIC ) strcat(buf, " magic");
- if (imm_flags & IMM_WEAPON ) strcat(buf, " weapon");
- if (imm_flags & IMM_BASH ) strcat(buf, " blunt");
- if (imm_flags & IMM_PIERCE ) strcat(buf, " piercing");
- if (imm_flags & IMM_SLASH ) strcat(buf, " slashing");
- if (imm_flags & IMM_FIRE ) strcat(buf, " fire");
- if (imm_flags & IMM_COLD ) strcat(buf, " cold");
- if (imm_flags & IMM_LIGHTNING ) strcat(buf, " lightning");
- if (imm_flags & IMM_ACID ) strcat(buf, " acid");
- if (imm_flags & IMM_POISON ) strcat(buf, " poison");
- if (imm_flags & IMM_NEGATIVE ) strcat(buf, " negative");
- if (imm_flags & IMM_HOLY ) strcat(buf, " holy");
- if (imm_flags & IMM_ENERGY ) strcat(buf, " energy");
- if (imm_flags & IMM_MENTAL ) strcat(buf, " mental");
- if (imm_flags & IMM_DISEASE ) strcat(buf, " disease");
- if (imm_flags & IMM_DROWNING ) strcat(buf, " drowning");
- if (imm_flags & IMM_LIGHT ) strcat(buf, " light");
- if (imm_flags & VULN_IRON ) strcat(buf, " iron");
- if (imm_flags & VULN_WOOD ) strcat(buf, " wood");
- if (imm_flags & VULN_SILVER ) strcat(buf, " silver");
-
- return (char *)(( buf[0] != '\0' ) ? buf+1 : "none");
+ return (char *)(buf+1);
}
-char *wear_bit_name(int wear_flags)
+char *wear_bit_name(int vector)
{
static char buf[512];
buf [0] = '\0';
- if (wear_flags & ITEM_TAKE ) strcat(buf, " take");
- if (wear_flags & ITEM_WEAR_FINGER ) strcat(buf, " finger");
- if (wear_flags & ITEM_WEAR_NECK ) strcat(buf, " neck");
- if (wear_flags & ITEM_WEAR_BODY ) strcat(buf, " torso");
- if (wear_flags & ITEM_WEAR_HEAD ) strcat(buf, " head");
- if (wear_flags & ITEM_WEAR_LEGS ) strcat(buf, " legs");
- if (wear_flags & ITEM_WEAR_FEET ) strcat(buf, " feet");
- if (wear_flags & ITEM_WEAR_HANDS ) strcat(buf, " hands");
- if (wear_flags & ITEM_WEAR_ARMS ) strcat(buf, " arms");
- if (wear_flags & ITEM_WEAR_SHIELD ) strcat(buf, " shield");
- if (wear_flags & ITEM_WEAR_ABOUT ) strcat(buf, " body");
- if (wear_flags & ITEM_WEAR_WAIST ) strcat(buf, " waist");
- if (wear_flags & ITEM_WEAR_WRIST ) strcat(buf, " wrist");
- if (wear_flags & ITEM_WIELD ) strcat(buf, " wield");
- if (wear_flags & ITEM_HOLD ) strcat(buf, " hold");
- if (wear_flags & ITEM_NO_SAC ) strcat(buf, " nosac");
- if (wear_flags & ITEM_WEAR_FLOAT ) strcat(buf, " float");
+ if (vector & ITEM_TAKE ) strcat(buf, " take");
+ if (vector & ITEM_WEAR_FINGER ) strcat(buf, " finger");
+ if (vector & ITEM_WEAR_NECK ) strcat(buf, " neck");
+ if (vector & ITEM_WEAR_BODY ) strcat(buf, " torso");
+ if (vector & ITEM_WEAR_HEAD ) strcat(buf, " head");
+ if (vector & ITEM_WEAR_LEGS ) strcat(buf, " legs");
+ if (vector & ITEM_WEAR_FEET ) strcat(buf, " feet");
+ if (vector & ITEM_WEAR_HANDS ) strcat(buf, " hands");
+ if (vector & ITEM_WEAR_ARMS ) strcat(buf, " arms");
+ if (vector & ITEM_WEAR_SHIELD ) strcat(buf, " shield");
+ if (vector & ITEM_WEAR_ABOUT ) strcat(buf, " body");
+ if (vector & ITEM_WEAR_WAIST ) strcat(buf, " waist");
+ if (vector & ITEM_WEAR_WRIST ) strcat(buf, " wrist");
+ if (vector & ITEM_WIELD ) strcat(buf, " wield");
+ if (vector & ITEM_HOLD ) strcat(buf, " hold");
+ if (vector & ITEM_NO_SAC ) strcat(buf, " nosac");
+ if (vector & ITEM_WEAR_FLOAT ) strcat(buf, " float");
+ if ( !*buf )
+ strcat( buf, " none" );
- return (char *)(( buf[0] != '\0' ) ? buf+1 : "none");
+ return (char *)(buf+1);
}
-char *form_bit_name(int form_flags)
+char *form_bit_name(int vector)
{
static char buf[512];
buf[0] = '\0';
- if (form_flags & FORM_POISON ) strcat(buf, " poison");
- else if (form_flags & FORM_EDIBLE ) strcat(buf, " edible");
- if (form_flags & FORM_MAGICAL ) strcat(buf, " magical");
- if (form_flags & FORM_INSTANT_DECAY ) strcat(buf, " instant_rot");
- if (form_flags & FORM_OTHER ) strcat(buf, " other");
- if (form_flags & FORM_ANIMAL ) strcat(buf, " animal");
- if (form_flags & FORM_SENTIENT ) strcat(buf, " sentient");
- if (form_flags & FORM_UNDEAD ) strcat(buf, " undead");
- if (form_flags & FORM_CONSTRUCT ) strcat(buf, " construct");
- if (form_flags & FORM_MIST ) strcat(buf, " mist");
- if (form_flags & FORM_INTANGIBLE ) strcat(buf, " intangible");
- if (form_flags & FORM_BIPED ) strcat(buf, " biped");
- if (form_flags & FORM_CENTAUR ) strcat(buf, " centaur");
- if (form_flags & FORM_INSECT ) strcat(buf, " insect");
- if (form_flags & FORM_SPIDER ) strcat(buf, " spider");
- if (form_flags & FORM_CRUSTACEAN ) strcat(buf, " crustacean");
- if (form_flags & FORM_WORM ) strcat(buf, " worm");
- if (form_flags & FORM_BLOB ) strcat(buf, " blob");
- if (form_flags & FORM_MAMMAL ) strcat(buf, " mammal");
- if (form_flags & FORM_BIRD ) strcat(buf, " bird");
- if (form_flags & FORM_REPTILE ) strcat(buf, " reptile");
- if (form_flags & FORM_SNAKE ) strcat(buf, " snake");
- if (form_flags & FORM_DRAGON ) strcat(buf, " dragon");
- if (form_flags & FORM_AMPHIBIAN ) strcat(buf, " amphibian");
- if (form_flags & FORM_FISH ) strcat(buf, " fish");
- if (form_flags & FORM_COLD_BLOOD ) strcat(buf, " cold_blooded");
+ if (vector & FORM_POISON ) strcat(buf, " poison");
+ else if (vector & FORM_EDIBLE ) strcat(buf, " edible");
+ if (vector & FORM_MAGICAL ) strcat(buf, " magical");
+ if (vector & FORM_INSTANT_DECAY ) strcat(buf, " instant_rot");
+ if (vector & FORM_OTHER ) strcat(buf, " other");
+ if (vector & FORM_ANIMAL ) strcat(buf, " animal");
+ if (vector & FORM_SENTIENT ) strcat(buf, " sentient");
+ if (vector & FORM_UNDEAD ) strcat(buf, " undead");
+ if (vector & FORM_CONSTRUCT ) strcat(buf, " construct");
+ if (vector & FORM_MIST ) strcat(buf, " mist");
+ if (vector & FORM_INTANGIBLE ) strcat(buf, " intangible");
+ if (vector & FORM_BIPED ) strcat(buf, " biped");
+ if (vector & FORM_CENTAUR ) strcat(buf, " centaur");
+ if (vector & FORM_INSECT ) strcat(buf, " insect");
+ if (vector & FORM_SPIDER ) strcat(buf, " spider");
+ if (vector & FORM_CRUSTACEAN ) strcat(buf, " crustacean");
+ if (vector & FORM_WORM ) strcat(buf, " worm");
+ if (vector & FORM_BLOB ) strcat(buf, " blob");
+ if (vector & FORM_MAMMAL ) strcat(buf, " mammal");
+ if (vector & FORM_BIRD ) strcat(buf, " bird");
+ if (vector & FORM_REPTILE ) strcat(buf, " reptile");
+ if (vector & FORM_SNAKE ) strcat(buf, " snake");
+ if (vector & FORM_DRAGON ) strcat(buf, " dragon");
+ if (vector & FORM_AMPHIBIAN ) strcat(buf, " amphibian");
+ if (vector & FORM_FISH ) strcat(buf, " fish");
+ if (vector & FORM_COLD_BLOOD ) strcat(buf, " cold_blooded");
+ if ( !*buf )
+ strcat( buf, " none" );
- return (char *)(( buf[0] != '\0' ) ? buf+1 : "none");
+ return (char *)(buf+1);
}
-char *part_bit_name(int part_flags)
+char *part_bit_name(int vector)
{
static char buf[512];
buf[0] = '\0';
- if (part_flags & PART_HEAD ) strcat(buf, " head");
- if (part_flags & PART_ARMS ) strcat(buf, " arms");
- if (part_flags & PART_LEGS ) strcat(buf, " legs");
- if (part_flags & PART_HEART ) strcat(buf, " heart");
- if (part_flags & PART_BRAINS ) strcat(buf, " brains");
- if (part_flags & PART_GUTS ) strcat(buf, " guts");
- if (part_flags & PART_HANDS ) strcat(buf, " hands");
- if (part_flags & PART_FEET ) strcat(buf, " feet");
- if (part_flags & PART_FINGERS ) strcat(buf, " fingers");
- if (part_flags & PART_EAR ) strcat(buf, " ears");
- if (part_flags & PART_EYE ) strcat(buf, " eyes");
- if (part_flags & PART_LONG_TONGUE ) strcat(buf, " long_tongue");
- if (part_flags & PART_EYESTALKS ) strcat(buf, " eyestalks");
- if (part_flags & PART_TENTACLES ) strcat(buf, " tentacles");
- if (part_flags & PART_FINS ) strcat(buf, " fins");
- if (part_flags & PART_WINGS ) strcat(buf, " wings");
- if (part_flags & PART_TAIL ) strcat(buf, " tail");
- if (part_flags & PART_CLAWS ) strcat(buf, " claws");
- if (part_flags & PART_FANGS ) strcat(buf, " fangs");
- if (part_flags & PART_HORNS ) strcat(buf, " horns");
- if (part_flags & PART_SCALES ) strcat(buf, " scales");
+ if (vector & PART_HEAD ) strcat(buf, " head");
+ if (vector & PART_ARMS ) strcat(buf, " arms");
+ if (vector & PART_LEGS ) strcat(buf, " legs");
+ if (vector & PART_HEART ) strcat(buf, " heart");
+ if (vector & PART_BRAINS ) strcat(buf, " brains");
+ if (vector & PART_GUTS ) strcat(buf, " guts");
+ if (vector & PART_HANDS ) strcat(buf, " hands");
+ if (vector & PART_FEET ) strcat(buf, " feet");
+ if (vector & PART_FINGERS ) strcat(buf, " fingers");
+ if (vector & PART_EAR ) strcat(buf, " ears");
+ if (vector & PART_EYE ) strcat(buf, " eyes");
+ if (vector & PART_LONG_TONGUE ) strcat(buf, " long_tongue");
+ if (vector & PART_EYESTALKS ) strcat(buf, " eyestalks");
+ if (vector & PART_TENTACLES ) strcat(buf, " tentacles");
+ if (vector & PART_FINS ) strcat(buf, " fins");
+ if (vector & PART_WINGS ) strcat(buf, " wings");
+ if (vector & PART_TAIL ) strcat(buf, " tail");
+ if (vector & PART_CLAWS ) strcat(buf, " claws");
+ if (vector & PART_FANGS ) strcat(buf, " fangs");
+ if (vector & PART_HORNS ) strcat(buf, " horns");
+ if (vector & PART_SCALES ) strcat(buf, " scales");
+ if ( !*buf )
+ strcat( buf, " none" );
- return (char *) (( buf[0] != '\0' ) ? buf+1 : "none");
+ return (char *)(buf+1);
}
-char *weapon_bit_name(int weapon_flags)
+char *weapon_bit_name(int vector)
{
static char buf[512];
buf[0] = '\0';
- if (weapon_flags & WEAPON_FLAMING ) strcat(buf, " flaming");
- if (weapon_flags & WEAPON_FROST ) strcat(buf, " frost");
- if (weapon_flags & WEAPON_VAMPIRIC ) strcat(buf, " vampiric");
- if (weapon_flags & WEAPON_SHARP ) strcat(buf, " sharp");
- if (weapon_flags & WEAPON_VORPAL ) strcat(buf, " vorpal");
- if (weapon_flags & WEAPON_TWO_HANDS ) strcat(buf, " two-handed");
- if (weapon_flags & WEAPON_SHOCKING ) strcat(buf, " shocking");
- if (weapon_flags & WEAPON_POISON ) strcat(buf, " poison");
+ if (vector & WEAPON_FLAMING ) strcat(buf, " flaming");
+ if (vector & WEAPON_FROST ) strcat(buf, " frost");
+ if (vector & WEAPON_VAMPIRIC ) strcat(buf, " vampiric");
+ if (vector & WEAPON_SHARP ) strcat(buf, " sharp");
+ if (vector & WEAPON_VORPAL ) strcat(buf, " vorpal");
+ if (vector & WEAPON_TWO_HANDS ) strcat(buf, " two-handed");
+ if (vector & WEAPON_SHOCKING ) strcat(buf, " shocking");
+ if (vector & WEAPON_POISON ) strcat(buf, " poison");
+ if ( !*buf )
+ strcat( buf, " none" );
- return (char *)(( buf[0] != '\0' ) ? buf+1 : "none");
+ return (char *)(buf+1);
}
-char *cont_bit_name( int cont_flags)
+char *cont_bit_name( int vector)
{
static char buf[512];
buf[0] = '\0';
+ if (vector & CONT_CLOSEABLE ) strcat(buf, " closable");
+ if (vector & CONT_PICKPROOF ) strcat(buf, " pickproof");
+ if (vector & CONT_CLOSED ) strcat(buf, " closed");
+ if (vector & CONT_LOCKED ) strcat(buf, " locked");
+ if ( !*buf )
+ strcat( buf, " none" );
- if (cont_flags & CONT_CLOSEABLE ) strcat(buf, " closable");
- if (cont_flags & CONT_PICKPROOF ) strcat(buf, " pickproof");
- if (cont_flags & CONT_CLOSED ) strcat(buf, " closed");
- if (cont_flags & CONT_LOCKED ) strcat(buf, " locked");
-
- return (char *)((buf[0] != '\0' ) ? buf+1 : "none");
+ return (char *)(buf+1);
}
-char *off_bit_name(int off_flags)
+char *off_bit_name(int vector)
{
static char buf[512];
buf[0] = '\0';
+ if (vector & OFF_AREA_ATTACK ) strcat(buf, " area attack");
+ if (vector & OFF_BACKSTAB ) strcat(buf, " backstab");
+ if (vector & OFF_BASH ) strcat(buf, " bash");
+ if (vector & OFF_BERSERK ) strcat(buf, " berserk");
+ if (vector & OFF_DISARM ) strcat(buf, " disarm");
+ if (vector & OFF_DODGE ) strcat(buf, " dodge");
+ if (vector & OFF_FADE ) strcat(buf, " fade");
+ if (vector & OFF_FAST ) strcat(buf, " fast");
+ if (vector & OFF_KICK ) strcat(buf, " kick");
+ if (vector & OFF_KICK_DIRT ) strcat(buf, " kick_dirt");
+ if (vector & OFF_PARRY ) strcat(buf, " parry");
+ if (vector & OFF_RESCUE ) strcat(buf, " rescue");
+ if (vector & OFF_TAIL ) strcat(buf, " tail");
+ if (vector & OFF_TRIP ) strcat(buf, " trip");
+ if (vector & OFF_CRUSH ) strcat(buf, " crush");
+ if (vector & ASSIST_ALL ) strcat(buf, " assist_all");
+ if (vector & ASSIST_ALIGN ) strcat(buf, " assist_align");
+ if (vector & ASSIST_RACE ) strcat(buf, " assist_race");
+ if (vector & ASSIST_PLAYERS ) strcat(buf, " assist_players");
+ if (vector & ASSIST_GUARD ) strcat(buf, " assist_guard");
+ if (vector & ASSIST_VNUM ) strcat(buf, " assist_vnum");
+ if ( !*buf )
+ strcat( buf, " none" );
- if (off_flags & OFF_AREA_ATTACK ) strcat(buf, " area attack");
- if (off_flags & OFF_BACKSTAB ) strcat(buf, " backstab");
- if (off_flags & OFF_BASH ) strcat(buf, " bash");
- if (off_flags & OFF_BERSERK ) strcat(buf, " berserk");
- if (off_flags & OFF_DISARM ) strcat(buf, " disarm");
- if (off_flags & OFF_DODGE ) strcat(buf, " dodge");
- if (off_flags & OFF_FADE ) strcat(buf, " fade");
- if (off_flags & OFF_FAST ) strcat(buf, " fast");
- if (off_flags & OFF_KICK ) strcat(buf, " kick");
- if (off_flags & OFF_KICK_DIRT ) strcat(buf, " kick_dirt");
- if (off_flags & OFF_PARRY ) strcat(buf, " parry");
- if (off_flags & OFF_RESCUE ) strcat(buf, " rescue");
- if (off_flags & OFF_TAIL ) strcat(buf, " tail");
- if (off_flags & OFF_TRIP ) strcat(buf, " trip");
- if (off_flags & OFF_CRUSH ) strcat(buf, " crush");
- if (off_flags & ASSIST_ALL ) strcat(buf, " assist_all");
- if (off_flags & ASSIST_ALIGN ) strcat(buf, " assist_align");
- if (off_flags & ASSIST_RACE ) strcat(buf, " assist_race");
- if (off_flags & ASSIST_PLAYERS ) strcat(buf, " assist_players");
- if (off_flags & ASSIST_GUARD ) strcat(buf, " assist_guard");
- if (off_flags & ASSIST_VNUM ) strcat(buf, " assist_vnum");
-
- return (char *)(( buf[0] != '\0' ) ? buf+1 : "none");
+ return (char *)(buf+1);
}
diff -buraP 003/src/merc.h 005/src/merc.h
--- 003/src/merc.h 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/merc.h 2008-10-08 12:32:02.000000000 -0400
@@ -1902,6 +1902,7 @@
[MAX_LEVEL+1]
[2];
extern char * const dir_name [];
+extern char * const dir_abbrev[];
extern const sh_int rev_dir [];
@@ -2124,7 +2125,7 @@
OD * create_object args( ( OBJ_INDEX_DATA *pObjIndex, int level ) );
void clone_object args( ( OBJ_DATA *parent, OBJ_DATA *clone ) );
void clear_char args( ( CHAR_DATA *ch ) );
-char * get_extra_descr args( ( const char *name, EXTRA_DESCR_DATA *ed ) );
+char * get_extra_descr args( ( char *name, EXTRA_DESCR_DATA *ed ) );
MID * get_mob_index args( ( int vnum ) );
OID * get_obj_index args( ( int vnum ) );
RID * get_room_index args( ( int vnum ) );
@@ -2139,7 +2140,7 @@
void * alloc_mem args( ( int sMem ) );
void * alloc_perm args( ( int sMem ) );
void free_mem args( ( void *pMem, int sMem ) );
-char * str_dup args( ( const char *str ) );
+char * str_dup args( ( char *str ) );
void free_string args( ( char *pstr ) );
int number_fuzzy args( ( int number ) );
int number_range args( ( int from, int to ) );
@@ -2191,7 +2192,7 @@
int liq_lookup args( ( const char *name) );
int material_lookup args( ( const char *name) );
int weapon_lookup args( ( const char *name) );
-int weapon_type args( ( const char *name) );
+int weapon_type_lookup args( ( const char *name) );
char *weapon_name args( ( int weapon_Type) );
int item_lookup args( ( const char *name) );
char *item_name args( ( int item_type) );
@@ -2259,16 +2260,16 @@
bool can_drop_obj args( ( CHAR_DATA *ch, OBJ_DATA *obj ) );
char * affect_loc_name args( ( int location ) );
char * affect_bit_name args( ( int vector ) );
-char * extra_bit_name args( ( int extra_flags ) );
-char * wear_bit_name args( ( int wear_flags ) );
-char * act_bit_name args( ( int act_flags ) );
-char * off_bit_name args( ( int off_flags ) );
-char * imm_bit_name args( ( int imm_flags ) );
-char * form_bit_name args( ( int form_flags ) );
-char * part_bit_name args( ( int part_flags ) );
-char * weapon_bit_name args( ( int weapon_flags ) );
-char * comm_bit_name args( ( int comm_flags ) );
-char * cont_bit_name args( ( int cont_flags) );
+char * extra_bit_name args( ( int vector ) );
+char * wear_bit_name args( ( int vector ) );
+char * act_bit_name args( ( int vector ) );
+char * off_bit_name args( ( int vector ) );
+char * imm_bit_name args( ( int vector ) );
+char * form_bit_name args( ( int vector ) );
+char * part_bit_name args( ( int vector ) );
+char * weapon_bit_name args( ( int vector ) );
+char * comm_bit_name args( ( int vector ) );
+char * cont_bit_name args( ( int vector ) );
/* interp.c */
diff -buraP 003/src/save.c 005/src/save.c
--- 003/src/save.c 2008-10-08 12:14:23.000000000 -0400
+++ 005/src/save.c 2008-10-08 12:32:02.000000000 -0400
@@ -728,6 +728,7 @@
void fread_char( CHAR_DATA *ch, FILE *fp )
{
+ static char end[MAX_INPUT_LENGTH] = "End";
char buf[MAX_STRING_LENGTH];
char *word;
bool fMatch;
@@ -740,7 +741,7 @@
for ( ; ; )
{
- word = (char *) (feof( fp ) ? "End" : fread_word( fp ) );
+ word = (char *) (feof( fp ) ? end : fread_word( fp ) );
fMatch = FALSE;
switch ( UPPER(word[0]) )
@@ -1130,6 +1131,7 @@
/* load a pet from the forgotten reaches */
void fread_pet( CHAR_DATA *ch, FILE *fp )
{
+ static char end[MAX_INPUT_LENGTH] = "END";
char *word;
CHAR_DATA *pet;
bool fMatch;
@@ -1137,7 +1139,7 @@
int percent;
/* first entry had BETTER be the vnum or we barf */
- word = (char *)(feof(fp) ? "END" : fread_word(fp));
+ word = (char *)(feof(fp) ? end : fread_word(fp));
if (!str_cmp(word,"Vnum"))
{
int vnum;
@@ -1159,7 +1161,7 @@
for ( ; ; )
{
- word = (char *)(feof(fp) ? "END" : fread_word(fp));
+ word = (char *)(feof(fp) ? end : fread_word(fp));
fMatch = FALSE;
switch (UPPER(word[0]))
@@ -1345,6 +1347,7 @@
void fread_obj( CHAR_DATA *ch, FILE *fp )
{
+ static char end[MAX_INPUT_LENGTH] = "End";
OBJ_DATA *obj;
char *word;
int iNest;
@@ -1361,7 +1364,7 @@
new_format = FALSE;
make_new = FALSE;
- word = (char *)(feof( fp ) ? "End" : fread_word( fp ));
+ word = (char *)(feof( fp ) ? end : fread_word( fp ));
if (!str_cmp(word,"Vnum" ))
{
int vnum;
@@ -1397,7 +1400,7 @@
if (first)
first = FALSE;
else
- word = (char *)(feof( fp ) ? "End" : fread_word( fp ));
+ word = (char *)(feof( fp ) ? end : fread_word( fp ));
fMatch = FALSE;
switch ( UPPER(word[0]) )