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

Function open

src/OpenLoco/src/Ui/Windows/DragVehiclePart.cpp:32–50  ·  view source on GitHub ↗

0x004B3B7E

Source from the content-addressed store, hash-verified

30
31 // 0x004B3B7E
32 void open(Vehicles::Car& car)
33 {
34 WindowManager::close(WindowType::dragVehiclePart);
35 _dragCarComponent = car.front;
36 _dragVehicleHead = car.front->head;
37 WindowManager::invalidate(WindowType::vehicle, enumValue(car.front->head));
38
39 uint16_t width = getWidthVehicleInline(car);
40 auto pos = Ui::ToolTip::getTooltipMouseLocation();
41 pos.y -= 30;
42 pos.x -= width / 2;
43 Ui::Size size = { width, 60 };
44
45 auto self = WindowManager::createWindow(WindowType::dragVehiclePart, { pos.x, pos.y }, size, WindowFlags::transparent | WindowFlags::stickToFront, getEvents());
46 self->setWidgets(widgets);
47 self->widgets[widx::frame].right = width - 1;
48
49 Input::windowPositionBegin(Ui::ToolTip::getTooltipMouseLocation().x, Ui::ToolTip::getTooltipMouseLocation().y, self, widx::frame);
50 }
51
52 static void onClose([[maybe_unused]] Window& self)
53 {

Callers

nothing calls this directly

Calls 8

enumValueFunction · 0.85
getWidthVehicleInlineFunction · 0.85
getTooltipMouseLocationFunction · 0.85
windowPositionBeginFunction · 0.85
setWidgetsMethod · 0.80
closeFunction · 0.70
invalidateFunction · 0.50
createWindowFunction · 0.50

Tested by

no test coverage detected