From 25f234e51c537f1a47c15e8a588adc10aab762a7 Mon Sep 17 00:00:00 2001 From: lalien Date: Wed, 5 Jul 2006 09:49:36 +0000 Subject: [PATCH] - Bug fix: This bug occured in Grumm H2. After playing two rounds of combat, the game freezes right when the END TURN button clicked. The enemy tries to reinforce H2 from several sectors simultaneously (H1 and G2), trying to put too many soldiers into H2 at the same time. As to other sectors, other people have reported the same occurance in Tixa and in Cambria G9, with the exact same symptoms. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@328 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameVersion.cpp | 2 +- JA2.vcproj | 4 ++-- Strategic/Queen Command.cpp | 23 +++++++++++++++++++++++ Strategic/Queen Command.h | 1 + Strategic/Reinforcement.cpp | 2 +- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index 8930ea72..188b1f64 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -23,7 +23,7 @@ INT16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - INT16 zVersionLabel[256] = { L"Release v1.13.325" }; + INT16 zVersionLabel[256] = { L"Release v1.13.328" }; #endif diff --git a/JA2.vcproj b/JA2.vcproj index 14512fb5..a7639875 100644 --- a/JA2.vcproj +++ b/JA2.vcproj @@ -43,7 +43,7 @@ = 1 && sSectorX <= 16 ); + Assert( sSectorY >= 1 && sSectorY <= 16 ); + + //Now count the number of mobile groups in the sector. + *pubNumTroops = *pubNumElites = *pubNumAdmins = 0; + pGroup = gpGroupList; + while( pGroup ) + { + if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY ) + { + *pubNumTroops += pGroup->pEnemyGroup->ubNumTroops; + *pubNumElites += pGroup->pEnemyGroup->ubNumElites; + *pubNumAdmins += pGroup->pEnemyGroup->ubNumAdmins; + } + pGroup = pGroup->next; + } +} + + void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites ) { SECTORINFO *pSector; diff --git a/Strategic/Queen Command.h b/Strategic/Queen Command.h index 998d95b1..df109b58 100644 --- a/Strategic/Queen Command.h +++ b/Strategic/Queen Command.h @@ -23,6 +23,7 @@ UINT8 NumEnemiesInSector( INT16 sSectorX, INT16 sSectorY ); UINT8 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY ); UINT8 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY ); void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites ); +void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites ); void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites ); void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites ); diff --git a/Strategic/Reinforcement.cpp b/Strategic/Reinforcement.cpp index 41953b65..4eafb80f 100644 --- a/Strategic/Reinforcement.cpp +++ b/Strategic/Reinforcement.cpp @@ -74,7 +74,7 @@ void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pub } - GetNumberOfMobileEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ), &ubNumAdmins, &ubNumTroops, &ubNumElites ); + GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ), &ubNumAdmins, &ubNumTroops, &ubNumElites ); *pubNumAdmins += ubNumAdmins; *pubNumTroops += ubNumTroops;