diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index d0e1d09b44..3cd456160c 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -112,6 +112,7 @@ void LinkGraphOverlay::MarkStationViewportLinksDirty(const Station *st) void LinkGraphOverlay::RebuildCache(bool incremental) { if (!incremental) { + this->dirty = false; this->cached_links.clear(); this->cached_stations.clear(); this->last_update_number = GetWindowUpdateNumber(); @@ -387,7 +388,6 @@ void LinkGraphOverlay::PrepareDraw() { if (this->dirty) { this->RebuildCache(); - this->dirty = false; } if (this->last_update_number != GetWindowUpdateNumber()) { this->last_update_number = GetWindowUpdateNumber(); diff --git a/src/linkgraph/linkgraph_gui.h b/src/linkgraph/linkgraph_gui.h index cf6cf25195..94e1abe25e 100644 --- a/src/linkgraph/linkgraph_gui.h +++ b/src/linkgraph/linkgraph_gui.h @@ -70,7 +70,7 @@ public: * @param scale Desired thickness of lines and size of station dots. */ LinkGraphOverlay(Window *w, uint wid, CargoTypes cargo_mask, uint32 company_mask, uint scale) : - window(w), widget_id(wid), cargo_mask(cargo_mask), company_mask(company_mask), scale(scale) + window(w), widget_id(wid), cargo_mask(cargo_mask), company_mask(company_mask), scale(scale), dirty(true) {} void RebuildCache(bool incremental = false);