aboutsummaryrefslogtreecommitdiff
path: root/src/game/Creature.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r--src/game/Creature.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index bfa185010fd..24fd970bddf 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1648,9 +1648,13 @@ bool Creature::IsWithinSightDist(Unit const* u) const
bool Creature::canStartAttack(Unit const* who, bool force) const
{
- if(isCivilian()
- || !who->isInAccessiblePlaceFor(this)
- || !canFly() && GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
+ if(isCivilian() || !who->isInAccessiblePlaceFor(this))
+ return false;
+
+ if(!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE))
+ //|| who->IsControlledByPlayer() && who->IsFlying()))
+ // we cannot check flying for other creatures, too much map/vmap calculation
+ // TODO: should switch to range attack
return false;
if(!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who))))
@@ -2190,6 +2194,9 @@ bool Creature::LoadCreaturesAddon(bool reload)
if (cainfo->move_flags != 0)
SetUnitMovementFlags(cainfo->move_flags);
+ if(GetCreatureInfo()->InhabitType & INHABIT_AIR)
+ AddUnitMovementFlag(MOVEMENTFLAG_FLY_MODE);
+
if(cainfo->auras)
{
for (CreatureDataAddonAura const* cAura = cainfo->auras; cAura->spell_id; ++cAura)
@@ -2504,4 +2511,4 @@ time_t Creature::GetLinkedCreatureRespawnTime() const
}
return 0;
-} \ No newline at end of file
+}