Fix reservation through multiple reserve-through signals after a junction.
This commit is contained in:
@@ -261,11 +261,19 @@ private:
|
||||
}
|
||||
|
||||
// returns true if dead end bit has been set
|
||||
inline bool ExecuteTraceRestrict(Node& n, TileIndex tile, Trackdir trackdir, int& cost, TraceRestrictProgramResult &out)
|
||||
inline bool ExecuteTraceRestrict(Node& n, TileIndex tile, Trackdir trackdir, int& cost, TraceRestrictProgramResult &out, bool *is_res_through)
|
||||
{
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, TrackdirToTrack(trackdir));
|
||||
if (prog && prog->actions_used_flags & TRPAUF_PF) {
|
||||
TraceRestrictProgramActionsUsedFlags flags_to_check = TRPAUF_PF;
|
||||
if (is_res_through != NULL) {
|
||||
*is_res_through = false;
|
||||
flags_to_check |= TRPAUF_RESERVE_THROUGH;
|
||||
}
|
||||
if (prog && prog->actions_used_flags & flags_to_check) {
|
||||
prog->Execute(Yapf().GetVehicle(), TraceRestrictProgramInput(tile, trackdir, &TraceRestrictPreviousSignalCallback, &n), out);
|
||||
if (out.flags & TRPRF_RESERVE_THROUGH && is_res_through != NULL) {
|
||||
*is_res_through = true;
|
||||
}
|
||||
if (out.flags & TRPRF_DENY) {
|
||||
n.m_segment->m_end_segment_reason |= ESRB_DEAD_END;
|
||||
return true;
|
||||
@@ -337,9 +345,11 @@ public:
|
||||
|
||||
if (ShouldCheckTraceRestrict(n, tile)) {
|
||||
TraceRestrictProgramResult out;
|
||||
if (ExecuteTraceRestrict(n, tile, trackdir, cost, out)) {
|
||||
bool is_reserve_through = false;
|
||||
if (ExecuteTraceRestrict(n, tile, trackdir, cost, out, &is_reserve_through)) {
|
||||
return -1;
|
||||
}
|
||||
if (is_reserve_through) n.m_num_signals_res_through_passed++;
|
||||
}
|
||||
|
||||
n.m_num_signals_passed++;
|
||||
@@ -352,7 +362,7 @@ public:
|
||||
|
||||
if (ShouldCheckTraceRestrict(n, tile)) {
|
||||
TraceRestrictProgramResult out;
|
||||
if (ExecuteTraceRestrict(n, tile, trackdir, cost, out)) {
|
||||
if (ExecuteTraceRestrict(n, tile, trackdir, cost, out, NULL)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user