diff options
author | terkhen <terkhen@openttd.org> | 2010-11-06 12:53:31 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2010-11-06 12:53:31 +0000 |
commit | c8a56f17f82be7d4a8e935fc514c86a313dc7d15 (patch) | |
tree | 4a2552f26ee887aa326721881fbbe6f62b8b48d2 /src/vehicle_base.h | |
parent | 78d0a1cb1af68863e3e7bfed584f4a94ee46f611 (diff) | |
download | openttd-c8a56f17f82be7d4a8e935fc514c86a313dc7d15.tar.xz |
(svn r21097) -Codechange: Unify cached max speed for all vehicle types.
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r-- | src/vehicle_base.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 13f71c1c7..e757ef581 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -64,6 +64,11 @@ struct NewGRFCache { uint8 cache_valid; ///< Bitset that indicates which cache values are valid. }; +/** Cached often queried values common to all vehicles. */ +struct VehicleCache { + uint16 cached_max_speed; ///< Maximum speed of the consist (minimum of the max speed of all vehicles in the consist). +}; + /** A vehicle pool for a little over 1 million vehicles. */ typedef Pool<Vehicle, VehicleID, 512, 0xFF000> VehiclePool; extern VehiclePool _vehicle_pool; @@ -199,6 +204,7 @@ public: byte subtype; ///< subtype (Filled with values from #EffectVehicles/#TrainSubTypes/#AircraftSubTypes) NewGRFCache grf_cache; ///< Cache of often used calculated NewGRF values + VehicleCache vcache; ///< Cache of often used vehicle values. /** Create a new vehicle */ Vehicle(VehicleType type = VEH_INVALID); |