diff --git a/src/game/MovementGenerator.h b/src/game/MovementGenerator.h index 083cc53a0..62e9d5939 100644 --- a/src/game/MovementGenerator.h +++ b/src/game/MovementGenerator.h @@ -53,7 +53,7 @@ class MANGOS_DLL_SPEC MovementGenerator virtual void unitSpeedChanged() { } // used by Evade code for select point to evade with expected restart default movement - virtual bool GetResetPosition(Unit&, float& /*x*/, float& /*y*/, float& /*z*/) { return false; } + virtual bool GetResetPosition(Unit&, float& /*x*/, float& /*y*/, float& /*z*/) const { return false; } // given destination unreachable? due to pathfinsing or other virtual bool IsReachable() const { return true; } @@ -92,10 +92,10 @@ class MANGOS_DLL_SPEC MovementGeneratorMedium : public MovementGenerator // u->AssertIsType(); return (static_cast(this))->Update(*((T*)&u), time_diff); } - bool GetResetPosition(Unit& u, float& x, float& y, float& z) override + bool GetResetPosition(Unit& u, float& x, float& y, float& z) const override { // u->AssertIsType(); - return (static_cast(this))->GetResetPosition(*((T*)&u), x, y, z); + return (static_cast(this))->GetResetPosition(*((T*)&u), x, y, z); } public: // Will not link if not overridden in the generators @@ -106,7 +106,7 @@ class MANGOS_DLL_SPEC MovementGeneratorMedium : public MovementGenerator bool Update(T& u, const uint32& time_diff); // not need always overwrites - bool GetResetPosition(T& /*u*/, float& /*x*/, float& /*y*/, float& /*z*/) { return false; } + bool GetResetPosition(T& /*u*/, float& /*x*/, float& /*y*/, float& /*z*/) const { return false; } }; struct SelectableMovement : public FactoryHolder diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 1f9cc8b76..4170e9121 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -247,14 +247,16 @@ void WaypointMovementGenerator::MovementInform(Creature& creature) creature.AI()->MovementInform(WAYPOINT_MOTION_TYPE, i_currentNode); } -bool WaypointMovementGenerator::GetResetPosition(Creature&, float& x, float& y, float& z) +bool WaypointMovementGenerator::GetResetPosition(Creature&, float& x, float& y, float& z) const { // prevent a crash at empty waypoint path. if (!i_path || i_path->empty()) return false; - const WaypointNode& node = i_path->at(i_currentNode); - x = node.x; y = node.y; z = node.z; + WaypointPath::const_iterator currPoint = i_path->find(i_currentNode); + MANGOS_ASSERT(currPoint != i_path->end()); + + x = currPoint->second.x; y = currPoint->second.y; z = currPoint->second.z; return true; } @@ -399,7 +401,7 @@ void FlightPathMovementGenerator::DoEventIfAny(Player& player, TaxiPathNodeEntry } } -bool FlightPathMovementGenerator::GetResetPosition(Player&, float& x, float& y, float& z) +bool FlightPathMovementGenerator::GetResetPosition(Player&, float& x, float& y, float& z) const { const TaxiPathNodeEntry& node = (*i_path)[i_currentNode]; x = node.x; y = node.y; z = node.z; diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h index db7171abd..1b3f00895 100644 --- a/src/game/WaypointMovementGenerator.h +++ b/src/game/WaypointMovementGenerator.h @@ -80,7 +80,7 @@ class MANGOS_DLL_SPEC WaypointMovementGenerator // now path movement implmementation void LoadPath(Creature& c); - bool GetResetPosition(Creature&, float& x, float& y, float& z); + bool GetResetPosition(Creature&, float& x, float& y, float& z) const; void AddToWaypointPauseTime(int32 waitTimeDiff); @@ -126,7 +126,7 @@ class MANGOS_DLL_SPEC FlightPathMovementGenerator void SetCurrentNodeAfterTeleport(); void SkipCurrentNode() { ++i_currentNode; } void DoEventIfAny(Player& player, TaxiPathNodeEntry const& node, bool departure); - bool GetResetPosition(Player&, float& x, float& y, float& z); + bool GetResetPosition(Player&, float& x, float& y, float& z) const; }; #endif diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 82700d1f4..308786fe0 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 "12683" + #define REVISION_NR "12684" #endif // __REVISION_NR_H__