summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-08-22 20:33:06 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-08-22 20:33:06 +0000
commit082687fc204c7b40bf676ad710c2488048571b73 (patch)
tree59b356c4d4cc86122ef42c46d9500ddeb93ba6bc /src/map/mob.c
parenta31d779891778d76d1c0fac3544e6dd1627da98a (diff)
downloadhercules-082687fc204c7b40bf676ad710c2488048571b73.tar.gz
hercules-082687fc204c7b40bf676ad710c2488048571b73.tar.bz2
hercules-082687fc204c7b40bf676ad710c2488048571b73.tar.xz
hercules-082687fc204c7b40bf676ad710c2488048571b73.zip
Major cleanup all over the place, made possible by mkbu95's scan-build report he provided us with.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16687 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 14a520ab8..6266f3042 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1189,16 +1189,13 @@ static int mob_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
return 0;
}
-static int mob_warpchase_sub(struct block_list *bl,va_list ap)
-{
- struct mob_data* md;
+static int mob_warpchase_sub(struct block_list *bl,va_list ap) {
struct block_list *target;
struct npc_data **target_nd;
struct npc_data *nd;
int *min_distance;
int cur_distance;
- md=va_arg(ap,struct mob_data *);
target= va_arg(ap, struct block_list*);
target_nd= va_arg(ap, struct npc_data**);
min_distance= va_arg(ap, int*);
@@ -1410,7 +1407,7 @@ int mob_warpchase(struct mob_data *md, struct block_list *target)
//Search for warps within mob's viewing range.
map_foreachinrange (mob_warpchase_sub, &md->bl,
- md->db->range2, BL_NPC, md, target, &warp, &distance);
+ md->db->range2, BL_NPC, target, &warp, &distance);
if (warp && unit_walktobl(&md->bl, &warp->bl, 1, 1))
return 1;
@@ -3903,20 +3900,17 @@ static int mob_read_sqldb(void)
const char* mob_db_name[] = { mob_db_db, mob_db2_db };
int fi;
- for( fi = 0; fi < ARRAYLENGTH(mob_db_name); ++fi )
- {
+ for( fi = 0; fi < ARRAYLENGTH(mob_db_name); ++fi ) {
uint32 lines = 0, count = 0;
// retrieve all rows from the mob database
- if( SQL_ERROR == Sql_Query(mmysql_handle, "SELECT * FROM `%s`", mob_db_name[fi]) )
- {
+ if( SQL_ERROR == Sql_Query(mmysql_handle, "SELECT * FROM `%s`", mob_db_name[fi]) ) {
Sql_ShowDebug(mmysql_handle);
continue;
}
// process rows one by one
- while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) )
- {
+ while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) ) {
// wrap the result into a TXT-compatible format
char line[1024];
char* str[31+2*MAX_MVP_DROP+2*MAX_MOB_DROP];
@@ -3945,7 +3939,6 @@ static int mob_read_sqldb(void)
Sql_FreeResult(mmysql_handle);
ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, mob_db_name[fi]);
- count = 0;
}
return 0;
}
@@ -4476,27 +4469,23 @@ static int mob_read_sqlskilldb(void)
const char* mob_skill_db_name[] = { mob_skill_db_db, mob_skill_db2_db };
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 0;
}
- for( fi = 0; fi < ARRAYLENGTH(mob_skill_db_name); ++fi )
- {
+ for( fi = 0; fi < ARRAYLENGTH(mob_skill_db_name); ++fi ) {
uint32 lines = 0, count = 0;
// retrieve all rows from the mob skill database
- if( SQL_ERROR == Sql_Query(mmysql_handle, "SELECT * FROM `%s`", mob_skill_db_name[fi]) )
- {
+ if( SQL_ERROR == Sql_Query(mmysql_handle, "SELECT * FROM `%s`", mob_skill_db_name[fi]) ) {
Sql_ShowDebug(mmysql_handle);
continue;
}
// process rows one by one
- while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) )
- {
+ while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) ) {
// wrap the result into a TXT-compatible format
char* str[19];
char* dummy = "";
@@ -4518,7 +4507,6 @@ static int mob_read_sqlskilldb(void)
Sql_FreeResult(mmysql_handle);
ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, mob_skill_db_name[fi]);
- count = 0;
}
return 0;
}