From c2a0a18a38d4f7f35d09285b4c2c128ec5229614 Mon Sep 17 00:00:00 2001 From: ApoC Date: Sat, 24 Jan 2009 00:21:29 +0100 Subject: [PATCH] [7158] Added isAlive() check into Unit::SelectHostilTarget() This can fix some unexpected behavior in some scripts which not checking alive state in main UpdateAI() method. Signed-off-by: ApoC --- src/game/Unit.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a11395c9b..65604b3f1 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9349,6 +9349,8 @@ bool Unit::SelectHostilTarget() assert(GetTypeId()== TYPEID_UNIT); + if (!this->isAlive()) + return false; //This function only useful once AI has been initialized if (!((Creature*)this)->AI()) return false; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 4ef3779b2..7f75b49b7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7157" + #define REVISION_NR "7158" #endif // __REVISION_NR_H__