Add game setting to limit train lookahead to signal aspect

In realistic braking mode when multi-aspect signalling enabled by GRF
This commit is contained in:
Jonathan G Rennison
2022-06-19 11:54:40 +01:00
parent bdd73a19a1
commit 22caac6529
13 changed files with 118 additions and 16 deletions

View File

@@ -225,6 +225,9 @@ class NIHVehicle : public NIHelper {
};
b = buffer + seprintf(buffer, lastof(buffer), " Position: current: %d, z: %d, end: %d, remaining: %d", l.current_position, stats.z_pos, l.reservation_end_position, l.reservation_end_position - l.current_position);
if (l.lookahead_end_position <= l.reservation_end_position) {
b += seprintf(b, lastof(buffer), ", (lookahead: end: %d, remaining: %d)", l.lookahead_end_position, l.lookahead_end_position - l.current_position);
}
if (l.next_extend_position > l.current_position) {
b += seprintf(b, lastof(buffer), ", next extend position: %d (dist: %d)", l.next_extend_position, l.next_extend_position - l.current_position);
}
@@ -273,7 +276,12 @@ class NIHVehicle : public NIHelper {
if (item.data_id > 0) print_braking_speed(item.start, item.data_id, item.z_pos);
break;
case TRLIT_SIGNAL:
b += seprintf(b, lastof(buffer), "signal: target speed: %u", item.data_id);
b += seprintf(b, lastof(buffer), "signal: target speed: %u, flags:", item.data_id);
if (HasBit(item.data_aux, TRSLAI_NO_ASPECT_INC)) b += seprintf(b, lastof(buffer), "n");
if (_settings_game.vehicle.realistic_braking_aspect_limited == TRBALM_ON && l.lookahead_end_position == item.start) {
b += seprintf(b, lastof(buffer), ", lookahead end");
print_braking_speed(item.start, 0, item.z_pos);
}
break;
case TRLIT_CURVE_SPEED:
b += seprintf(b, lastof(buffer), "curve speed: %u", item.data_id);

View File

@@ -125,6 +125,12 @@ static const SettingDescEnumEntry _train_braking_model[] = {
{ 0, STR_NULL }
};
static const SettingDescEnumEntry _realistic_braking_aspect_limited[] = {
{ TRBALM_OFF, STR_CONFIG_SETTING_OFF },
{ TRBALM_ON, STR_CONFIG_SETTING_TRAIN_BRAKING_ASPECT_LIMITED_ON },
{ 0, STR_NULL }
};
static const SettingDescEnumEntry _station_delivery_mode[] = {
{ SD_NEAREST_FIRST, STR_CONFIG_SETTING_ORIGINAL},
{ SD_BALANCED, STR_CONFIG_SETTING_DELIVERY_BALANCED},
@@ -1327,6 +1333,16 @@ post_cb = TrainBrakingModelChanged
cat = SC_EXPERT
patxname = ""realistic_braking.vehicle.train_braking_model""
[SDT_ENUM]
var = vehicle.realistic_braking_aspect_limited
type = SLE_UINT8
def = TRBALM_OFF
enumlist = _realistic_braking_aspect_limited
str = STR_CONFIG_SETTING_REALISTIC_BRAKING_ASPECT_LIMITED
strhelp = STR_CONFIG_SETTING_REALISTIC_BRAKING_ASPECT_LIMITED_HELPTEXT
cat = SC_EXPERT
patxname = ""realistic_braking.vehicle.realistic_braking_aspect_limited""
[SDT_VAR]
var = vehicle.roadveh_acceleration_model
type = SLE_UINT8