More UINT8 -> UINT16 changes

This commit is contained in:
Asdow
2024-11-11 00:08:30 +02:00
parent 040410b450
commit fcf2b27d1a
21 changed files with 121 additions and 121 deletions
+4 -4
View File
@@ -2048,7 +2048,7 @@ static void ARCreateMilitia( UINT8 mclass, INT32 i, INT16 sX, INT16 sY)
swprintf( gpCivs[i].pSoldier->name, gpStrategicString[ STR_AR_MILITIA_NAME ] ); swprintf( gpCivs[i].pSoldier->name, gpStrategicString[ STR_AR_MILITIA_NAME ] );
} }
static void ARCreateMilitiaSquad( UINT8 *cnt, UINT8 ubEliteMilitia, UINT8 ubRegMilitia, UINT8 ubGreenMilitia, INT16 sX, INT16 sY) static void ARCreateMilitiaSquad( UINT16 *cnt, UINT16 ubEliteMilitia, UINT16 ubRegMilitia, UINT16 ubGreenMilitia, INT16 sX, INT16 sY)
{ {
while( *cnt < gpAR->ubCivs && (ubEliteMilitia || ubRegMilitia || ubGreenMilitia) ) while( *cnt < gpAR->ubCivs && (ubEliteMilitia || ubRegMilitia || ubGreenMilitia) )
{ {
@@ -2077,10 +2077,10 @@ void CreateAutoResolveInterface()
VOBJECT_DESC VObjectDesc; VOBJECT_DESC VObjectDesc;
INT32 i, index; INT32 i, index;
HVOBJECT hVObject; HVOBJECT hVObject;
UINT8 ubGreenMilitia, ubRegMilitia, ubEliteMilitia; UINT16 ubGreenMilitia, ubRegMilitia, ubEliteMilitia;
UINT16 pMoveDir[4][3]; UINT16 pMoveDir[4][3];
UINT8 uiDirNumber = 0; UINT8 uiDirNumber = 0;
UINT8 cnt; UINT16 cnt;
//Setup new autoresolve blanket interface. //Setup new autoresolve blanket interface.
MSYS_DefineRegion( &gpAR->AutoResolveRegion, 0 + xResOffset, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH-1, 0, MSYS_DefineRegion( &gpAR->AutoResolveRegion, 0 + xResOffset, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH-1, 0,
@@ -2200,7 +2200,7 @@ void CreateAutoResolveInterface()
ubGreenMilitia = MilitiaInSectorOfRank( gpAR->ubSectorX, gpAR->ubSectorY, GREEN_MILITIA ); ubGreenMilitia = MilitiaInSectorOfRank( gpAR->ubSectorX, gpAR->ubSectorY, GREEN_MILITIA );
// see if we get any bonus militia from nearby towns // see if we get any bonus militia from nearby towns
UINT8 bonusGreenMilitia = 0, bonusRegularMilitia = 0, bonusEliteMilitia = 0; UINT16 bonusGreenMilitia = 0, bonusRegularMilitia = 0, bonusEliteMilitia = 0;
RebelCommand::GetBonusMilitia(gpAR->ubSectorX, gpAR->ubSectorY, bonusGreenMilitia, bonusRegularMilitia, bonusEliteMilitia, FALSE); // no need to create a group for autoresolve as we're just increasing local militia pop RebelCommand::GetBonusMilitia(gpAR->ubSectorX, gpAR->ubSectorY, bonusGreenMilitia, bonusRegularMilitia, bonusEliteMilitia, FALSE); // no need to create a group for autoresolve as we're just increasing local militia pop
ubEliteMilitia += bonusEliteMilitia; ubEliteMilitia += bonusEliteMilitia;
ubRegMilitia += bonusRegularMilitia; ubRegMilitia += bonusRegularMilitia;
+1 -1
View File
@@ -519,7 +519,7 @@ typedef struct SECTORINFO
//the more people go near it. A travel rating of 0 means there are never people //the more people go near it. A travel rating of 0 means there are never people
//around. This value is used for determining how often items would "vanish" from //around. This value is used for determining how often items would "vanish" from
//a sector (nice theory, except it isn't being used that way. Stealing is only in towns. ARM) //a sector (nice theory, except it isn't being used that way. Stealing is only in towns. ARM)
UINT8 ubNumberOfCivsAtLevel[ MAX_MILITIA_LEVELS ]; // town militia per experience class, 0/1/2 is GREEN/REGULAR/ELITE UINT16 ubNumberOfCivsAtLevel[ MAX_MILITIA_LEVELS ]; // town militia per experience class, 0/1/2 is GREEN/REGULAR/ELITE
// HEADROCK HAM 3.6: Adding separate training percentage for MOBILES. // HEADROCK HAM 3.6: Adding separate training percentage for MOBILES.
UINT8 usFiller3; UINT8 usFiller3;
UINT8 usFiller1; UINT8 usFiller1;
+6 -6
View File
@@ -6231,14 +6231,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen4");
usSector = SECTOR( sSectorX, sSectorY ); usSector = SECTOR( sSectorX, sSectorY );
// distribute here // distribute here
SectorInfo[usSector].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] = ( UINT8 )( iNumberOfGreens / iNumberUnderControl ); SectorInfo[usSector].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] = ( UINT16 )( iNumberOfGreens / iNumberUnderControl );
SectorInfo[usSector].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] = ( UINT8 )( iNumberOfRegulars / iNumberUnderControl ); SectorInfo[usSector].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] = ( UINT16 )( iNumberOfRegulars / iNumberUnderControl );
SectorInfo[usSector].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] = ( UINT8 )( iNumberOfElites / iNumberUnderControl ); SectorInfo[usSector].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] = ( UINT16 )( iNumberOfElites / iNumberUnderControl );
// Flugente: indivdual militia // Flugente: indivdual militia
DropIndividualMilitia( usSector, GREEN_MILITIA, (UINT8)(iNumberOfGreens / iNumberUnderControl) ); DropIndividualMilitia( usSector, GREEN_MILITIA, (UINT16)(iNumberOfGreens / iNumberUnderControl) );
DropIndividualMilitia( usSector, REGULAR_MILITIA, (UINT8)(iNumberOfRegulars / iNumberUnderControl) ); DropIndividualMilitia( usSector, REGULAR_MILITIA, (UINT16)(iNumberOfRegulars / iNumberUnderControl) );
DropIndividualMilitia( usSector, ELITE_MILITIA, (UINT8)(iNumberOfElites / iNumberUnderControl) ); DropIndividualMilitia( usSector, ELITE_MILITIA, (UINT16)(iNumberOfElites / iNumberUnderControl) );
// Flugente: as we do not move the group militia, we have to make sure we don't accidentally overfill a sector // Flugente: as we do not move the group militia, we have to make sure we don't accidentally overfill a sector
sTotalSoFar = NumNonPlayerTeamMembersInSector( sSectorX, sSectorY, MILITIA_TEAM ); sTotalSoFar = NumNonPlayerTeamMembersInSector( sSectorX, sSectorY, MILITIA_TEAM );
+2 -2
View File
@@ -1004,7 +1004,7 @@ void HandlePossibleMilitiaPromotion( SOLDIERTYPE* pSoldier, BOOLEAN aAutoResolve
pSoldier->ubMilitiaAssists = 0; pSoldier->ubMilitiaAssists = 0;
} }
void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UINT8 usGreens, UINT8 usRegulars, UINT8 usElites ) void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UINT16 usGreens, UINT16 usRegulars, UINT16 usElites )
{ {
if ( !usGreens && !usRegulars && !usElites ) if ( !usGreens && !usRegulars && !usElites )
return; return;
@@ -1042,7 +1042,7 @@ void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UI
// militia are disbanded - we have to take note of that // militia are disbanded - we have to take note of that
void DisbandIndividualMilitia( UINT8 aSector, UINT8 usGreens, UINT8 usRegulars, UINT8 usElites ) void DisbandIndividualMilitia( UINT8 aSector, UINT16 usGreens, UINT16 usRegulars, UINT16 usElites )
{ {
std::vector<MILITIA>::iterator itend = gIndividualMilitiaVector.end( ); std::vector<MILITIA>::iterator itend = gIndividualMilitiaVector.end( );
for ( std::vector<MILITIA>::iterator it = gIndividualMilitiaVector.begin( ); it != itend; ++it ) for ( std::vector<MILITIA>::iterator it = gIndividualMilitiaVector.begin( ); it != itend; ++it )
+3 -3
View File
@@ -179,10 +179,10 @@ FLOAT PromoteIndividualMilitiaInSector( UINT8 aSector, FLOAT aPointsToAdd );
// handle possible militia promotion and individual militia update // handle possible militia promotion and individual militia update
void HandlePossibleMilitiaPromotion( SOLDIERTYPE* pSoldier, BOOLEAN aAutoResolve ); void HandlePossibleMilitiaPromotion( SOLDIERTYPE* pSoldier, BOOLEAN aAutoResolve );
void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UINT8 usGreens, UINT8 usRegulars, UINT8 usElites ); void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UINT16 usGreens, UINT16 usRegulars, UINT16 usElites );
// militia are disbanded - we have to take note of that // militia are disbanded - we have to take note of that
void DisbandIndividualMilitia( UINT8 aSector, UINT8 usGreens, UINT8 usRegulars, UINT8 usElites ); void DisbandIndividualMilitia( UINT8 aSector, UINT16 usGreens, UINT16 usRegulars, UINT16 usElites );
void PromoteIndividualMilitia( UINT8 aSector, UINT8 aSoldierClass ); void PromoteIndividualMilitia( UINT8 aSector, UINT8 aSoldierClass );
@@ -195,4 +195,4 @@ UINT32 GetDailyUpkeep_IndividualMilitia( UINT32& arNumGreen, UINT32& arNumRegula
void PickIndividualMilitia( UINT8 aSector, UINT8 ubType, UINT16 aNumber ); void PickIndividualMilitia( UINT8 aSector, UINT8 ubType, UINT16 aNumber );
void DropIndividualMilitia( UINT8 aSector, UINT8 ubType, UINT16 aNumber ); void DropIndividualMilitia( UINT8 aSector, UINT8 ubType, UINT16 aNumber );
#endif #endif
+36 -36
View File
@@ -140,12 +140,12 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
SECTORINFO *pTSectorInfo = &( SectorInfo[ SECTOR( sTMapX, sTMapY ) ] ); SECTORINFO *pTSectorInfo = &( SectorInfo[ SECTOR( sTMapX, sTMapY ) ] );
UINT8 bGreensSourceTeam = 0, bGreensDestTeam = 0; UINT16 bGreensSourceTeam = 0, bGreensDestTeam = 0;
UINT8 bRegularsSourceTeam = 0, bRegularsDestTeam = 0; UINT16 bRegularsSourceTeam = 0, bRegularsDestTeam = 0;
UINT8 bElitesSourceTeam = 0, bElitesDestTeam = 0; UINT16 bElitesSourceTeam = 0, bElitesDestTeam = 0;
UINT8 bTotalGreens = 0, bTotalRegulars = 0, bTotalElites = 0; UINT16 bTotalGreens = 0, bTotalRegulars = 0, bTotalElites = 0;
UINT8 bTotalGreensPercent = 0, bTotalRegularsPercent = 0, bTotalElitesPercent = 0; UINT8 bTotalGreensPercent = 0, bTotalRegularsPercent = 0, bTotalElitesPercent = 0;
INT8 bNewSourceGroupSize = 0, bNewDestGroupSize = 0, bGroupSizeRatio = 0; INT16 bNewSourceGroupSize = 0, bNewDestGroupSize = 0, bGroupSizeRatio = 0;
UINT8 ubChanceToSpreadOut; UINT8 ubChanceToSpreadOut;
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
@@ -165,8 +165,8 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
{ {
// Wilderness->Wilderness movement. Calculate Spread Out chance based on threats. // Wilderness->Wilderness movement. Calculate Spread Out chance based on threats.
UINT8 ubNumEnemiesNearOrigin = NumEnemiesInFiveSectors( sMapX, sMapY ); UINT16 ubNumEnemiesNearOrigin = NumEnemiesInFiveSectors( sMapX, sMapY );
UINT8 ubNumEnemiesNearTarget = NumEnemiesInFiveSectors( sTMapX, sTMapY ); UINT16 ubNumEnemiesNearTarget = NumEnemiesInFiveSectors( sTMapX, sTMapY );
if (ubNumEnemiesNearOrigin == 0 && if (ubNumEnemiesNearOrigin == 0 &&
ubNumEnemiesNearTarget > 0 ) ubNumEnemiesNearTarget > 0 )
@@ -264,9 +264,9 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
// Flugente: mobiles take along their gear // Flugente: mobiles take along their gear
// move only gear for those who come new into a sector // move only gear for those who come new into a sector
UINT8 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]); UINT16 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]);
UINT8 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]); UINT16 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]);
UINT8 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]); UINT16 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]);
MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, elites, regulars, greens); MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, elites, regulars, greens);
@@ -306,9 +306,9 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
// Flugente: mobiles take along their gear // Flugente: mobiles take along their gear
// move only gear for those who come new into a sector // move only gear for those who come new into a sector
UINT8 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]); UINT16 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]);
UINT8 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]); UINT16 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]);
UINT8 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]); UINT16 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]);
MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, elites, regulars, greens); MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, elites, regulars, greens);
@@ -336,7 +336,7 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
{ {
// Source team moves En-Masse to target sector. // Source team moves En-Masse to target sector.
bNewDestGroupSize = __min( (NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, MILITIA_TEAM ) + NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM )), (UINT8)gGameExternalOptions.iMaxMilitiaPerSector ); bNewDestGroupSize = __min( (NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, MILITIA_TEAM ) + NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM )), (UINT16)gGameExternalOptions.iMaxMilitiaPerSector );
bNewSourceGroupSize = __max( 0, (NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, MILITIA_TEAM ) + NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM )) - gGameExternalOptions.iMaxMilitiaPerSector ); bNewSourceGroupSize = __max( 0, (NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, MILITIA_TEAM ) + NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM )) - gGameExternalOptions.iMaxMilitiaPerSector );
// If there are still going to be two teams after the transfer // If there are still going to be two teams after the transfer
@@ -396,9 +396,9 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
// Flugente: mobiles take along their gear // Flugente: mobiles take along their gear
// move only gear for those who come new into a sector // move only gear for those who come new into a sector
UINT8 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]); UINT16 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]);
UINT8 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]); UINT16 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]);
UINT8 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]); UINT16 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]);
MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, elites, regulars, greens); MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, elites, regulars, greens);
@@ -432,9 +432,9 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
// Flugente: update individual militia data // Flugente: update individual militia data
ApplyTacticalLifeRatioToMilitia( ); ApplyTacticalLifeRatioToMilitia( );
UINT8 greens = pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]; UINT16 greens = pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];
UINT8 regulars = pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]; UINT16 regulars = pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];
UINT8 elites = pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]; UINT16 elites = pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];
StrategicRemoveMilitiaFromSector( sMapX, sMapY, GREEN_MILITIA, greens ); StrategicRemoveMilitiaFromSector( sMapX, sMapY, GREEN_MILITIA, greens );
StrategicRemoveMilitiaFromSector( sMapX, sMapY, REGULAR_MILITIA, regulars ); StrategicRemoveMilitiaFromSector( sMapX, sMapY, REGULAR_MILITIA, regulars );
@@ -549,7 +549,7 @@ UINT16 CountDirectionEnemyRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir )
for( sLMY = MINIMUM_VALID_Y_COORDINATE; sLMY <= MAXIMUM_VALID_Y_COORDINATE ; ++sLMY ) for( sLMY = MINIMUM_VALID_Y_COORDINATE; sLMY <= MAXIMUM_VALID_Y_COORDINATE ; ++sLMY )
{ {
// SECTORINFO *pSectorInfo = &( SectorInfo[ uiSector ] ); // SECTORINFO *pSectorInfo = &( SectorInfo[ uiSector ] );
UINT8 uiSumOfEnemyTroops = NumNonPlayerTeamMembersInSector( sLMX, sLMY, ENEMY_TEAM ); UINT16 uiSumOfEnemyTroops = NumNonPlayerTeamMembersInSector( sLMX, sLMY, ENEMY_TEAM );
//pSectorInfo->ubNumAdmins + pSectorInfo->ubNumTroops + pSectorInfo->ubNumElites; //pSectorInfo->ubNumAdmins + pSectorInfo->ubNumTroops + pSectorInfo->ubNumElites;
// there's an enemy // there's an enemy
@@ -605,21 +605,21 @@ UINT16 CountDirectionRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir )
return iRes; return iRes;
} }
UINT8 ubMaxSquadSize = gGameExternalOptions.iMaxMilitiaPerSector; UINT16 ubMaxSquadSize = gGameExternalOptions.iMaxMilitiaPerSector;
UINT8 ubSourceGreens = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]; UINT16 ubSourceGreens = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ GREEN_MILITIA ];
UINT8 ubSourceRegulars = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]; UINT16 ubSourceRegulars = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ];
UINT8 ubSourceElites = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]; UINT16 ubSourceElites = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
UINT8 ubTargetGreens = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]; UINT16 ubTargetGreens = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ GREEN_MILITIA ];
UINT8 ubTargetRegulars = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]; UINT16 ubTargetRegulars = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ];
UINT8 ubTargetElites = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]; UINT16 ubTargetElites = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
UINT8 ubSourceMilitia = ubSourceGreens + ubSourceRegulars + ubSourceElites; UINT16 ubSourceMilitia = ubSourceGreens + ubSourceRegulars + ubSourceElites;
UINT8 ubTargetMilitia = ubTargetGreens + ubTargetRegulars + ubTargetElites; UINT16 ubTargetMilitia = ubTargetGreens + ubTargetRegulars + ubTargetElites;
UINT16 usSourceEnemiesInFiveSectors = NumEnemiesInFiveSectors( sMapX, sMapY ); UINT16 usSourceEnemiesInFiveSectors = NumEnemiesInFiveSectors( sMapX, sMapY );
UINT16 usTargetEnemiesInFiveSectors = NumEnemiesInFiveSectors( sDMapX, sDMapY ); UINT16 usTargetEnemiesInFiveSectors = NumEnemiesInFiveSectors( sDMapX, sDMapY );
UINT8 ubTargetEnemies = NumNonPlayerTeamMembersInSector( sDMapX, sDMapY, ENEMY_TEAM ); UINT16 ubTargetEnemies = NumNonPlayerTeamMembersInSector( sDMapX, sDMapY, ENEMY_TEAM );
UINT16 usSourceMilitiaInFiveSectors = CountAllMilitiaInFiveSectors( sMapX, sMapY ); UINT16 usSourceMilitiaInFiveSectors = CountAllMilitiaInFiveSectors( sMapX, sMapY );
UINT16 usTargetMilitiaInFiveSectors = CountAllMilitiaInFiveSectors( sDMapX, sDMapY ); UINT16 usTargetMilitiaInFiveSectors = CountAllMilitiaInFiveSectors( sDMapX, sDMapY );
@@ -1112,7 +1112,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
UINT16 pMoveDir[4][3]; UINT16 pMoveDir[4][3];
UINT8 uiDirNumber = 0; UINT8 uiDirNumber = 0;
UINT8 x; UINT8 x;
UINT8 uiNumGreen = 0, uiNumReg = 0, uiNumElite = 0; UINT16 uiNumGreen = 0, uiNumReg = 0, uiNumElite = 0;
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
BOOLEAN fMoreTroopsLeft[4] = {FALSE,FALSE,FALSE,FALSE}; BOOLEAN fMoreTroopsLeft[4] = {FALSE,FALSE,FALSE,FALSE};
BOOLEAN fFirstLoop = TRUE; BOOLEAN fFirstLoop = TRUE;
@@ -1175,7 +1175,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
// Flugente: order sNumber reinforcements from src sector to target sector // Flugente: order sNumber reinforcements from src sector to target sector
BOOLEAN CallMilitiaReinforcements( INT16 sTargetMapX, INT16 sTargetMapY, INT16 sSrcMapX, INT16 sSrcMapY, UINT16 sNumber ) BOOLEAN CallMilitiaReinforcements( INT16 sTargetMapX, INT16 sTargetMapY, INT16 sSrcMapX, INT16 sSrcMapY, UINT16 sNumber )
{ {
UINT8 uiNumGreen = 0, uiNumReg = 0, uiNumElite = 0; UINT16 uiNumGreen = 0, uiNumReg = 0, uiNumElite = 0;
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sTargetMapX, sTargetMapY ) ] ); SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sTargetMapX, sTargetMapY ) ] );
guiDirNumber = 0; guiDirNumber = 0;
@@ -1236,9 +1236,9 @@ BOOLEAN CallMilitiaReinforcements( INT16 sTargetMapX, INT16 sTargetMapY, INT16 s
{ {
++sMilitiaMoved; ++sMilitiaMoved;
UINT8 militia_green = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, GREEN_MILITIA ); UINT16 militia_green = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, GREEN_MILITIA );
UINT8 militia_troop = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, REGULAR_MILITIA ); UINT16 militia_troop = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, REGULAR_MILITIA );
UINT8 militia_elite = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, ELITE_MILITIA ); UINT16 militia_elite = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, ELITE_MILITIA );
gpAttackDirs[guiDirNumber][0] += militia_green - uiNumGreen; gpAttackDirs[guiDirNumber][0] += militia_green - uiNumGreen;
gpAttackDirs[guiDirNumber][1] += militia_troop - uiNumReg; gpAttackDirs[guiDirNumber][1] += militia_troop - uiNumReg;
+6 -6
View File
@@ -298,9 +298,9 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
VOBJECT_DESC VObjectDesc; VOBJECT_DESC VObjectDesc;
INT32 i; INT32 i;
UINT8 ubGroupID = 0; UINT8 ubGroupID = 0;
UINT8 ubNumStationaryEnemies = 0; UINT16 ubNumStationaryEnemies = 0;
UINT8 ubNumMobileEnemies = 0; UINT16 ubNumMobileEnemies = 0;
UINT8 ubNumMercs; UINT16 ubNumMercs;
BOOLEAN fUsePluralVersion = FALSE; BOOLEAN fUsePluralVersion = FALSE;
INT8 bBestExpLevel = 0; INT8 bBestExpLevel = 0;
BOOLEAN fRetreatAnOption = TRUE; BOOLEAN fRetreatAnOption = TRUE;
@@ -2387,9 +2387,9 @@ void RetreatAllInvolvedMilitiaGroups()
return; return;
// as group size will be cut to MAX_STRATEGIC_ENEMY_GROUP_SIZE, see how many troops are allowed and reduce sector count accordingly // as group size will be cut to MAX_STRATEGIC_ENEMY_GROUP_SIZE, see how many troops are allowed and reduce sector count accordingly
UINT8 greens = pSector->ubNumberOfCivsAtLevel[0]; UINT16 greens = pSector->ubNumberOfCivsAtLevel[0];
UINT8 regulars = pSector->ubNumberOfCivsAtLevel[1]; UINT16 regulars = pSector->ubNumberOfCivsAtLevel[1];
UINT8 elites = pSector->ubNumberOfCivsAtLevel[2]; UINT16 elites = pSector->ubNumberOfCivsAtLevel[2];
pGroup = CreateNewMilitiaGroupDepartingFromSector( SECTOR( sBattleSectorX, sBattleSectorY ), greens, regulars, elites ); pGroup = CreateNewMilitiaGroupDepartingFromSector( SECTOR( sBattleSectorX, sBattleSectorY ), greens, regulars, elites );
+3 -3
View File
@@ -1771,8 +1771,8 @@ void AddPossiblePendingEnemiesToBattle()
BOOLEAN fMagicallyAppeared=FALSE; BOOLEAN fMagicallyAppeared=FALSE;
#endif #endif
UINT8 ubSlots, ubNumAvailable; UINT16 ubSlots, ubNumAvailable;
UINT8 ubNumRobots, ubNumElites, ubNumTroops, ubNumAdmins, ubNumTanks, ubNumJeeps; UINT16 ubNumRobots, ubNumElites, ubNumTroops, ubNumAdmins, ubNumTanks, ubNumJeeps;
UINT8 ubNumGroupsInSector; UINT8 ubNumGroupsInSector;
UINT8 ubGroupIndex; UINT8 ubGroupIndex;
GROUP *pGroup; GROUP *pGroup;
@@ -2000,7 +2000,7 @@ void AddPossiblePendingEnemiesToBattle()
pGroup = pGroupInSectorList[ ubGroupIndex]; pGroup = pGroupInSectorList[ ubGroupIndex];
// Flugente fix: check for underflow... // Flugente fix: check for underflow...
UINT8 currentgroupsize = pGroup->pEnemyGroup->ubElitesInBattle + pGroup->pEnemyGroup->ubTroopsInBattle + pGroup->pEnemyGroup->ubAdminsInBattle UINT16 currentgroupsize = pGroup->pEnemyGroup->ubElitesInBattle + pGroup->pEnemyGroup->ubTroopsInBattle + pGroup->pEnemyGroup->ubAdminsInBattle
+ pGroup->pEnemyGroup->ubRobotsInBattle + pGroup->pEnemyGroup->ubTanksInBattle + pGroup->pEnemyGroup->ubJeepsInBattle; + pGroup->pEnemyGroup->ubRobotsInBattle + pGroup->pEnemyGroup->ubTanksInBattle + pGroup->pEnemyGroup->ubJeepsInBattle;
if ( currentgroupsize > pGroup->ubGroupSize ) if ( currentgroupsize > pGroup->ubGroupSize )
ubNumAvailable = 0; ubNumAvailable = 0;
+1 -1
View File
@@ -3182,7 +3182,7 @@ INT32 GetMiningPolicyBonus(INT16 townId)
return 0; return 0;
} }
void GetBonusMilitia(INT16 sx, INT16 sy, UINT8& green, UINT8& regular, UINT8& elite, BOOLEAN createGroup) void GetBonusMilitia(INT16 sx, INT16 sy, UINT16& green, UINT16& regular, UINT16& elite, BOOLEAN createGroup)
{ {
if (!gGameExternalOptions.fRebelCommandEnabled) if (!gGameExternalOptions.fRebelCommandEnabled)
return; return;
+1 -1
View File
@@ -188,7 +188,7 @@ void ApplyMilitiaBonuses(SOLDIERTYPE* pMilitia);
UINT8 GetApproximateEnemyLocationResolutionIndex(); UINT8 GetApproximateEnemyLocationResolutionIndex();
FLOAT GetAssignmentBonus(INT16 x, INT16 y); FLOAT GetAssignmentBonus(INT16 x, INT16 y);
INT32 GetMiningPolicyBonus(INT16 townId); INT32 GetMiningPolicyBonus(INT16 townId);
void GetBonusMilitia(INT16 x, INT16 y, UINT8& green, UINT8& regular, UINT8& elite, BOOLEAN createGroup); void GetBonusMilitia(INT16 x, INT16 y, UINT16& green, UINT16& regular, UINT16& elite, BOOLEAN createGroup);
INT16 GetFortificationsBonus(UINT8 sector); INT16 GetFortificationsBonus(UINT8 sector);
FLOAT GetHarriersSpeedPenalty(UINT8 sector); FLOAT GetHarriersSpeedPenalty(UINT8 sector);
FLOAT GetLoyaltyGainModifier(); FLOAT GetLoyaltyGainModifier();
+4 -4
View File
@@ -806,7 +806,7 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin
return NULL; return NULL;
} }
GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT8& arusNumAdmins, UINT8& arusNumTroops, UINT8& arusNumElites ) GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT16& arusNumAdmins, UINT16& arusNumTroops, UINT16& arusNumElites )
{ {
GROUP *pNew; GROUP *pNew;
AssertMsg( uiSector >= 0 && uiSector <= 255, String( "CreateNewMilitiaGroupDepartingFromSector with out of range value of %d", uiSector ) ); AssertMsg( uiSector >= 0 && uiSector <= 255, String( "CreateNewMilitiaGroupDepartingFromSector with out of range value of %d", uiSector ) );
@@ -846,7 +846,7 @@ GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT8& arusNum
pNew->pEnemyGroup->ubNumAdmins = arusNumAdmins; pNew->pEnemyGroup->ubNumAdmins = arusNumAdmins;
pNew->pEnemyGroup->ubNumTroops = arusNumTroops; pNew->pEnemyGroup->ubNumTroops = arusNumTroops;
pNew->pEnemyGroup->ubNumElites = arusNumElites; pNew->pEnemyGroup->ubNumElites = arusNumElites;
pNew->ubGroupSize = (UINT8)(arusNumAdmins + arusNumTroops + arusNumElites); pNew->ubGroupSize = arusNumAdmins + arusNumTroops + arusNumElites;
pNew->ubTransportationMask = FOOT; pNew->ubTransportationMask = FOOT;
pNew->fVehicle = FALSE; pNew->fVehicle = FALSE;
pNew->ubCreatedSectorID = pNew->ubOriginalSector; pNew->ubCreatedSectorID = pNew->ubOriginalSector;
@@ -1120,7 +1120,7 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating
gfCantRetreatInPBI = TRUE; gfCantRetreatInPBI = TRUE;
} }
ubChosenMerc = (UINT8)Random( ubNumMercs ); ubChosenMerc = (UINT16)Random( ubNumMercs );
pSoldier = MercPtrs[ ubMercsInGroup[ ubChosenMerc ] ]; pSoldier = MercPtrs[ ubMercsInGroup[ ubChosenMerc ] ];
gpTacticalTraversalChosenSoldier = pSoldier; gpTacticalTraversalChosenSoldier = pSoldier;
@@ -1149,7 +1149,7 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating
gfCantRetreatInPBI = TRUE; gfCantRetreatInPBI = TRUE;
} }
ubChosenMerc = (UINT8)Random( ubNumMercs ); ubChosenMerc = (UINT16)Random( ubNumMercs );
pSoldier = MercPtrs[ ubMercsInGroup[ ubChosenMerc ] ]; pSoldier = MercPtrs[ ubMercsInGroup[ ubChosenMerc ] ];
+1 -1
View File
@@ -204,7 +204,7 @@ BOOLEAN SetGroupPatrolParameters( UINT8 ubGroupID, UINT8 ubRestAtFL, UINT8 ubRes
//............................................................ //............................................................
GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumRobots, UINT8 ubNumTanks, UINT8 ubNumJeeps ); GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumRobots, UINT8 ubNumTanks, UINT8 ubNumJeeps );
GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT8& arusNumAdmins, UINT8& arusNumTroops, UINT8& arusNumElites ); GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT16& arusNumAdmins, UINT16& arusNumTroops, UINT16& arusNumElites );
#ifdef JA2UB #ifdef JA2UB
GROUP* CreateNewEnemyGroupDepartingFromSectorUsingZLevel( UINT32 uiSector, UINT8 ubSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks ); GROUP* CreateNewEnemyGroupDepartingFromSectorUsingZLevel( UINT32 uiSector, UINT8 ubSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks );
+18 -18
View File
@@ -471,7 +471,7 @@ INT8 MilitiaRankToSoldierClass(UINT8 ubRank)
return(bSoldierClass); return(bSoldierClass);
} }
void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 ubHowMany) void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT16 ubHowMany)
{ {
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
@@ -486,15 +486,15 @@ void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 u
fMapPanelDirty = TRUE; fMapPanelDirty = TRUE;
} }
void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, UINT8 ubHowMany) void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, UINT16 ubHowMany)
{ {
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
// damn well better have that many around to promote! // damn well better have that many around to promote!
//Assert(pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] >= ubHowMany); //Assert(pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] >= ubHowMany);
UINT8 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubCurrentRank ); UINT16 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubCurrentRank );
UINT8 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubCurrentRank ); UINT16 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubCurrentRank );
//KM : July 21, 1999 patch fix //KM : July 21, 1999 patch fix
if ( ubCurrentRank >= ELITE_MILITIA || stationary + ingroups < ubHowMany ) if ( ubCurrentRank >= ELITE_MILITIA || stationary + ingroups < ubHowMany )
@@ -503,8 +503,8 @@ void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRa
} }
// determine how many static and - if necessary - group-based militia we have to remove // determine how many static and - if necessary - group-based militia we have to remove
UINT8 reducestatic = min( stationary, ubHowMany ); UINT16 reducestatic = min( stationary, ubHowMany );
UINT8 reducegroups = min( ingroups, ubHowMany - reducestatic ); UINT16 reducegroups = min( ingroups, ubHowMany - reducestatic );
pSectorInfo->ubNumberOfCivsAtLevel[ubCurrentRank] -= reducestatic; pSectorInfo->ubNumberOfCivsAtLevel[ubCurrentRank] -= reducestatic;
pSectorInfo->ubNumberOfCivsAtLevel[ubCurrentRank + 1] += reducestatic; pSectorInfo->ubNumberOfCivsAtLevel[ubCurrentRank + 1] += reducestatic;
@@ -541,7 +541,7 @@ void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRa
fMapPanelDirty = TRUE; fMapPanelDirty = TRUE;
} }
void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 ubHowMany) void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT16 ubHowMany)
{ {
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
@@ -549,8 +549,8 @@ void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UI
// damn well better have that many around to remove! // damn well better have that many around to remove!
//Assert(pSectorInfo->ubNumberOfCivsAtLevel[ ubRank ] >= ubHowMany); //Assert(pSectorInfo->ubNumberOfCivsAtLevel[ ubRank ] >= ubHowMany);
UINT8 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubRank ); UINT16 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubRank );
UINT8 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubRank ); UINT16 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubRank );
//KM : July 21, 1999 patch fix //KM : July 21, 1999 patch fix
if ( stationary + ingroups < ubHowMany ) if ( stationary + ingroups < ubHowMany )
@@ -559,8 +559,8 @@ void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UI
} }
// determine how many static and - if necessary - group-based militia we have to remove // determine how many static and - if necessary - group-based militia we have to remove
UINT8 reducestatic = min( stationary, ubHowMany ); UINT16 reducestatic = min( stationary, ubHowMany );
UINT8 reducegroups = min( ingroups, ubHowMany - reducestatic ); UINT16 reducegroups = min( ingroups, ubHowMany - reducestatic );
pSectorInfo->ubNumberOfCivsAtLevel[ubRank] -= reducestatic; pSectorInfo->ubNumberOfCivsAtLevel[ubRank] -= reducestatic;
@@ -571,21 +571,21 @@ void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UI
{ {
if ( ubRank == GREEN_MILITIA ) if ( ubRank == GREEN_MILITIA )
{ {
UINT8 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumAdmins ); UINT16 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumAdmins );
pGroup->pEnemyGroup->ubNumAdmins -= reduced; pGroup->pEnemyGroup->ubNumAdmins -= reduced;
pGroup->ubGroupSize -= reduced; pGroup->ubGroupSize -= reduced;
reducegroups -= reduced; reducegroups -= reduced;
} }
else if ( ubRank == REGULAR_MILITIA ) else if ( ubRank == REGULAR_MILITIA )
{ {
UINT8 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumTroops ); UINT16 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumTroops );
pGroup->pEnemyGroup->ubNumTroops -= reduced; pGroup->pEnemyGroup->ubNumTroops -= reduced;
pGroup->ubGroupSize -= reduced; pGroup->ubGroupSize -= reduced;
reducegroups -= reduced; reducegroups -= reduced;
} }
else if ( ubRank == ELITE_MILITIA ) else if ( ubRank == ELITE_MILITIA )
{ {
UINT8 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumElites ); UINT16 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumElites );
pGroup->pEnemyGroup->ubNumElites -= reduced; pGroup->pEnemyGroup->ubNumElites -= reduced;
pGroup->ubGroupSize -= reduced; pGroup->ubGroupSize -= reduced;
reducegroups -= reduced; reducegroups -= reduced;
@@ -705,12 +705,12 @@ void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY)
} }
} }
UINT8 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank) UINT16 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank)
{ {
return MilitiaInSectorOfRankStationary( sMapX, sMapY, ubRank ) + MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubRank ); return MilitiaInSectorOfRankStationary( sMapX, sMapY, ubRank ) + MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubRank );
} }
UINT8 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank ) UINT16 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
{ {
if ( ubRank < MAX_MILITIA_LEVELS ) if ( ubRank < MAX_MILITIA_LEVELS )
return SectorInfo[SECTOR( sMapX, sMapY )].ubNumberOfCivsAtLevel[ubRank]; return SectorInfo[SECTOR( sMapX, sMapY )].ubNumberOfCivsAtLevel[ubRank];
@@ -718,9 +718,9 @@ UINT8 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
return 0; return 0;
} }
UINT8 MilitiaInSectorOfRankInGroups( INT16 sMapX, INT16 sMapY, UINT8 ubRank ) UINT16 MilitiaInSectorOfRankInGroups( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
{ {
UINT8 count = 0; UINT16 count = 0;
GROUP *pGroup = gpGroupList; GROUP *pGroup = gpGroupList;
while ( pGroup ) while ( pGroup )
+7 -7
View File
@@ -30,9 +30,9 @@ INT8 SoldierClassToMilitiaRank(UINT8 ubSoldierClass);
INT8 MilitiaRankToSoldierClass(UINT8 ubRank); INT8 MilitiaRankToSoldierClass(UINT8 ubRank);
// these add, promote, and remove militias of a certain rank // these add, promote, and remove militias of a certain rank
void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 ubHowMany); void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT16 ubHowMany);
void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, UINT8 ubHowMany); void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, UINT16 ubHowMany);
void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 ubHowMany); void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT16 ubHowMany);
void StrategicRemoveAllStaticMilitiaFromSector( INT16 sMapX, INT16 sMapY, UINT8 ubRank ); void StrategicRemoveAllStaticMilitiaFromSector( INT16 sMapX, INT16 sMapY, UINT8 ubRank );
@@ -49,9 +49,9 @@ UINT8 FindBestMilitiaTrainingLeadershipInSector ( INT16 sMapX, INT16 sMapY, INT8
// call this if the player attacks his own militia // call this if the player attacks his own militia
void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY); void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY);
UINT8 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank); UINT16 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank);
UINT8 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank ); UINT16 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank );
UINT8 MilitiaInSectorOfRankInGroups( INT16 sMapX, INT16 sMapY, UINT8 ubRank ); UINT16 MilitiaInSectorOfRankInGroups( 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 // Returns TRUE if sector is under player control, has no enemies in it, and isn't currently in combat mode
BOOLEAN SectorOursAndPeaceful( INT16 sMapX, INT16 sMapY, INT8 bMapZ ); BOOLEAN SectorOursAndPeaceful( INT16 sMapX, INT16 sMapY, INT8 bMapZ );
@@ -135,4 +135,4 @@ FLOAT GetIntel();
void AddRaidPersonnel( INT32 aBloodcats, INT32 aZombie, INT32 aBandits ); void AddRaidPersonnel( INT32 aBloodcats, INT32 aZombie, INT32 aBandits );
void GetRaidPersonnel( INT32& arBloodcats, INT32& arZombie, INT32& arBandits ); void GetRaidPersonnel( INT32& arBloodcats, INT32& arZombie, INT32& arBandits );
#endif #endif
+3 -3
View File
@@ -17506,9 +17506,9 @@ BOOLEAN MilitiaPlotStart( )
return FALSE; return FALSE;
// as group size will be cut to MAX_STRATEGIC_ENEMY_GROUP_SIZE, see how many troops are allowed and reduce sector count accordingly // as group size will be cut to MAX_STRATEGIC_ENEMY_GROUP_SIZE, see how many troops are allowed and reduce sector count accordingly
UINT8 greens = pSector->ubNumberOfCivsAtLevel[0]; UINT16 greens = pSector->ubNumberOfCivsAtLevel[0];
UINT8 regulars = pSector->ubNumberOfCivsAtLevel[1]; UINT16 regulars = pSector->ubNumberOfCivsAtLevel[1];
UINT8 elites = pSector->ubNumberOfCivsAtLevel[2]; UINT16 elites = pSector->ubNumberOfCivsAtLevel[2];
// when we start plotting, the group is still empty - we add militia later // when we start plotting, the group is still empty - we add militia later
GROUP* pGroup = CreateNewMilitiaGroupDepartingFromSector( SECTOR( sSelMapX, sSelMapY ), greens, regulars, elites ); GROUP* pGroup = CreateNewMilitiaGroupDepartingFromSector( SECTOR( sSelMapX, sSelMapY ), greens, regulars, elites );
+4 -4
View File
@@ -3924,23 +3924,23 @@ void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX,
} }
} }
void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, UINT8 usElites, UINT8 usRegulars, UINT8 usGreens) void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, UINT16 usElites, UINT16 usRegulars, UINT16 usGreens)
{ {
if ( !gGameExternalOptions.fMilitiaUseSectorInventory ) if ( !gGameExternalOptions.fMilitiaUseSectorInventory )
return; return;
// atm there is no class-specific selection, but that might change in the future // atm there is no class-specific selection, but that might change in the future
for (UINT8 i = 0; i < usElites; ++i) for (UINT16 i = 0; i < usElites; ++i)
{ {
MoveOneMilitiaEquipmentSet( sSourceX, sSourceY, sTargetX, sTargetY, SOLDIER_CLASS_ELITE_MILITIA); MoveOneMilitiaEquipmentSet( sSourceX, sSourceY, sTargetX, sTargetY, SOLDIER_CLASS_ELITE_MILITIA);
} }
for (UINT8 i = 0; i < usRegulars; ++i) for (UINT16 i = 0; i < usRegulars; ++i)
{ {
MoveOneMilitiaEquipmentSet( sSourceX, sSourceY, sTargetX, sTargetY, SOLDIER_CLASS_REG_MILITIA); MoveOneMilitiaEquipmentSet( sSourceX, sSourceY, sTargetX, sTargetY, SOLDIER_CLASS_REG_MILITIA);
} }
for (UINT8 i = 0; i < usGreens; ++i) for (UINT16 i = 0; i < usGreens; ++i)
{ {
MoveOneMilitiaEquipmentSet( sSourceX, sSourceY, sTargetX, sTargetY, SOLDIER_CLASS_GREEN_MILITIA); MoveOneMilitiaEquipmentSet( sSourceX, sSourceY, sTargetX, sTargetY, SOLDIER_CLASS_GREEN_MILITIA);
} }
+2 -2
View File
@@ -121,9 +121,9 @@ extern ARMY_GUN_CHOICE_TYPE gArmyItemChoices[SOLDIER_GUN_CHOICE_SELECTIONS][MAX_
void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, INT8 bSoldierClass); void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, INT8 bSoldierClass);
// move a number of militia equipment sets between sectors // move a number of militia equipment sets between sectors
void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, UINT8 usElites, UINT8 usRegulars, UINT8 usGreens); void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, UINT16 usElites, UINT16 usRegulars, UINT16 usGreens);
// take militia items from sector // take militia items from sector
void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ); void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass );
#endif #endif
+1 -1
View File
@@ -199,7 +199,7 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
{ {
SECTORINFO *pSector; SECTORINFO *pSector;
INT32 x; INT32 x;
UINT8 ubGreen, ubRegs, ubElites; UINT16 ubGreen, ubRegs, ubElites;
if( gbWorldSectorZ > 0 ) if( gbWorldSectorZ > 0 )
return; return;
+1 -1
View File
@@ -994,7 +994,7 @@ BOOLEAN ExecuteOverhead( )
// check if bonus militia join us // check if bonus militia join us
if (checkBonusMilitia == TRUE && gGameExternalOptions.fRebelCommandEnabled && gubPBSectorZ == 0) if (checkBonusMilitia == TRUE && gGameExternalOptions.fRebelCommandEnabled && gubPBSectorZ == 0)
{ {
UINT8 bonusGreenMilitia = 0, bonusRegularMilitia = 0, bonusEliteMilitia = 0; UINT16 bonusGreenMilitia = 0, bonusRegularMilitia = 0, bonusEliteMilitia = 0;
RebelCommand::GetBonusMilitia(gubPBSectorX, gubPBSectorY, bonusGreenMilitia, bonusRegularMilitia, bonusEliteMilitia, TRUE); RebelCommand::GetBonusMilitia(gubPBSectorX, gubPBSectorY, bonusGreenMilitia, bonusRegularMilitia, bonusEliteMilitia, TRUE);
checkBonusMilitia = FALSE; checkBonusMilitia = FALSE;
} }
+15 -15
View File
@@ -2109,12 +2109,12 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT16 ubNumLarvae, UINT16 ubN
} }
} }
void AddSoldierInitListOtherCreatures( UINT8 usNum ) void AddSoldierInitListOtherCreatures( UINT16 usNum )
{ {
SOLDIERINITNODE *curr; SOLDIERINITNODE *curr;
UINT8 ubFreeSlots; UINT16 ubFreeSlots;
BOOLEAN fDoPlacement; BOOLEAN fDoPlacement;
UINT8 ubNumCreatures = usNum; UINT16 ubNumCreatures = usNum;
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "AddSoldierInitListBloodcats" ) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "AddSoldierInitListBloodcats" ) );
@@ -2465,7 +2465,7 @@ void AddSoldierInitListBloodcats()
else else
{ //We don't yet know the number of bloodcat placements in this sector so { //We don't yet know the number of bloodcat placements in this sector so
//count them now, and permanently record it. //count them now, and permanently record it.
INT8 bBloodCatPlacements = 0; INT16 bBloodCatPlacements = 0;
curr = gSoldierInitHead; curr = gSoldierInitHead;
while( curr ) while( curr )
{ {
@@ -2513,11 +2513,11 @@ void AddSoldierInitListBloodcats()
} }
if( pSector->bBloodCats > 0 ) if( pSector->bBloodCats > 0 )
{ //Add them to the world now... { //Add them to the world now...
UINT8 ubNumAdded = 0; UINT16 ubNumAdded = 0;
UINT8 ubMaxNum = (UINT8)pSector->bBloodCats; UINT16 ubMaxNum = (UINT16)pSector->bBloodCats;
SOLDIERINITNODE *mark; SOLDIERINITNODE *mark;
UINT8 ubSlotsToFill; UINT16 ubSlotsToFill;
UINT8 ubSlotsAvailable; UINT16 ubSlotsAvailable;
SOLDIERINITNODE *curr; SOLDIERINITNODE *curr;
//Sort the list in the following manner: //Sort the list in the following manner:
@@ -2983,12 +2983,12 @@ void StripEnemyDetailedPlacementsIfSectorWasPlayerLiberated()
//#define CENTRAL_GRIDNO 13202 //#define CENTRAL_GRIDNO 13202
//#define CENTRAL_RADIUS 30 //#define CENTRAL_RADIUS 30
void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNumGreen, UINT8 ubNumReg, UINT8 ubNumElites ) void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT16 ubNumGreen, UINT16 ubNumReg, UINT16 ubNumElites )
{ {
SOLDIERTYPE *pSoldier; SOLDIERTYPE *pSoldier;
MAPEDGEPOINTINFO MapEdgepointInfo; MAPEDGEPOINTINFO MapEdgepointInfo;
UINT8 ubCurrSlot; UINT16 ubCurrSlot;
UINT8 ubTotalSoldiers; UINT16 ubTotalSoldiers;
UINT8 bDesiredDirection=0; UINT8 bDesiredDirection=0;
ubTotalSoldiers = ubNumGreen + ubNumReg + ubNumElites; ubTotalSoldiers = ubNumGreen + ubNumReg + ubNumElites;
@@ -3073,7 +3073,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu
} }
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 );
} }
else if( ubNumReg && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumReg) ) else if( ubNumReg && (UINT16)Random( ubTotalSoldiers ) < (ubNumElites + ubNumReg) )
{ {
ubNumReg--; ubNumReg--;
ubTotalSoldiers--; ubTotalSoldiers--;
@@ -3113,7 +3113,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu
} }
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 );
} }
else if( ubNumGreen && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumReg + ubNumGreen) ) else if( ubNumGreen && (UINT16)Random( ubTotalSoldiers ) < (UINT16)(ubNumElites + ubNumReg + ubNumGreen) )
{ {
ubNumGreen--; ubNumGreen--;
ubTotalSoldiers--; ubTotalSoldiers--;
@@ -3219,7 +3219,7 @@ void SectorAddAssassins( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
return; return;
// now count militia, and which type (green, regular, elite) is most numerous - that will be the best type to blend in // now count militia, and which type (green, regular, elite) is most numerous - that will be the best type to blend in
UINT8 militiacnt = MilitiaInSectorOfRank( sMapX, sMapY, GREEN_MILITIA ); UINT16 militiacnt = MilitiaInSectorOfRank( sMapX, sMapY, GREEN_MILITIA );
UINT8 militiadisguise = GREEN_MILITIA; UINT8 militiadisguise = GREEN_MILITIA;
if ( MilitiaInSectorOfRank( sMapX, sMapY, REGULAR_MILITIA ) > militiacnt ) if ( MilitiaInSectorOfRank( sMapX, sMapY, REGULAR_MILITIA ) > militiacnt )
{ {
@@ -3290,7 +3290,7 @@ void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
} }
// we can't spawn if all civilian slots are already taken (we leave a bit of reserve for more important civs) // we can't spawn if all civilian slots are already taken (we leave a bit of reserve for more important civs)
UINT8 maxcivs = max(0, gGameExternalOptions.ubGameMaximumNumberOfCivilians - 3); UINT16 maxcivs = max(0, gGameExternalOptions.ubGameMaximumNumberOfCivilians - 3);
for (UINT16 i = numberofpows; i < numprisoners; ++i) for (UINT16 i = numberofpows; i < numprisoners; ++i)
{ {
+2 -2
View File
@@ -44,9 +44,9 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT16 ubTotalAdmin, UINT16 ubTotal
void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT16 ubNumLarvae, UINT16 ubNumInfants, void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT16 ubNumLarvae, UINT16 ubNumInfants,
UINT16 ubNumYoungMales, UINT16 ubNumYoungFemales, UINT16 ubNumAdultMales, UINT16 ubNumYoungMales, UINT16 ubNumYoungFemales, UINT16 ubNumAdultMales,
UINT16 ubNumAdultFemales ); UINT16 ubNumAdultFemales );
void AddSoldierInitListOtherCreatures( UINT8 usNum ); void AddSoldierInitListOtherCreatures( UINT16 usNum );
void AddSoldierInitListMilitia( UINT16 ubNumGreen, UINT16 ubNumReg, UINT16 ubNumElites ); void AddSoldierInitListMilitia( UINT16 ubNumGreen, UINT16 ubNumReg, UINT16 ubNumElites );
void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNumGreen, UINT8 ubNumReg, UINT8 ubNumElites ); void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT16 ubNumGreen, UINT16 ubNumReg, UINT16 ubNumElites );
void AddSoldierInitListBloodcats(); void AddSoldierInitListBloodcats();