1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Fix #6261: Broken pathfinding after removing park entrances with the tile inspector

Check the gParkEntrance locations after loading from file and clear those locations for which there is no longer a park entrance map element.
Resolves path finding problems in parks caused, for example, be deleting a park entrance using the tile inspector.

Fixes #6261, #6344, #6520.
This commit is contained in:
zaxcav
2017-10-22 23:22:46 +02:00
committed by Michael Steenbeek
parent 81ba7e774f
commit f5ff867599
4 changed files with 24 additions and 0 deletions

View File

@@ -33,6 +33,7 @@
- Fix: [#6196, #6223] Guest's energy underflows and never decreases.
- Fix: [#6198] You cannot cancel RCT1 directory selection.
- Fix: [#6202] Guests can break occupied benches (original bug).
- Fix: [#6261, #6344, #6520] Broken pathfinding after removing park entrances with the tile inspector
- Fix: [#6271] Wrong booster speed tooltip text.
- Fix: [#6308] Cannot create title sequence if title sequences folder does not exist.
- Fix: [#6318] Cannot sack staff that have not been placed

View File

@@ -1121,6 +1121,9 @@ void game_fix_save_vars()
// Fix invalid vehicle sprite sizes, thus preventing visual corruption of sprites
fix_invalid_vehicle_sprite_sizes();
// Fix gParkEntrance locations for which the map_element no longer exists
fix_park_entrance_locations();
}
void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, const utf8 * path, bool loadTitleFirst)

View File

@@ -683,4 +683,22 @@ extern "C"
return;
} while (!map_element_is_last_for_tile(mapElement++));
}
void fix_park_entrance_locations(void)
{
// Fix gParkEntrance locations for which the map_element no longer exists
for (uint8 entranceNum = 0; entranceNum < MAX_PARK_ENTRANCES; ++entranceNum)
{
if (gParkEntrances[entranceNum].x == LOCATION_NULL)
continue;
if (map_get_park_entrance_element_at(
gParkEntrances[entranceNum].x,
gParkEntrances[entranceNum].y,
gParkEntrances[entranceNum].z >> 3, false) == NULL)
{
gParkEntrances[entranceNum].x = LOCATION_NULL;
}
}
}
}

View File

@@ -58,6 +58,8 @@ void reset_park_entrance();
void maze_entrance_hedge_replacement(sint32 x, sint32 y, rct_map_element *mapElement);
void maze_entrance_hedge_removal(sint32 x, sint32 y, rct_map_element *mapElement);
void fix_park_entrance_locations();
#ifdef __cplusplus
}
#endif