From 8eb3d653da176d4bd4b966065965001d18e37e90 Mon Sep 17 00:00:00 2001 From: terkhen Date: Sat, 6 Nov 2010 12:37:55 +0000 Subject: (svn r21090) -Codechange: Rename VehicleCache to NewGRFCache. --- src/vehicle_base.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/vehicle_base.h') diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 6bd99e10b..1c794cb09 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -47,12 +47,13 @@ enum VehicleFlags { }; /** Cached often 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 +struct NewGRFCache { + /* Values calculated when they are requested for the first time after invalidating the NewGRF cache. */ + uint32 position_consist_length; ///< Cache for NewGRF var 40. + uint32 position_same_id_length; ///< Cache for NewGRF var 41. + uint32 consist_cargo_information; ///< Cache for NewGRF var 42. + uint32 company_information; ///< Cache for NewGRF var 43. + uint8 cache_valid; ///< Bitset that indicates which cache values are valid. }; /** A vehicle pool for a little over 1 million vehicles. */ @@ -189,7 +190,7 @@ public: byte subtype; ///< subtype (Filled with values from #EffectVehicles/#TrainSubTypes/#AircraftSubTypes) - VehicleCache vcache; ///< Cache of often used calculated values + NewGRFCache grf_cache; ///< Cache of often used calculated NewGRF values /** Create a new vehicle */ Vehicle(VehicleType type = VEH_INVALID); @@ -308,7 +309,7 @@ public: */ FORCEINLINE void InvalidateNewGRFCache() { - this->vcache.cache_valid = 0; + this->grf_cache.cache_valid = 0; } /** -- cgit v1.2.3-54-g00ecf