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
+18 -18
View File
@@ -471,7 +471,7 @@ INT8 MilitiaRankToSoldierClass(UINT8 ubRank)
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 ) ] );
@@ -486,15 +486,15 @@ void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 u
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 ) ] );
// damn well better have that many around to promote!
//Assert(pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] >= ubHowMany);
UINT8 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubCurrentRank );
UINT8 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubCurrentRank );
UINT16 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubCurrentRank );
UINT16 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubCurrentRank );
//KM : July 21, 1999 patch fix
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
UINT8 reducestatic = min( stationary, ubHowMany );
UINT8 reducegroups = min( ingroups, ubHowMany - reducestatic );
UINT16 reducestatic = min( stationary, ubHowMany );
UINT16 reducegroups = min( ingroups, ubHowMany - reducestatic );
pSectorInfo->ubNumberOfCivsAtLevel[ubCurrentRank] -= reducestatic;
pSectorInfo->ubNumberOfCivsAtLevel[ubCurrentRank + 1] += reducestatic;
@@ -541,7 +541,7 @@ void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRa
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 ) ] );
@@ -549,8 +549,8 @@ void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UI
// damn well better have that many around to remove!
//Assert(pSectorInfo->ubNumberOfCivsAtLevel[ ubRank ] >= ubHowMany);
UINT8 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubRank );
UINT8 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubRank );
UINT16 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubRank );
UINT16 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubRank );
//KM : July 21, 1999 patch fix
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
UINT8 reducestatic = min( stationary, ubHowMany );
UINT8 reducegroups = min( ingroups, ubHowMany - reducestatic );
UINT16 reducestatic = min( stationary, ubHowMany );
UINT16 reducegroups = min( ingroups, ubHowMany - reducestatic );
pSectorInfo->ubNumberOfCivsAtLevel[ubRank] -= reducestatic;
@@ -571,21 +571,21 @@ void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UI
{
if ( ubRank == GREEN_MILITIA )
{
UINT8 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumAdmins );
UINT16 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumAdmins );
pGroup->pEnemyGroup->ubNumAdmins -= reduced;
pGroup->ubGroupSize -= reduced;
reducegroups -= reduced;
}
else if ( ubRank == REGULAR_MILITIA )
{
UINT8 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumTroops );
UINT16 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumTroops );
pGroup->pEnemyGroup->ubNumTroops -= reduced;
pGroup->ubGroupSize -= reduced;
reducegroups -= reduced;
}
else if ( ubRank == ELITE_MILITIA )
{
UINT8 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumElites );
UINT16 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumElites );
pGroup->pEnemyGroup->ubNumElites -= reduced;
pGroup->ubGroupSize -= 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 );
}
UINT8 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
UINT16 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
{
if ( ubRank < MAX_MILITIA_LEVELS )
return SectorInfo[SECTOR( sMapX, sMapY )].ubNumberOfCivsAtLevel[ubRank];
@@ -718,9 +718,9 @@ UINT8 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
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;
while ( pGroup )