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.