MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / processMouseOver

Function processMouseOver

src/OpenLoco/src/Input/MouseInput.cpp:1527–1646  ·  view source on GitHub ↗

0x004CD47A

Source from the content-addressed store, hash-verified

1525
1526 // 0x004CD47A
1527 void processMouseOver(int32_t x, int32_t y)
1528 {
1529 bool skipItem = false;
1530 Ui::CursorId cursorId = Ui::CursorId::pointer;
1531
1532 Windows::MapToolTip::reset();
1533
1534 if (hasMapSelectionFlag(MapSelectionFlags::hoveringOverStation))
1535 {
1536 resetMapSelectionFlag(MapSelectionFlags::hoveringOverStation);
1537 auto station = StationManager::get(_hoveredStationId);
1538 if (!station->empty())
1539 {
1540 station->invalidate();
1541 }
1542 }
1543
1544 Ui::Window* window = Ui::WindowManager::findAt(x, y);
1545
1546 if (window != nullptr)
1547 {
1548 int16_t widgetIdx = window->findWidgetAt(x, y);
1549
1550 if (widgetIdx != -1)
1551 {
1552 Ui::Widget& widget = window->widgets[widgetIdx];
1553 switch (widget.type)
1554 {
1555 case Ui::WidgetType::panel:
1556 case Ui::WidgetType::newsPanel:
1557 case Ui::WidgetType::frame:
1558 if (window->hasFlags(Ui::WindowFlags::resizable))
1559 {
1560 if (window->minWidth != window->maxWidth || window->minHeight != window->maxHeight)
1561 {
1562 if (x >= window->x + window->width - 19 && y >= window->y + window->height - 19)
1563 {
1564 cursorId = Ui::CursorId::diagonalArrows;
1565 break;
1566 }
1567 }
1568 }
1569 [[fallthrough]];
1570 default:
1571 _scrollLast.x = x;
1572 _scrollLast.y = y;
1573 cursorId = window->callCursor(widgetIdx, window->widgets[widgetIdx].id, x, y, cursorId);
1574 break;
1575
1576 case Ui::WidgetType::scrollview:
1577 {
1578 _scrollLast.x = x;
1579 _scrollLast.y = y;
1580
1581 auto res = Ui::ScrollView::getPart(
1582 *window,
1583 &window->widgets[widgetIdx],
1584 x,

Callers 2

handleInputFunction · 0.85
minimalHandleInputFunction · 0.85

Calls 15

hasMapSelectionFlagFunction · 0.85
resetMapSelectionFlagFunction · 0.85
findAtFunction · 0.85
getPartFunction · 0.85
getToolCursorFunction · 0.85
findFunction · 0.85
getToolWindowTypeFunction · 0.85
getToolWindowNumberFunction · 0.85
getItemLeftFunction · 0.85
rightOverFunction · 0.85
setCursorFunction · 0.85
findWidgetAtMethod · 0.80

Tested by

no test coverage detected