mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-19 02:12:37 +01:00
Change: Clamp terraform toolbar to main toolbar (#14725)
This commit is contained in:
@@ -1677,7 +1677,7 @@ restart:
|
||||
/**
|
||||
* Computer the position of the top-left corner of a window to be opened right
|
||||
* under the toolbar.
|
||||
* @param window_width the width of the window to get the position for
|
||||
* @param window_width the width of the window to get the position for.
|
||||
* @return Coordinate of the top-left corner of the new window.
|
||||
*/
|
||||
Point GetToolbarAlignedWindowPosition(int window_width)
|
||||
@@ -1688,6 +1688,24 @@ Point GetToolbarAlignedWindowPosition(int window_width)
|
||||
return pt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the position of the construction toolbars.
|
||||
*
|
||||
* If the terraform toolbar is open place them to the right/left of it,
|
||||
* otherwise use default toolbar aligned position.
|
||||
* @param window_width the width of the toolbar to get the position for.
|
||||
* @return Coordinate of the top-left corner of the new toolbar.
|
||||
*/
|
||||
Point AlignInitialConstructionToolbar(int window_width)
|
||||
{
|
||||
Point pt = GetToolbarAlignedWindowPosition(window_width);
|
||||
const Window *w = FindWindowByClass(WC_SCEN_LAND_GEN);
|
||||
if (w != nullptr && w->top == pt.y && !_settings_client.gui.link_terraform_toolbar) {
|
||||
pt.x = w->left + (_current_text_dir == TD_RTL ? w->width : - window_width);
|
||||
}
|
||||
return pt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the position of the top-left corner of a new window that is opened.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user