aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2012-12-29 14:23:23 -0500
committerSubv <s.v.h21@hotmail.com>2012-12-29 14:23:23 -0500
commit3d3a8107e0d3509b6df35b26df914517ecee1938 (patch)
tree4b7c9b2c8ddf5ff8b0c5e82510b00e9015222ff6 /src
parent792edb2880029c64bf55ab444b72c52183304338 (diff)
Core/Entities: Account for creatures that are spawned below ground level when adding flying flags. (Triggers, mostly)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index d0ab5e78c97..e069f5653c9 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -437,7 +437,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
float ground = GetPositionZ();
GetMap()->GetWaterOrGroundLevel(GetPositionX(), GetPositionY(), GetPositionZ(), &ground);
- bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground);
+ bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground + 0.05f) || G3D::fuzzyLt(GetPositionZ(), ground - 0.05f); // Can be underground too, prevent the falling
if (cInfo->InhabitType & INHABIT_AIR && cInfo->InhabitType & INHABIT_GROUND && isInAir)
SetCanFly(true);
@@ -482,7 +482,7 @@ void Creature::Update(uint32 diff)
float ground = GetPositionZ();
GetMap()->GetWaterOrGroundLevel(GetPositionX(), GetPositionY(), GetPositionZ(), &ground);
- bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground + 0.05f);
+ bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground + 0.05f) || G3D::fuzzyLt(GetPositionZ(), ground - 0.05f); // Can be underground too, prevent the falling
CreatureTemplate const* cinfo = GetCreatureTemplate();
if (cinfo->InhabitType & INHABIT_AIR && cinfo->InhabitType & INHABIT_GROUND && isInAir)
@@ -1574,7 +1574,7 @@ void Creature::setDeathState(DeathState s)
float ground = GetPositionZ();
GetMap()->GetWaterOrGroundLevel(GetPositionX(), GetPositionY(), GetPositionZ(), &ground);
- bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground);
+ bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground + 0.05f) || G3D::fuzzyLt(GetPositionZ(), ground - 0.05f); // Can be underground too, prevent the falling
if (cinfo->InhabitType & INHABIT_AIR && cinfo->InhabitType & INHABIT_GROUND && isInAir)
SetCanFly(true);