summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-12-28 00:16:39 +0100
committerHaru <haru@dotalux.com>2016-01-06 15:14:50 +0100
commitf878d5e2156dc88fb73d27473acfe01d72427bbd (patch)
tree7bcb5cd894ffd776545f4fe480276476c7688252 /src/map/pet.c
parentb3c722ecf777aeeea6317755a6adfc0216b7a2bd (diff)
downloadhercules-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/pet.c')
-rw-r--r--src/map/pet.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index 18a5ba915..8726b611b 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -964,15 +964,16 @@ int pet_ai_hard(int tid, int64 tick, int id, intptr_t data) {
return 0;
}
-int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
+int pet_ai_sub_hard_lootsearch(struct block_list *bl, va_list ap)
{
- struct pet_data* pd;
- struct flooritem_data *fitem = (struct flooritem_data *)bl;
- struct block_list **target;
- int sd_charid =0;
-
- pd=va_arg(ap,struct pet_data *);
- target=va_arg(ap,struct block_list**);
+ struct pet_data *pd = va_arg(ap,struct pet_data *);
+ struct block_list **target = va_arg(ap,struct block_list**);
+ struct flooritem_data *fitem = NULL;
+ int sd_charid = 0;
+
+ nullpo_ret(bl);
+ Assert_ret(bl->type == BL_ITEM);
+ fitem = BL_UCAST(BL_ITEM, bl);
sd_charid = fitem->first_get_charid;