1
0
mirror of https://github.com/vcmi/vcmi.git synced 2026-05-22 09:55:17 +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:
Ivan Savenko
2024-08-11 20:22:35 +00:00
parent 9b914bb4db
commit 2a05fbdd50
95 changed files with 601 additions and 568 deletions
+3 -3
View File
@@ -32,7 +32,7 @@
#define LOGFL(text, formattingEl) print(boost::str(boost::format(text) % formattingEl))
CBattleAI::CBattleAI()
: side(-1),
: side(BattleSide::NONE),
wasWaitingForRealize(false),
wasUnlockingGs(false)
{
@@ -100,7 +100,7 @@ void CBattleAI::yourTacticPhase(const BattleID & battleID, int distance)
cb->battleMakeTacticAction(battleID, BattleAction::makeEndOFTacticPhase(cb->getBattle(battleID)->battleGetTacticsSide()));
}
static float getStrengthRatio(std::shared_ptr<CBattleInfoCallback> cb, int side)
static float getStrengthRatio(std::shared_ptr<CBattleInfoCallback> cb, BattleSide side)
{
auto stacks = cb->battleGetAllStacks();
auto our = 0;
@@ -243,7 +243,7 @@ BattleAction CBattleAI::useCatapult(const BattleID & battleID, const CStack * st
return attack;
}
void CBattleAI::battleStart(const BattleID & battleID, const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool Side, bool replayAllowed)
void CBattleAI::battleStart(const BattleID & battleID, const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, BattleSide Side, bool replayAllowed)
{
LOG_TRACE(logAi);
side = Side;