1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Merge pull request #4586 from IvanSavenko/fix_stack_count

Fix positioning of defender units in non-bank battles
This commit is contained in:
Ivan Savenko 2024-09-14 13:43:54 +03:00 committed by GitHub
commit 85a1acc4de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,7 +56,7 @@ BattleLayout BattleLayout::createLayout(IGameCallback * cb, const std::string &
result.warMachines[BattleSide::ATTACKER][i] = loadHex(config["attackerWarMachines"][i]);
for (size_t i = 0; i < 4; ++i)
result.warMachines[BattleSide::DEFENDER][i] = loadHex(config["attackerWarMachines"][i]);
result.warMachines[BattleSide::DEFENDER][i] = loadHex(config["defenderWarMachines"][i]);
if (attacker->formation == EArmyFormation::LOOSE && !config["attackerUnitsLoose"].isNull())
result.units[BattleSide::ATTACKER] = loadUnits(config["attackerUnitsLoose"][attacker->stacksCount() - 1]);
@ -65,10 +65,10 @@ BattleLayout BattleLayout::createLayout(IGameCallback * cb, const std::string &
else
result.units[BattleSide::ATTACKER] = loadUnits(config["attackerUnits"]);
if (attacker->formation == EArmyFormation::LOOSE && !config["defenderUnitsLoose"].isNull())
result.units[BattleSide::DEFENDER] = loadUnits(config["defenderUnitsLoose"][attacker->stacksCount() - 1]);
else if (attacker->formation == EArmyFormation::TIGHT && !config["defenderUnitsTight"].isNull())
result.units[BattleSide::DEFENDER] = loadUnits(config["defenderUnitsTight"][attacker->stacksCount() - 1]);
if (defender->formation == EArmyFormation::LOOSE && !config["defenderUnitsLoose"].isNull())
result.units[BattleSide::DEFENDER] = loadUnits(config["defenderUnitsLoose"][defender->stacksCount() - 1]);
else if (defender->formation == EArmyFormation::TIGHT && !config["defenderUnitsTight"].isNull())
result.units[BattleSide::DEFENDER] = loadUnits(config["defenderUnitsTight"][defender->stacksCount() - 1]);
else
result.units[BattleSide::DEFENDER] = loadUnits(config["defenderUnits"]);