diff options
author | rubidium <rubidium@openttd.org> | 2009-05-23 09:10:56 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-05-23 09:10:56 +0000 |
commit | 6237fe146228e84761c6aba14bf7acf6c359f061 (patch) | |
tree | 0ff89de7f14a652d59d972e949761819642296a4 /src/vehicle_base.h | |
parent | da5661a0c8870c532c393ec3d330c3fbb44eb8ac (diff) | |
download | openttd-6237fe146228e84761c6aba14bf7acf6c359f061.tar.xz |
(svn r16394) -Codechange: move (NewGRF) cache variables into a separate struct so (some vehicle related) NewGRF cache 'desyncs' can be tested easier.
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r-- | src/vehicle_base.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 841acb5bb..350b5e7c5 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -43,6 +43,15 @@ enum VehicleFlags { VF_AUTOFILL_PRES_WAIT_TIME, ///< Whether non-destructive auto-fill should preserve waiting times }; +/** Cached oftenly queried (NewGRF) values */ +struct VehicleCache { + uint8 cache_valid; ///< Whether the caches are valid + uint32 cached_var40; ///< Cache for NewGRF var 40 + uint32 cached_var41; ///< Cache for NewGRF var 41 + uint32 cached_var42; ///< Cache for NewGRF var 42 + uint32 cached_var43; ///< Cache for NewGRF var 43 +}; + typedef Pool<Vehicle, VehicleID, 512, 64000> VehiclePool; extern VehiclePool _vehicle_pool; @@ -170,12 +179,7 @@ public: byte subtype; ///< subtype (Filled with values from EffectVehicles/TrainSubTypes/AircraftSubTypes) - /* cached oftenly queried NewGRF values */ - uint8 cache_valid; ///< Whether the caches are valid - uint32 cached_var40; ///< Cache for NewGRF var 40 - uint32 cached_var41; ///< Cache for NewGRF var 41 - uint32 cached_var42; ///< Cache for NewGRF var 42 - uint32 cached_var43; ///< Cache for NewGRF var 43 + VehicleCache vcache; ///< Cache of often used calculated values /** Create a new vehicle */ Vehicle(); |