MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / AlignInitialConstructionToolbar

Function AlignInitialConstructionToolbar

src/window.cpp:1701–1709  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

1699 * @return Coordinate of the top-left corner of the new toolbar.
1700 */
1701Point AlignInitialConstructionToolbar(int window_width)
1702{
1703 Point pt = GetToolbarAlignedWindowPosition(window_width);
1704 const Window *w = FindWindowByClass(WC_SCEN_LAND_GEN);
1705 if (w != nullptr && w->top == pt.y && !_settings_client.gui.link_terraform_toolbar) {
1706 pt.x = w->left + (_current_text_dir == TD_RTL ? w->width : - window_width);
1707 }
1708 return pt;
1709}
1710
1711/**
1712 * Compute the position of the top-left corner of a new window that is opened.

Callers 4

OnInitialPositionMethod · 0.85
OnInitialPositionMethod · 0.85
OnInitialPositionMethod · 0.85
OnInitialPositionMethod · 0.85

Calls 2

FindWindowByClassFunction · 0.85

Tested by

no test coverage detected