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

Function onScrollMouseDown

src/OpenLoco/src/Ui/Windows/VehicleList.cpp:1024–1052  ·  view source on GitHub ↗

0x004C27C0

Source from the content-addressed store, hash-verified

1022
1023 // 0x004C27C0
1024 static void onScrollMouseDown(Window& self, [[maybe_unused]] int16_t x, int16_t y, [[maybe_unused]] uint8_t scroll_index)
1025 {
1026 uint16_t currentRow = y / self.rowHeight;
1027 if (currentRow >= self.rowCount)
1028 {
1029 return;
1030 }
1031
1032 EntityId currentVehicleId = EntityId(self.rowInfo[currentRow]);
1033 if (currentVehicleId == EntityId::null)
1034 {
1035 return;
1036 }
1037
1038 auto* head = EntityManager::get<VehicleHead>(currentVehicleId);
1039 if (head == nullptr)
1040 {
1041 return;
1042 }
1043
1044 if (head->isPlaced())
1045 {
1046 Ui::Windows::Vehicle::Main::open(head);
1047 }
1048 else
1049 {
1050 Ui::Windows::Vehicle::Details::open(head);
1051 }
1052 }
1053
1054 // 0x004C2820
1055 static void onResize(Window& self)

Callers

nothing calls this directly

Calls 3

EntityIdEnum · 0.85
isPlacedMethod · 0.80
openFunction · 0.70

Tested by

no test coverage detected