Auto separation: Add setting to scale vehicle lateness adjustments.

No longer set vehicle lateness to 0 if separation fails, instead
leave it as it was.

The setting defaults to 100% (full abruptness, old behaviour).
Reduce the setting if auto separation is too disruptive, e.g. causes
excessive waiting in stations.

Note that this is not savegame compatible.
This commit is contained in:
Jonathan G Rennison
2015-08-11 21:20:01 +01:00
parent cca6495d1e
commit 40ad3dea02
5 changed files with 23 additions and 2 deletions

View File

@@ -548,8 +548,11 @@ void UpdateSeparationOrder(Vehicle *v_start)
}
int separation_ahead = SeparationBetween(v, v->AheadSeparation());
int separation_behind = SeparationBetween(v->BehindSeparation(), v);
v->lateness_counter = (separation_ahead - separation_behind) / 2;
if (separation_ahead == -1 || separation_behind == -1) v->lateness_counter = 0;
if (separation_ahead != -1 && separation_behind != -1) {
int new_lateness = (separation_ahead - separation_behind) / 2;
v->lateness_counter = (new_lateness * _settings_game.order.timetable_separation_rate +
v->lateness_counter * (100 - _settings_game.order.timetable_separation_rate)) / 100;
}
v = v->AheadSeparation();
} while (v != v_start);
}