diff options
author | Haru <haru@dotalux.com> | 2015-12-28 15:41:36 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-01-06 15:18:39 +0100 |
commit | e3eac134b1607cfe78331e298aaa20b260662571 (patch) | |
tree | 135f15dadc1c7964b3078fd8223771f94d1ed0e6 /src/map/pet.c | |
parent | 0e05c1ed742707e0eb5923b562b2f6b8c6c5a3be (diff) | |
download | hercules-e3eac134b1607cfe78331e298aaa20b260662571.tar.gz hercules-e3eac134b1607cfe78331e298aaa20b260662571.tar.bz2 hercules-e3eac134b1607cfe78331e298aaa20b260662571.tar.xz hercules-e3eac134b1607cfe78331e298aaa20b260662571.zip |
Replaced the remaining explicit casts with BL_CAST/BL_UCAST
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/pet.c')
-rw-r--r-- | src/map/pet.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/map/pet.c b/src/map/pet.c index 501dc8c27..db8d0d1f1 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -359,9 +359,10 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo) sd->status.pet_id = 0; return 1; } - sd->pd = pd = (struct pet_data *)aCalloc(1,sizeof(struct pet_data)); + CREATE(pd, struct pet_data, 1); pd->bl.type = BL_PET; pd->bl.id = npc->get_new_npc_id(); + sd->pd = pd; pd->msd = sd; pd->petDB = &pet->db[i]; @@ -505,13 +506,15 @@ int pet_catch_process1(struct map_session_data *sd,int target_class) } int pet_catch_process2(struct map_session_data* sd, int target_id) { - struct mob_data* md; + struct mob_data *md = NULL; + struct block_list *bl = NULL; int i = 0, pet_catch_rate = 0; nullpo_retr(1, sd); - md = (struct mob_data*)map->id2bl(target_id); - if(!md || md->bl.type != BL_MOB || md->bl.prev == NULL) { + bl = map->id2bl(target_id); // TODO: Why does this not use map->id2md? + md = BL_CAST(BL_MOB, bl); + if (md == NULL || md->bl.prev == NULL) { // Invalid inputs/state, abort capture. clif->pet_roulette(sd,0); sd->catch_target_class = -1; |