mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
- Added options for delaying veteran militia training and mobile militia training. - Added cost modifiers to promoting green militia to regular and promoting regular to veteran.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@595 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+23
-18
@@ -1100,7 +1100,9 @@ BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pSoldier )
|
||||
BOOLEAN CanCharacterTrainMilitia( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
|
||||
if (gGameExternalOptions.gfmusttrainroaming)
|
||||
if (gGameExternalOptions.gfmusttrainroaming
|
||||
&& (GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay)
|
||||
&& (!IsThisSectorASAMSector(pSoldier->sSectorX,pSoldier->sSectorY,0 )))
|
||||
{
|
||||
if( BasicCanCharacterTrainMilitia( pSoldier ) &&
|
||||
MilitiaTrainingAllowedInSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) &&
|
||||
@@ -1120,7 +1122,7 @@ BOOLEAN CanCharacterTrainMilitia( SOLDIERTYPE *pSoldier )
|
||||
if( BasicCanCharacterTrainMilitia( pSoldier ) &&
|
||||
MilitiaTrainingAllowedInSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) &&
|
||||
DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( pSoldier ) &&
|
||||
( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) == FALSE ) &&
|
||||
( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier,ELITE_MILITIA ) == FALSE ) &&
|
||||
( CountMilitiaTrainersInSoldiersSector( pSoldier ) < gGameExternalOptions.ubMaxMilitiaTrainersPerSector ) )
|
||||
{
|
||||
return( TRUE );
|
||||
@@ -1211,7 +1213,7 @@ INT8 CountMilitiaTrainersInSoldiersSector( SOLDIERTYPE * pSoldier )
|
||||
|
||||
|
||||
|
||||
BOOLEAN IsMilitiaTrainableFromSoldiersSectorMaxed( SOLDIERTYPE *pSoldier )
|
||||
BOOLEAN IsMilitiaTrainableFromSoldiersSectorMaxed( SOLDIERTYPE *pSoldier, INT8 iMilitiaType )
|
||||
{
|
||||
INT8 bTownId = 0;
|
||||
BOOLEAN fSamSitePresent = FALSE;
|
||||
@@ -1232,18 +1234,17 @@ BOOLEAN IsMilitiaTrainableFromSoldiersSectorMaxed( SOLDIERTYPE *pSoldier )
|
||||
// if there is a sam site here
|
||||
if( fSamSitePresent )
|
||||
{
|
||||
if( IsSAMSiteFullOfMilitia( pSoldier->sSectorX, pSoldier->sSectorY ) )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
return( FALSE );
|
||||
if( IsSAMSiteFullOfMilitia( pSoldier->sSectorX, pSoldier->sSectorY,iMilitiaType ) )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// this considers *ALL* safe sectors of the town, not just the one soldier is in
|
||||
if( IsTownFullMilitia( bTownId ) )
|
||||
if( IsTownFullMilitia( bTownId, iMilitiaType ) )
|
||||
{
|
||||
// town is full of militia
|
||||
return( TRUE );
|
||||
@@ -7332,6 +7333,7 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
INT8 bTownId;
|
||||
CHAR16 sString[ 128 ];
|
||||
CHAR16 sStringA[ 128 ];
|
||||
BOOLEAN fCanTrainMilitia = TRUE;
|
||||
|
||||
|
||||
pSoldier = GetSelectedAssignSoldier( FALSE );
|
||||
@@ -7396,10 +7398,18 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
|
||||
|
||||
// Kaiden: Roaming Militia Training:
|
||||
// Added to the if test here:
|
||||
// && (!gGameExternalOptions.gfmusttrainroaming)
|
||||
if(IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA ))
|
||||
if (!gGameExternalOptions.gfmusttrainroaming)
|
||||
fCanTrainMilitia = FALSE;
|
||||
else if (GetWorldDay( ) < gGameExternalOptions.guiAllowMilitiaGroupsDelay)
|
||||
fCanTrainMilitia = FALSE;
|
||||
else if (IsThisSectorASAMSector(pSoldier->sSectorX,pSoldier->sSectorY,0 ))
|
||||
fCanTrainMilitia = FALSE;
|
||||
else
|
||||
fCanTrainMilitia = TRUE;
|
||||
|
||||
if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) && (!gGameExternalOptions.gfmusttrainroaming))
|
||||
|
||||
if(!fCanTrainMilitia)
|
||||
{
|
||||
if( bTownId == BLANK_SECTOR )
|
||||
{
|
||||
@@ -7417,11 +7427,6 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ( CountMilitiaTrainersInSoldiersSector( pSoldier ) >= gGameExternalOptions.ubMaxMilitiaTrainersPerSector )
|
||||
{
|
||||
swprintf( sString, gzLateLocalizedString[ 47 ], gGameExternalOptions.ubMaxMilitiaTrainersPerSector );
|
||||
|
||||
@@ -315,7 +315,7 @@ void ReEvaluateEveryonesNothingToDo();
|
||||
void SetAssignmentForList( INT8 bAssignment, INT8 bParam );
|
||||
|
||||
// is this area maxed out on militia?
|
||||
BOOLEAN IsMilitiaTrainableFromSoldiersSectorMaxed( SOLDIERTYPE *pSoldier );
|
||||
BOOLEAN IsMilitiaTrainableFromSoldiersSectorMaxed( SOLDIERTYPE *pSoldier, INT8 iMilitiaType );
|
||||
|
||||
// function where we actually set someone's assignment so we can trap certain situations
|
||||
void ChangeSoldiersAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment );
|
||||
|
||||
@@ -462,10 +462,16 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
||||
// Kaiden: Moved Create Militia code into CreateMilitiaSquads
|
||||
// Removed the code from here and added the procedure call
|
||||
// If it's time, and this is a city sector create a new group.
|
||||
// But only if we're not training our own.
|
||||
// But only if we're not training our own.
|
||||
|
||||
if( (!gGameExternalOptions.gfmusttrainroaming) && ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ) )
|
||||
{
|
||||
if( GetWorldHour() % gGameExternalOptions.guiCreateEachNHours )return;
|
||||
if (GetWorldDay( ) < gGameExternalOptions.guiAllowMilitiaGroupsDelay)
|
||||
return;
|
||||
|
||||
if( GetWorldHour() % gGameExternalOptions.guiCreateEachNHours )
|
||||
return;
|
||||
|
||||
CreateMilitiaSquads( sMapX, sMapY );
|
||||
}
|
||||
|
||||
@@ -545,7 +551,8 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
||||
// Kaiden: Roaming Militia Training:
|
||||
// If we're training roaming militia,
|
||||
// we'll get our squad from here:
|
||||
|
||||
// Don't need to check for delay, as this function won't be
|
||||
// called if there is a delay set.
|
||||
void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
||||
{
|
||||
UINT16 pMoveDir[4][3];
|
||||
|
||||
+157
-46
@@ -35,6 +35,8 @@ UINT8 gubTownSectorServerIndex = 0;
|
||||
BOOLEAN gfYesNoPromptIsForContinue = FALSE; // this flag remembers whether we're starting new training, or continuing
|
||||
INT32 giTotalCostOfTraining = 0;
|
||||
BOOLEAN gfAreWeTrainingMobile = FALSE;
|
||||
BOOLEAN gfAreWePromotingGreen = FALSE;
|
||||
BOOLEAN gfAreWePromotingRegular = FALSE;
|
||||
|
||||
|
||||
//the completed list of sector soldiers for training militia
|
||||
@@ -108,7 +110,9 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
// If we're not training roaming militia,
|
||||
// then we will handle everything as normal.
|
||||
|
||||
if( (IsMilitiaTrainableFromSoldiersSectorMaxed( pTrainer )) && (gGameExternalOptions.gfmusttrainroaming))
|
||||
if( (IsMilitiaTrainableFromSoldiersSectorMaxed( pTrainer, ELITE_MILITIA ))
|
||||
&& (gGameExternalOptions.gfmusttrainroaming)
|
||||
&&(GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay))
|
||||
{
|
||||
CreateMilitiaSquads(sMapX, sMapY );
|
||||
}
|
||||
@@ -182,7 +186,8 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
// Kaiden: Veteran militia training
|
||||
// This is essentially copy/pasted from above
|
||||
// But the names have been changed to protect the innocent
|
||||
if ((!fFoundOne) && (gGameExternalOptions.gfTrainVeteranMilitia))
|
||||
if ((!fFoundOne) && (gGameExternalOptions.gfTrainVeteranMilitia)
|
||||
&& (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay))
|
||||
{
|
||||
// are there any REGULAR militia men in the training sector itself?
|
||||
if (MilitiaInSectorOfRank(sMapX, sMapY, REGULAR_MILITIA) > 0)
|
||||
@@ -573,18 +578,35 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia2");
|
||||
// We want to charge more for Roaming
|
||||
|
||||
// get total cost
|
||||
if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) && (gGameExternalOptions.gfmusttrainroaming))
|
||||
if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA )
|
||||
&& (gGameExternalOptions.gfmusttrainroaming)
|
||||
&& (GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay))
|
||||
{
|
||||
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier) * iNumberOfSectors;
|
||||
Assert( giTotalCostOfTraining > 0 );
|
||||
gfAreWeTrainingMobile = TRUE;
|
||||
}
|
||||
else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA )
|
||||
&& (gGameExternalOptions.gfTrainVeteranMilitia)
|
||||
&& (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay))
|
||||
{
|
||||
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iVeteranCostModifier) * iNumberOfSectors;
|
||||
Assert( giTotalCostOfTraining > 0 );
|
||||
gfAreWePromotingRegular = TRUE;
|
||||
}
|
||||
else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, GREEN_MILITIA ))
|
||||
{
|
||||
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iRegularCostModifier) * iNumberOfSectors;
|
||||
Assert( giTotalCostOfTraining > 0 );
|
||||
gfAreWePromotingGreen = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
giTotalCostOfTraining = iMilitiaTrainingCost * iNumberOfSectors;
|
||||
Assert( giTotalCostOfTraining > 0 );
|
||||
}
|
||||
|
||||
|
||||
gfYesNoPromptIsForContinue = FALSE;
|
||||
|
||||
if( LaptopSaveInfo.iCurrentBalance < giTotalCostOfTraining )
|
||||
@@ -637,6 +659,7 @@ void HandleInterfaceMessageForContinuingTrainingMilitia( SOLDIERTYPE *pSoldier )
|
||||
INT16 sSectorX = 0, sSectorY = 0;
|
||||
CHAR16 sStringB[ 128 ];
|
||||
INT8 bTownId;
|
||||
BOOLEAN fIsFull = FALSE;
|
||||
|
||||
|
||||
INT32 iMinLoyaltyToTrain = gGameExternalOptions.iMinLoyaltyToTrain;
|
||||
@@ -667,9 +690,17 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3");
|
||||
// if ( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) )
|
||||
// And we're not training mobile militia from a SAM Site
|
||||
|
||||
if ((IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ))
|
||||
&& ((!gGameExternalOptions.gfmusttrainroaming)
|
||||
|| (IsThisSectorASAMSector(sSectorX,sSectorY,0 ))) )
|
||||
if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA ))
|
||||
if (!gGameExternalOptions.gfmusttrainroaming)
|
||||
fIsFull = TRUE;
|
||||
else if (GetWorldDay( ) < gGameExternalOptions.guiAllowMilitiaGroupsDelay)
|
||||
fIsFull = TRUE;
|
||||
else if (IsThisSectorASAMSector(sSectorX,sSectorY,0 ))
|
||||
fIsFull = TRUE;
|
||||
else
|
||||
fIsFull = FALSE;
|
||||
|
||||
if (fIsFull)
|
||||
{
|
||||
// we're full!!! go home!
|
||||
bTownId = GetTownIdForSector( sSectorX, sSectorY );
|
||||
@@ -688,47 +719,35 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3");
|
||||
DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMilitiaOkBoxCallback );
|
||||
return;
|
||||
}
|
||||
/* else
|
||||
{
|
||||
if (( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier )) && (!gGameExternalOptions.gfmusttrainroaming))
|
||||
{
|
||||
// we're full!!! go home!
|
||||
bTownId = GetTownIdForSector( sSectorX, sSectorY );
|
||||
if ( bTownId == BLANK_SECTOR )
|
||||
{
|
||||
// wilderness SAM site
|
||||
GetSectorIDString( sSectorX, sSectorY, 0, sStringB, TRUE );
|
||||
void (*tempFptr)(INT16 , INT16 , INT8 , CHAR16 *, BOOLEAN) = GetSectorIDString;
|
||||
swprintf( (wchar_t *)sString, (wchar_t *)pMilitiaConfirmStrings[ 10 ], sStringB, tempFptr, iMinLoyaltyToTrain );
|
||||
}
|
||||
else
|
||||
{
|
||||
// town
|
||||
swprintf( (wchar_t *)sString, (wchar_t *)pMilitiaConfirmStrings[ 10 ], pTownNames[ bTownId ], iMinLoyaltyToTrain );
|
||||
}
|
||||
DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMilitiaOkBoxCallback );
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Kaiden: Roaming Militia Training:
|
||||
// Charging more to train Roaming Militia
|
||||
if ( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) && (gGameExternalOptions.gfmusttrainroaming))
|
||||
// Also Charging more for promotions over Training
|
||||
|
||||
if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA )
|
||||
&& (gGameExternalOptions.gfmusttrainroaming)
|
||||
&&(GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay))
|
||||
{
|
||||
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier);
|
||||
gfAreWeTrainingMobile = TRUE;
|
||||
}
|
||||
else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA )
|
||||
&& (gGameExternalOptions.gfTrainVeteranMilitia)
|
||||
&& (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay))
|
||||
{
|
||||
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iVeteranCostModifier);
|
||||
gfAreWePromotingRegular = TRUE;
|
||||
}
|
||||
else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, GREEN_MILITIA ))
|
||||
{
|
||||
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iRegularCostModifier);
|
||||
gfAreWePromotingGreen = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// continue training always handles just one sector at a time
|
||||
giTotalCostOfTraining = iMilitiaTrainingCost;
|
||||
giTotalCostOfTraining = (iMilitiaTrainingCost);
|
||||
}
|
||||
|
||||
// can player afford to continue training?
|
||||
if( LaptopSaveInfo.iCurrentBalance < giTotalCostOfTraining )
|
||||
{
|
||||
@@ -889,15 +908,15 @@ BOOLEAN CanNearbyMilitiaScoutThisSector( INT16 sSectorX, INT16 sSectorY )
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
BOOLEAN IsTownFullMilitia( INT8 bTownId )
|
||||
BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType )
|
||||
{
|
||||
INT32 iMaxMilitiaPerSector = gGameExternalOptions.iMaxMilitiaPerSector;
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia4");
|
||||
|
||||
INT32 iCounter = 0;
|
||||
INT16 sSectorX = 0, sSectorY = 0;
|
||||
INT32 iNumberOfMilitia = 0;
|
||||
INT32 iMaxNumber = 0;
|
||||
BOOLEAN fIncreaseCost = FALSE;
|
||||
|
||||
while( pTownNamesList[ iCounter ] != 0 )
|
||||
{
|
||||
@@ -910,15 +929,42 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia4");
|
||||
// if sector is ours get number of militia here
|
||||
if( SectorOursAndPeaceful( sSectorX, sSectorY, 0 ) )
|
||||
{
|
||||
|
||||
//Kaiden: Checking for Price Hikes.
|
||||
if (iMilitiaType == GREEN_MILITIA)
|
||||
{
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA );
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA );
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
|
||||
iMaxNumber += iMaxMilitiaPerSector;
|
||||
|
||||
if (MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA ) > 0)
|
||||
fIncreaseCost = TRUE;
|
||||
}
|
||||
else if (iMilitiaType == REGULAR_MILITIA)
|
||||
{
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA );
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
|
||||
iMaxNumber += iMaxMilitiaPerSector;
|
||||
|
||||
if (MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ) > 0)
|
||||
fIncreaseCost = TRUE;
|
||||
}
|
||||
|
||||
//Kaiden: OK So iMilitiaType should be ELITE_MILITIA
|
||||
// and we're just checking sectors for purposes
|
||||
// of training mobile militia or ending training
|
||||
|
||||
// don't count GREEN militia, they can be trained into regulars first
|
||||
// Kaiden: Veteran Militia Training:
|
||||
// And we don't count regulars either if we're training veterans
|
||||
if (gGameExternalOptions.gfTrainVeteranMilitia)
|
||||
if (gGameExternalOptions.gfTrainVeteranMilitia && (iMilitiaType == ELITE_MILITIA)
|
||||
&& (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay))
|
||||
{
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
|
||||
iMaxNumber += iMaxMilitiaPerSector;
|
||||
}
|
||||
else
|
||||
else if (iMilitiaType == ELITE_MILITIA)
|
||||
{
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA );
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
|
||||
@@ -930,6 +976,24 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia4");
|
||||
iCounter++;
|
||||
}
|
||||
|
||||
if (iMilitiaType == GREEN_MILITIA)
|
||||
{
|
||||
if (( iNumberOfMilitia == iMaxNumber ) && (fIncreaseCost))
|
||||
return( TRUE );
|
||||
else
|
||||
return( FALSE );
|
||||
|
||||
}
|
||||
else if (iMilitiaType == REGULAR_MILITIA)
|
||||
{
|
||||
if (( iNumberOfMilitia == iMaxNumber ) && (fIncreaseCost))
|
||||
return( TRUE );
|
||||
else
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// now check the number of militia
|
||||
if ( iMaxNumber > iNumberOfMilitia )
|
||||
{
|
||||
@@ -939,7 +1003,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia4");
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN IsSAMSiteFullOfMilitia( INT16 sSectorX, INT16 sSectorY )
|
||||
BOOLEAN IsSAMSiteFullOfMilitia( INT16 sSectorX, INT16 sSectorY, INT8 iMilitiaType )
|
||||
{
|
||||
BOOLEAN fSamSitePresent = FALSE;
|
||||
INT32 iNumberOfMilitia = 0;
|
||||
@@ -956,16 +1020,47 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia5");
|
||||
|
||||
if( SectorOursAndPeaceful( sSectorX, sSectorY, 0 ) )
|
||||
{
|
||||
|
||||
//Kaiden: If we're checking for specific Militia for Price Hikes:
|
||||
if (iMilitiaType == GREEN_MILITIA)
|
||||
{
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA );
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA );
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
|
||||
|
||||
if (( iNumberOfMilitia == iMaxMilitiaPerSector) &&
|
||||
(MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA ) > 0))
|
||||
return( TRUE );
|
||||
else
|
||||
return( FALSE );
|
||||
|
||||
}
|
||||
else if (iMilitiaType == REGULAR_MILITIA)
|
||||
{
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA );
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
|
||||
|
||||
if (( iNumberOfMilitia == iMaxMilitiaPerSector) &&
|
||||
(MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ) > 0))
|
||||
return( TRUE );
|
||||
else
|
||||
return( FALSE );
|
||||
}
|
||||
// Kaiden: Ok we're not checking for militia promotions now,
|
||||
// so MilitiaType should be ELITE_MILITIA for purposes
|
||||
// of training Roaming or not.
|
||||
|
||||
// don't count GREEN militia, they can be trained into regulars first
|
||||
|
||||
// Kaiden: Veteran Militia Training:
|
||||
// And we don't count regulars either if we're training veterans
|
||||
if (gGameExternalOptions.gfTrainVeteranMilitia)
|
||||
if (gGameExternalOptions.gfTrainVeteranMilitia && (iMilitiaType == ELITE_MILITIA)
|
||||
&& (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay))
|
||||
{
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
|
||||
iMaxNumber += iMaxMilitiaPerSector;
|
||||
}
|
||||
else
|
||||
else if (iMilitiaType == ELITE_MILITIA)
|
||||
{
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA );
|
||||
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
|
||||
@@ -1250,19 +1345,35 @@ void PayForTrainingInSector( UINT8 ubSector )
|
||||
INT32 iMilitiaTrainingCost = gGameExternalOptions.iMilitiaTrainingCost;
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia6");
|
||||
Assert( SectorInfo[ ubSector ].fMilitiaTrainingPaid == FALSE );
|
||||
INT32 CostMultiplyer = 0;
|
||||
|
||||
// spend the money
|
||||
// Kaiden: Roaming Militia Training:
|
||||
// Charging more to train Roaming Militia
|
||||
// Or for promotions.
|
||||
|
||||
if ( gfAreWeTrainingMobile)
|
||||
{
|
||||
AddTransactionToPlayersBook( TRAIN_TOWN_MILITIA, ubSector, GetWorldTotalMin(), -( iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier ) );
|
||||
CostMultiplyer = gGameExternalOptions.iMilitiaCostModifier;
|
||||
gfAreWeTrainingMobile = FALSE;
|
||||
}
|
||||
else if ( gfAreWePromotingGreen)
|
||||
{
|
||||
CostMultiplyer = gGameExternalOptions.iRegularCostModifier;
|
||||
gfAreWePromotingGreen = FALSE;
|
||||
}
|
||||
else if ( gfAreWePromotingRegular)
|
||||
{
|
||||
CostMultiplyer = gGameExternalOptions.iVeteranCostModifier;
|
||||
gfAreWePromotingRegular = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddTransactionToPlayersBook( TRAIN_TOWN_MILITIA, ubSector, GetWorldTotalMin(), -( iMilitiaTrainingCost ) );
|
||||
CostMultiplyer = 1;
|
||||
}
|
||||
|
||||
AddTransactionToPlayersBook( TRAIN_TOWN_MILITIA, ubSector, GetWorldTotalMin(), -( iMilitiaTrainingCost*CostMultiplyer ) );
|
||||
|
||||
// mark this sector sectors as being paid up
|
||||
SectorInfo[ ubSector ].fMilitiaTrainingPaid = TRUE;
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ void HandleMilitiaStatusInCurrentMapBeforeLoadingNewMap( void );
|
||||
BOOLEAN CanNearbyMilitiaScoutThisSector( INT16 sSectorX, INT16 sSectorY );
|
||||
|
||||
// is the town militia full?
|
||||
BOOLEAN IsTownFullMilitia( INT8 bTownId );
|
||||
BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType );
|
||||
// is the SAM site full of militia?
|
||||
BOOLEAN IsSAMSiteFullOfMilitia( INT16 sSectorX, INT16 sSectorY );
|
||||
BOOLEAN IsSAMSiteFullOfMilitia( INT16 sSectorX, INT16 sSectorY, INT8 iMilitiaType );
|
||||
|
||||
|
||||
// now that town training is complete, handle the continue boxes
|
||||
|
||||
Reference in New Issue
Block a user