Merge branch 'master' into jgrpp

# Conflicts:
#	src/base_station_base.h
#	src/newgrf_roadstop.cpp
#	src/newgrf_station.cpp
#	src/object_gui.cpp
#	src/saveload/settings_sl.cpp
#	src/saveload/station_sl.cpp
#	src/settings.cpp
#	src/settings_internal.h
#	src/timer/timer_game_calendar.cpp
This commit is contained in:
Jonathan G Rennison
2024-03-09 20:10:57 +00:00
19 changed files with 901 additions and 548 deletions

View File

@@ -259,10 +259,19 @@ public:
* caching the full path the ship can get stuck in a loop. */
const WaterRegionPatchDesc end_water_patch = GetWaterRegionPatchInfo(node->GetTile());
const WaterRegionPatchDesc start_water_patch = GetWaterRegionPatchInfo(tile);
assert(start_water_patch == high_level_path.front());
while (node->m_parent) {
const WaterRegionPatchDesc node_water_patch = GetWaterRegionPatchInfo(node->GetTile());
if (node_water_patch == start_water_patch || (!is_intermediate_destination && node_water_patch != end_water_patch)) {
const bool node_water_patch_on_high_level_path = std::find(high_level_path.begin(), high_level_path.end(), node_water_patch) != high_level_path.end();
const bool add_full_path = !is_intermediate_destination && node_water_patch != end_water_patch;
/* The cached path must always lead to a region patch that's on the high level path.
* This is what can happen when that's not the case https://github.com/OpenTTD/OpenTTD/issues/12176. */
if (add_full_path || !node_water_patch_on_high_level_path || node_water_patch == start_water_patch) {
path_cache.push_front(node->GetTrackdir());
} else {
path_cache.clear();
}
node = node->m_parent;
}