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:
@@ -1400,6 +1400,8 @@ STR_CONFIG_SETTING_TIMETABLE_IN_TICKS :Show timetable
|
|||||||
STR_CONFIG_SETTING_TIMETABLE_IN_TICKS_HELPTEXT :Show travel times in time tables in game ticks instead of days
|
STR_CONFIG_SETTING_TIMETABLE_IN_TICKS_HELPTEXT :Show travel times in time tables in game ticks instead of days
|
||||||
STR_CONFIG_SETTING_TIMETABLE_SEPARATION :Use timetable to ensure vehicle separation: {STRING2}
|
STR_CONFIG_SETTING_TIMETABLE_SEPARATION :Use timetable to ensure vehicle separation: {STRING2}
|
||||||
STR_CONFIG_SETTING_TIMETABLE_SEPARATION_HELPTEXT :Select whether to ensure separation of vehicles when using automatic timetables
|
STR_CONFIG_SETTING_TIMETABLE_SEPARATION_HELPTEXT :Select whether to ensure separation of vehicles when using automatic timetables
|
||||||
|
STR_CONFIG_SETTING_TIMETABLE_SEPARATION_RATE :Vehicle separation factor: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_TIMETABLE_SEPARATION_RATE_HELPTEXT :How much of the vehicle separation timetable change to apply at each step
|
||||||
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE :Show arrival and departure in timetables: {STRING2}
|
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE :Show arrival and departure in timetables: {STRING2}
|
||||||
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE_HELPTEXT :Display anticipated arrival and departure times in timetables
|
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE_HELPTEXT :Display anticipated arrival and departure times in timetables
|
||||||
STR_CONFIG_SETTING_QUICKGOTO :Quick creation of vehicle orders: {STRING2}
|
STR_CONFIG_SETTING_QUICKGOTO :Quick creation of vehicle orders: {STRING2}
|
||||||
|
@@ -1628,6 +1628,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
vehicles->Add(new SettingEntry("order.serviceathelipad"));
|
vehicles->Add(new SettingEntry("order.serviceathelipad"));
|
||||||
vehicles->Add(new SettingEntry("order.timetable_automated"));
|
vehicles->Add(new SettingEntry("order.timetable_automated"));
|
||||||
vehicles->Add(new SettingEntry("order.timetable_separation"));
|
vehicles->Add(new SettingEntry("order.timetable_separation"));
|
||||||
|
vehicles->Add(new SettingEntry("order.timetable_separation_rate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *limitations = main->Add(new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS));
|
SettingsPage *limitations = main->Add(new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS));
|
||||||
|
@@ -440,6 +440,7 @@ struct OrderSettings {
|
|||||||
bool no_servicing_if_no_breakdowns; ///< don't send vehicles to depot when breakdowns are disabled
|
bool no_servicing_if_no_breakdowns; ///< don't send vehicles to depot when breakdowns are disabled
|
||||||
bool timetable_automated; ///< whether to automatically manage timetables
|
bool timetable_automated; ///< whether to automatically manage timetables
|
||||||
bool timetable_separation; ///< whether to perform automatic separation based on timetable
|
bool timetable_separation; ///< whether to perform automatic separation based on timetable
|
||||||
|
uint8 timetable_separation_rate; ///< percentage of timetable separation change to apply
|
||||||
bool serviceathelipad; ///< service helicopters at helipads automatically (no need to send to depot)
|
bool serviceathelipad; ///< service helicopters at helipads automatically (no need to send to depot)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -347,6 +347,20 @@ str = STR_CONFIG_SETTING_TIMETABLE_SEPARATION
|
|||||||
strhelp = STR_CONFIG_SETTING_TIMETABLE_SEPARATION_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_TIMETABLE_SEPARATION_HELPTEXT
|
||||||
cat = SC_EXPERT
|
cat = SC_EXPERT
|
||||||
|
|
||||||
|
[SDT_VAR]
|
||||||
|
base = GameSettings
|
||||||
|
var = order.timetable_separation_rate
|
||||||
|
type = SLE_UINT8
|
||||||
|
from = TIMESEP_SV
|
||||||
|
def = 100
|
||||||
|
min = 0
|
||||||
|
max = 100
|
||||||
|
interval = 10
|
||||||
|
str = STR_CONFIG_SETTING_TIMETABLE_SEPARATION_RATE
|
||||||
|
strhelp = STR_CONFIG_SETTING_TIMETABLE_SEPARATION_RATE_HELPTEXT
|
||||||
|
strval = STR_CONFIG_SETTING_PERCENTAGE
|
||||||
|
cat = SC_EXPERT
|
||||||
|
|
||||||
; There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow
|
; There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow
|
||||||
; these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI.
|
; these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI.
|
||||||
[SDT_OMANY]
|
[SDT_OMANY]
|
||||||
|
@@ -548,8 +548,11 @@ void UpdateSeparationOrder(Vehicle *v_start)
|
|||||||
}
|
}
|
||||||
int separation_ahead = SeparationBetween(v, v->AheadSeparation());
|
int separation_ahead = SeparationBetween(v, v->AheadSeparation());
|
||||||
int separation_behind = SeparationBetween(v->BehindSeparation(), v);
|
int separation_behind = SeparationBetween(v->BehindSeparation(), v);
|
||||||
v->lateness_counter = (separation_ahead - separation_behind) / 2;
|
if (separation_ahead != -1 && separation_behind != -1) {
|
||||||
if (separation_ahead == -1 || separation_behind == -1) v->lateness_counter = 0;
|
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();
|
v = v->AheadSeparation();
|
||||||
} while (v != v_start);
|
} while (v != v_start);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user