diff options
author | terkhen <terkhen@openttd.org> | 2010-12-14 21:33:53 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2010-12-14 21:33:53 +0000 |
commit | 48b7916458de4b2cdbc226a4a6ab078db4c77e73 (patch) | |
tree | c3a49ca7a91890042ca56765574bc40a54c15f96 /src/train.h | |
parent | a93944e765776c6e9a2bd556457cd93748068da6 (diff) | |
download | openttd-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.h | 12 |
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; |