summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/window.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/window.cpp b/src/window.cpp
index ba105839a..82458879b 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -843,23 +843,35 @@ restart:
}
}
+/**
+ * Set the x and y coordinates of a new window.
+ *
+ * @param *desc The pointer to the WindowDesc to be created
+ * @param window_number the window number of the new window
+ * @param data arbitrary data that is send with the WE_CREATE message
+ *
+ * @return see Window pointer of the newly created window
+ */
static Window *LocalAllocateWindowDesc(const WindowDesc *desc, int window_number, void *data)
{
Point pt;
Window *w;
/* By default position a child window at an offset of 10/10 of its parent.
+ * With the exception of WC_BUILD_TOOLBAR (build railway/roads/ship docks/airports)
+ * and WC_SCEN_LAND_GEN (landscaping). Whose child window has an offset of 0/36 of
+ * its parent. So it's exactly under the parent toolbar and no buttons will be covered.
* However if it falls too extremely outside window positions, reposition
* it to an automatic place */
if (desc->parent_cls != 0 /* WC_MAIN_WINDOW */ &&
(w = FindWindowById(desc->parent_cls, window_number)) != NULL &&
w->left < _screen.width - 20 && w->left > -60 && w->top < _screen.height - 20) {
- pt.x = w->left + 10;
+ pt.x = w->left + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? 0 : 10);
if (pt.x > _screen.width + 10 - desc->default_width) {
pt.x = (_screen.width + 10 - desc->default_width) - 20;
}
- pt.y = w->top + 10;
+ pt.y = w->top + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? 36 : 10);
} else {
switch (desc->left) {
case WDP_ALIGN_TBR: { /* Align the right side with the top toolbar */