From 7f48f29a4a4c9bc4cf1d05a45f55a84c845a344b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 20 Jan 2023 16:22:43 +0200 Subject: [PATCH 1/2] Fix bug if vehicle holds more soldiers than can fit in a squad (by Seven) We would fail Assert(fSuccess) as all passengers would not fit in one squad, and the code wouldn't allow creating a new squad where they could be placed. --- Strategic/PreBattle Interface.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 72ec674af..53df0d35a 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -2141,6 +2141,13 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles // because if this is a simultaneous group attack, the mercs could be coming from different sides, and the // placement screen can't handle mercs on the same squad arriving from difference edges! fSuccess = AddCharacterToSquad( pSoldier, bUniqueVehicleSquad ); + { + bUniqueVehicleSquad = GetFirstEmptySquad(); + if (bUniqueVehicleSquad != -1) + { + fSuccess = AddCharacterToSquad(pSoldier, bUniqueVehicleSquad); + } + } } //CHRISL: So what's supposed to happen in the merc is assigned to a vehicle but fExitVehicles is FALSE? else From 304aa6987ae93e009138af3b3e22ec68c509708b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 20 Jan 2023 16:51:55 +0200 Subject: [PATCH 2/2] Add missing if conditional to previous fix --- Strategic/PreBattle Interface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 53df0d35a..81909888a 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -2141,6 +2141,8 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles // because if this is a simultaneous group attack, the mercs could be coming from different sides, and the // placement screen can't handle mercs on the same squad arriving from difference edges! fSuccess = AddCharacterToSquad( pSoldier, bUniqueVehicleSquad ); + // if we failed, create another squad + if (!fSuccess) { bUniqueVehicleSquad = GetFirstEmptySquad(); if (bUniqueVehicleSquad != -1)