mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 04:23:20 +01:00
Merge pull request #21542 from Harry-Hopkinson/gLandPrice-to-GameState
Move gLandPrice to GameState_t
This commit is contained in:
@@ -1005,10 +1005,10 @@ private:
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_LAND_COST_INCREASE:
|
||||
if (gLandPrice < 200.00_GBP)
|
||||
if (gameState.LandPrice < 200.00_GBP)
|
||||
{
|
||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||
ScenarioSetSetting::CostToBuyLand, gLandPrice + 1.00_GBP);
|
||||
ScenarioSetSetting::CostToBuyLand, gameState.LandPrice + 1.00_GBP);
|
||||
GameActions::Execute(&scenarioSetSetting);
|
||||
}
|
||||
else
|
||||
@@ -1018,10 +1018,10 @@ private:
|
||||
Invalidate();
|
||||
break;
|
||||
case WIDX_LAND_COST_DECREASE:
|
||||
if (gLandPrice > 5.00_GBP)
|
||||
if (gameState.LandPrice > 5.00_GBP)
|
||||
{
|
||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||
ScenarioSetSetting::CostToBuyLand, gLandPrice - 1.00_GBP);
|
||||
ScenarioSetSetting::CostToBuyLand, gameState.LandPrice - 1.00_GBP);
|
||||
GameActions::Execute(&scenarioSetSetting);
|
||||
}
|
||||
else
|
||||
@@ -1215,7 +1215,7 @@ private:
|
||||
// Cost to buy land value
|
||||
screenCoords = windowPos + ScreenCoordsXY{ landCostWidget.left + 1, landCostWidget.top };
|
||||
auto ft = Formatter();
|
||||
ft.Add<money64>(gLandPrice);
|
||||
ft.Add<money64>(gameState.LandPrice);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace OpenRCT2
|
||||
money64 ExpenditureTable[EXPENDITURE_TABLE_MONTH_COUNT][EnumValue(ExpenditureType::Count)];
|
||||
random_engine_t ScenarioRand;
|
||||
TileCoordsXY MapSize;
|
||||
money64 LandPrice;
|
||||
|
||||
::EditorStep EditorStep;
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY&
|
||||
surfaceElement->SetOwnership(OWNERSHIP_OWNED);
|
||||
ParkUpdateFencesAroundTile(loc);
|
||||
}
|
||||
res.Cost = gLandPrice;
|
||||
res.Cost = GetGameState().LandPrice;
|
||||
return res;
|
||||
|
||||
case LandBuyRightSetting::BuyConstructionRights: // 2
|
||||
|
||||
@@ -184,7 +184,7 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY&
|
||||
}
|
||||
}
|
||||
|
||||
res.Cost = gLandPrice;
|
||||
res.Cost = GetGameState().LandPrice;
|
||||
if (isExecuting)
|
||||
{
|
||||
if (_ownership != OWNERSHIP_UNOWNED)
|
||||
|
||||
@@ -146,7 +146,7 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
|
||||
}
|
||||
break;
|
||||
case ScenarioSetSetting::CostToBuyLand:
|
||||
gLandPrice = std::clamp<money64>(_value, 5.00_GBP, 200.00_GBP);
|
||||
gameState.LandPrice = std::clamp<money64>(_value, 5.00_GBP, 200.00_GBP);
|
||||
break;
|
||||
case ScenarioSetSetting::CostToBuyConstructionRights:
|
||||
gameState.ConstructionRightsPrice = std::clamp<money64>(_value, 5.00_GBP, 200.00_GBP);
|
||||
|
||||
@@ -668,7 +668,7 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t&
|
||||
}
|
||||
else if (argv[0] == "land_rights_cost")
|
||||
{
|
||||
console.WriteFormatLine("land_rights_cost %d.%d0", gLandPrice / 10, gLandPrice % 10);
|
||||
console.WriteFormatLine("land_rights_cost %d.%d0", gameState.LandPrice / 10, gameState.LandPrice % 10);
|
||||
}
|
||||
else if (argv[0] == "construction_rights_cost")
|
||||
{
|
||||
|
||||
@@ -541,12 +541,12 @@ namespace OpenRCT2
|
||||
money16 tempConstructionRightPrice{};
|
||||
cs.ReadWrite(tempLandPrice);
|
||||
cs.ReadWrite(tempConstructionRightPrice);
|
||||
gLandPrice = ToMoney64(tempLandPrice);
|
||||
gameState.LandPrice = ToMoney64(tempLandPrice);
|
||||
gameState.ConstructionRightsPrice = ToMoney64(tempConstructionRightPrice);
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.ReadWrite(gLandPrice);
|
||||
cs.ReadWrite(gameState.LandPrice);
|
||||
cs.ReadWrite(gameState.ConstructionRightsPrice);
|
||||
}
|
||||
cs.ReadWrite(gGrassSceneryTileLoopPosition);
|
||||
|
||||
@@ -1425,7 +1425,7 @@ namespace RCT1
|
||||
void ImportFinance(GameState_t& gameState)
|
||||
{
|
||||
gameState.ParkEntranceFee = _s4.ParkEntranceFee;
|
||||
gLandPrice = ToMoney64(_s4.LandPrice);
|
||||
gameState.LandPrice = ToMoney64(_s4.LandPrice);
|
||||
gameState.ConstructionRightsPrice = ToMoney64(_s4.ConstructionRightsPrice);
|
||||
|
||||
gameState.Cash = ToMoney64(_s4.Cash);
|
||||
|
||||
@@ -387,7 +387,7 @@ namespace RCT2
|
||||
}
|
||||
}
|
||||
|
||||
gLandPrice = ToMoney64(_s6.LandPrice);
|
||||
gameState.LandPrice = ToMoney64(_s6.LandPrice);
|
||||
gameState.ConstructionRightsPrice = ToMoney64(_s6.ConstructionRightsPrice);
|
||||
// unk_01358774
|
||||
// Pad01358776
|
||||
|
||||
@@ -243,12 +243,12 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
money64 ScPark::landPrice_get() const
|
||||
{
|
||||
return gLandPrice;
|
||||
return GetGameState().LandPrice;
|
||||
}
|
||||
void ScPark::landPrice_set(money64 value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
gLandPrice = value;
|
||||
GetGameState().LandPrice = value;
|
||||
}
|
||||
|
||||
money64 ScPark::constructionRightsPrice_get() const
|
||||
|
||||
@@ -47,8 +47,6 @@
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
money64 gLandPrice;
|
||||
|
||||
int16_t gParkRatingCasualtyPenalty;
|
||||
|
||||
// If this value is more than or equal to 0, the park rating is forced to this value. Used for cheat
|
||||
@@ -272,7 +270,7 @@ void Park::Initialise()
|
||||
gameState.ScenarioObjective.Type = OBJECTIVE_GUESTS_BY;
|
||||
gameState.ScenarioObjective.Year = 4;
|
||||
gameState.ScenarioObjective.NumGuests = 1000;
|
||||
gLandPrice = 90.00_GBP;
|
||||
gameState.LandPrice = 90.00_GBP;
|
||||
gameState.ConstructionRightsPrice = 40.00_GBP;
|
||||
gameState.ParkFlags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||
ResetHistories();
|
||||
|
||||
@@ -92,8 +92,6 @@ namespace OpenRCT2
|
||||
};
|
||||
} // namespace OpenRCT2
|
||||
|
||||
extern money64 gLandPrice;
|
||||
|
||||
extern int16_t gParkRatingCasualtyPenalty;
|
||||
|
||||
void ParkSetForcedRating(int32_t rating);
|
||||
|
||||
Reference in New Issue
Block a user