summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-04-09 21:15:24 +0000
committerfrosch <frosch@openttd.org>2011-04-09 21:15:24 +0000
commit6ce83c0aaa4028f05088c9c613f6b7b08b250aab (patch)
tree03ec674e60d3161a1668f1ca10cdadc8260d8df5
parentaf2f6de903ba54fd52dda4885ecc769bb42b3e1a (diff)
downloadopenttd-6ce83c0aaa4028f05088c9c613f6b7b08b250aab.tar.xz
(svn r22307) -Fix: When drawing the town authority window, check whether the availability of the actions changed, and force a complete redraw in that case.
-rw-r--r--src/town_gui.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index c2a8909a6..76b89e2cc 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -73,6 +73,7 @@ private:
Town *town; ///< Town being displayed.
int sel_index; ///< Currently selected town action, \c 0 to \c TACT_COUNT-1, \c -1 means no action selected.
Scrollbar *vscroll;
+ uint displayed_actions_on_previous_painting; ///< Actions that were available on the previous call to OnPaint()
/**
* Get the position of the Nth set bit.
@@ -96,7 +97,7 @@ private:
}
public:
- TownAuthorityWindow(const WindowDesc *desc, WindowNumber window_number) : Window(), sel_index(-1)
+ TownAuthorityWindow(const WindowDesc *desc, WindowNumber window_number) : Window(), sel_index(-1), displayed_actions_on_previous_painting(0)
{
this->town = Town::Get(window_number);
this->InitNested(desc, window_number);
@@ -108,6 +109,8 @@ public:
{
int numact;
uint buttons = GetMaskOfTownActions(&numact, _local_company, this->town);
+ if (buttons != displayed_actions_on_previous_painting) this->SetDirty();
+ displayed_actions_on_previous_painting = buttons;
this->vscroll->SetCount(numact + 1);