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

Function drawGraphKeyVehicles

src/OpenLoco/src/Ui/Windows/MapWindow.cpp:1382–1419  ·  view source on GitHub ↗

0x0046D379

Source from the content-addressed store, hash-verified

1380
1381 // 0x0046D379
1382 static void drawGraphKeyVehicles(Window* self, Gfx::DrawingContext& drawingCtx, uint16_t x, uint16_t& y)
1383 {
1384 static constexpr StringId lineNames[] = {
1385 StringIds::forbid_trains,
1386 StringIds::forbid_buses,
1387 StringIds::forbid_trucks,
1388 StringIds::forbid_trams,
1389 StringIds::forbid_aircraft,
1390 StringIds::forbid_ships,
1391 };
1392
1393 auto tr = Gfx::TextRenderer(drawingCtx);
1394
1395 for (uint8_t i = 0; i < std::size(_vehicleTypeCounts); i++)
1396 {
1397 if (!(self->var_854 & (1 << i)) || !(mapFrameNumber & (1 << 2)))
1398 {
1399 auto colour = vehicleTypeColours[i];
1400
1401 drawingCtx.drawRect(x, y + 3, 5, 5, colour, Gfx::RectFlags::none);
1402 }
1403
1404 FormatArguments args{};
1405 args.push(lineNames[i]);
1406
1407 auto stringId = StringIds::small_black_string;
1408
1409 if (self->var_854 & (1 << i))
1410 {
1411 stringId = StringIds::small_white_string;
1412 }
1413
1414 auto point = Point(x + 6, y);
1415 tr.drawStringLeftClipped(point, 94, Colour::black, stringId, args);
1416
1417 y += 10;
1418 }
1419 }
1420
1421 // 0x0046D47F
1422 static void drawGraphKeyIndustries(Window* self, Gfx::DrawingContext& drawingCtx, uint16_t x, uint16_t& y)

Callers 1

drawFunction · 0.85

Calls 4

TextRendererClass · 0.85
drawStringLeftClippedMethod · 0.80
drawRectMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected