1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 05:53:02 +01:00

#21193: Move gParkFlags to GameState_t, refactor uses

Also changed a few instances where GetGameState was called inside the same function.
The change in Peep.cpp is needed because of a function conflict. FormatStringID exists both in the global and in the OpenRCT2 namespace.
This commit is contained in:
Hielke Morsink
2024-01-22 16:03:39 +01:00
parent 8e88f464b3
commit 13351d996e
60 changed files with 366 additions and 242 deletions

View File

@@ -12,6 +12,7 @@
#include "../Cheats.h"
#include "../Context.h"
#include "../Game.h"
#include "../GameState.h"
#include "../OpenRCT2.h"
#include "../TrackImporter.h"
#include "../actions/FootpathLayoutPlaceAction.h"
@@ -1935,10 +1936,11 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon
}
}
auto& gameState = GetGameState();
_trackDesignDrawingPreview = true;
uint8_t backup_rotation = _currentTrackPieceDirection;
uint32_t backup_park_flags = gParkFlags;
gParkFlags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
uint32_t backup_park_flags = gameState.ParkFlags;
gameState.ParkFlags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
auto mapSize = TileCoordsXY{ gMapSize.x * 16, gMapSize.y * 16 };
_currentTrackPieceDirection = 0;
@@ -1962,7 +1964,7 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon
auto res = TrackDesignPlaceVirtual(
tds, td6, PTD_OPERATION_PLACE_TRACK_PREVIEW, placeScenery, *ride,
{ mapSize.x, mapSize.y, z, _currentTrackPieceDirection });
gParkFlags = backup_park_flags;
gameState.ParkFlags = backup_park_flags;
if (res.Error == GameActions::Status::Ok)
{