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/unit.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/unit.c')
-rw-r--r-- | src/map/unit.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index 28dd68e7d..7f722684d 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -670,15 +670,15 @@ int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool if( sd->status.pet_id > 0 && sd->pd && sd->pd->pet.intimate > 0 ) { // Check if pet needs to be teleported. [Skotlex] int flag = 0; - struct block_list* bl = &sd->pd->bl; - if( !checkpath && !path->search(NULL,bl->m,bl->x,bl->y,dst_x,dst_y,0,CELL_CHKNOPASS) ) + struct block_list* pbl = &sd->pd->bl; + if( !checkpath && !path->search(NULL,pbl->m,pbl->x,pbl->y,dst_x,dst_y,0,CELL_CHKNOPASS) ) flag = 1; - else if (!check_distance_bl(&sd->bl, bl, AREA_SIZE)) //Too far, teleport. + else if (!check_distance_bl(&sd->bl, pbl, AREA_SIZE)) //Too far, teleport. flag = 2; if( flag ) { - unit->movepos(bl,sd->bl.x,sd->bl.y, 0, 0); - clif->slide(bl,bl->x,bl->y); + unit->movepos(pbl,sd->bl.x,sd->bl.y, 0, 0); + clif->slide(pbl,pbl->x,pbl->y); } } } @@ -720,6 +720,8 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag) struct skill_unit* su = NULL; int nx, ny, result; + nullpo_ret(bl); + sd = BL_CAST(BL_PC, bl); su = BL_CAST(BL_SKILL, bl); |