mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Improve multiselection contract renewal
* Contract duration lines are greyed out if the player lacks funds *Selecting a mix of AIM and other merc types allows renewing contracts for selected AIM mercs * Multiselection of only mercs whose contracts are not renewable (IMPs, rebels, etc) will have greyed out contract lines
This commit is contained in:
+47
-11
@@ -12738,10 +12738,6 @@ void ContractRegionMvtCallback( MOUSE_REGION *pRegion, INT32 iReason )
|
|||||||
|
|
||||||
void HandleShadingOfLinesForContractMenu( void )
|
void HandleShadingOfLinesForContractMenu( void )
|
||||||
{
|
{
|
||||||
SOLDIERTYPE *pSoldier;
|
|
||||||
MERCPROFILESTRUCT *pProfile;
|
|
||||||
|
|
||||||
|
|
||||||
if( ( fShowContractMenu == FALSE ) || ( ghContractBox == - 1 ) )
|
if( ( fShowContractMenu == FALSE ) || ( ghContractBox == - 1 ) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -12762,13 +12758,31 @@ void HandleShadingOfLinesForContractMenu( void )
|
|||||||
Assert( CanExtendContractForCharSlot( bSelectedContractChar ) );
|
Assert( CanExtendContractForCharSlot( bSelectedContractChar ) );
|
||||||
|
|
||||||
// grab the character
|
// grab the character
|
||||||
pSoldier = gCharactersList[ bSelectedContractChar ].usSolID;
|
SOLDIERTYPE* pSoldier = gCharactersList[ bSelectedContractChar ].usSolID;
|
||||||
|
const bool multipleMercsSelected = (gSelectedSoldiers.size() > 0) ? true : false;
|
||||||
|
|
||||||
|
bool atLeastOneAIMmerc = false;
|
||||||
|
if (pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC)
|
||||||
|
{
|
||||||
|
atLeastOneAIMmerc = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (multipleMercsSelected)
|
||||||
|
{
|
||||||
|
for (const auto& soldier : gSelectedSoldiers)
|
||||||
|
{
|
||||||
|
if (soldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC)
|
||||||
|
{
|
||||||
|
atLeastOneAIMmerc = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// is guy in AIM? and well enough to talk and make such decisions?
|
// is guy in AIM? and well enough to talk and make such decisions?
|
||||||
if( ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) && ( pSoldier->stats.bLife >= OKLIFE ) )
|
if( (atLeastOneAIMmerc) && ( pSoldier->stats.bLife >= OKLIFE ) )
|
||||||
{
|
{
|
||||||
pProfile = &( gMercProfiles[ pSoldier->ubProfile ] );
|
MERCPROFILESTRUCT* pProfile = &( gMercProfiles[ pSoldier->ubProfile ] );
|
||||||
|
|
||||||
if (is_networked)
|
if (is_networked)
|
||||||
{
|
{
|
||||||
@@ -12779,8 +12793,30 @@ void HandleShadingOfLinesForContractMenu( void )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Determine salary costs
|
||||||
|
UINT32 sumOneDay = 0;
|
||||||
|
UINT32 sumOneWeek = 0;
|
||||||
|
UINT32 sumBiWeekly = 0;
|
||||||
|
if (multipleMercsSelected)
|
||||||
|
{
|
||||||
|
for (const auto& soldier : gSelectedSoldiers)
|
||||||
|
{
|
||||||
|
const auto& profile = gMercProfiles[soldier->ubProfile];
|
||||||
|
sumOneDay += profile.sSalary;
|
||||||
|
sumOneWeek += profile.uiWeeklySalary;
|
||||||
|
sumBiWeekly += profile.uiBiWeeklySalary;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sumOneDay = pProfile->sSalary;
|
||||||
|
sumOneWeek = pProfile->uiWeeklySalary;
|
||||||
|
sumBiWeekly = pProfile->uiBiWeeklySalary;
|
||||||
|
}
|
||||||
|
|
||||||
// one day
|
// one day
|
||||||
if( pProfile->sSalary > LaptopSaveInfo.iCurrentBalance )
|
if(sumOneDay > LaptopSaveInfo.iCurrentBalance )
|
||||||
{
|
{
|
||||||
ShadeStringInBox( ghContractBox, CONTRACT_MENU_DAY );
|
ShadeStringInBox( ghContractBox, CONTRACT_MENU_DAY );
|
||||||
}
|
}
|
||||||
@@ -12790,7 +12826,7 @@ void HandleShadingOfLinesForContractMenu( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// one week
|
// one week
|
||||||
if( ( INT32 )( pProfile->uiWeeklySalary ) > LaptopSaveInfo.iCurrentBalance )
|
if( ( INT32 )(sumOneWeek) > LaptopSaveInfo.iCurrentBalance )
|
||||||
{
|
{
|
||||||
ShadeStringInBox( ghContractBox, CONTRACT_MENU_WEEK );
|
ShadeStringInBox( ghContractBox, CONTRACT_MENU_WEEK );
|
||||||
}
|
}
|
||||||
@@ -12800,7 +12836,7 @@ void HandleShadingOfLinesForContractMenu( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// two weeks
|
// two weeks
|
||||||
if( ( INT32 )( pProfile->uiBiWeeklySalary ) > LaptopSaveInfo.iCurrentBalance )
|
if( ( INT32 )(sumBiWeekly) > LaptopSaveInfo.iCurrentBalance )
|
||||||
{
|
{
|
||||||
ShadeStringInBox( ghContractBox, CONTRACT_MENU_TWO_WEEKS );
|
ShadeStringInBox( ghContractBox, CONTRACT_MENU_TWO_WEEKS );
|
||||||
}
|
}
|
||||||
@@ -12820,7 +12856,7 @@ void HandleShadingOfLinesForContractMenu( void )
|
|||||||
|
|
||||||
// if THIS soldier is involved in a fight (dismissing in a hostile sector IS ok...)
|
// if THIS soldier is involved in a fight (dismissing in a hostile sector IS ok...)
|
||||||
// Also if we have multiple mercs selected, disable terminating contracts
|
// Also if we have multiple mercs selected, disable terminating contracts
|
||||||
if( gSelectedSoldiers.size() > 0 || (( gTacticalStatus.uiFlags & INCOMBAT ) && pSoldier->bInSector ))
|
if (multipleMercsSelected || (( gTacticalStatus.uiFlags & INCOMBAT ) && pSoldier->bInSector ))
|
||||||
{
|
{
|
||||||
ShadeStringInBox( ghContractBox, CONTRACT_MENU_TERMINATE );
|
ShadeStringInBox( ghContractBox, CONTRACT_MENU_TERMINATE );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user