mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Unified handling of battle sides ID's
- Replaced BattleSide namespace-enum with enum class - Merged two different BattleSide enum's into one - Merged BattlePerspective enum into BattleSide enum - Changed all places that use integers to represent battle side to use BattleSide enum - Added BattleSideArray convenience wrapper for std::array that is always 2-elements in size and allows access to its elements using BattleSide enum
This commit is contained in:
@@ -34,7 +34,7 @@ BattleFlowProcessor::BattleFlowProcessor(BattleProcessor * owner, CGameHandler *
|
||||
{
|
||||
}
|
||||
|
||||
void BattleFlowProcessor::summonGuardiansHelper(const CBattleInfoCallback & battle, std::vector<BattleHex> & output, const BattleHex & targetPosition, ui8 side, bool targetIsTwoHex) //return hexes for summoning two hex monsters in output, target = unit to guard
|
||||
void BattleFlowProcessor::summonGuardiansHelper(const CBattleInfoCallback & battle, std::vector<BattleHex> & output, const BattleHex & targetPosition, BattleSide side, bool targetIsTwoHex) //return hexes for summoning two hex monsters in output, target = unit to guard
|
||||
{
|
||||
int x = targetPosition.getX();
|
||||
int y = targetPosition.getY();
|
||||
@@ -185,7 +185,7 @@ void BattleFlowProcessor::trySummonGuardians(const CBattleInfoCallback & battle,
|
||||
|
||||
void BattleFlowProcessor::castOpeningSpells(const CBattleInfoCallback & battle)
|
||||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
for(auto i : {BattleSide::ATTACKER, BattleSide::DEFENDER})
|
||||
{
|
||||
auto h = battle.battleGetFightingHero(i);
|
||||
if (!h)
|
||||
@@ -742,7 +742,7 @@ void BattleFlowProcessor::stackTurnTrigger(const CBattleInfoCallback & battle, c
|
||||
return b->subtype.as<SpellID>() == SpellID::NONE;
|
||||
});
|
||||
|
||||
int side = *battle.playerToSide(st->unitOwner());
|
||||
BattleSide side = battle.playerToSide(st->unitOwner());
|
||||
if(st->canCast() && battle.battleGetEnchanterCounter(side) == 0)
|
||||
{
|
||||
bool cast = false;
|
||||
|
||||
Reference in New Issue
Block a user