mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[9208] Big cleanup in UNIT_STAT_* use
* Re-number enums by function groups and use where possible new defined masks in code instead raw enum |-lists. * Avoid use movement generator generic state markers like UNIT_STAT_CONFUSED for mark movement stoped. Add special shadow UNIT_STAT_CONFUSED_MOVE/etc states for like use. UNIT_STAT_CONFUSED in like case will be safe expect use for normal checks confused state presence And UNIT_STAT_CONFUSED_MOVE for check real move in this state
This commit is contained in:
parent
7d6b1b292e
commit
6a2e8064f1
25 changed files with 251 additions and 104 deletions
|
|
@ -28,7 +28,7 @@ template<class T>
|
|||
void PointMovementGenerator<T>::Initialize(T &unit)
|
||||
{
|
||||
unit.StopMoving();
|
||||
unit.addUnitState(UNIT_STAT_ROAMING);
|
||||
unit.addUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
|
||||
Traveller<T> traveller(unit);
|
||||
i_destinationHolder.SetDestination(traveller,i_x,i_y,i_z);
|
||||
|
||||
|
|
@ -36,17 +36,40 @@ void PointMovementGenerator<T>::Initialize(T &unit)
|
|||
((Creature&)unit).AddMonsterMoveFlag(MONSTER_MOVE_FLY);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void PointMovementGenerator<T>::Finalize(T &unit)
|
||||
{
|
||||
unit.clearUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void PointMovementGenerator<T>::Interrupt(T &unit)
|
||||
{
|
||||
unit.clearUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void PointMovementGenerator<T>::Reset(T &unit)
|
||||
{
|
||||
unit.StopMoving();
|
||||
unit.addUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
||||
{
|
||||
if(!&unit)
|
||||
return false;
|
||||
|
||||
if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED))
|
||||
if(unit.hasUnitState(UNIT_STAT_CAN_NOT_MOVE))
|
||||
{
|
||||
unit.clearUnitState(UNIT_STAT_ROAMING_MOVE);
|
||||
return true;
|
||||
}
|
||||
|
||||
unit.addUnitState(UNIT_STAT_ROAMING_MOVE);
|
||||
Traveller<T> traveller(unit);
|
||||
|
||||
i_destinationHolder.UpdateTraveller(traveller, diff, false);
|
||||
|
||||
if(i_destinationHolder.HasArrived())
|
||||
|
|
@ -78,6 +101,8 @@ template bool PointMovementGenerator<Creature>::Update(Creature&, const uint32 &
|
|||
|
||||
void AssistanceMovementGenerator::Finalize(Unit &unit)
|
||||
{
|
||||
unit.clearUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
|
||||
|
||||
((Creature*)&unit)->SetNoCallAssistance(false);
|
||||
((Creature*)&unit)->CallAssistance();
|
||||
if (unit.isAlive())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue