From 9c66082b079af7f608d033225c1544558c93a715 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Fri, 8 Jun 2007 09:35:39 +0000 Subject: (svn r10062) -Codechange: Don't redraw all station tiles when cargo is added or removed if the station has no custom graphics. --- src/station.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/station.cpp') diff --git a/src/station.cpp b/src/station.cpp index 2234e8417..9ddebb10e 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -133,7 +133,7 @@ void Station::MarkDirty() const } } -void Station::MarkTilesDirty() const +void Station::MarkTilesDirty(bool cargo_change) const { TileIndex tile = train_tile; int w, h; @@ -141,6 +141,15 @@ void Station::MarkTilesDirty() const /* XXX No station is recorded as 0, not INVALID_TILE... */ if (tile == 0) return; + /* cargo_change is set if we're refreshing the tiles due to cargo moving + * around. */ + if (cargo_change) { + /* Don't waste time updating if there are no custom station graphics + * that might change. Even if there are custom graphics, they might + * not change. Unfortunately we have no way of telling. */ + if (this->num_specs == 0) return; + } + for (h = 0; h < trainst_h; h++) { for (w = 0; w < trainst_w; w++) { if (TileBelongsToRailStation(tile)) { -- cgit v1.2.3-54-g00ecf