1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-30 18:25:16 +01:00

Move cheats to struct in GameState_t

This commit is contained in:
Duncan
2024-03-03 21:44:15 +00:00
committed by GitHub
parent 4ccecd6e68
commit 4b6ba80a46
76 changed files with 561 additions and 487 deletions

View File

@@ -827,7 +827,7 @@ bool MapCanBuildAt(const CoordsXYZ& loc)
{
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
return true;
if (gCheatsSandboxMode)
if (GetGameState().Cheats.SandboxMode)
return true;
if (MapIsLocationOwned(loc))
return true;
@@ -963,7 +963,7 @@ uint8_t MapGetLowestLandHeight(const MapRange& range)
if (surfaceElement != nullptr && min_height > surfaceElement->BaseHeight)
{
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode)
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode)
{
if (!MapIsLocationInPark(CoordsXY{ xi, yi }))
{
@@ -992,7 +992,7 @@ uint8_t MapGetHighestLandHeight(const MapRange& range)
auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ xi, yi });
if (surfaceElement != nullptr)
{
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode)
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode)
{
if (!MapIsLocationInPark(CoordsXY{ xi, yi }))
{
@@ -1362,8 +1362,8 @@ void MapRemoveOutOfRangeElements()
// NOTE: This is only a workaround for non-networked games.
// Map resize has to become its own Game Action to properly solve this issue.
//
bool buildState = gCheatsBuildInPauseMode;
gCheatsBuildInPauseMode = true;
bool buildState = GetGameState().Cheats.BuildInPauseMode;
GetGameState().Cheats.BuildInPauseMode = true;
for (int32_t y = MAXIMUM_MAP_SIZE_BIG - COORDS_XY_STEP; y >= 0; y -= COORDS_XY_STEP)
{
@@ -1384,7 +1384,7 @@ void MapRemoveOutOfRangeElements()
}
// Reset cheat state
gCheatsBuildInPauseMode = buildState;
GetGameState().Cheats.BuildInPauseMode = buildState;
}
static void MapExtendBoundarySurfaceExtendTile(const SurfaceElement& sourceTile, SurfaceElement& destTile)