From 208398017a3b83e37e6d657c0444622d70f617d3 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 24 Mar 2009 09:46:45 -0600 Subject: [7529] Hide some implementation details for fall damage calculation and breath timers. Author: VladimirMangos --HG-- branch : trunk --- src/game/MovementHandler.cpp | 3 +-- src/game/Player.cpp | 9 +++++++++ src/game/Player.h | 15 +++++++++------ 3 files changed, 19 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 7acc0a36386..2ec6022ca39 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -273,8 +273,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) } } - if (GetPlayer()->m_lastFallTime >= movementInfo.fallTime || GetPlayer()->m_lastFallZ <=movementInfo.z || recv_data.GetOpcode() == MSG_MOVE_FALL_LAND) - GetPlayer()->SetFallInformation(movementInfo.fallTime, movementInfo.z); + GetPlayer()->UpdateFallInformationIfNeed(movementInfo,MSG_MOVE_FALL_LAND); if(GetPlayer()->isMovingOrTurning()) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a4b9ceabb60..b688c48fc52 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -468,6 +468,9 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this) m_farsightVision = false; m_runes = NULL; + + m_lastFallTime = 0; + m_lastFallZ = 0; } Player::~Player () @@ -20948,3 +20951,9 @@ void Player::UpdateKnownCurrencies(uint32 itemId, bool apply) RemoveFlag64(PLAYER_FIELD_KNOWN_CURRENCIES,(1LL << (ctEntry->BitIndex-1))); } } + +void Player::UpdateFallInformationIfNeed( MovementInfo const& minfo,uint16 opcode ) +{ + if (m_lastFallTime >= minfo.fallTime || m_lastFallZ <=minfo.z || opcode == MSG_MOVE_FALL_LAND) + SetFallInformation(minfo.fallTime, minfo.z); +} diff --git a/src/game/Player.h b/src/game/Player.h index bc64311c055..53005250160 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1958,8 +1958,7 @@ class TRINITY_DLL_SPEC Player : public Unit /*** VARIOUS SYSTEMS ***/ /*********************************************************/ MovementInfo m_movementInfo; - uint32 m_lastFallTime; - float m_lastFallZ; + void UpdateFallInformationIfNeed(MovementInfo const& minfo,uint16 opcode); Unit *m_mover; WorldObject *m_seer; void SetFallInformation(uint32 time, float z) @@ -2210,10 +2209,6 @@ class TRINITY_DLL_SPEC Player : public Unit void StopMirrorTimer(MirrorTimerType Type); void HandleDrowning(uint32 time_diff); int32 getMaxTimer(MirrorTimerType timer); - int32 m_MirrorTimer[MAX_TIMERS]; - uint8 m_MirrorTimerFlags; - uint8 m_MirrorTimerFlagsLast; - bool m_isInWater; /*********************************************************/ /*** HONOR SYSTEM ***/ @@ -2379,6 +2374,14 @@ class TRINITY_DLL_SPEC Player : public Unit void UpdateCharmedAI(); UnitAI *i_AI; + + uint32 m_lastFallTime; + float m_lastFallZ; + + int32 m_MirrorTimer[MAX_TIMERS]; + uint8 m_MirrorTimerFlags; + uint8 m_MirrorTimerFlagsLast; + bool m_isInWater; }; void AddItemsSetItem(Player*player,Item *item); -- cgit v1.2.3