Core/MovementGenerators: Ensure correct virtual function overrides are called. May/should/will/could/might fix various different movement related issues. Please report back.
This commit is contained in:
@@ -38,7 +38,7 @@ class MovementGenerator
|
|||||||
|
|
||||||
virtual void Reset(Unit &) = 0;
|
virtual void Reset(Unit &) = 0;
|
||||||
|
|
||||||
virtual bool Update(Unit &, const uint32 time_diff) = 0;
|
virtual bool Update(Unit &, const uint32& time_diff) = 0;
|
||||||
|
|
||||||
virtual MovementGeneratorType GetMovementGeneratorType() = 0;
|
virtual MovementGeneratorType GetMovementGeneratorType() = 0;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ class MovementGeneratorMedium : public MovementGenerator
|
|||||||
//u->AssertIsType<T>();
|
//u->AssertIsType<T>();
|
||||||
(static_cast<D*>(this))->Reset(*((T*)&u));
|
(static_cast<D*>(this))->Reset(*((T*)&u));
|
||||||
}
|
}
|
||||||
bool Update(Unit &u, const uint32 time_diff)
|
bool Update(Unit &u, const uint32& time_diff)
|
||||||
{
|
{
|
||||||
//u->AssertIsType<T>();
|
//u->AssertIsType<T>();
|
||||||
return (static_cast<D*>(this))->Update(*((T*)&u), time_diff);
|
return (static_cast<D*>(this))->Update(*((T*)&u), time_diff);
|
||||||
@@ -74,7 +74,7 @@ class MovementGeneratorMedium : public MovementGenerator
|
|||||||
void Initialize(T &u);
|
void Initialize(T &u);
|
||||||
void Finalize(T &u);
|
void Finalize(T &u);
|
||||||
void Reset(T &u);
|
void Reset(T &u);
|
||||||
bool Update(T &u, const uint32 time_diff);
|
bool Update(T &u, const uint32& time_diff);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SelectableMovement : public FactoryHolder<MovementGenerator, MovementGeneratorType>
|
struct SelectableMovement : public FactoryHolder<MovementGenerator, MovementGeneratorType>
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ void TimedFleeingMovementGenerator::Finalize(Unit &owner)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 time_diff)
|
bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32& time_diff)
|
||||||
{
|
{
|
||||||
if (!owner.isAlive())
|
if (!owner.isAlive())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class TimedFleeingMovementGenerator
|
|||||||
i_totalFleeTime(time) {}
|
i_totalFleeTime(time) {}
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return TIMED_FLEEING_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() { return TIMED_FLEEING_MOTION_TYPE; }
|
||||||
bool Update(Unit &, const uint32);
|
bool Update(Unit &, const uint32&);
|
||||||
void Finalize(Unit &);
|
void Finalize(Unit &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void RotateMovementGenerator::Initialize(Unit& owner)
|
|||||||
owner.AttackStop();
|
owner.AttackStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RotateMovementGenerator::Update(Unit& owner, const uint32 diff)
|
bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
|
||||||
{
|
{
|
||||||
float angle = owner.GetOrientation();
|
float angle = owner.GetOrientation();
|
||||||
if (m_direction == ROTATE_DIRECTION_LEFT)
|
if (m_direction == ROTATE_DIRECTION_LEFT)
|
||||||
@@ -93,7 +93,7 @@ DistractMovementGenerator::Finalize(Unit& owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DistractMovementGenerator::Update(Unit& /*owner*/, const uint32 time_diff)
|
DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
|
||||||
{
|
{
|
||||||
if (time_diff > m_timer)
|
if (time_diff > m_timer)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class IdleMovementGenerator : public MovementGenerator
|
|||||||
void Initialize(Unit &);
|
void Initialize(Unit &);
|
||||||
void Finalize(Unit &) { }
|
void Finalize(Unit &) { }
|
||||||
void Reset(Unit &);
|
void Reset(Unit &);
|
||||||
bool Update(Unit &, const uint32) { return true; }
|
bool Update(Unit &, const uint32&) { return true; }
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return IDLE_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() { return IDLE_MOTION_TYPE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ class RotateMovementGenerator : public MovementGenerator
|
|||||||
void Initialize(Unit& owner);
|
void Initialize(Unit& owner);
|
||||||
void Finalize(Unit& owner);
|
void Finalize(Unit& owner);
|
||||||
void Reset(Unit& owner) { Initialize(owner); }
|
void Reset(Unit& owner) { Initialize(owner); }
|
||||||
bool Update(Unit& owner, const uint32 time_diff);
|
bool Update(Unit& owner, const uint32& time_diff);
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return ROTATE_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() { return ROTATE_MOTION_TYPE; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -58,7 +58,7 @@ class DistractMovementGenerator : public MovementGenerator
|
|||||||
void Initialize(Unit& owner);
|
void Initialize(Unit& owner);
|
||||||
void Finalize(Unit& owner);
|
void Finalize(Unit& owner);
|
||||||
void Reset(Unit& owner) { Initialize(owner); }
|
void Reset(Unit& owner) { Initialize(owner); }
|
||||||
bool Update(Unit& owner, const uint32 time_diff);
|
bool Update(Unit& owner, const uint32& time_diff);
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return DISTRACT_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() { return DISTRACT_MOTION_TYPE; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ void AssistanceMovementGenerator::Finalize(Unit &unit)
|
|||||||
unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY));
|
unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectMovementGenerator::Update(Unit &unit, const uint32)
|
bool EffectMovementGenerator::Update(Unit &unit, const uint32&)
|
||||||
{
|
{
|
||||||
return !unit.movespline->Finalized();
|
return !unit.movespline->Finalized();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class EffectMovementGenerator : public MovementGenerator
|
|||||||
void Initialize(Unit &) {}
|
void Initialize(Unit &) {}
|
||||||
void Finalize(Unit &unit);
|
void Finalize(Unit &unit);
|
||||||
void Reset(Unit &) {}
|
void Reset(Unit &) {}
|
||||||
bool Update(Unit &u, const uint32);
|
bool Update(Unit &u, const uint32&);
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return EFFECT_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() { return EFFECT_MOTION_TYPE; }
|
||||||
private:
|
private:
|
||||||
uint32 m_Id;
|
uint32 m_Id;
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ void FlightPathMovementGenerator::Reset(Player & player)
|
|||||||
init.Launch();
|
init.Launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FlightPathMovementGenerator::Update(Player &player, const uint32 /*diff*/)
|
bool FlightPathMovementGenerator::Update(Player &player, const uint32& /*diff*/)
|
||||||
{
|
{
|
||||||
uint32 pointId = (uint32)player.movespline->currentPathIdx();
|
uint32 pointId = (uint32)player.movespline->currentPathIdx();
|
||||||
if (pointId > i_currentNode)
|
if (pointId > i_currentNode)
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public PathMovementBase<Player, TaxiPathNodeList const*>
|
|||||||
void Initialize(Player &);
|
void Initialize(Player &);
|
||||||
void Reset(Player &);
|
void Reset(Player &);
|
||||||
void Finalize(Player &);
|
void Finalize(Player &);
|
||||||
bool Update(Player &, const uint32);
|
bool Update(Player &, const uint32&);
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; }
|
||||||
|
|
||||||
TaxiPathNodeList const& GetPath() { return *i_path; }
|
TaxiPathNodeList const& GetPath() { return *i_path; }
|
||||||
|
|||||||
Reference in New Issue
Block a user