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

Function tooltip

src/OpenLoco/src/Ui/Windows/BuildVehicle.cpp:1234–1274  ·  view source on GitHub ↗

0x4C370C

Source from the content-addressed store, hash-verified

1232
1233 // 0x4C370C
1234 static std::optional<FormatArguments> tooltip(Ui::Window& window, WidgetIndex_t widgetIndex, [[maybe_unused]] const WidgetId id)
1235 {
1236 FormatArguments args{};
1237 if (widgetIndex < widx::tab_track_type_0 || widgetIndex >= widx::scrollview_vehicle_selection)
1238 {
1239 args.push(StringIds::tooltip_scroll_new_vehicle_list);
1240 }
1241 else
1242 {
1243 auto trackTypeTab = widxToTrackTypeTab(widgetIndex);
1244 auto type = _trackTypesForTab[trackTypeTab];
1245 if (type == 0xFF)
1246 {
1247 if (_transportTypeTabInformation[window.currentTab].type == VehicleType::aircraft)
1248 {
1249
1250 args.push(StringIds::airport);
1251 }
1252 else
1253 {
1254 args.push(StringIds::docks);
1255 }
1256 }
1257 else
1258 {
1259 bool is_road = type & (1 << 7);
1260 type &= ~(1 << 7);
1261 if (is_road)
1262 {
1263 auto roadObj = ObjectManager::get<RoadObject>(type);
1264 args.push(roadObj->name);
1265 }
1266 else
1267 {
1268 auto trackObj = ObjectManager::get<TrackObject>(type);
1269 args.push(trackObj->name);
1270 }
1271 }
1272 }
1273 return args;
1274 }
1275
1276 // 0x4C37CB
1277 static Ui::CursorId cursor(Window& window, WidgetIndex_t widgetIdx, [[maybe_unused]] const WidgetId id, [[maybe_unused]] int16_t xPos, int16_t yPos, Ui::CursorId fallback)

Callers

nothing calls this directly

Calls 2

widxToTrackTypeTabFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected