Fix crash which could occur when trying to extend invalidated reservation
When using realistic braking
This commit is contained in:
@@ -1016,7 +1016,11 @@ static void AdvanceLookAheadPosition(Train *v)
|
|||||||
|
|
||||||
if (v->lookahead->current_position == v->lookahead->next_extend_position) {
|
if (v->lookahead->current_position == v->lookahead->next_extend_position) {
|
||||||
SetTrainReservationLookaheadEnd(v);
|
SetTrainReservationLookaheadEnd(v);
|
||||||
|
|
||||||
|
/* This may clear the lookahead if it has become invalid */
|
||||||
TryLongReserveChooseTrainTrackFromReservationEnd(v, true);
|
TryLongReserveChooseTrainTrackFromReservationEnd(v, true);
|
||||||
|
if (v->lookahead == nullptr) return;
|
||||||
|
|
||||||
v->lookahead->SetNextExtendPositionIfUnset();
|
v->lookahead->SetNextExtendPositionIfUnset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user