summaryrefslogtreecommitdiff
path: root/src/train.h
diff options
context:
space:
mode:
authorVít Šefl <vituscze@gmail.com>2021-08-15 11:17:05 +0200
committerGitHub <noreply@github.com>2021-08-15 11:17:05 +0200
commit2183fd4dabe72bd96b264bf8cdb3a2a8be625cf8 (patch)
tree7a94f94723ac65e43d5ab856d5945b3bce9a5b31 /src/train.h
parent579f393374c4fae2458523a674c453349fce7c59 (diff)
downloadopenttd-2183fd4dabe72bd96b264bf8cdb3a2a8be625cf8.tar.xz
Feature: [NewGRF] Maximum curve speed modifier for rail vehicles (#9346)
Diffstat (limited to 'src/train.h')
-rw-r--r--src/train.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/train.h b/src/train.h
index af638c283..0b7b7be5b 100644
--- a/src/train.h
+++ b/src/train.h
@@ -72,6 +72,7 @@ struct TrainCache {
/* cached values, recalculated on load and each time a vehicle is added to/removed from the consist. */
bool cached_tilt; ///< train can tilt; feature provides a bonus in curves
+ int cached_curve_speed_mod; ///< curve speed modifier of the entire train
byte user_def_data; ///< Cached property 0x25. Can be set by Callback 0x36.
@@ -313,6 +314,15 @@ protected: // These functions should not be called outside acceleration code.
}
/**
+ * Returns the curve speed modifier of this vehicle.
+ * @return Current curve speed modifier, in fixed-point binary representation with 8 fractional bits.
+ */
+ inline int GetCurveSpeedModifier() const
+ {
+ return GetVehicleProperty(this, PROP_TRAIN_CURVE_SPEED_MOD, RailVehInfo(this->engine_type)->curve_speed_mod, true);
+ }
+
+ /**
* Checks if the vehicle is at a tile that can be sloped.
* @return True if the tile can be sloped.
*/