summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index 09a19e27d..a11b5dc28 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -323,9 +323,13 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
}
//To set Mob's CHASE/FOLLOW states (shouldn't be done if there's no path to reach)
-#define set_mobstate(bl, flag) \
- if((bl)->type == BL_MOB && (flag)) \
- ((TBL_MOB*)(bl))->state.skillstate = ((TBL_MOB*)(bl))->state.aggressive?MSS_FOLLOW:MSS_RUSH;
+static inline void set_mobstate(struct block_list* bl, int flag)
+{
+ struct mob_data* md = BL_CAST(BL_MOB,bl);
+
+ if( md && flag )
+ md->state.skillstate = md->state.aggressive ? MSS_FOLLOW : MSS_RUSH;
+}
static int unit_walktobl_sub(int tid, unsigned int tick, int id, intptr_t data)
{