summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2008-06-20 14:54:47 +0000
committerskidd13 <skidd13@openttd.org>2008-06-20 14:54:47 +0000
commitfd49e1c379aa520c07320d499bf6bec79d5c7931 (patch)
tree85a0e1fd9cad4fff39133d90b7242a444c3bd614 /src
parent52c06f1baa1c14b7bc291e05177ecbe2cd241d07 (diff)
downloadopenttd-fd49e1c379aa520c07320d499bf6bec79d5c7931.tar.xz
(svn r13592) -Fix: window size remembering was broken
Diffstat (limited to 'src')
-rw-r--r--src/bridge_gui.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index ed66dcce9..f0760dc97 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -60,7 +60,7 @@ enum BuildBridgeSelectionWidgets {
class BuildBridgeWindow : public Window {
private:
/* Runtime saved values */
- static uint last_size;
+ static uint16 last_size;
static Listing last_sorting;
/* Constants for sorting the bridges */
@@ -132,9 +132,8 @@ public:
this->vscroll.cap = 4;
} else {
/* Resize the bridge selection window if we used a bigger one the last time */
- this->vscroll.cap = (this->vscroll.count > this->last_size) ? this->last_size : this->vscroll.count;
+ this->vscroll.cap = min(this->last_size, this->vscroll.count);
ResizeWindow(this, 0, (this->vscroll.cap - 4) * this->resize.step_height);
- this->widget[BBSW_BRIDGE_LIST].data = (this->vscroll.cap << 8) + 1;
}
this->FindWindowPlacementAndResize(desc);
@@ -222,12 +221,12 @@ public:
this->widget[BBSW_BRIDGE_LIST].data = (this->vscroll.cap << 8) + 1;
SetVScrollCount(this, this->bridges->Length());
- this->last_size = this->vscroll.cap;
+ this->last_size = max(this->vscroll.cap, this->last_size);
}
};
/* Set the default size of the Build Bridge Window */
-uint BuildBridgeWindow::last_size = 4;
+uint16 BuildBridgeWindow::last_size = 4;
/* Set the default sorting for the bridges */
Listing BuildBridgeWindow::last_sorting = {false, 0};