mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Fix: GROUP pointer can be NULL after MoveSAIGroupToSector is called
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8033 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+23
-17
@@ -1870,23 +1870,25 @@ BOOLEAN HandlePlayerGroupNoticedByPatrolGroup( GROUP *pPlayerGroup, GROUP *pEnem
|
||||
{
|
||||
MoveSAIGroupToSector( &pEnemyGroup, (UINT8)SECTOR( pPlayerGroup->ubNextX, pPlayerGroup->ubNextY ), DIRECT, PURSUIT );
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
#ifdef JA2BETAVERSION
|
||||
if ( pEnemyGroup )
|
||||
LogStrategicEvent( "Enemy group at %c%d detected player group at %c%d and is moving to intercept them at %c%d.",
|
||||
pEnemyGroup->ubSectorY + 'A' - 1, pEnemyGroup->ubSectorX,
|
||||
pPlayerGroup->ubSectorY + 'A' - 1, pPlayerGroup->ubSectorX,
|
||||
pPlayerGroup->ubNextY + 'A' - 1, pPlayerGroup->ubNextX );
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveSAIGroupToSector( &pEnemyGroup, (UINT8)SECTOR( pPlayerGroup->ubSectorX, pPlayerGroup->ubSectorY ), DIRECT, PURSUIT );
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
#ifdef JA2BETAVERSION
|
||||
if ( pEnemyGroup )
|
||||
LogStrategicEvent( "Enemy group at %c%d detected player group at %c%d and is moving to intercept them at %c%d.",
|
||||
pEnemyGroup->ubSectorY + 'A' - 1, pEnemyGroup->ubSectorX,
|
||||
pPlayerGroup->ubSectorY + 'A' - 1, pPlayerGroup->ubSectorX,
|
||||
pPlayerGroup->ubSectorY + 'A' - 1, pPlayerGroup->ubSectorX );
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1936,7 +1938,8 @@ void HandlePlayerGroupNoticedByGarrison( GROUP *pPlayerGroup, UINT8 ubSectorID )
|
||||
|
||||
MoveSAIGroupToSector( &pGroup, (UINT8)SECTOR( pPlayerGroup->ubSectorX, pPlayerGroup->ubSectorY ), DIRECT, REINFORCEMENTS );
|
||||
|
||||
RemoveSoldiersFromGarrisonBasedOnComposition( pSector->ubGarrisonID, pGroup->ubGroupSize );
|
||||
if ( pGroup )
|
||||
RemoveSoldiersFromGarrisonBasedOnComposition( pSector->ubGarrisonID, pGroup->ubGroupSize );
|
||||
|
||||
if( pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumAdmins + pSector->ubNumTanks > iMaxEnemyGroupSize )
|
||||
{
|
||||
@@ -1975,11 +1978,11 @@ BOOLEAN HandleMilitiaNoticedByPatrolGroup( UINT8 ubSectorID, GROUP *pEnemyGroup
|
||||
|
||||
MoveSAIGroupToSector( &pEnemyGroup, (UINT8)SECTOR( ubSectorX, ubSectorY ), DIRECT, REINFORCEMENTS );
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
LogStrategicEvent( "Enemy group at %c%d detected militia at %c%d and is moving to attack them.",
|
||||
pEnemyGroup->ubSectorY + 'A' - 1, pEnemyGroup->ubSectorX,
|
||||
ubSectorY + 'A' - 1, ubSectorX );
|
||||
#endif
|
||||
#ifdef JA2BETAVERSION
|
||||
if ( pEnemyGroup )
|
||||
LogStrategicEvent( "Enemy group at %c%d detected militia at %c%d and is moving to attack them.", pEnemyGroup->ubSectorY + 'A' - 1, pEnemyGroup->ubSectorX, ubSectorY + 'A' - 1, ubSectorX );
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2080,11 +2083,10 @@ BOOLEAN HandleEmptySectorNoticedByPatrolGroup( GROUP *pGroup, UINT8 ubEmptySecto
|
||||
gGarrisonGroup[ ubGarrisonID ].ubPendingGroupID = pGroup->ubGroupID;
|
||||
MoveSAIGroupToSector( &pGroup, (UINT8)SECTOR( ubSectorX, ubSectorY ), DIRECT, REINFORCEMENTS );
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
LogStrategicEvent( "Enemy group at %c%d detected undefended sector at %c%d and is moving to retake it.",
|
||||
pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX,
|
||||
ubSectorY + 'A' - 1, ubSectorX );
|
||||
#endif
|
||||
#ifdef JA2BETAVERSION
|
||||
if ( pGroup )
|
||||
LogStrategicEvent( "Enemy group at %c%d detected undefended sector at %c%d and is moving to retake it.", pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, ubSectorY + 'A' - 1, ubSectorX );
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -5416,9 +5418,13 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
|
||||
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 ( pGroup )
|
||||
{
|
||||
pGroup->pEnemyGroup->ubIntention = REINFORCEMENTS;
|
||||
gGarrisonGroup[ SectorInfo[ ubSectorID ].ubGarrisonID ].ubPendingGroupID = pGroup->ubGroupID;
|
||||
}
|
||||
|
||||
if( pPendingGroup )
|
||||
{ //Reassign the pending group
|
||||
|
||||
Reference in New Issue
Block a user