summaryrefslogtreecommitdiff
path: root/src/town_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/town_gui.cpp')
-rw-r--r--src/town_gui.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index fce2a8ce6..cbcb43f20 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -846,6 +846,12 @@ public:
}
}
+ virtual void OnPaint()
+ {
+ if (this->towns.NeedRebuild()) this->BuildSortTownList();
+ this->DrawWidgets();
+ }
+
virtual void OnHundredthTick()
{
this->BuildSortTownList();
@@ -859,12 +865,14 @@ public:
virtual void OnInvalidateData(int data)
{
+ /* We can only set the trigger for resorting/rebuilding.
+ * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
+ * and a rebuild needs to be done first though it is scheduled later. */
if (data == 0) {
this->towns.ForceRebuild();
} else {
this->towns.ForceResort();
}
- this->BuildSortTownList();
}
};