summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-02 21:01:13 +0000
committerrubidium <rubidium@openttd.org>2009-01-02 21:01:13 +0000
commit5130369301b709e1d326ee7e706e7fde7dad5200 (patch)
treef6233a3ac26f3ff8d8c2ee669a02349d66c8e407
parentd91baac764ccd1a29c07ec871ab96f0d709f7813 (diff)
downloadopenttd-5130369301b709e1d326ee7e706e7fde7dad5200.tar.xz
(svn r14786) -Fix: road/rail/water/airport toolbar opened over terraform toolbar when toolbar linking is turned on.
-rw-r--r--src/terraform_gui.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 3aa8e38d3..74760f791 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -10,6 +10,7 @@
#include "company_base.h"
#include "gui.h"
#include "window_gui.h"
+#include "window_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "command_func.h"
@@ -328,16 +329,24 @@ static const WindowDesc _terraform_desc = {
void ShowTerraformToolbar(Window *link)
{
if (!IsValidCompanyID(_current_company)) return;
+
Window *w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
- if (w != NULL && link != NULL) {
- /* Align the terraform toolbar under the main toolbar and put the linked
- * toolbar to left of it
- */
+ if (link == NULL) return;
+
+ if (w == NULL) {
+ w = FindWindowById(WC_SCEN_LAND_GEN, 0);
+ } else {
w->top = 22;
w->SetDirty();
- link->left = w->left - link->width;
- link->SetDirty();
}
+ if (w == NULL) return;
+
+ /* Align the terraform toolbar under the main toolbar and put the linked
+ * toolbar to left of it
+ */
+ link->top = w->top;
+ link->left = w->left - link->width;
+ link->SetDirty();
}
static byte _terraform_size = 1;