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