(svn r16480) -Fix (r15617): Invalidate newgrf variable caches of more vehicles in more places. Esp. they were only invalidated for trains.
This commit is contained in:
@@ -245,6 +245,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
|
||||
|
Reference in New Issue
Block a user