diff options
author | Machiavelli <none@none> | 2010-06-27 03:47:18 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2010-06-27 03:47:18 +0200 |
commit | 26f4fae8020ac805376c9b696331857ed1004c94 (patch) | |
tree | 01e06f4e490372a26d66e26f5bfa267a978c5a5b /src | |
parent | 0fd3e47edcd1cea73a29a101221a3dbe131b4df7 (diff) |
Fix bug that creatures which use FleeingMovementGenerator would not attack after respawning.
Bug was caused by improper react state
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 11 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 11 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 8bff608c149..f51b7a585bd 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -410,13 +410,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data) if (isTrigger()) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (isTotem() || isTrigger() - || GetCreatureType() == CREATURE_TYPE_CRITTER) - SetReactState(REACT_PASSIVE); - /*else if (isCivilian()) - SetReactState(REACT_DEFENSIVE);*/ - else - SetReactState(REACT_AGGRESSIVE); + InitializeReactState(); if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_NO_TAUNT) { @@ -1602,6 +1596,9 @@ void Creature::Respawn(bool force) uint16 poolid = GetDBTableGUIDLow() ? poolhandler.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0; if (poolid) poolhandler.UpdatePool<Creature>(poolid, GetDBTableGUIDLow()); + + //Re-initialize reactstate that could be altered by movementgenerators + InitializeReactState(); } UpdateObjectVisibility(); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index ae37ba56fd3..11b8ce29763 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -428,9 +428,20 @@ class Creature : public Unit, public GridObject<Creature> bool canWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; } bool canSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; } //bool canFly() const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; } + void SetReactState(ReactStates st) { m_reactState = st; } ReactStates GetReactState() { return m_reactState; } bool HasReactState(ReactStates state) const { return (m_reactState == state); } + void InitializeReactState() + { + if (isTotem() || isTrigger() || GetCreatureType() == CREATURE_TYPE_CRITTER) + SetReactState(REACT_PASSIVE); + else + SetReactState(REACT_AGGRESSIVE); + /*else if (isCivilian()) + SetReactState(REACT_DEFENSIVE);*/; + } + ///// TODO RENAME THIS!!!!! bool isCanTrainingOf(Player* player, bool msg) const; bool isCanInteractWithBattleMaster(Player* player, bool msg) const; |