summaryrefslogtreecommitdiff
path: root/src/map/script.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/script.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/script.c')
-rw-r--r--src/map/script.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 7581531da..befb85304 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10395,7 +10395,15 @@ BUILDIN(announce) {
if( flag&(BC_TARGET_MASK|BC_SOURCE_MASK) ) {
// Broadcast source or broadcast region defined
send_target target;
- struct block_list *bl = (flag&BC_NPC) ? map->id2bl(st->oid) : (struct block_list *)script->rid2sd(st); // If bc_npc flag is set, use NPC as broadcast source
+ struct block_list *bl = NULL;
+ if (flag&BC_NPC) {
+ // If bc_npc flag is set, use NPC as broadcast source
+ bl = map->id2bl(st->oid);
+ } else {
+ struct map_session_data *sd = script->rid2sd(st);
+ if (sd != NULL)
+ bl = &sd->bl;
+ }
if (bl == NULL)
return true;
@@ -17614,15 +17622,15 @@ BUILDIN(bg_monster)
return true;
}
-BUILDIN(bg_monster_set_team) {
- struct mob_data *md;
- struct block_list *mbl;
+BUILDIN(bg_monster_set_team)
+{
int id = script_getnum(st,2),
bg_id = script_getnum(st,3);
+ struct block_list *mbl = map->id2bl(id); // TODO: Why does this not use map->id2md?
+ struct mob_data *md = BL_CAST(BL_MOB, mbl);
- if( (mbl = map->id2bl(id)) == NULL || mbl->type != BL_MOB )
+ if (md == NULL)
return true;
- md = (struct mob_data *)mbl;
md->bg_id = bg_id;
mob_stop_attack(md);