summaryrefslogtreecommitdiff
path: root/src/station.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-06-08 09:35:39 +0000
committerpeter1138 <peter1138@openttd.org>2007-06-08 09:35:39 +0000
commit9c66082b079af7f608d033225c1544558c93a715 (patch)
tree2e4dbdfce24473a173e2061ef009fc3d4a98f929 /src/station.cpp
parent29f6ae952cdbd3ff702c84b6ad1e4a68968dc9ce (diff)
downloadopenttd-9c66082b079af7f608d033225c1544558c93a715.tar.xz
(svn r10062) -Codechange: Don't redraw all station tiles when cargo is added or removed if the station has no custom graphics.
Diffstat (limited to 'src/station.cpp')
-rw-r--r--src/station.cpp11
1 files changed, 10 insertions, 1 deletions
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)) {