Fix reverse behind signal pathfinding when there is no dead-end

This could cause issues if all the paths behind the reverse signal
converge with paths not via the reverse signal with a lower cost
This commit is contained in:
Jonathan G Rennison
2021-08-30 19:13:55 +01:00
parent ae6b9f6e9c
commit bbe079c906

View File

@@ -383,6 +383,9 @@ public:
if (!is_reserve_through) { if (!is_reserve_through) {
n.m_last_non_reserve_through_signal_tile = tile; n.m_last_non_reserve_through_signal_tile = tile;
n.m_last_non_reserve_through_signal_td = trackdir; n.m_last_non_reserve_through_signal_td = trackdir;
if (n.flags_u.flags_s.m_reverse_pending) {
n.m_segment->m_end_segment_reason |= ESRB_SAFE_TILE;
}
} }
n.m_num_signals_passed++; n.m_num_signals_passed++;
@@ -415,6 +418,9 @@ public:
n.m_last_non_reserve_through_signal_tile = tile; n.m_last_non_reserve_through_signal_tile = tile;
n.m_last_non_reserve_through_signal_td = trackdir; n.m_last_non_reserve_through_signal_td = trackdir;
} }
if (n.flags_u.flags_s.m_reverse_pending && IsTileType(tile, MP_TUNNELBRIDGE) && IsTunnelBridgeSignalSimulationEntrance(tile)) {
n.m_segment->m_end_segment_reason |= ESRB_SAFE_TILE;
}
return cost; return cost;
} }
@@ -807,7 +813,8 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
{ {
return !m_disable_cache return !m_disable_cache
&& (n.m_parent != nullptr) && (n.m_parent != nullptr)
&& (n.m_parent->m_num_signals_passed >= m_sig_look_ahead_costs.size()); && (n.m_parent->m_num_signals_passed >= m_sig_look_ahead_costs.size())
&& !n.flags_u.flags_s.m_reverse_pending;
} }
inline void ConnectNodeToCachedData(Node &n, CachedData &ci) inline void ConnectNodeToCachedData(Node &n, CachedData &ci)