1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-02-01 11:15:13 +01:00

Merge pull request #2159 from FlukiestEmperor/develop

Fixes NULL map elements when loading a save
This commit is contained in:
Ted John
2015-10-30 12:31:51 +00:00

View File

@@ -792,6 +792,19 @@ void game_fix_save_vars() {
}
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) = peepCount;
// Fixes broken saves where a surface element could be null
for (int y = 0; y < 256; y++) {
for (int x = 0; x < 256; x++) {
rct_map_element *mapElement = map_get_surface_element_at(x, y);
if (mapElement == NULL)
{
log_error("Null map element at x = %d and y = %d. Fixing...", x, y);
map_element_insert(x, y, 14, 0);
}
}
}
}
// Load game state for multiplayer