diff options
author | Vincent_Michael <Vincent_Michael@gmx.de> | 2012-12-29 15:33:57 +0100 |
---|---|---|
committer | Vincent_Michael <Vincent_Michael@gmx.de> | 2012-12-29 15:33:57 +0100 |
commit | ae47b641e10a5af32ba7858504ebeac1915f6841 (patch) | |
tree | 828b122510e4277c6ababe5fe53155dc1713f79b /src | |
parent | 24eba2359a66e9b897baac6662fb94f7d64ff94e (diff) | |
parent | 91f1e53ba2c601d2190d54f2ed058dfef000f22a (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 17 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 25 |
2 files changed, 17 insertions, 25 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 3e03b91c217..bfe76f33e29 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -480,6 +480,23 @@ void Creature::Update(uint32 diff) RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING); } + // Set the movement flags if the creature is in that mode. (Only fly if actually in air, only swim if in water, etc) + float ground = GetPositionZ(); + GetMap()->GetWaterOrGroundLevel(GetPositionX(), GetPositionY(), GetPositionZ(), &ground); + + bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground + 0.05f); + CreatureTemplate const* cinfo = GetCreatureTemplate(); + + if (cinfo->InhabitType & INHABIT_AIR && cinfo->InhabitType & INHABIT_GROUND && isInAir) + SetCanFly(true); + else if (cinfo->InhabitType & INHABIT_AIR && isInAir) + SetDisableGravity(true); + else + { + SetCanFly(false); + SetDisableGravity(false); + } + switch (m_deathState) { case JUST_RESPAWNED: diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 7df33ceb2d8..860bf13ca8a 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16781,31 +16781,6 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel else if (turn) UpdateOrientation(orientation); - if (Creature* creature = ToCreature()) - { - // Set the movement flags if the creature is in that mode. (Only fly if actually in air, only swim if in water, etc) - float ground = z; - GetMap()->GetWaterOrGroundLevel(x, y, z, &ground); - - bool isInAir = G3D::fuzzyGt(z, ground); - CreatureTemplate const* cinfo = creature->GetCreatureTemplate(); - - if (cinfo->InhabitType & INHABIT_AIR && cinfo->InhabitType & INHABIT_GROUND && isInAir) - SetCanFly(true); - else if (cinfo->InhabitType & INHABIT_AIR && isInAir) - SetDisableGravity(true); - else - { - SetCanFly(false); - SetDisableGravity(false); - } - - if (cinfo->InhabitType & INHABIT_WATER && GetMap()->IsInWater(x, y, z)) - AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING); - else - RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING); - } - // code block for underwater state update UpdateUnderwaterState(GetMap(), x, y, z); |