(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:
frosch
2009-05-31 12:03:14 +00:00
parent 749c976e47
commit 6e06b592ad
7 changed files with 44 additions and 4 deletions

View File

@@ -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