Merged from revision: 7199

Fixes (by Buggler)
- Fixed town militia training bug after declining to train a new mobile militia squad upon completion
- Fixed income from facilities not properly added to cash balance

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7200 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-05-11 05:58:07 +00:00
parent de713b496d
commit 779a83f121
5 changed files with 49 additions and 25 deletions
+14 -5
View File
@@ -41,9 +41,10 @@
#endif
INT16 gsSkyriderCostModifier;
// HEADROCK HAM 3.6: Strategic info variable, total of costs accumulated for the use of facilities today. Deducted
// from account and reset at midnight, unless player can't pay (in which case, carries over to the next day).
// HEADROCK HAM 3.6: Strategic info variable, total of income/costs accumulated for the use of facilities today.
// Account settle and reset at midnight, unless player can't pay (in which case, carries over to the next day).
// This variable is SAVED and LOADED.
INT32 giTotalEarnedForFacilityOperationsToday = 0;
INT32 giTotalOwedForFacilityOperationsToday = 0;
BOOLEAN gfOutstandingFacilityDebt = TRUE;
@@ -626,9 +627,9 @@ void UpdateFacilityUsageCosts( )
else if (sCost < 0)
{
/////////////////////////////////////////////////////////
// Put money directly into the player's account
// Increase income for operating this facility
LaptopSaveInfo.iCurrentBalance += (-1 * sCost);
giTotalEarnedForFacilityOperationsToday += (-1 * gFacilityTypes[ubFacilityType].AssignmentData[ubAssignmentType].sCostPerHour);
}
}
@@ -637,6 +638,13 @@ void UpdateFacilityUsageCosts( )
}
}
void HandleDailyPaymentFacilityIncome( void )
{
// Pay total income.
AddTransactionToPlayersBook( FACILITY_OPERATIONS, 0, GetWorldTotalMin(), giTotalEarnedForFacilityOperationsToday );
giTotalEarnedForFacilityOperationsToday = 0;
}
// HEADROCK HAM 3.6: This function runs once at the end of each day.
// It handles debt accrued by operation facilities. If there is enough money to pay the debt off, this
// is done automatically. If only part of the money is available, or none of it, your account is emptied and all
@@ -2036,7 +2044,8 @@ INT32 GetTotalFacilityHourlyCosts( BOOLEAN fPositive )
void InitFacilities()
{
// Initialize facility debt.
// Initialize facility accounts.
giTotalEarnedForFacilityOperationsToday = 0;
giTotalOwedForFacilityOperationsToday = 0;
gfOutstandingFacilityDebt = FALSE;
}