summaryrefslogtreecommitdiff
path: root/src/linkgraph/linkgraph_gui.cpp
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2019-02-23 19:19:41 +0000
committerGitHub <noreply@github.com>2019-02-23 19:19:41 +0000
commit87ebfe1227ecc811a18d9b9c791e3e21da3f5eb2 (patch)
tree2792f87f0fbcc12ef020a7942ecd708011c54de0 /src/linkgraph/linkgraph_gui.cpp
parentf240f61fb2813a7cc3d2ad130477039b2a4701fd (diff)
downloadopenttd-87ebfe1227ecc811a18d9b9c791e3e21da3f5eb2.tar.xz
Fix #7004: Mark linkgraph dirty to be rebuilt on next draw call. (#7265)
Previously the linkgraph was rebuilt before the viewport extents were finalized.
Diffstat (limited to 'src/linkgraph/linkgraph_gui.cpp')
-rw-r--r--src/linkgraph/linkgraph_gui.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp
index 7923fc26c..4db9f95b3 100644
--- a/src/linkgraph/linkgraph_gui.cpp
+++ b/src/linkgraph/linkgraph_gui.cpp
@@ -239,8 +239,12 @@ void LinkGraphOverlay::AddLinks(const Station *from, const Station *to)
* Draw the linkgraph overlay or some part of it, in the area given.
* @param dpi Area to be drawn to.
*/
-void LinkGraphOverlay::Draw(const DrawPixelInfo *dpi) const
+void LinkGraphOverlay::Draw(const DrawPixelInfo *dpi)
{
+ if (this->dirty) {
+ this->RebuildCache();
+ this->dirty = false;
+ }
this->DrawLinks(dpi);
this->DrawStationDots(dpi);
}