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

Function switchTab

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

0x0048E520

Source from the content-addressed store, hash-verified

1366
1367 // 0x0048E520
1368 static void switchTab(Window& self, WidgetIndex_t widgetIndex)
1369 {
1370 if (widgetIndex != widx::tab_cargo)
1371 {
1372 if (StationId(self.number) == _lastSelectedStation)
1373 {
1374 showStationCatchment(StationId::null);
1375 }
1376 }
1377
1378 if (ToolManager::isToolActive(self.type, self.number))
1379 {
1380 ToolManager::toolCancel();
1381 }
1382
1383 TextInput::sub_4CE6C9(self.type, self.number);
1384
1385 self.currentTab = widgetIndex - widx::tab_station;
1386 self.frameNo = 0;
1387 self.flags &= ~(WindowFlags::maximised);
1388 self.var_85C = -1;
1389
1390 self.viewportRemove(0);
1391
1392 auto tabInfo = tabInformationByTabOffset[widgetIndex - widx::tab_station];
1393
1394 self.holdableWidgets = 0;
1395 self.eventHandlers = &tabInfo.events;
1396 self.activatedWidgets = 0;
1397 self.setWidgets(tabInfo.widgets);
1398 self.disabledWidgets = 0;
1399 self.rowHeight = tabInfo.rowHeight;
1400
1401 // We'll need the vehicle list to determine what vehicle tabs to show
1402 VehiclesStopping::populateVehicleList(self);
1403 self.rowHover = -1;
1404
1405 self.invalidate();
1406 self.callOnResize();
1407 self.callPrepareDraw();
1408 self.initScrollWidgets();
1409 self.invalidate();
1410 self.moveInsideScreenEdges();
1411 }
1412
1413 // 0x0048EFBC
1414 void drawTabs(Window& self, Gfx::DrawingContext& drawingCtx)

Callers 1

onMouseUpFunction · 0.70

Calls 13

StationIdEnum · 0.85
showStationCatchmentFunction · 0.85
isToolActiveFunction · 0.85
sub_4CE6C9Function · 0.85
viewportRemoveMethod · 0.80
setWidgetsMethod · 0.80
callOnResizeMethod · 0.80
callPrepareDrawMethod · 0.80
initScrollWidgetsMethod · 0.80
moveInsideScreenEdgesMethod · 0.80
toolCancelFunction · 0.70
populateVehicleListFunction · 0.70

Tested by

no test coverage detected