BattleHexArray - new container for BattleHexes

This commit is contained in:
MichalZr6
2025-01-06 23:18:18 +01:00
parent f792eb2da5
commit a99274d72e
85 changed files with 5357 additions and 5036 deletions
+6 -6
View File
@@ -242,10 +242,10 @@ void CStack::prepareAttacked(BattleStackAttacked & bsa, vstd::RNG & rand, const
bsa.newState.operation = UnitChanges::EOperation::RESET_STATE;
}
std::vector<BattleHex> CStack::meleeAttackHexes(const battle::Unit * attacker, const battle::Unit * defender, BattleHex attackerPos, BattleHex defenderPos)
BattleHexArray CStack::meleeAttackHexes(const battle::Unit * attacker, const battle::Unit * defender, BattleHex attackerPos, BattleHex defenderPos)
{
int mask = 0;
std::vector<BattleHex> res;
BattleHexArray res;
if (!attackerPos.isValid())
attackerPos = attacker->getPosition();
@@ -260,7 +260,7 @@ std::vector<BattleHex> CStack::meleeAttackHexes(const battle::Unit * attacker, c
if((mask & 1) == 0)
{
mask |= 1;
res.push_back(defenderPos);
res.insert(defenderPos);
}
}
if (attacker->doubleWide() //back <=> front
@@ -269,7 +269,7 @@ std::vector<BattleHex> CStack::meleeAttackHexes(const battle::Unit * attacker, c
if((mask & 1) == 0)
{
mask |= 1;
res.push_back(defenderPos);
res.insert(defenderPos);
}
}
if (defender->doubleWide()//front <=> back
@@ -278,7 +278,7 @@ std::vector<BattleHex> CStack::meleeAttackHexes(const battle::Unit * attacker, c
if((mask & 2) == 0)
{
mask |= 2;
res.push_back(otherDefenderPos);
res.insert(otherDefenderPos);
}
}
if (defender->doubleWide() && attacker->doubleWide()//back <=> back
@@ -287,7 +287,7 @@ std::vector<BattleHex> CStack::meleeAttackHexes(const battle::Unit * attacker, c
if((mask & 2) == 0)
{
mask |= 2;
res.push_back(otherDefenderPos);
res.insert(otherDefenderPos);
}
}