fix(Core/Movement): properly handle UNIT_STATE_CHARGING (#7152)

- Closes #6065
- Closes #6669
This commit is contained in:
UltraNix
2021-08-05 13:55:11 +02:00
committed by GitHub
parent 7822a270ff
commit 36a1777b99
2 changed files with 13 additions and 6 deletions

View File

@@ -29,6 +29,11 @@ void PointMovementGenerator<T>::DoInitialize(T* unit)
unit->StopMoving();
unit->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
if (id == EVENT_CHARGE)
{
unit->AddUnitState(UNIT_STATE_CHARGING);
}
i_recalculateSpeed = false;
Movement::MoveSplineInit init(unit);
if (m_precomputedPath.size() > 2) // pussywizard: for charge
@@ -131,6 +136,10 @@ template<class T>
void PointMovementGenerator<T>::DoFinalize(T* unit)
{
unit->ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
if (id == EVENT_CHARGE)
{
unit->ClearUnitState(UNIT_STATE_CHARGING);
}
if (unit->movespline->Finalized())
MovementInform(unit);
@@ -143,6 +152,10 @@ void PointMovementGenerator<T>::DoReset(T* unit)
unit->StopMoving();
unit->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
if (id == EVENT_CHARGE)
{
unit->AddUnitState(UNIT_STATE_CHARGING);
}
}
template<class T>