From e59e951e315aaed2c7be3e1d53b57a12f82031d8 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Wed, 9 Oct 2013 19:32:19 +0000 Subject: [PATCH] Bugfix for JaggZilla Bug #635 - NPCs that turn neutral cannot end a battle for an entire sector anymore if there is other enemies around. - Enemies that bled to death won't stop the code anymore to grant us victory. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6476 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Dialogue.cpp | 11 +++++++++-- Tactical/Overhead.cpp | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index b422a7af..5750ba1e 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -186,6 +186,7 @@ BOOLEAN InternalInitiateConversation( SOLDIERTYPE *pDestSoldier, SOLDIERTYPE *pS extern void EndGameMessageBoxCallBack( UINT8 ubExitValue ); extern INT32 FindNearestOpenableNonDoor( INT32 sStartGridNo ); extern void RecalculateOppCntsDueToBecomingNeutral( SOLDIERTYPE * pSoldier ); +extern UINT8 NumCapableEnemyInSector( ); #ifdef JA2UB //JA25 UB @@ -3016,7 +3017,10 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum break; case NPC_ACTION_END_COMBAT: - ExitCombatMode(); + // silversurfer: Bugfix for JaggZilla Bug #635 + // We can't end combat just because this one guy is now not hostile anymore. What about the rest of the sector? + if ( NumCapableEnemyInSector() == 0 ) + ExitCombatMode(); break; case NPC_ACTION_BECOME_FRIENDLY_END_COMBAT: @@ -3029,7 +3033,10 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum RecalculateOppCntsDueToBecomingNeutral( pSoldier ); if ( gTacticalStatus.bNumFoughtInBattle[ CIV_TEAM ] == 0 ) { - gTacticalStatus.fEnemyInSector = FALSE; + // silversurfer: Bugfix for JaggZilla Bug #635 + // Function CheckForEndOfBattle() will set this IF the sector is really free of enemies. + //gTacticalStatus.fEnemyInSector = FALSE; + CheckForEndOfBattle( FALSE ); } if ( !gTacticalStatus.fEnemyInSector ) { diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 3975cddc..8000b784 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -6995,7 +6995,8 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) // OK, KILL any enemies that are incompacitated if ( KillIncompacitatedEnemyInSector( ) ) { - return( FALSE ); + // silversurfer: Why this? The rest of our enemies just bled to death so go on with the code! + //return( FALSE ); } }