diff options
author | Haru <haru@dotalux.com> | 2013-09-25 00:29:15 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-09-25 00:29:15 +0200 |
commit | 44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7 (patch) | |
tree | 1c1e300503d99ecbe8b41355daa716858aaece5d /src/map/mob.c | |
parent | b9c8f57b92d2935db971a38e144529682712dc82 (diff) | |
download | hercules-44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7.tar.gz hercules-44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7.tar.bz2 hercules-44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7.tar.xz hercules-44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7.zip |
Renamed more forgotten variables during interface conversions
(related: b9c8f57)
Most renames are trivial (just to avoid shadowing global variables, even
if they currently did no harm), but there were some cases of partly
renamed variables that caused some NULL checks to always pass and who
knows what could have been happened when they were too subtle to make
the application crash.
Also corrected some potentially unsafe macro definitions
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 0c1ad0d5d..42e127b5f 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -3887,26 +3887,21 @@ bool mob_parse_dbrow(char** str) /*========================================== * mob_db.txt reading *------------------------------------------*/ -bool mob_readdb_sub(char* fields[], int columns, int current) -{ +bool mob_readdb_sub(char* fields[], int columns, int current) { return mob->parse_dbrow(fields); } -void mob_readdb(void) -{ +void mob_readdb(void) { const char* filename[] = { DBPATH"mob_db.txt", "mob_db2.txt" }; int fi; - for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) - { - if(fi > 0) - { - char path[256]; - sprintf(path, "%s/%s", iMap->db_path, filename[fi]); - if(!exists(path)) - { + for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) { + if(fi > 0) { + char filepath[256]; + sprintf(filepath, "%s/%s", iMap->db_path, filename[fi]); + if(!exists(filepath)) { continue; } } @@ -4135,23 +4130,20 @@ bool mob_parse_row_chatdb(char** str, const char* source, int line, int* last_ms /*========================================== * mob_chat_db.txt reading [SnakeDrak] *-------------------------------------------------------------------------*/ -void mob_readchatdb(void) -{ +void mob_readchatdb(void) { char arc[]="mob_chat_db.txt"; uint32 lines=0, count=0; - char line[1024], path[256]; + char line[1024], filepath[256]; int i, tmp=0; FILE *fp; - sprintf(path, "%s/%s", iMap->db_path, arc); - fp=fopen(path, "r"); - if(fp == NULL) - { - ShowWarning("mob_readchatdb: File not found \"%s\", skipping.\n", path); + sprintf(filepath, "%s/%s", iMap->db_path, arc); + fp=fopen(filepath, "r"); + if(fp == NULL) { + ShowWarning("mob_readchatdb: File not found \"%s\", skipping.\n", filepath); return; } - while(fgets(line, sizeof(line), fp)) - { + while(fgets(line, sizeof(line), fp)) { char *str[3], *p, *np; int j=0; @@ -4179,7 +4171,7 @@ void mob_readchatdb(void) continue; } - if( !mob->parse_row_chatdb(str, path, lines, &tmp) ) + if( !mob->parse_row_chatdb(str, filepath, lines, &tmp) ) continue; count++; @@ -4457,20 +4449,16 @@ void mob_readskilldb(void) { "mob_skill_db2.txt" }; int fi; - if( battle_config.mob_skill_rate == 0 ) - { + if( battle_config.mob_skill_rate == 0 ) { ShowStatus("Mob skill use disabled. Not reading mob skills.\n"); return; } - for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) - { - if(fi > 0) - { - char path[256]; - sprintf(path, "%s/%s", iMap->db_path, filename[fi]); - if(!exists(path)) - { + for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) { + if(fi > 0) { + char filepath[256]; + sprintf(filepath, "%s/%s", iMap->db_path, filename[fi]); + if(!exists(filepath)) { continue; } } |