mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #10102 from ZehMatt/fix-9969
Only temporarily set the cheat state
This commit is contained in:
commit
acab73ae6a
|
@ -1548,34 +1548,35 @@ void map_restore_provisional_elements()
|
|||
void map_remove_out_of_range_elements()
|
||||
{
|
||||
int32_t mapMaxXY = gMapSizeMaxXY;
|
||||
// Ensure that we can remove elements
|
||||
bool buildState = gCheatsBuildInPauseMode;
|
||||
CheatsSet(CheatType::BuildInPauseMode, true);
|
||||
|
||||
// Since we might lack cheat permission, check if the cheat has really been turned on.
|
||||
if (gCheatsBuildInPauseMode)
|
||||
// Ensure that we can remove elements
|
||||
//
|
||||
// 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;
|
||||
|
||||
for (int32_t y = 0; y < (MAXIMUM_MAP_SIZE_TECHNICAL * 32); y += 32)
|
||||
{
|
||||
for (int32_t y = 0; y < (MAXIMUM_MAP_SIZE_TECHNICAL * 32); y += 32)
|
||||
for (int32_t x = 0; x < (MAXIMUM_MAP_SIZE_TECHNICAL * 32); x += 32)
|
||||
{
|
||||
for (int32_t x = 0; x < (MAXIMUM_MAP_SIZE_TECHNICAL * 32); x += 32)
|
||||
if (x == 0 || y == 0 || x >= mapMaxXY || y >= mapMaxXY)
|
||||
{
|
||||
if (x == 0 || y == 0 || x >= mapMaxXY || y >= mapMaxXY)
|
||||
// Note this purposely does not use LandSetRightsAction as X Y coordinates are outside of normal range.
|
||||
auto surfaceElement = map_get_surface_element_at({ x, y });
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
// Note this purposely does not use LandSetRightsAction as X Y coordinates are outside of normal range.
|
||||
auto surfaceElement = map_get_surface_element_at({ x, y });
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
surfaceElement->SetOwnership(OWNERSHIP_UNOWNED);
|
||||
update_park_fences_around_tile({ x, y });
|
||||
}
|
||||
clear_elements_at({ x, y });
|
||||
surfaceElement->SetOwnership(OWNERSHIP_UNOWNED);
|
||||
update_park_fences_around_tile({ x, y });
|
||||
}
|
||||
clear_elements_at({ x, y });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#Reset cheat state
|
||||
CheatsSet(CheatType::BuildInPauseMode, buildState);
|
||||
// Reset cheat state
|
||||
gCheatsBuildInPauseMode = buildState;
|
||||
}
|
||||
|
||||
static void map_extend_boundary_surface_extend_tile(const SurfaceElement& sourceTile, SurfaceElement& destTile)
|
||||
|
|
Loading…
Reference in New Issue