Fix handling of LinkGraphOverlay dirty flag

This commit is contained in:
Jonathan G Rennison
2022-11-10 23:40:13 +00:00
parent 2af2c56d19
commit 8c2dd8d7fb
2 changed files with 2 additions and 2 deletions

View File

@@ -112,6 +112,7 @@ void LinkGraphOverlay::MarkStationViewportLinksDirty(const Station *st)
void LinkGraphOverlay::RebuildCache(bool incremental) void LinkGraphOverlay::RebuildCache(bool incremental)
{ {
if (!incremental) { if (!incremental) {
this->dirty = false;
this->cached_links.clear(); this->cached_links.clear();
this->cached_stations.clear(); this->cached_stations.clear();
this->last_update_number = GetWindowUpdateNumber(); this->last_update_number = GetWindowUpdateNumber();
@@ -387,7 +388,6 @@ void LinkGraphOverlay::PrepareDraw()
{ {
if (this->dirty) { if (this->dirty) {
this->RebuildCache(); this->RebuildCache();
this->dirty = false;
} }
if (this->last_update_number != GetWindowUpdateNumber()) { if (this->last_update_number != GetWindowUpdateNumber()) {
this->last_update_number = GetWindowUpdateNumber(); this->last_update_number = GetWindowUpdateNumber();

View File

@@ -70,7 +70,7 @@ public:
* @param scale Desired thickness of lines and size of station dots. * @param scale Desired thickness of lines and size of station dots.
*/ */
LinkGraphOverlay(Window *w, uint wid, CargoTypes cargo_mask, uint32 company_mask, uint scale) : 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); void RebuildCache(bool incremental = false);