diff options
author | frosch <frosch@openttd.org> | 2009-05-31 12:03:14 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-05-31 12:03:14 +0000 |
commit | 9853c0dc224e01cf3394336ab074cbb18592bd5b (patch) | |
tree | 8beff2dc7ba4f4426c471c831bbd7b62c0b8d0e6 /src/vehicle_base.h | |
parent | 56988b198d6657cda7a404d2f13c0d50ec3eed06 (diff) | |
download | openttd-9853c0dc224e01cf3394336ab074cbb18592bd5b.tar.xz |
(svn r16480) -Fix (r15617): Invalidate newgrf variable caches of more vehicles in more places. Esp. they were only invalidated for trains.
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r-- | src/vehicle_base.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 581a55135..b4a43e2ae 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -246,6 +246,26 @@ public: virtual SpriteID GetImage(Direction direction) const { return 0; } /** + * Invalidates cached NewGRF variables + * @see InvalidateNewGRFCacheOfChain + */ + FORCEINLINE void InvalidateNewGRFCache() + { + this->vcache.cache_valid = 0; + } + + /** + * Invalidates cached NewGRF variables of all vehicles in the chain (after the current vehicle) + * @see InvalidateNewGRFCache + */ + FORCEINLINE void InvalidateNewGRFCacheOfChain() + { + for (Vehicle *u = this; u != NULL; u = u->Next()) { + u->InvalidateNewGRFCache(); + } + } + + /** * Gets the speed in km-ish/h that can be sent into SetDParam for string processing. * @return the vehicle's speed */ |