1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Refactoring 1st phase - Renaming's mainly

S'more small battle order refactoring.
This commit is contained in:
krs
2023-02-25 00:25:30 +02:00
parent d55ac50e3c
commit 0373febe6f
2 changed files with 122 additions and 99 deletions

View File

@@ -611,20 +611,29 @@ bool CUnitState::waited(int turn) const
int 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 2;
return WAIT_MORALE;
else
return 3;
return WAIT;
}
else if(creatureIndex() == CreatureID::CATAPULT || isTurret()) //catapult and turrets are first
{
return 0;
return SIEGE;
}
else
{
return 1;
return NORMAL;
}
}