mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Fix for uninitialized group in reinforcements
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1168 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1221,16 +1221,6 @@ void AddPossiblePendingEnemiesToBattle()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddEnemiesToBattle( pGroup, ubInsertionCode,
|
|
||||||
pSector->ubNumAdmins - pSector->ubAdminsInBattle,
|
|
||||||
pSector->ubNumTroops - pSector->ubTroopsInBattle,
|
|
||||||
pSector->ubNumElites - pSector->ubElitesInBattle,
|
|
||||||
FALSE );
|
|
||||||
|
|
||||||
pSector->ubAdminsInBattle = pSector->ubNumAdmins;
|
|
||||||
pSector->ubTroopsInBattle = pSector->ubNumTroops;
|
|
||||||
pSector->ubElitesInBattle = pSector->ubNumElites;
|
|
||||||
|
|
||||||
// Assume we added one since there are supposedly more available and room for them
|
// Assume we added one since there are supposedly more available and room for them
|
||||||
ubSlots--;
|
ubSlots--;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,6 +285,8 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
|||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
ubIndex = Random(ubDirNumber);
|
ubIndex = Random(ubDirNumber);
|
||||||
|
#if 0
|
||||||
|
// This should be handled in AddPossiblePendingEnemiesToBattle
|
||||||
if( NumMobileEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) && GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
|
if( NumMobileEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) && GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
|
||||||
{
|
{
|
||||||
UINT8 numElite;
|
UINT8 numElite;
|
||||||
@@ -329,6 +331,7 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
|||||||
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
|
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if( NumEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) > gubReinforcementMinEnemyStaticGroupSize )
|
if( NumEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) > gubReinforcementMinEnemyStaticGroupSize )
|
||||||
{
|
{
|
||||||
@@ -348,6 +351,16 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
|||||||
(pSector->ubNumAdmins)--;
|
(pSector->ubNumAdmins)--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ],
|
||||||
|
pThisSector->ubNumAdmins - pThisSector->ubAdminsInBattle,
|
||||||
|
pThisSector->ubNumTroops - pThisSector->ubTroopsInBattle,
|
||||||
|
pThisSector->ubNumElites - pThisSector->ubElitesInBattle,
|
||||||
|
FALSE );
|
||||||
|
|
||||||
|
pThisSector->ubAdminsInBattle = pThisSector->ubNumAdmins;
|
||||||
|
pThisSector->ubTroopsInBattle = pThisSector->ubNumTroops;
|
||||||
|
pThisSector->ubElitesInBattle = pThisSector->ubNumElites;
|
||||||
|
|
||||||
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
|
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user