mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Fix from Heinz:
1) Fixed error creating new soldiers in DoReinforcementAsPendingEnemy 2) Fixed some bugs in Shopkeeper interface. 3) Fixed CTD when pressing Alt-Y not in cheat mode 4) Save/load screen shouldn't appear during quickload git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2612 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1600,7 +1600,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
|
||||
{
|
||||
ubNumElites--;
|
||||
ubTotalSoldiers--;
|
||||
pSoldier = TacticalCreateEliteEnemy();
|
||||
Assert(pSoldier = TacticalCreateEliteEnemy());
|
||||
if( pGroup )
|
||||
{
|
||||
pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
@@ -1623,7 +1623,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
|
||||
{
|
||||
ubNumTroops--;
|
||||
ubTotalSoldiers--;
|
||||
pSoldier = TacticalCreateArmyTroop();
|
||||
Assert(pSoldier = TacticalCreateArmyTroop());
|
||||
if( pGroup )
|
||||
{
|
||||
pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
@@ -1646,7 +1646,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
|
||||
{
|
||||
ubNumAdmins--;
|
||||
ubTotalSoldiers--;
|
||||
pSoldier = TacticalCreateAdministrator();
|
||||
Assert(pSoldier = TacticalCreateAdministrator());
|
||||
if( pGroup )
|
||||
{
|
||||
pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
@@ -2184,4 +2184,21 @@ BOOLEAN OnlyHostileCivsInSector()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN CheckPendingEnemies()
|
||||
{
|
||||
if( gbWorldSectorZ ) return FALSE;
|
||||
SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
||||
if( (pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins) > ( pSector->ubElitesInBattle + pSector->ubTroopsInBattle + pSector->ubAdminsInBattle) )
|
||||
return TRUE;
|
||||
for (GROUP *pGroup = gpGroupList; pGroup; pGroup = pGroup->next)
|
||||
{
|
||||
if( !pGroup->fPlayer
|
||||
&& !pGroup->fVehicle
|
||||
&& pGroup->ubSectorX == gWorldSectorX
|
||||
&& pGroup->ubSectorY == gWorldSectorY
|
||||
&& pGroup->ubGroupSize > pGroup->pEnemyGroup->ubElitesInBattle + pGroup->pEnemyGroup->ubTroopsInBattle + pGroup->pEnemyGroup->ubAdminsInBattle)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,4 +56,6 @@ BOOLEAN OnlyHostileCivsInSector();
|
||||
|
||||
extern INT16 gsInterrogationGridNo[3];
|
||||
|
||||
BOOLEAN CheckPendingEnemies();
|
||||
|
||||
#endif
|
||||
@@ -247,7 +247,7 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
||||
GROUP *pGroup;
|
||||
//ENEMYGROUP *pEnemyGroup;
|
||||
SECTORINFO *pThisSector, *pSector;
|
||||
|
||||
|
||||
if( !gGameExternalOptions.gfAllowReinforcements )
|
||||
return 255;
|
||||
|
||||
@@ -274,7 +274,7 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
||||
}
|
||||
}
|
||||
|
||||
while( ubDirNumber > 0)
|
||||
while( ubDirNumber > 0 )
|
||||
{
|
||||
ubIndex = Random(ubDirNumber);
|
||||
|
||||
@@ -286,26 +286,22 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
||||
{
|
||||
(pThisSector->ubNumElites)++;
|
||||
(pSector->ubNumElites)--;
|
||||
(pThisSector->ubElitesInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 0, 0, 1, FALSE );
|
||||
}else if( pSector->ubNumTroops )
|
||||
{
|
||||
(pThisSector->ubNumTroops)++;
|
||||
(pSector->ubNumTroops)--;
|
||||
(pThisSector->ubTroopsInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 0, 1, 0, FALSE );
|
||||
}else if( pSector->ubNumAdmins )
|
||||
{
|
||||
(pThisSector->ubNumAdmins)++;
|
||||
(pSector->ubNumAdmins)--;
|
||||
(pThisSector->ubAdminsInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 1, 0, 0, FALSE );
|
||||
}
|
||||
|
||||
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 ];
|
||||
}
|
||||
else
|
||||
@@ -458,3 +454,4 @@ void AddPossiblePendingMilitiaToBattle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user