diff options
author | megamage <none@none> | 2009-06-15 12:02:55 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-06-15 12:02:55 -0500 |
commit | b9610f27dd2c55f63f9a96f1259a8dce33b71d88 (patch) | |
tree | 4920b011dc839e2c4901e31d8996a206bff63808 /src/game/Creature.cpp | |
parent | 4d6fb6c8b2d84996711fa8bc41e71fa6d483b98c (diff) |
*Check movementflag to interrupt casting instead of checking position.
*Also some other fixes about movement flags.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r-- | src/game/Creature.cpp | 15 |
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 +} |