mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Replaced
UINT8 CountAllMilitiaInSector(INT16 sMapX, INT16 sMapY); with UINT8 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam ); git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7708 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -4103,10 +4103,11 @@ void CalculateAttackValues()
|
||||
pCell->usNextAttack += (UINT32)(( i - 4 ) * 2000 );
|
||||
}
|
||||
|
||||
|
||||
if( i >= CountAllMilitiaInSector( gpAR->ubSectorX, gpAR->ubSectorY ) )
|
||||
{ //Extra delay if soldier's from reinforcement
|
||||
pCell->usNextAttack += REINFORCMENT_ATTACK_DELAY_PER_SOLDIER_IN_SECTOR * CountAllMilitiaInSector( gpAR->ubSectorX, gpAR->ubSectorY );
|
||||
UINT8 militiainsector = NumNonPlayerTeamMembersInSector( gpAR->ubSectorX, gpAR->ubSectorY, MILITIA_TEAM );
|
||||
if ( i >= militiainsector )
|
||||
{
|
||||
//Extra delay if soldier's from reinforcement
|
||||
pCell->usNextAttack += REINFORCMENT_ATTACK_DELAY_PER_SOLDIER_IN_SECTOR * militiainsector;
|
||||
}
|
||||
|
||||
|
||||
@@ -5661,7 +5662,7 @@ void CheckForSoldiersWhoRetreatedIntoMilitiaHeldSectors()
|
||||
for(int sY = 1; sY < ( MAP_WORLD_Y - 1); sY++ ) {
|
||||
// Check if there is a sector where enemies retreated to and there are also militia present
|
||||
if ( (NumNonPlayerTeamMembersInSector( sX, sY, ENEMY_TEAM ) > 0) &&
|
||||
(CountAllMilitiaInSector(sX, sY) > 0) &&
|
||||
(NumNonPlayerTeamMembersInSector( sX, sY, MILITIA_TEAM ) > 0) &&
|
||||
(!gTacticalStatus.fEnemyInSector)) {
|
||||
unsigned mercCnt = 0;
|
||||
for( int i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) {
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "Strategic AI.h"
|
||||
#include "MessageBoxScreen.h"
|
||||
#include "Map Information.h"
|
||||
#include "Queen Command.h"
|
||||
#endif
|
||||
|
||||
#include "Strategic Mines.h"
|
||||
@@ -1115,9 +1116,10 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest )
|
||||
gubCreatureBattleCode = CREATURE_BATTLE_CODE_PREBATTLEINTERFACE;
|
||||
}
|
||||
}
|
||||
else if( CountAllMilitiaInSector( ubSectorX, ubSectorY ) )
|
||||
{ //we have militia in the sector
|
||||
gubCreatureBattleCode = CREATURE_BATTLE_CODE_AUTORESOLVE;
|
||||
else if ( NumNonPlayerTeamMembersInSector( ubSectorX, ubSectorY, MILITIA_TEAM ) )
|
||||
{
|
||||
//we have militia in the sector
|
||||
gubCreatureBattleCode = CREATURE_BATTLE_CODE_AUTORESOLVE;
|
||||
}
|
||||
else if( !StrategicMap[ ubSectorX + MAP_WORLD_X * ubSectorY ].fEnemyControlled )
|
||||
{ //player controlled sector -- eat some civilians
|
||||
|
||||
@@ -800,7 +800,7 @@ void AddCommonInfoToBox(void)
|
||||
swprintf( wString, L"%s:", pwTownInfoStrings[ 11 ] );
|
||||
AddMonoString( &hStringHandle, wString );
|
||||
|
||||
ubMilitiaTotal = CountAllMilitiaInSector(bCurrentTownMineSectorX, bCurrentTownMineSectorY);
|
||||
ubMilitiaTotal = NumNonPlayerTeamMembersInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY, MILITIA_TEAM );
|
||||
if (ubMilitiaTotal > 0)
|
||||
{
|
||||
// some militia, show total & their breakdown by level
|
||||
|
||||
@@ -2015,7 +2015,7 @@ BOOLEAN IsThereMilitiaInAdjacentSector( INT16 sMapX, INT16 sMapY )
|
||||
GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, FALSE, TRUE );
|
||||
|
||||
for( x = 0; x < uiDirNumber ; ++x )
|
||||
if( CountAllMilitiaInSector( SECTORX( pMoveDir[ x ][ 0 ] ), SECTORY( pMoveDir[ x ][ 0 ] ) ) )
|
||||
if ( NumNonPlayerTeamMembersInSector( SECTORX( pMoveDir[x][0] ), SECTORY( pMoveDir[x][0] ), MILITIA_TEAM ) )
|
||||
fResult = TRUE;
|
||||
|
||||
return fResult;
|
||||
|
||||
@@ -408,7 +408,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
gubExplicitEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE;
|
||||
}
|
||||
}
|
||||
else if ( pBattleGroup && pBattleGroup->usGroupTeam != OUR_TEAM && CountAllMilitiaInSector( pBattleGroup->ubSectorX, pBattleGroup->ubSectorY ) > 0 )
|
||||
else if ( pBattleGroup && pBattleGroup->usGroupTeam != OUR_TEAM && NumNonPlayerTeamMembersInSector( pBattleGroup->ubSectorX, pBattleGroup->ubSectorY, MILITIA_TEAM ) > 0 )
|
||||
{
|
||||
gubEnemyEncounterCode = ENEMY_ENCOUNTER_CODE;
|
||||
}
|
||||
@@ -1268,7 +1268,7 @@ void RenderPreBattleInterface()
|
||||
x = 142 + (27 - StringPixLength( str, FONT14ARIAL )) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
//militia
|
||||
swprintf( str, L"%d", CountAllMilitiaInSector( gubPBSectorX, gubPBSectorY ) );
|
||||
swprintf( str, L"%d", NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, MILITIA_TEAM ) );
|
||||
x = 227 + (27 - StringPixLength( str, FONT14ARIAL )) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
SetFontShadow( FONT_NEARBLACK );
|
||||
@@ -1533,8 +1533,10 @@ void RetreatMercsCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
|
||||
// NOTE: this code assumes you can never retreat while underground
|
||||
HandleLoyaltyImplicationsOfMercRetreat( RETREAT_PBI, gubPBSectorX, gubPBSectorY, 0 );
|
||||
if( CountAllMilitiaInSector( gubPBSectorX, gubPBSectorY ) )
|
||||
{ //Mercs retreat, but enemies still need to fight the militia
|
||||
|
||||
if ( NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, MILITIA_TEAM ) )
|
||||
{
|
||||
//Mercs retreat, but enemies still need to fight the militia
|
||||
gfEnterAutoResolveMode = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1528,7 +1528,7 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
}
|
||||
}
|
||||
|
||||
if( ( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) && !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) )
|
||||
if ( (!PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) && !NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, MILITIA_TEAM ))
|
||||
|| !NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) )
|
||||
return;
|
||||
|
||||
@@ -1673,13 +1673,13 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
|
||||
if( ubStrategicInsertionCode == 255 )
|
||||
{
|
||||
if( !CountAllMilitiaInSector( gWorldSectorX + 1, gWorldSectorY ) )
|
||||
if ( !NumNonPlayerTeamMembersInSector( gWorldSectorX + 1, gWorldSectorY, MILITIA_TEAM ) )
|
||||
ubStrategicInsertionCode = INSERTION_CODE_EAST;
|
||||
else if( !CountAllMilitiaInSector( gWorldSectorX - 1, gWorldSectorY ) )
|
||||
else if ( !NumNonPlayerTeamMembersInSector( gWorldSectorX - 1, gWorldSectorY, MILITIA_TEAM ) )
|
||||
ubStrategicInsertionCode = INSERTION_CODE_WEST;
|
||||
else if( !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY + 1 ) )
|
||||
else if ( !NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY + 1, MILITIA_TEAM ) )
|
||||
ubStrategicInsertionCode = INSERTION_CODE_SOUTH;
|
||||
else if( !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY - 1 ) )
|
||||
else if ( !NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY - 1, MILITIA_TEAM ) )
|
||||
ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ UINT8 CountAllMilitiaInFiveSectors(INT16 sMapX, INT16 sMapY)
|
||||
UINT16 pusMoveDir[4][3];
|
||||
UINT8 ubDirNumber, ubIndex;
|
||||
|
||||
ubResult = CountAllMilitiaInSector( sMapX, sMapY );
|
||||
ubResult = NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM );
|
||||
|
||||
if( !gGameExternalOptions.gfAllowReinforcements )
|
||||
return ubResult;
|
||||
@@ -150,7 +150,7 @@ UINT8 CountAllMilitiaInFiveSectors(INT16 sMapX, INT16 sMapY)
|
||||
GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir, FALSE, TRUE );
|
||||
|
||||
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
|
||||
ubResult += CountAllMilitiaInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) );
|
||||
ubResult += NumNonPlayerTeamMembersInSector( SECTORX( pusMoveDir[ubIndex][0] ), SECTORY( pusMoveDir[ubIndex][0] ), MILITIA_TEAM );
|
||||
|
||||
|
||||
return ubResult;
|
||||
@@ -184,8 +184,8 @@ BOOLEAN ARMoveBestMilitiaManFromAdjacentSector(INT16 sMapX, INT16 sMapY)
|
||||
if( !gGameExternalOptions.gfAllowReinforcements )
|
||||
return FALSE;
|
||||
|
||||
if( CountAllMilitiaInSector( sMapX, sMapY ) >= gGameExternalOptions.iMaxMilitiaPerSector ||
|
||||
CountAllMilitiaInFiveSectors( sMapX, sMapY ) - CountAllMilitiaInSector( sMapX, sMapY ) == 0 )
|
||||
if ( NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM ) >= gGameExternalOptions.iMaxMilitiaPerSector ||
|
||||
CountAllMilitiaInFiveSectors( sMapX, sMapY ) - NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM ) == 0 )
|
||||
return FALSE;
|
||||
|
||||
GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir, FALSE, TRUE );
|
||||
@@ -356,7 +356,7 @@ UINT8 DoReinforcementAsPendingMilitia( INT16 sMapX, INT16 sMapY, UINT8 *pubRank
|
||||
|
||||
GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir, FALSE, TRUE );
|
||||
|
||||
if( CountAllMilitiaInFiveSectors( sMapX, sMapY ) - CountAllMilitiaInSector( sMapX, sMapY ) == 0 )
|
||||
if ( CountAllMilitiaInFiveSectors( sMapX, sMapY ) - NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM ) == 0 )
|
||||
{
|
||||
*pubRank = 255;
|
||||
return 255;
|
||||
@@ -364,7 +364,7 @@ UINT8 DoReinforcementAsPendingMilitia( INT16 sMapX, INT16 sMapY, UINT8 *pubRank
|
||||
for(;;)
|
||||
{
|
||||
ubIndex = Random(ubDirNumber);
|
||||
if( CountAllMilitiaInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
|
||||
if ( NumNonPlayerTeamMembersInSector( SECTORX( pusMoveDir[ubIndex][0] ), SECTORY( pusMoveDir[ubIndex][0] ), MILITIA_TEAM ) )
|
||||
{
|
||||
pSector = &SectorInfo[ pusMoveDir[ ubIndex ][ 0 ] ];
|
||||
|
||||
@@ -460,7 +460,7 @@ void AddPossiblePendingMilitiaToBattle()
|
||||
}
|
||||
|
||||
if( ubPredefinedInsertionCode != 255 && ubPredefinedRank != 255 &&
|
||||
CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) )
|
||||
NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, MILITIA_TEAM ) )
|
||||
{
|
||||
ubNumElites = ubNumRegulars = ubNumGreens = 0;
|
||||
|
||||
|
||||
@@ -2461,7 +2461,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
||||
{
|
||||
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||
}
|
||||
else if( CountAllMilitiaInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY-1) ) &&
|
||||
else if ( NumNonPlayerTeamMembersInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY - 1), MILITIA_TEAM ) &&
|
||||
AttemptToNoticeAdjacentGroupSucceeds() )
|
||||
{
|
||||
return HandleMilitiaNoticedByPatrolGroup( (UINT8)SECTOR( pEnemyGroup->ubSectorX, pEnemyGroup->ubSectorY-1 ), pEnemyGroup );
|
||||
@@ -2479,7 +2479,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
||||
{
|
||||
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||
}
|
||||
else if( CountAllMilitiaInSector( (UINT8)(pEnemyGroup->ubSectorX-1), pEnemyGroup->ubSectorY ) &&
|
||||
else if ( NumNonPlayerTeamMembersInSector( (UINT8)(pEnemyGroup->ubSectorX - 1), pEnemyGroup->ubSectorY, MILITIA_TEAM ) &&
|
||||
AttemptToNoticeAdjacentGroupSucceeds() )
|
||||
{
|
||||
return HandleMilitiaNoticedByPatrolGroup( (UINT8)SECTOR( pEnemyGroup->ubSectorX-1, pEnemyGroup->ubSectorY ), pEnemyGroup );
|
||||
@@ -2497,7 +2497,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
||||
{
|
||||
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||
}
|
||||
else if( CountAllMilitiaInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY+1) ) &&
|
||||
else if ( NumNonPlayerTeamMembersInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY + 1), MILITIA_TEAM ) &&
|
||||
AttemptToNoticeAdjacentGroupSucceeds() )
|
||||
{
|
||||
return HandleMilitiaNoticedByPatrolGroup( (UINT8)SECTOR( pEnemyGroup->ubSectorX, pEnemyGroup->ubSectorY+1 ), pEnemyGroup );
|
||||
@@ -2515,7 +2515,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
||||
{
|
||||
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||
}
|
||||
else if( CountAllMilitiaInSector( (UINT8)(pEnemyGroup->ubSectorX+1), pEnemyGroup->ubSectorY ) &&
|
||||
else if ( NumNonPlayerTeamMembersInSector( (UINT8)(pEnemyGroup->ubSectorX + 1), pEnemyGroup->ubSectorY, MILITIA_TEAM ) &&
|
||||
AttemptToNoticeAdjacentGroupSucceeds() )
|
||||
{
|
||||
return HandleMilitiaNoticedByPatrolGroup( (UINT8)SECTOR( pEnemyGroup->ubSectorX+1, pEnemyGroup->ubSectorY ), pEnemyGroup );
|
||||
@@ -6067,7 +6067,7 @@ BOOLEAN GarrisonCanProvideMinimumReinforcements( INT32 iGarrisonID )
|
||||
//If so, do not provide reinforcements from here.
|
||||
ubSectorX = (UINT8)SECTORX( gGarrisonGroup[ iGarrisonID ].ubSectorID );
|
||||
ubSectorY = (UINT8)SECTORY( gGarrisonGroup[ iGarrisonID ].ubSectorID );
|
||||
if( PlayerMercsInSector( ubSectorX, ubSectorY, 0 ) || CountAllMilitiaInSector( ubSectorX, ubSectorY ) )
|
||||
if ( PlayerMercsInSector( ubSectorX, ubSectorY, 0 ) || NumNonPlayerTeamMembersInSector( ubSectorX, ubSectorY, MILITIA_TEAM ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -749,7 +749,7 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin
|
||||
#ifdef JA2BETAVERSION
|
||||
{
|
||||
CHAR16 str[ 512 ];
|
||||
if( PlayerMercsInSector( pNew->ubSectorX, pNew->ubSectorY, 0 ) || CountAllMilitiaInSector( pNew->ubSectorX, pNew->ubSectorY ) )
|
||||
if ( PlayerMercsInSector( pNew->ubSectorX, pNew->ubSectorY, 0 ) || NumNonPlayerTeamMembersInSector( pNew->ubSectorX, pNew->ubSectorY, MILITIA_TEAM ) )
|
||||
{
|
||||
swprintf( str, L"Attempting to send enemy troops from player occupied location. "
|
||||
L"Please ALT+TAB out of the game before doing anything else and send 'Strategic Decisions.txt' "
|
||||
@@ -1173,7 +1173,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
||||
}
|
||||
else
|
||||
{
|
||||
if( CountAllMilitiaInSector( pGroup->ubSectorX, pGroup->ubSectorY ) )
|
||||
if ( NumNonPlayerTeamMembersInSector( pGroup->ubSectorX, pGroup->ubSectorY, MILITIA_TEAM ) )
|
||||
{
|
||||
fMilitiaPresent = TRUE;
|
||||
fBattlePending = TRUE;
|
||||
|
||||
@@ -2047,7 +2047,7 @@ UINT32 EnemyStrength( void )
|
||||
//as a serious loyalty penalty.
|
||||
void HandleLoyaltyImplicationsOfMercRetreat( INT8 bRetreatCode, INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
|
||||
{
|
||||
if( CountAllMilitiaInSector( sSectorX, sSectorY ) )
|
||||
if ( NumNonPlayerTeamMembersInSector( sSectorX, sSectorY, MILITIA_TEAM ) )
|
||||
{ //Big morale penalty!
|
||||
HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_ABANDON_MILITIA, sSectorX, sSectorY, (INT8)sSectorZ );
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
while (ubMilitiaTrained < iTrainingSquadSize)
|
||||
{
|
||||
// is there room for another militia in the training sector itself?
|
||||
if (CountAllMilitiaInSector(sMapX, sMapY) < iMaxMilitiaPerSector)
|
||||
if ( NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM ) < iMaxMilitiaPerSector )
|
||||
{
|
||||
// great! Create a new GREEN militia guy in the training sector
|
||||
StrategicAddMilitiaToSector(sMapX, sMapY, GREEN_MILITIA, 1);
|
||||
@@ -189,7 +189,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
while( ServeNextFriendlySectorInTown( &sNeighbourX, &sNeighbourY ) )
|
||||
{
|
||||
// is there room for another militia in this neighbouring sector ?
|
||||
if (CountAllMilitiaInSector(sNeighbourX, sNeighbourY) < iMaxMilitiaPerSector)
|
||||
if ( NumNonPlayerTeamMembersInSector( sNeighbourX, sNeighbourY, MILITIA_TEAM ) < iMaxMilitiaPerSector )
|
||||
{
|
||||
// great! Create a new GREEN militia guy in the neighbouring sector
|
||||
StrategicAddMilitiaToSector(sNeighbourX, sNeighbourY, GREEN_MILITIA, 1);
|
||||
@@ -549,21 +549,6 @@ void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY)
|
||||
}
|
||||
|
||||
|
||||
UINT8 CountAllMilitiaInSector(INT16 sMapX, INT16 sMapY)
|
||||
{
|
||||
UINT8 ubMilitiaTotal = 0;
|
||||
UINT8 ubRank;
|
||||
|
||||
// find out if there are any town militia in this SECTOR (don't care about other sectors in same town)
|
||||
for( ubRank = 0; ubRank < MAX_MILITIA_LEVELS; ubRank++ )
|
||||
{
|
||||
ubMilitiaTotal += MilitiaInSectorOfRank(sMapX, sMapY, ubRank);
|
||||
}
|
||||
|
||||
return(ubMilitiaTotal);
|
||||
}
|
||||
|
||||
|
||||
UINT8 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank)
|
||||
{
|
||||
unsigned count = SectorInfo[ SECTOR( sMapX, sMapY ) ].ubNumberOfCivsAtLevel[ ubRank ];
|
||||
|
||||
@@ -47,7 +47,6 @@ UINT8 FindBestMilitiaTrainingLeadershipInSector ( INT16 sMapX, INT16 sMapY, INT8
|
||||
// call this if the player attacks his own militia
|
||||
void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY);
|
||||
|
||||
UINT8 CountAllMilitiaInSector(INT16 sMapX, INT16 sMapY);
|
||||
UINT8 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank);
|
||||
|
||||
// Returns TRUE if sector is under player control, has no enemies in it, and isn't currently in combat mode
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "Isometric Utils.h"
|
||||
#include "DisplayCover.h"
|
||||
#include "worldman.h"
|
||||
#include "Queen Command.h"
|
||||
|
||||
// sevenfm: need this for correct calculation of traits menu position
|
||||
extern INT16 gsInterfaceLevel;
|
||||
@@ -459,8 +460,6 @@ ArtilleryTeam::Functions( UINT32 aVal )
|
||||
/////////////////////////////// Artillery Team Selection ////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////// Reinforcement Sector Selection ////////////////////////////////////////////
|
||||
extern UINT8 CountAllMilitiaInSector(INT16 sMapX, INT16 sMapY);
|
||||
|
||||
void
|
||||
ReinforcementSector::Setup( UINT32 aVal )
|
||||
{
|
||||
@@ -502,7 +501,7 @@ ReinforcementSector::Setup( UINT32 aVal )
|
||||
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Setup_ReinforcementNumber, sectornr ) );
|
||||
|
||||
// grey out if no reinforcements can be called from this sector
|
||||
if( !CountAllMilitiaInSector( loopX, loopY ) )
|
||||
if ( !NumNonPlayerTeamMembersInSector( loopX, loopY, MILITIA_TEAM ) )
|
||||
{
|
||||
// Set this option off.
|
||||
pOption->setAvail(new popupCallbackFunction<bool,void*>( &Popup_OptionOff, NULL ));
|
||||
@@ -544,7 +543,7 @@ ReinforcementNumber::Setup( UINT32 aVal )
|
||||
|
||||
CHAR16 pStr[300];
|
||||
|
||||
UINT8 numberofmilitia = CountAllMilitiaInSector( SECTORX(usSector), SECTORY(usSector) );
|
||||
UINT8 numberofmilitia = NumNonPlayerTeamMembersInSector( SECTORX( usSector ), SECTORY( usSector ), MILITIA_TEAM );
|
||||
|
||||
// 5 militia option
|
||||
swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 5 );
|
||||
|
||||
@@ -3487,7 +3487,7 @@ BOOLEAN GetFarthestOpponent(SOLDIERTYPE *pSoldier, UINT8* puID, INT16 sRange)
|
||||
BOOLEAN MoreFriendsThanEnemiesinNearbysectors(UINT8 ausTeam, INT16 aX, INT16 aY, INT8 aZ)
|
||||
{
|
||||
UINT16 enemyteam = NumEnemiesInFiveSectors(aX, aY) - NumEnemiesInAnySector(aX, aY, aZ);
|
||||
UINT16 militiateam = CountAllMilitiaInFiveSectors(aX, aY) - CountAllMilitiaInSector(aX, aY);
|
||||
UINT16 militiateam = CountAllMilitiaInFiveSectors( aX, aY ) - NumNonPlayerTeamMembersInSector( aX, aY, MILITIA_TEAM );
|
||||
|
||||
if ( ausTeam == ENEMY_TEAM )
|
||||
return (enemyteam > militiateam);
|
||||
|
||||
Reference in New Issue
Block a user