[12684] Fix a VC90 compile problem. Also add some const correctness

author @Schmoozerd
This commit is contained in:
sanctum32 2013-10-11 19:52:04 +03:00 committed by Antz
parent ab23f6978a
commit c6ae586f4a
4 changed files with 13 additions and 11 deletions

View file

@ -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<T>();
return (static_cast<D*>(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<T>();
return (static_cast<D*>(this))->GetResetPosition(*((T*)&u), x, y, z);
return (static_cast<D const*>(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<MovementGenerator, MovementGeneratorType>

View file

@ -247,14 +247,16 @@ void WaypointMovementGenerator<Creature>::MovementInform(Creature& creature)
creature.AI()->MovementInform(WAYPOINT_MOTION_TYPE, i_currentNode);
}
bool WaypointMovementGenerator<Creature>::GetResetPosition(Creature&, float& x, float& y, float& z)
bool WaypointMovementGenerator<Creature>::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;

View file

@ -80,7 +80,7 @@ class MANGOS_DLL_SPEC WaypointMovementGenerator<Creature>
// 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

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12683"
#define REVISION_NR "12684"
#endif // __REVISION_NR_H__