diff options
author | Haru <haru@dotalux.com> | 2013-12-10 19:48:55 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-12-17 01:11:33 +0100 |
commit | 15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48 (patch) | |
tree | c5dd5b25003f8c21381c7a2e1f010dba71e40b90 /src/map/pc.c | |
parent | a23d072a66d2569ba13921522be3c82ae9aad576 (diff) | |
download | hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.gz hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.bz2 hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.xz hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.zip |
Fixed several compiler warnings
- Warnings detected thanks to Xcode's compiler settings (more strict by
default) and clang, warnings mostly but not only related to data sizes
on 64 bit systems, that were silenced until now by very lax compiler
settings.
- This also decreases by a great deal the amount of warnings produced by
MSVC in x64 mode (for the adventurous ones who tried that)
- Also fixed (or silenced in case of false positives) the potential
issues pointed out by the (awesome) clang static analyzer.
- Patch co-produced with Ind, I'm merging and committing in his place!
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index ab5749eb1..24b57c826 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4437,7 +4437,6 @@ int pc_useitem(struct map_session_data *sd,int n) { return 0; if( sd->inventory_data[n]->delay > 0 ) { - int i; ARR_FIND(0, MAX_ITEMDELAYS, i, sd->item_delay[i].nameid == nameid ); if( i == MAX_ITEMDELAYS ) /* item not found. try first empty now */ ARR_FIND(0, MAX_ITEMDELAYS, i, !sd->item_delay[i].nameid ); @@ -4922,9 +4921,10 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int if( i != sd->guild->instances ) { m = instance->list[sd->guild->instance[i]].map[j]; map_index = map_id2index(m); - stop = true; + //stop = true; Uncomment if adding new checks } } + /* we hit a instance, if empty we populate the spawn data */ if( map->list[m].instance_id >= 0 && instance->list[map->list[m].instance_id].respawn.map == 0 && instance->list[map->list[m].instance_id].respawn.x == 0 && @@ -6789,15 +6789,15 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h * Invoked when a player has negative current hp *------------------------------------------*/ int pc_dead(struct map_session_data *sd,struct block_list *src) { - int i=0,j=0,k=0; + int i=0,j=0; int64 tick = timer->gettick(); - for(k = 0; k < 5; k++) - if (sd->devotion[k]){ - struct map_session_data *devsd = map->id2sd(sd->devotion[k]); + for(j = 0; j < 5; j++) + if (sd->devotion[j]){ + struct map_session_data *devsd = map->id2sd(sd->devotion[j]); if (devsd) status_change_end(&devsd->bl, SC_DEVOTION, INVALID_TIMER); - sd->devotion[k] = 0; + sd->devotion[j] = 0; } if(sd->status.pet_id > 0 && sd->pd) { @@ -7057,14 +7057,13 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { if(id == 0) continue; if(id == -1){ - int eq_num=0,eq_n[MAX_INVENTORY]; + int eq_num=0,eq_n[MAX_INVENTORY],k; memset(eq_n,0,sizeof(eq_n)); for(i=0;i<MAX_INVENTORY;i++){ if( (type == 1 && !sd->status.inventory[i].equip) || (type == 2 && sd->status.inventory[i].equip) || type == 3) { - int k; ARR_FIND( 0, MAX_INVENTORY, k, eq_n[k] <= 0 ); if( k < MAX_INVENTORY ) eq_n[k] = i; @@ -10206,7 +10205,7 @@ int pc_readdb(void) { int stat; if(line[0]=='/' && line[1]=='/') continue; - if ((stat=strtoul(line,NULL,10))<0) + if ((stat=(int)strtol(line,NULL,10))<0) stat=0; if (i > MAX_LEVEL) break; |