Merge pull request #10102 from ZehMatt/fix-9969

Only temporarily set the cheat state
This commit is contained in:
ζeh Matt 2019-10-16 19:16:18 +02:00 committed by GitHub
commit acab73ae6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 18 deletions

View File

@ -1548,13 +1548,15 @@ 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 x = 0; x < (MAXIMUM_MAP_SIZE_TECHNICAL * 32); x += 32)
@ -1572,10 +1574,9 @@ void map_remove_out_of_range_elements()
}
}
}
}
//#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)