mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +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:
@@ -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 ];
|
||||
|
||||
Reference in New Issue
Block a user