From e4ef716d919b7d9d16afca71312039f2c91fb41f Mon Sep 17 00:00:00 2001 From: silversurfer Date: Sun, 1 Feb 2015 22:14:33 +0000 Subject: [PATCH] Bugfix: When using a vehicle to move to an enemy sector mercs will force exit the vehicle. In this case the team panel sort order was random depending on which merc was last selected. This problem occurred because the sort function for the squad was not called for this scenario. It is now called whenever a merc is added to a squad. Because of this the call for the sort function was removed from function SetAssignmentForList(). We do not need to call it twice. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7724 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Assignments.cpp | 6 ++++-- Tactical/Squads.cpp | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index d86439b6..b0012dbb 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -17094,7 +17094,9 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) //CHRISL: When setting mercs to a squad, resort the Squad list so we're in ubID order so team panel appears the same // when switching between squads - switch( bAssignment ) + // silversurfer: Shouldn't be necessary anymore because SortSquadByID() is now called whenever a merc is added to a squad by function AddCharacterToSquad(). + // This is necessary because mercs can be added to squads by other functions as well and we always want to sort. +/* switch( bAssignment ) { case( SQUAD_1 ): case( SQUAD_2 ): @@ -17118,7 +17120,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) case( SQUAD_20 ): SortSquadByID(bAssignment); break; - } + }*/ // check if we should start/stop flashing any mercs' assignment strings after these changes diff --git a/Tactical/Squads.cpp b/Tactical/Squads.cpp index 8e6c1424..462448ca 100644 --- a/Tactical/Squads.cpp +++ b/Tactical/Squads.cpp @@ -378,12 +378,15 @@ BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) pCharacter->bOldAssignment = bSquadValue; } - // if current tactical sqaud...upadte panel + // if current tactical squad...update panel if( NumberOfPeopleInSquad( ( INT8 )iCurrentTacticalSquad ) == 0 ) { SetCurrentSquad( bSquadValue, TRUE ); } + // silversurfer: We need to sort the squad here. Otherwise it will have a random sort order when we force exit a vehicle in an enemy sector. + SortSquadByID(bSquadValue); + if( bSquadValue == ( INT8 ) iCurrentTacticalSquad ) { CheckForAndAddMercToTeamPanel( Squad[ iCurrentTacticalSquad ][ bCounter ] );