From 6c0b9415c0d04f1824b18db2ab398795671c29d2 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 12 Sep 2024 20:11:26 +0000 Subject: [PATCH] Fix positioning of defender units in non-bank battles --- lib/battle/BattleLayout.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/battle/BattleLayout.cpp b/lib/battle/BattleLayout.cpp index e1f711277..6fa951d87 100644 --- a/lib/battle/BattleLayout.cpp +++ b/lib/battle/BattleLayout.cpp @@ -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"]);