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

Function onScrollMouseDown

src/OpenLoco/src/Ui/Windows/StationWindow.cpp:1112–1140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110 }
1111
1112 static void onScrollMouseDown(Window& self, [[maybe_unused]] int16_t x, int16_t y, [[maybe_unused]] uint8_t scroll_index)
1113 {
1114 uint16_t currentRow = y / self.rowHeight;
1115 if (currentRow >= self.rowCount)
1116 {
1117 return;
1118 }
1119
1120 EntityId currentVehicleId = EntityId(self.rowInfo[currentRow]);
1121 if (currentVehicleId == EntityId::null)
1122 {
1123 return;
1124 }
1125
1126 auto* head = EntityManager::get<VehicleHead>(currentVehicleId);
1127 if (head == nullptr)
1128 {
1129 return;
1130 }
1131
1132 if (head->isPlaced())
1133 {
1134 Ui::Windows::Vehicle::Main::open(head);
1135 }
1136 else
1137 {
1138 Ui::Windows::Vehicle::Details::open(head);
1139 }
1140 }
1141
1142 static void onResize(Window& self)
1143 {

Callers

nothing calls this directly

Calls 3

EntityIdEnum · 0.85
isPlacedMethod · 0.80
openFunction · 0.70

Tested by

no test coverage detected