diff options
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 */ |