summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-09-17 06:12:53 +0000
committeryexo <yexo@openttd.org>2010-09-17 06:12:53 +0000
commit6b35ad3f0bd9028b3e619cb2eadfba05c425faa5 (patch)
treed4811e1d55710037380e57efdd9b7bda0542ac3b /src
parent97dbb1f27d6e1cad6be0b53f74a88694562f1331 (diff)
downloadopenttd-6b35ad3f0bd9028b3e619cb2eadfba05c425faa5.tar.xz
(svn r20820) -Codechange: remove two more contants related to the height of the main toolbar
Diffstat (limited to 'src')
-rw-r--r--src/window.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 57fc81f4c..b362ffcc8 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1053,7 +1053,8 @@ static bool IsGoodAutoPlace1(int left, int top, int width, int height, Point &po
int right = width + left;
int bottom = height + top;
- if (left < 0 || top < 22 || right > _screen.width || bottom > _screen.height) return false;
+ const Window *main_toolbar = FindWindowByClass(WC_MAIN_TOOLBAR);
+ if (left < 0 || (main_toolbar != NULL && top < main_toolbar->height) || right > _screen.width || bottom > _screen.height) return false;
/* Make sure it is not obscured by any window. */
const Window *w;
@@ -1122,7 +1123,8 @@ static Point GetAutoPlacePosition(int width, int height)
Point pt;
/* First attempt, try top-left of the screen */
- if (IsGoodAutoPlace1(0, 24, width, height, pt)) return pt;
+ const Window *main_toolbar = FindWindowByClass(WC_MAIN_TOOLBAR);
+ if (IsGoodAutoPlace1(0, main_toolbar != NULL ? main_toolbar->height + 2 : 2, width, height, pt)) return pt;
/* Second attempt, try around all existing windows with a distance of 2 pixels.
* The new window must be entirely on-screen, and not overlap with an existing window.