From 67812044b8146c5a2c116e901a11dcd7fcbfbcfc Mon Sep 17 00:00:00 2001 From: Wanne Date: Fri, 28 Oct 2011 09:18:30 +0000 Subject: [PATCH] - Bugfix: Fixed assertion crash in UC-1.13 cutscene, when Deidranna wants to send troops to the SAM git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4769 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Strategic AI.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index dd7b502a..0a38a2b7 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -4600,19 +4600,23 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_P3, 0, 0, ubNumSoldiers ); MoveSAIGroupToSector( &pGroup, ubSectorID, STAGE, REINFORCEMENTS ); - if( gGarrisonGroup[ SectorInfo[ ubSectorID ].ubGarrisonID ].ubPendingGroupID ) - { //Clear the pending group's assignment. - pPendingGroup = GetGroup( gGarrisonGroup[ SectorInfo[ ubSectorID ].ubGarrisonID ].ubPendingGroupID ); - Assert( pPendingGroup ); - ClearPreviousAIGroupAssignment( pPendingGroup ); - } - //Assign the elite squad to attack the SAM site - pGroup->pEnemyGroup->ubIntention = REINFORCEMENTS; - gGarrisonGroup[ SectorInfo[ ubSectorID ].ubGarrisonID ].ubPendingGroupID = pGroup->ubGroupID; + // WANNE: This should fix the assertion in UC in the cutscene! + if (SectorInfo[ ubSectorID ].ubGarrisonID != 255) + { + if( gGarrisonGroup[ SectorInfo[ ubSectorID ].ubGarrisonID ].ubPendingGroupID ) + { //Clear the pending group's assignment. + pPendingGroup = GetGroup( gGarrisonGroup[ SectorInfo[ ubSectorID ].ubGarrisonID ].ubPendingGroupID ); + Assert( pPendingGroup ); + ClearPreviousAIGroupAssignment( pPendingGroup ); + } + //Assign the elite squad to attack the SAM site + pGroup->pEnemyGroup->ubIntention = REINFORCEMENTS; + gGarrisonGroup[ SectorInfo[ ubSectorID ].ubGarrisonID ].ubPendingGroupID = pGroup->ubGroupID; - if( pPendingGroup ) - { //Reassign the pending group - ReassignAIGroup( &pPendingGroup ); + if( pPendingGroup ) + { //Reassign the pending group + ReassignAIGroup( &pPendingGroup ); + } } break;