summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-12-28 15:41:36 +0100
committerHaru <haru@dotalux.com>2016-01-06 15:18:39 +0100
commite3eac134b1607cfe78331e298aaa20b260662571 (patch)
tree135f15dadc1c7964b3078fd8223771f94d1ed0e6 /src/map/unit.c
parent0e05c1ed742707e0eb5923b562b2f6b8c6c5a3be (diff)
downloadhercules-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/unit.c')
-rw-r--r--src/map/unit.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index 53d0a9bf4..03334f7f3 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -93,9 +93,10 @@ struct unit_data* unit_bl2ud(struct block_list *bl)
* @param bl block_list to process
* @return a pointer to the given object's unit_data
*/
-struct unit_data* unit_bl2ud2(struct block_list *bl) {
- if( bl && bl->type == BL_NPC && ((struct npc_data*)bl)->ud == &npc->base_ud ) {
- struct npc_data *nd = (struct npc_data *)bl;
+struct unit_data *unit_bl2ud2(struct block_list *bl)
+{
+ struct npc_data *nd = BL_CAST(BL_NPC, bl);
+ if (nd != NULL && nd->ud == &npc->base_ud) {
nd->ud = NULL;
CREATE(nd->ud, struct unit_data, 1);
unit->dataset(&nd->bl);
@@ -1261,13 +1262,17 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
break;
case WE_MALE:
case WE_FEMALE:
+ {
+ struct map_session_data *p_sd = NULL;
if (!sd->status.partner_id)
return 0;
- target = (struct block_list*)map->charid2sd(sd->status.partner_id);
- if (!target) {
+ p_sd = map->charid2sd(sd->status.partner_id);
+ if (p_sd == NULL) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
+ target = &p_sd->bl;
+ }
break;
case GC_WEAPONCRUSH:
if( sc && sc->data[SC_COMBOATTACK] && sc->data[SC_COMBOATTACK]->val1 == GC_WEAPONBLOCKING ) {