From f878d5e2156dc88fb73d27473acfe01d72427bbd Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 28 Dec 2015 00:16:39 +0100 Subject: 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 --- src/map/map.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/map/map.c') 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; } -- cgit v1.2.3-60-g2f50