summaryrefslogtreecommitdiff
path: root/src/main_gui.cpp
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2014-02-15 12:19:46 +0000
committerfonsinchen <fonsinchen@openttd.org>2014-02-15 12:19:46 +0000
commit405539791524847ce28e24e0513de8203ac12586 (patch)
tree9187acd5c99e1009bbb5f5690cd4808cf37a8036 /src/main_gui.cpp
parent4a00552a0959a260b23767d46a1047b9ac1f3f50 (diff)
downloadopenttd-405539791524847ce28e24e0513de8203ac12586.tar.xz
(svn r26338) -Fix [FS#5908]: Don't redraw the link graph overlay if it's empty (MJP)
Diffstat (limited to 'src/main_gui.cpp')
-rw-r--r--src/main_gui.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 350439ce1..9d13deef6 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -253,11 +253,17 @@ struct MainWindow : Window
virtual void OnTick()
{
- if (--refresh == 0) {
- this->viewport->overlay->RebuildCache();
- this->GetWidget<NWidgetBase>(WID_M_VIEWPORT)->SetDirty(this);
- this->refresh = LINKGRAPH_REFRESH_PERIOD;
+ if (--this->refresh > 0) return;
+
+ this->refresh = LINKGRAPH_REFRESH_PERIOD;
+
+ if (this->viewport->overlay->GetCargoMask() == 0 ||
+ this->viewport->overlay->GetCompanyMask() == 0) {
+ return;
}
+
+ this->viewport->overlay->RebuildCache();
+ this->GetWidget<NWidgetBase>(WID_M_VIEWPORT)->SetDirty(this);
}
virtual void OnPaint()