diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 1f924660c..39a954a4a 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -418,9 +418,10 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) // sLog.outDetail(" Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer); - m_curr = m_WayPoints.begin(); - m_curr = GetNextWayPoint(); - m_next = GetNextWayPoint(); + m_next = m_WayPoints.begin(); // will used in MoveToNextWayPoint for init m_curr + MoveToNextWayPoint(); // m_curr -> first point + MoveToNextWayPoint(); // skip first point + m_pathTime = timer; m_nextNodeTime = m_curr->first; @@ -428,13 +429,13 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) return true; } -Transport::WayPointMap::const_iterator Transport::GetNextWayPoint() +void Transport::MoveToNextWayPoint() { - WayPointMap::const_iterator iter = m_curr; - ++iter; - if (iter == m_WayPoints.end()) - iter = m_WayPoints.begin(); - return iter; + m_curr = m_next; + + ++m_next; + if (m_next == m_WayPoints.end()) + m_next = m_WayPoints.begin(); } void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) @@ -506,8 +507,7 @@ void Transport::Update(uint32 /*p_time*/) DoEventIfAny(*m_curr,true); - m_curr = GetNextWayPoint(); - m_next = GetNextWayPoint(); + MoveToNextWayPoint(); DoEventIfAny(*m_curr,false); diff --git a/src/game/Transports.h b/src/game/Transports.h index a7917d69d..fe69f4f85 100644 --- a/src/game/Transports.h +++ b/src/game/Transports.h @@ -76,6 +76,6 @@ class Transport : public GameObject void TeleportTransport(uint32 newMapid, float x, float y, float z); void UpdateForMap(Map const* map); void DoEventIfAny(WayPointMap::value_type const& node, bool departure); - WayPointMap::const_iterator GetNextWayPoint(); + void MoveToNextWayPoint(); // move m_next/m_cur to next points }; #endif diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c6996b0e9..ca8761ff1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10807" + #define REVISION_NR "10808" #endif // __REVISION_NR_H__