From 46acf64d0f44956b0ceee8ff00721ae05f363dcc Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 30 Sep 2014 22:48:04 +0200 Subject: Core/GameObjects: Fixed possible crashes if transport objects don't have entries in TransportAnimation.dbc --- src/server/game/Entities/GameObject/GameObject.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 5b4f6807a8a..2d06fe396b8 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -243,8 +243,9 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 /*phase case GAMEOBJECT_TYPE_TRANSPORT: { m_goValue.Transport.AnimationInfo = sTransportMgr->GetTransportAnimInfo(goinfo->entry); - m_goValue.Transport.PathProgress = (getMSTime() / GetTransportPeriod()); - m_goValue.Transport.PathProgress *= GetTransportPeriod(); + m_goValue.Transport.PathProgress = getMSTime(); + if (m_goValue.Transport.AnimationInfo) + m_goValue.Transport.PathProgress -= m_goValue.Transport.PathProgress % GetTransportPeriod(); // align to period m_goValue.Transport.CurrentSeg = 0; m_goValue.Transport.StateUpdateTimer = 0; m_goValue.Transport.StopFrames = new std::vector(); @@ -2129,7 +2130,9 @@ void GameObject::SetTransportState(GOState state, uint32 stopFrame /*= 0*/) if (state == GO_STATE_TRANSPORT_ACTIVE) { m_goValue.Transport.StateUpdateTimer = 0; - m_goValue.Transport.PathProgress = getMSTime() + m_goValue.Transport.StopFrames->at(GetGoState() - GO_STATE_TRANSPORT_STOPPED); + m_goValue.Transport.PathProgress = getMSTime(); + if (GetGoState() >= GO_STATE_TRANSPORT_STOPPED) + m_goValue.Transport.StopFrames->at(GetGoState() - GO_STATE_TRANSPORT_STOPPED); SetGoState(GO_STATE_TRANSPORT_ACTIVE); } else -- cgit v1.2.3