diff --git a/docs/newgrf-additions-nml.html b/docs/newgrf-additions-nml.html
index 22a237283c..5236cfddfc 100644
--- a/docs/newgrf-additions-nml.html
+++ b/docs/newgrf-additions-nml.html
@@ -40,6 +40,11 @@
This flag must only be set if a different sprite is returned when bit 24 of extra_callback_info2 is set.
+
disable_realistic_braking | 0 or 1 |
+
+ When this property is set realistic braking is disabled for trains of this railtype even when realistic braking is otherwise in effect.
+ |
+
diff --git a/docs/newgrf-additions.html b/docs/newgrf-additions.html
index 41a913e882..2a15989167 100644
--- a/docs/newgrf-additions.html
+++ b/docs/newgrf-additions.html
@@ -231,6 +231,12 @@
The property length is 1 byte. 0 is disabled (default). 1 is enabled.
This is indicated by the feature name: action0_railtype_restricted_signals, version 1
+ Disable use of realistic braking with this rail type (mappable property: railtype_disable_realistic_braking)
+ This applies to Action 2/3 - Railtype custom signal sprites.
+ When this property is set realistic braking is disabled for trains of this railtype even when realistic braking is otherwise in effect.
+ The property length is 1 byte. 0 is realistic braking is not disabled for this railtype. 1 is disable realistic braking for this railtype.
+
+ This is indicated by the feature name: action0_railtype_disable_realistic_braking, version 1
Extra road/tram type flags (mappable property: roadtype_extra_flags)
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index a91212f414..8500cff39f 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -2468,7 +2468,7 @@ DEF_CONSOLE_CMD(ConDumpRailTypes)
grfid = grf->grfid;
grfs.insert(std::pair(grfid, grf));
}
- IConsolePrintF(CC_DEFAULT, " %02u %c%c%c%c, Flags: %c%c%c%c%c%c, Ctrl Flags: %c%c, GRF: %08X, %s",
+ IConsolePrintF(CC_DEFAULT, " %02u %c%c%c%c, Flags: %c%c%c%c%c%c, Ctrl Flags: %c%c%c, GRF: %08X, %s",
(uint) rt,
rti->label >> 24, rti->label >> 16, rti->label >> 8, rti->label,
HasBit(rti->flags, RTF_CATENARY) ? 'c' : '-',
@@ -2479,6 +2479,7 @@ DEF_CONSOLE_CMD(ConDumpRailTypes)
HasBit(rti->flags, RTF_DISALLOW_90DEG) ? 'd' : '-',
HasBit(rti->ctrl_flags, RTCF_PROGSIG) ? 'p' : '-',
HasBit(rti->ctrl_flags, RTCF_RESTRICTEDSIG) ? 'r' : '-',
+ HasBit(rti->ctrl_flags, RTCF_NOREALISTICBRAKING) ? 'b' : '-',
BSWAP32(grfid),
GetStringPtr(rti->strings.name)
);
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 39c4f2dc3e..9b158391c8 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -4377,6 +4377,11 @@ static ChangeInfoResult RailTypeChangeInfo(uint id, int numinfo, int prop, const
SB(rti->ctrl_flags, RTCF_RESTRICTEDSIG, 1, (buf->ReadByte() != 0 ? 1 : 0));
break;
+ case A0RPI_RAILTYPE_DISABLE_REALISTIC_BRAKING:
+ if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break;
+ SB(rti->ctrl_flags, RTCF_NOREALISTICBRAKING, 1, (buf->ReadByte() != 0 ? 1 : 0));
+ break;
+
default:
ret = HandleAction0PropertyDefault(buf, prop);
break;
@@ -4459,6 +4464,7 @@ static ChangeInfoResult RailTypeReserveInfo(uint id, int numinfo, int prop, cons
case A0RPI_RAILTYPE_ENABLE_PROGRAMMABLE_SIGNALS:
case A0RPI_RAILTYPE_ENABLE_RESTRICTED_SIGNALS:
+ case A0RPI_RAILTYPE_DISABLE_REALISTIC_BRAKING:
buf->Skip(buf->ReadExtendedByte());
break;
@@ -8403,6 +8409,7 @@ static const GRFFeatureInfo _grf_feature_list[] = {
GRFFeatureInfo("action5_programmable_signals", 1),
GRFFeatureInfo("action0_railtype_programmable_signals", 1),
GRFFeatureInfo("action0_railtype_restricted_signals", 1),
+ GRFFeatureInfo("action0_railtype_disable_realistic_braking", 1),
GRFFeatureInfo("action0_roadtype_extra_flags", 1),
GRFFeatureInfo(),
};
@@ -8522,6 +8529,7 @@ static const GRFPropertyMapDefinition _grf_action0_remappable_properties[] = {
GRFPropertyMapDefinition(GSF_BRIDGES, A0RPI_BRIDGE_AVAILABILITY_FLAGS, "bridge_availability_flags"),
GRFPropertyMapDefinition(GSF_RAILTYPES, A0RPI_RAILTYPE_ENABLE_PROGRAMMABLE_SIGNALS, "railtype_enable_programmable_signals"),
GRFPropertyMapDefinition(GSF_RAILTYPES, A0RPI_RAILTYPE_ENABLE_RESTRICTED_SIGNALS, "railtype_enable_restricted_signals"),
+ GRFPropertyMapDefinition(GSF_RAILTYPES, A0RPI_RAILTYPE_DISABLE_REALISTIC_BRAKING, "railtype_disable_realistic_braking"),
GRFPropertyMapDefinition(GSF_ROADTYPES, A0RPI_ROADTYPE_EXTRA_FLAGS, "roadtype_extra_flags"),
GRFPropertyMapDefinition(GSF_TRAMTYPES, A0RPI_ROADTYPE_EXTRA_FLAGS, "roadtype_extra_flags"),
GRFPropertyMapDefinition(),
diff --git a/src/newgrf.h b/src/newgrf.h
index 44f9f410ee..b4f9bbf6ae 100644
--- a/src/newgrf.h
+++ b/src/newgrf.h
@@ -117,6 +117,7 @@ enum Action0RemapPropertyIds {
A0RPI_BRIDGE_AVAILABILITY_FLAGS,
A0RPI_RAILTYPE_ENABLE_PROGRAMMABLE_SIGNALS,
A0RPI_RAILTYPE_ENABLE_RESTRICTED_SIGNALS,
+ A0RPI_RAILTYPE_DISABLE_REALISTIC_BRAKING,
A0RPI_ROADTYPE_EXTRA_FLAGS,
};
diff --git a/src/rail.h b/src/rail.h
index 35347e1d57..72ea03f947 100644
--- a/src/rail.h
+++ b/src/rail.h
@@ -43,8 +43,9 @@ DECLARE_ENUM_AS_BIT_SET(RailTypeFlags)
/** Railtype control flags. */
enum RailTypeCtrlFlags {
- RTCF_PROGSIG = 0, ///< Custom signal sprites enabled for programmable pre-signals.
- RTCF_RESTRICTEDSIG = 1, ///< Custom signal sprite flag enabled for restricted signals.
+ RTCF_PROGSIG = 0, ///< Custom signal sprites enabled for programmable pre-signals.
+ RTCF_RESTRICTEDSIG = 1, ///< Custom signal sprite flag enabled for restricted signals.
+ RTCF_NOREALISTICBRAKING = 2, ///< Realistic braking disabled for this track type
};
struct SpriteGroup;
diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h
index 40e0b2e879..7616837f3d 100644
--- a/src/table/newgrf_debug_data.h
+++ b/src/table/newgrf_debug_data.h
@@ -838,9 +838,10 @@ class NIHRailType : public NIHelper {
HasBit(info->flags, RTF_ALLOW_90DEG) ? 'a' : '-',
HasBit(info->flags, RTF_DISALLOW_90DEG) ? 'd' : '-');
print(buffer);
- seprintf(buffer, lastof(buffer), " Ctrl flags: %c%c",
+ seprintf(buffer, lastof(buffer), " Ctrl flags: %c%c%c",
HasBit(info->ctrl_flags, RTCF_PROGSIG) ? 'p' : '-',
- HasBit(info->ctrl_flags, RTCF_RESTRICTEDSIG) ? 'r' : '-');
+ HasBit(info->ctrl_flags, RTCF_RESTRICTEDSIG) ? 'r' : '-',
+ HasBit(info->ctrl_flags, RTCF_NOREALISTICBRAKING) ? 'b' : '-');
print(buffer);
seprintf(buffer, lastof(buffer), " Powered: 0x" OTTD_PRINTFHEX64, info->powered_railtypes);
print(buffer);
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index f40dd69523..586cc388b4 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1073,7 +1073,7 @@ void Train::UpdateAcceleration()
assert(weight != 0);
this->acceleration = Clamp(power / weight * 4, 1, 255);
- if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC) {
+ if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC && !HasBit(GetRailTypeInfo(this->railtype)->ctrl_flags, RTCF_NOREALISTICBRAKING)) {
this->tcache.cached_tflags |= TCF_RL_BRAKING;
switch (_settings_game.vehicle.train_acceleration_model) {
default: NOT_REACHED();