1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-29 00:41:38 +02:00

BattlePhases enum moved to Unit.h

This commit is contained in:
krs
2023-02-25 00:54:48 +02:00
parent 0373febe6f
commit 7421fabf2c
4 changed files with 30 additions and 38 deletions

View File

@ -609,31 +609,22 @@ bool CUnitState::waited(int turn) const
return false;
}
int CUnitState::battleQueuePhase(int turn) const
BattlePhases CUnitState::battleQueuePhase(int turn) const
{
enum BattlePhases
{
SIEGE, // [0] - turrets/catapult,
NORMAL, // [1] - normal (unmoved) creatures, other war machines,
WAIT_MORALE, // [2] - waited creatures that had morale,
WAIT, // [3] - rest of waited creatures
MAX_NO_OF_PHASES // [4] - number of phases. Can be used in for loops.
};
if(turn <= 0 && waited()) //consider waiting state only for ongoing round
{
if(hadMorale)
return WAIT_MORALE;
return battle::WAIT_MORALE;
else
return WAIT;
return battle::WAIT;
}
else if(creatureIndex() == CreatureID::CATAPULT || isTurret()) //catapult and turrets are first
{
return SIEGE;
return battle::SIEGE;
}
else
{
return NORMAL;
return battle::NORMAL;
}
}