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

Method OnInitialPosition

src/bridge_gui.cpp:218–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216 }
217
218 Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
219 {
220 /* Position the window so hopefully the first bridge from the list is under the mouse pointer. */
221 NWidgetBase *list = this->GetWidget<NWidgetBase>(WID_BBS_BRIDGE_LIST);
222 Point corner; // point of the top left corner of the window.
223 corner.y = Clamp(_cursor.pos.y - list->pos_y - 5, GetMainViewTop(), GetMainViewBottom() - sm_height);
224 corner.x = Clamp(_cursor.pos.x - list->pos_x - 5, 0, _screen.width - sm_width);
225 return corner;
226 }
227
228 void DrawWidget(const Rect &r, WidgetID widget) const override
229 {

Callers

nothing calls this directly

Calls 4

ClampFunction · 0.85
GetMainViewTopFunction · 0.85
GetMainViewBottomFunction · 0.85

Tested by

no test coverage detected