diff options
author | Haru <haru@dotalux.com> | 2015-12-28 00:16:39 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-01-06 15:14:50 +0100 |
commit | f878d5e2156dc88fb73d27473acfe01d72427bbd (patch) | |
tree | 7bcb5cd894ffd776545f4fe480276476c7688252 /src/map/map.c | |
parent | b3c722ecf777aeeea6317755a6adfc0216b7a2bd (diff) | |
download | hercules-f878d5e2156dc88fb73d27473acfe01d72427bbd.tar.gz hercules-f878d5e2156dc88fb73d27473acfe01d72427bbd.tar.bz2 hercules-f878d5e2156dc88fb73d27473acfe01d72427bbd.tar.xz hercules-f878d5e2156dc88fb73d27473acfe01d72427bbd.zip |
Replaced some explicit casts with BL_UCAST/BL_UCCAST
- Replaced casts in foreach callbacks.
- Added assertions and nullpo checks where applicable.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/map/map.c b/src/map/map.c index e3054fb30..0a0a09fcb 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2431,8 +2431,10 @@ void map_spawnmobs(int16 m) { int map_removemobs_sub(struct block_list *bl, va_list ap) { - struct mob_data *md = (struct mob_data *)bl; - nullpo_ret(md); + struct mob_data *md = NULL; + nullpo_ret(bl); + Assert_ret(bl->type == BL_MOB); + md = BL_UCAST(BL_MOB, bl); //When not to remove mob: // doesn't respawn and is not a slave @@ -5332,10 +5334,10 @@ int cleanup_sub(struct block_list *bl, va_list ap) { switch(bl->type) { case BL_PC: - map->quit((struct map_session_data *) bl); + map->quit(BL_UCAST(BL_PC, bl)); break; case BL_NPC: - npc->unload((struct npc_data *)bl,false); + npc->unload(BL_UCAST(BL_NPC, bl), false); break; case BL_MOB: unit->free(bl,CLR_OUTSIGHT); @@ -5347,7 +5349,7 @@ int cleanup_sub(struct block_list *bl, va_list ap) { map->clearflooritem(bl); break; case BL_SKILL: - skill->delunit((struct skill_unit *) bl); + skill->delunit(BL_UCAST(BL_SKILL, bl)); break; } |