summaryrefslogtreecommitdiff
path: root/src/train.h
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-12-14 21:33:53 +0000
committerterkhen <terkhen@openttd.org>2010-12-14 21:33:53 +0000
commit48b7916458de4b2cdbc226a4a6ab078db4c77e73 (patch)
treec3a49ca7a91890042ca56765574bc40a54c15f96 /src/train.h
parenta93944e765776c6e9a2bd556457cd93748068da6 (diff)
downloadopenttd-48b7916458de4b2cdbc226a4a6ab078db4c77e73.tar.xz
(svn r21521) -Codechange: Unify some cached values that were present in both road vehicles and trains.
Diffstat (limited to 'src/train.h')
-rw-r--r--src/train.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/train.h b/src/train.h
index 4e0bc10de..4cc9ea7a2 100644
--- a/src/train.h
+++ b/src/train.h
@@ -68,16 +68,12 @@ struct TrainCache {
uint16 last_speed; // NOSAVE: only used in UI
/* cached values, recalculated on load and each time a vehicle is added to/removed from the consist. */
- uint16 cached_total_length; ///< Length of the whole train, valid only for first engine.
- uint8 cached_veh_length; ///< length of this vehicle in units of 1/8 of normal length, cached because this can be set by a callback
bool cached_tilt; ///< train can tilt; feature provides a bonus in curves
+ byte user_def_data; ///< Cached property 0x25. Can be set by Callback 0x36.
+
/* cached max. speed / acceleration data */
int cached_max_curve_speed; ///< max consist speed limited by curves
-
- byte user_def_data;
-
- EngineID first_engine; ///< cached EngineID of the front vehicle. INVALID_ENGINE for the front vehicle itself.
};
/**
@@ -387,7 +383,7 @@ protected: // These functions should not be called outside acceleration code.
{
/* For powered wagons the engine defines the type of engine (i.e. railtype) */
if (HasBit(this->flags, VRF_POWEREDWAGON) && HasPowerOnRail(head->railtype, GetRailType(this->tile))) {
- return RailVehInfo(this->tcache.first_engine)->pow_wag_power;
+ return RailVehInfo(this->gcache.first_engine)->pow_wag_power;
}
return 0;
@@ -408,7 +404,7 @@ protected: // These functions should not be called outside acceleration code.
/* Powered wagons have extra weight added. */
if (HasBit(this->flags, VRF_POWEREDWAGON)) {
- weight += RailVehInfo(this->tcache.first_engine)->pow_wag_weight;
+ weight += RailVehInfo(this->gcache.first_engine)->pow_wag_weight;
}
return weight;