Fix train braking behaviour when lookahead is aspect limited

When lookahead end is within the reservation end
This commit is contained in:
Jonathan G Rennison
2022-07-30 20:37:03 +01:00
parent 71b6d7a502
commit cbabbb6db6
2 changed files with 4 additions and 2 deletions

View File

@@ -289,7 +289,8 @@ class NIHVehicle : public NIHelper {
if (HasBit(item.data_aux, TRSLAI_NEXT_ONLY)) b += seprintf(b, lastof(buffer), "s"); if (HasBit(item.data_aux, TRSLAI_NEXT_ONLY)) b += seprintf(b, lastof(buffer), "s");
if (HasBit(item.data_aux, TRSLAI_COMBINED)) b += seprintf(b, lastof(buffer), "c"); if (HasBit(item.data_aux, TRSLAI_COMBINED)) b += seprintf(b, lastof(buffer), "c");
if (HasBit(item.data_aux, TRSLAI_COMBINED_SHUNT)) b += seprintf(b, lastof(buffer), "X"); if (HasBit(item.data_aux, TRSLAI_COMBINED_SHUNT)) b += seprintf(b, lastof(buffer), "X");
if (_settings_game.vehicle.realistic_braking_aspect_limited == TRBALM_ON && l.lookahead_end_position == item.start) { if (_settings_game.vehicle.realistic_braking_aspect_limited == TRBALM_ON &&
(l.lookahead_end_position == item.start || l.lookahead_end_position == item.start + 1)) {
b += seprintf(b, lastof(buffer), ", lookahead end"); b += seprintf(b, lastof(buffer), ", lookahead end");
print_braking_speed(item.start, 0, item.z_pos); print_braking_speed(item.start, 0, item.z_pos);
} }

View File

@@ -959,7 +959,8 @@ static void ApplyLookAheadItem(const Train *v, const TrainReservationLookAheadIt
break; break;
case TRLIT_SIGNAL: case TRLIT_SIGNAL:
if (_settings_game.vehicle.realistic_braking_aspect_limited == TRBALM_ON && v->lookahead->lookahead_end_position == item.start) { if (_settings_game.vehicle.realistic_braking_aspect_limited == TRBALM_ON &&
(v->lookahead->lookahead_end_position == item.start || v->lookahead->lookahead_end_position == item.start + 1)) {
limit_advisory_speed(item.start, 0, item.z_pos); limit_advisory_speed(item.start, 0, item.z_pos);
} }
break; break;