Cache the result of GetImage() in Vehicle::UpdateViewport() where possible.
Sprite number is not cached if callback is made, or a variable access outside a whitelist occurs. Invalidate cached sprite number when direction or cargo changes, or vehicle is marked dirty.
This commit is contained in:
@@ -1293,6 +1293,7 @@ TileIndex Aircraft::GetOrderStationLocation(StationID station)
|
||||
void Aircraft::MarkDirty()
|
||||
{
|
||||
this->colourmap = PAL_NONE;
|
||||
this->cur_image_valid_dir = INVALID_DIR;
|
||||
this->UpdateViewport(true, false);
|
||||
if (this->subtype == AIR_HELICOPTER) this->Next()->Next()->cur_image = GetRotorImage(this, EIT_ON_MAP);
|
||||
}
|
||||
|
Reference in New Issue
Block a user