mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 18:31:59 -05:00
Move gConstructionRightsPrice to GameState_t (#21467)
* Move gConstructionRightsPrice to GameState_t * Add OpenRCT2 namespace
This commit is contained in:
parent
b2639add4c
commit
57a4c83f80
11 changed files with 20 additions and 17 deletions
|
@ -1031,10 +1031,10 @@ private:
|
|||
Invalidate();
|
||||
break;
|
||||
case WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE:
|
||||
if (gConstructionRightsPrice < 200.00_GBP)
|
||||
if (gameState.ConstructionRightsPrice < 200.00_GBP)
|
||||
{
|
||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||
ScenarioSetSetting::CostToBuyConstructionRights, gConstructionRightsPrice + 1.00_GBP);
|
||||
ScenarioSetSetting::CostToBuyConstructionRights, gameState.ConstructionRightsPrice + 1.00_GBP);
|
||||
GameActions::Execute(&scenarioSetSetting);
|
||||
}
|
||||
else
|
||||
|
@ -1044,10 +1044,10 @@ private:
|
|||
Invalidate();
|
||||
break;
|
||||
case WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE:
|
||||
if (gConstructionRightsPrice > 5.00_GBP)
|
||||
if (gameState.ConstructionRightsPrice > 5.00_GBP)
|
||||
{
|
||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||
ScenarioSetSetting::CostToBuyConstructionRights, gConstructionRightsPrice - 1.00_GBP);
|
||||
ScenarioSetSetting::CostToBuyConstructionRights, gameState.ConstructionRightsPrice - 1.00_GBP);
|
||||
GameActions::Execute(&scenarioSetSetting);
|
||||
}
|
||||
else
|
||||
|
@ -1230,7 +1230,7 @@ private:
|
|||
screenCoords = windowPos
|
||||
+ ScreenCoordsXY{ constructionRightsCostWidget.left + 1, constructionRightsCostWidget.top };
|
||||
auto ft = Formatter();
|
||||
ft.Add<money64>(gConstructionRightsPrice);
|
||||
ft.Add<money64>(gameState.ConstructionRightsPrice);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace OpenRCT2
|
|||
money64 ParkValue;
|
||||
money64 ParkValueHistory[FINANCE_GRAPH_SIZE];
|
||||
money64 CompanyValue;
|
||||
money64 ConstructionRightsPrice;
|
||||
uint8_t ParkRatingHistory[32];
|
||||
ClimateType Climate;
|
||||
ClimateState ClimateCurrent;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "LandBuyRightsAction.h"
|
||||
|
||||
#include "../Context.h"
|
||||
#include "../GameState.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../actions/LandSetHeightAction.h"
|
||||
#include "../audio/audio.h"
|
||||
|
@ -24,6 +25,8 @@
|
|||
#include "../world/Scenery.h"
|
||||
#include "../world/Surface.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
LandBuyRightsAction::LandBuyRightsAction(const MapRange& range, LandBuyRightSetting setting)
|
||||
: _range(range)
|
||||
, _setting(setting)
|
||||
|
@ -163,7 +166,7 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY&
|
|||
uint16_t baseZ = surfaceElement->GetBaseZ();
|
||||
MapInvalidateTile({ loc, baseZ, baseZ + 16 });
|
||||
}
|
||||
res.Cost = gConstructionRightsPrice;
|
||||
res.Cost = GetGameState().ConstructionRightsPrice;
|
||||
return res;
|
||||
|
||||
default:
|
||||
|
|
|
@ -149,7 +149,7 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
|
|||
gLandPrice = std::clamp<money64>(_value, 5.00_GBP, 200.00_GBP);
|
||||
break;
|
||||
case ScenarioSetSetting::CostToBuyConstructionRights:
|
||||
gConstructionRightsPrice = std::clamp<money64>(_value, 5.00_GBP, 200.00_GBP);
|
||||
gameState.ConstructionRightsPrice = std::clamp<money64>(_value, 5.00_GBP, 200.00_GBP);
|
||||
break;
|
||||
case ScenarioSetSetting::ParkChargeMethod:
|
||||
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
|
||||
|
|
|
@ -673,7 +673,8 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t&
|
|||
else if (argv[0] == "construction_rights_cost")
|
||||
{
|
||||
console.WriteFormatLine(
|
||||
"construction_rights_cost %d.%d0", gConstructionRightsPrice / 10, gConstructionRightsPrice % 10);
|
||||
"construction_rights_cost %d.%d0", gameState.ConstructionRightsPrice / 10,
|
||||
gameState.ConstructionRightsPrice % 10);
|
||||
}
|
||||
else if (argv[0] == "climate")
|
||||
{
|
||||
|
|
|
@ -542,12 +542,12 @@ namespace OpenRCT2
|
|||
cs.ReadWrite(tempLandPrice);
|
||||
cs.ReadWrite(tempConstructionRightPrice);
|
||||
gLandPrice = ToMoney64(tempLandPrice);
|
||||
gConstructionRightsPrice = ToMoney64(tempConstructionRightPrice);
|
||||
gameState.ConstructionRightsPrice = ToMoney64(tempConstructionRightPrice);
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.ReadWrite(gLandPrice);
|
||||
cs.ReadWrite(gConstructionRightsPrice);
|
||||
cs.ReadWrite(gameState.ConstructionRightsPrice);
|
||||
}
|
||||
cs.ReadWrite(gGrassSceneryTileLoopPosition);
|
||||
cs.ReadWrite(gWidePathTileLoopPosition);
|
||||
|
|
|
@ -1393,7 +1393,7 @@ namespace RCT1
|
|||
{
|
||||
gameState.ParkEntranceFee = _s4.ParkEntranceFee;
|
||||
gLandPrice = ToMoney64(_s4.LandPrice);
|
||||
gConstructionRightsPrice = ToMoney64(_s4.ConstructionRightsPrice);
|
||||
gameState.ConstructionRightsPrice = ToMoney64(_s4.ConstructionRightsPrice);
|
||||
|
||||
gameState.Cash = ToMoney64(_s4.Cash);
|
||||
gameState.BankLoan = ToMoney64(_s4.Loan);
|
||||
|
|
|
@ -388,7 +388,7 @@ namespace RCT2
|
|||
}
|
||||
|
||||
gLandPrice = ToMoney64(_s6.LandPrice);
|
||||
gConstructionRightsPrice = ToMoney64(_s6.ConstructionRightsPrice);
|
||||
gameState.ConstructionRightsPrice = ToMoney64(_s6.ConstructionRightsPrice);
|
||||
// unk_01358774
|
||||
// Pad01358776
|
||||
// _s6.CdKey
|
||||
|
|
|
@ -253,12 +253,12 @@ namespace OpenRCT2::Scripting
|
|||
|
||||
money64 ScPark::constructionRightsPrice_get() const
|
||||
{
|
||||
return gConstructionRightsPrice;
|
||||
return GetGameState().ConstructionRightsPrice;
|
||||
}
|
||||
void ScPark::constructionRightsPrice_set(money64 value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
gConstructionRightsPrice = value;
|
||||
GetGameState().ConstructionRightsPrice = value;
|
||||
}
|
||||
|
||||
int16_t ScPark::casualtyPenalty_get() const
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
using namespace OpenRCT2;
|
||||
|
||||
money64 gLandPrice;
|
||||
money64 gConstructionRightsPrice;
|
||||
|
||||
int16_t gParkRatingCasualtyPenalty;
|
||||
uint32_t gGuestsInParkHistory[32];
|
||||
|
@ -275,7 +274,7 @@ void Park::Initialise()
|
|||
gameState.ScenarioObjective.Year = 4;
|
||||
gameState.ScenarioObjective.NumGuests = 1000;
|
||||
gLandPrice = 90.00_GBP;
|
||||
gConstructionRightsPrice = 40.00_GBP;
|
||||
gameState.ConstructionRightsPrice = 40.00_GBP;
|
||||
gameState.ParkFlags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||
ResetHistories();
|
||||
FinanceResetHistory();
|
||||
|
|
|
@ -93,7 +93,6 @@ namespace OpenRCT2
|
|||
} // namespace OpenRCT2
|
||||
|
||||
extern money64 gLandPrice;
|
||||
extern money64 gConstructionRightsPrice;
|
||||
|
||||
extern int16_t gParkRatingCasualtyPenalty;
|
||||
extern uint32_t gGuestsInParkHistory[32];
|
||||
|
|
Loading…
Reference in a new issue