diff --git a/docs/newgrf-additions-nml.html b/docs/newgrf-additions-nml.html index c2abbdfb19..5f0562d9b8 100644 --- a/docs/newgrf-additions-nml.html +++ b/docs/newgrf-additions-nml.html @@ -615,20 +615,23 @@ item (FEAT_GLOBALVARS) { Set whether reserve through is unconditionally enabled for the most recently defined style (defined using the define_style property). - style_lookahead_extra_aspects0 - 6 + style_lookahead_extra_aspects0 - 6 or 255 Set the look-ahead extra aspects for the most recently defined style (defined using the define_style property).
- This property only makes a difference when the "limit train lookahead to signal aspect" game setting is enabled.
+ This property only makes a difference when the "realistic train braking is aspect limited" game setting is enabled.
This limits the signal aspect which the hypothetical train driver can "read" from the signal without affecting signal aspect propagation to other signals, or variable extra_callback_info2.
Example values could include: 1 for traditional banner repeater signals.
Shunt signals should use style_lookahead_single_signal_only instead.
- The value is clamped to be less than or equal to the value set in the extra_aspects property. + The value is clamped to be less than or equal to the value set in the extra_aspects property.
+
+ As a special case, a value of 255 (0xFF) disables the "realistic train braking is aspect limited" setting entirely for signals using this style.
+ This should only be used for signal types which are intended to emulate in-cab signalling, instead of the "driver" visually reading a signal. style_lookahead_single_signal_only0 or 1 Set the look-ahead to single signal only mode for the most recently defined style (defined using the define_style property).
- This property only makes a difference when the "limit train lookahead to signal aspect" game setting is enabled, or when using a different signal + This property only makes a difference when the "realistic train braking is aspect limited" game setting is enabled, or when using a different signal type which uses tyle_combined_normal_shunt.
This is similar to style_lookahead_extra_aspects with a value of 0, except the lookahead always ends at the next signal, even if that signal type sets style_no_aspect_increase.
diff --git a/docs/newgrf-additions.html b/docs/newgrf-additions.html index 412e09bc24..7b2ef3a1d2 100644 --- a/docs/newgrf-additions.html +++ b/docs/newgrf-additions.html @@ -515,17 +515,21 @@

This is indicated by the feature name: action0_signals_style, version 1

Set custom signal style train look-ahead extra aspects (mappable property: signals_style_lookahead_extra_aspects)

This applies to the most recent custom signal style defined using the signals_define_style property.
- This property only makes a difference when the "limit train lookahead to signal aspect" game setting is enabled.
+ This property only makes a difference when the "realistic train braking is aspect limited" game setting is enabled.
This limits the signal aspect which the hypothetical train driver can "read" from the signal without affecting signal aspect propagation to other signals, or variable 0x18.
Example values could include: 1 for traditional banner repeater signals.
Shunt signals should use signals_style_lookahead_single_signal_only instead.

The property length is 1 byte. The value is clamped to be less than or equal to the value set in the signals_extra_aspects property.
The Action 0 Id field is not used, the value is ignored.

-

This is indicated by the feature name: action0_signals_style, version 1

+

As a special case, a value of 255 (0xFF) disables the "realistic train braking is aspect limited" setting entirely for signals using this style.
+ This should only be used for signal types which are intended to emulate in-cab signalling, instead of the "driver" visually reading a signal.
+ This special case is indicated by the feature name action0_signals_style, version 2. +

+

This property is indicated by the feature name: action0_signals_style, version 1

Set custom signal style train look-ahead to single signal only mode (mappable property: signals_style_lookahead_single_signal_only)

This applies to the most recent custom signal style defined using the signals_define_style property.
- This property only makes a difference when the "limit train lookahead to signal aspect" game setting is enabled, or when using a different signal + This property only makes a difference when the "realistic train braking is aspect limited" game setting is enabled, or when using a different signal type which uses signals_style_combined_normal_shunt.
This is similar to signals_style_lookahead_extra_aspects with a value of 0, except the lookahead always ends at the next signal, even if that signal type sets signals_style_no_aspect_increase.
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 37a0f7b6b0..92066440c8 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -3107,7 +3107,7 @@ DEF_CONSOLE_CMD(ConDumpSignalStyles) grfid = style.grffile->grfid; grfs.insert(std::pair(grfid, style.grffile)); } - IConsolePrintF(CC_DEFAULT, " %2u: GRF: %08X, Local: %2u, Extra aspects: %2u, Flags: %c%c%c%c%c%c%c, %s", + IConsolePrintF(CC_DEFAULT, " %2u: GRF: %08X, Local: %2u, Extra aspects: %3u, Flags: %c%c%c%c%c%c%c, %s", (uint) (i + 1), BSWAP32(grfid), style.grf_local_id, diff --git a/src/newgrf.cpp b/src/newgrf.cpp index f3188dcd15..49bfecba6e 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4158,7 +4158,7 @@ static ChangeInfoResult SignalsChangeInfo(uint id, int numinfo, int prop, const case A0RPI_SIGNALS_STYLE_LOOKAHEAD_EXTRA_ASPECTS: { if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break; - uint8 value = std::min(buf->ReadByte(), NEW_SIGNALS_MAX_EXTRA_ASPECT); + uint8 value = buf->ReadByte(); if (_cur.grffile->current_new_signal_style != nullptr) { SetBit(_cur.grffile->current_new_signal_style->style_flags, NSSF_LOOKAHEAD_ASPECTS_SET); _cur.grffile->current_new_signal_style->lookahead_extra_aspects = value; diff --git a/src/newgrf_extension.cpp b/src/newgrf_extension.cpp index c6584700b2..6d6a9d718c 100644 --- a/src/newgrf_extension.cpp +++ b/src/newgrf_extension.cpp @@ -52,7 +52,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = { GRFFeatureInfo("action0_signals_restricted_signals", 2), GRFFeatureInfo("action0_signals_recolour", 1), GRFFeatureInfo("action0_signals_extra_aspects", 1), - GRFFeatureInfo("action0_signals_style", 1), + GRFFeatureInfo("action0_signals_style", 2), GRFFeatureInfo("varaction2_signals_signal_context", 1), GRFFeatureInfo("varaction2_signals_signal_side", 1), GRFFeatureInfo("varaction2_signals_signal_vertical_clearance", 1), diff --git a/src/pbs.cpp b/src/pbs.cpp index c73503cb03..0c86717e62 100644 --- a/src/pbs.cpp +++ b/src/pbs.cpp @@ -1133,6 +1133,10 @@ int AdvanceTrainReservationLookaheadEnd(const Train *v, int lookahead_end_positi /* Signal is within visual range */ uint8 style = item.data_aux >> 8; uint8 max_aspect = (style == 0) ? _extra_aspects : _new_signal_styles[style - 1].lookahead_extra_aspects; + if (max_aspect == 0xFF) { + /* This signal has unlimited lookahead */ + return v->lookahead->reservation_end_position + 1; + } if (!HasBit(item.data_aux, TRSLAI_NEXT_ONLY)) allow_skip_no_aspect_inc = true; max_aspect += ((HasBit(item.data_aux, TRSLAI_NO_ASPECT_INC) && allow_skip_no_aspect_inc) ? 1 : 2); if (max_aspect > known_signals_ahead) known_signals_ahead = max_aspect; diff --git a/src/signal.cpp b/src/signal.cpp index ee0253b8d6..11920677de 100644 --- a/src/signal.cpp +++ b/src/signal.cpp @@ -1804,7 +1804,9 @@ static bool DetermineExtraAspectsVariable() _new_signal_styles[i].lookahead_extra_aspects = 0; SetBit(_signal_style_masks.next_only, i + 1); } else if (HasBit(_new_signal_styles[i].style_flags, NSSF_LOOKAHEAD_ASPECTS_SET)) { - _new_signal_styles[i].lookahead_extra_aspects = std::min(_new_signal_styles[i].lookahead_extra_aspects, _new_signal_styles[i].grffile->new_signal_extra_aspects); + if (_new_signal_styles[i].lookahead_extra_aspects != 255) { + _new_signal_styles[i].lookahead_extra_aspects = std::min(_new_signal_styles[i].lookahead_extra_aspects, _new_signal_styles[i].grffile->new_signal_extra_aspects); + } } else { _new_signal_styles[i].lookahead_extra_aspects = _new_signal_styles[i].grffile->new_signal_extra_aspects; }