forked from rosebudai/OpenRCT2-Web
Move gCompanyValue to GameState_t
This commit is contained in:
1 parent
bcff6f5a7e
commit
70ea832808
12 files changed
+16
-18
No files matched your search
@@ -595,7 +595,7 @@ public:
|
||||
ft.Add<money64>(gameState.ParkValue);
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_PARK_VALUE_LABEL, ft);
|
||||
ft = Formatter();
|
||||
ft.Add<money64>(gCompanyValue);
|
||||
ft.Add<money64>(gameState.CompanyValue);
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 294 }, STR_COMPANY_VALUE_LABEL, ft);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace OpenRCT2
|
||||
uint32_t ParkSize;
|
||||
money64 ParkValue;
|
||||
money64 ParkValueHistory[FINANCE_GRAPH_SIZE];
|
||||
money64 CompanyValue;
|
||||
uint8_t ParkRatingHistory[32];
|
||||
ClimateType Climate;
|
||||
ClimateState ClimateCurrent;
|
||||
|
||||
@@ -565,7 +565,7 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t&
|
||||
}
|
||||
else if (argv[0] == "company_value")
|
||||
{
|
||||
console.WriteFormatLine("company_value %d", gCompanyValue / 10);
|
||||
console.WriteFormatLine("company_value %d", gameState.CompanyValue / 10);
|
||||
}
|
||||
else if (argv[0] == "money")
|
||||
{
|
||||
|
||||
@@ -236,7 +236,7 @@ void FinanceInit()
|
||||
|
||||
gameState.BankLoanInterestRate = 10;
|
||||
gameState.ParkValue = 0;
|
||||
gCompanyValue = 0;
|
||||
gameState.CompanyValue = 0;
|
||||
gameState.ScenarioCompletedCompanyValue = kMoney64Undefined;
|
||||
gameState.TotalAdmissions = 0;
|
||||
gameState.TotalIncomeFromAdmissions = 0;
|
||||
|
||||
@@ -885,7 +885,7 @@ namespace OpenRCT2
|
||||
});
|
||||
}
|
||||
cs.ReadWrite(gameState.ParkValue);
|
||||
cs.ReadWrite(gCompanyValue);
|
||||
cs.ReadWrite(gameState.CompanyValue);
|
||||
cs.ReadWrite(gameState.ParkSize);
|
||||
cs.ReadWrite(gameState.NumGuestsInPark);
|
||||
cs.ReadWrite(gameState.NumGuestsHeadingForPark);
|
||||
|
||||
@@ -1402,7 +1402,7 @@ namespace RCT1
|
||||
gameState.BankLoanInterestRate = 1;
|
||||
gameState.InitialCash = ToMoney64(_s4.Cash);
|
||||
|
||||
gCompanyValue = ToMoney64(_s4.CompanyValue);
|
||||
gameState.CompanyValue = ToMoney64(_s4.CompanyValue);
|
||||
gameState.ParkValue = CorrectRCT1ParkValue(_s4.ParkValue);
|
||||
gCurrentProfit = ToMoney64(_s4.Profit);
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ namespace RCT2
|
||||
gameState.ScenarioCompletedCompanyValue = RCT12CompletedCompanyValueToOpenRCT2(_s6.CompletedCompanyValue);
|
||||
gameState.TotalAdmissions = _s6.TotalAdmissions;
|
||||
gameState.TotalIncomeFromAdmissions = ToMoney64(_s6.IncomeFromAdmissions);
|
||||
gCompanyValue = ToMoney64(_s6.CompanyValue);
|
||||
gameState.CompanyValue = ToMoney64(_s6.CompanyValue);
|
||||
std::memcpy(gPeepWarningThrottle, _s6.PeepWarningThrottle, sizeof(_s6.PeepWarningThrottle));
|
||||
|
||||
// Awards
|
||||
|
||||
@@ -103,7 +103,7 @@ void ScenarioReset(GameState_t& gameState)
|
||||
auto& park = GetContext()->GetGameState()->GetPark();
|
||||
gameState.ParkRating = park.CalculateParkRating();
|
||||
gameState.ParkValue = park.CalculateParkValue();
|
||||
gCompanyValue = park.CalculateCompanyValue();
|
||||
gameState.CompanyValue = park.CalculateCompanyValue();
|
||||
gHistoricalProfit = gameState.InitialCash - gameState.BankLoan;
|
||||
gameState.Cash = gameState.InitialCash;
|
||||
|
||||
@@ -201,7 +201,7 @@ void ScenarioFailure(GameState_t& gameState)
|
||||
*/
|
||||
void ScenarioSuccess(GameState_t& gameState)
|
||||
{
|
||||
auto companyValue = gCompanyValue;
|
||||
auto companyValue = gameState.CompanyValue;
|
||||
|
||||
gameState.ScenarioCompletedCompanyValue = companyValue;
|
||||
PeepApplause();
|
||||
|
||||
@@ -189,15 +189,16 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
money64 ScPark::companyValue_get() const
|
||||
{
|
||||
return gCompanyValue;
|
||||
return GetGameState().CompanyValue;
|
||||
}
|
||||
void ScPark::companyValue_set(money64 value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
auto& gameState = GetGameState();
|
||||
|
||||
if (gCompanyValue != value)
|
||||
if (gameState.CompanyValue != value)
|
||||
{
|
||||
gCompanyValue = value;
|
||||
gameState.CompanyValue = value;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_CASH);
|
||||
ContextBroadcastIntent(&intent);
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace OpenRCT2::Scripting
|
||||
else if (value == "failed")
|
||||
gameState.ScenarioCompletedCompanyValue = COMPANY_VALUE_ON_FAILED_OBJECTIVE;
|
||||
else if (value == "completed")
|
||||
gameState.ScenarioCompletedCompanyValue = gCompanyValue;
|
||||
gameState.ScenarioCompletedCompanyValue = gameState.CompanyValue;
|
||||
}
|
||||
|
||||
money64 companyValueRecord_get() const
|
||||
|
||||
@@ -50,8 +50,6 @@ using namespace OpenRCT2;
|
||||
money64 gLandPrice;
|
||||
money64 gConstructionRightsPrice;
|
||||
|
||||
money64 gCompanyValue;
|
||||
|
||||
int16_t gParkRatingCasualtyPenalty;
|
||||
uint32_t gGuestsInParkHistory[32];
|
||||
|
||||
@@ -229,7 +227,7 @@ money64 Park::GetParkValue() const
|
||||
|
||||
money64 Park::GetCompanyValue() const
|
||||
{
|
||||
return gCompanyValue;
|
||||
return GetGameState().CompanyValue;
|
||||
}
|
||||
|
||||
void Park::Initialise()
|
||||
@@ -305,7 +303,7 @@ void Park::Update(const Date& date)
|
||||
{
|
||||
gameState.ParkRating = CalculateParkRating();
|
||||
gameState.ParkValue = CalculateParkValue();
|
||||
gCompanyValue = CalculateCompanyValue();
|
||||
gameState.CompanyValue = CalculateCompanyValue();
|
||||
gameState.TotalRideValueForMoney = CalculateTotalRideValueForMoney();
|
||||
gameState.SuggestedGuestMaximum = CalculateSuggestedMaxGuests();
|
||||
gameState.GuestGenerationProbability = CalculateGuestGenerationProbability();
|
||||
|
||||
@@ -95,8 +95,6 @@ namespace OpenRCT2
|
||||
extern money64 gLandPrice;
|
||||
extern money64 gConstructionRightsPrice;
|
||||
|
||||
extern money64 gCompanyValue;
|
||||
|
||||
extern int16_t gParkRatingCasualtyPenalty;
|
||||
extern uint32_t gGuestsInParkHistory[32];
|
||||
|
||||
|
||||
Reference in new issue
Block a user