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

Function drawGraphKeyRoutes

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

0x0046D5A4

Source from the content-addressed store, hash-verified

1458
1459 // 0x0046D5A4
1460 static void drawGraphKeyRoutes(Window* self, Gfx::DrawingContext& drawingCtx, uint16_t x, uint16_t& y)
1461 {
1462 auto tr = Gfx::TextRenderer(drawingCtx);
1463
1464 for (auto i = 0; _routeToObjectIdMap[i] != 0xFF; i++)
1465 {
1466 auto index = _routeToObjectIdMap[i];
1467 auto colour = _routeColours[i];
1468
1469 if (!(self->var_854 & (1 << i)) || !(mapFrameNumber & (1 << 2)))
1470 {
1471 drawingCtx.drawRect(x, y + 3, 5, 5, colour, Gfx::RectFlags::none);
1472 }
1473
1474 auto routeType = StringIds::map_routes_aircraft;
1475
1476 if (index != 0xFE)
1477 {
1478 routeType = StringIds::map_routes_ships;
1479
1480 if (index != 0xFD)
1481 {
1482 if (index & (1 << 7))
1483 {
1484 auto roadObj = ObjectManager::get<RoadObject>(index & ~(1 << 7));
1485 routeType = roadObj->name;
1486 }
1487 else
1488 {
1489 auto trackObj = ObjectManager::get<TrackObject>(index);
1490 routeType = trackObj->name;
1491 }
1492 }
1493 }
1494
1495 FormatArguments args{};
1496 args.push(routeType);
1497
1498 auto stringId = StringIds::small_black_string;
1499
1500 if (self->var_854 & (1 << i))
1501 {
1502 stringId = StringIds::small_white_string;
1503 }
1504
1505 auto point = Point(x + 6, y);
1506 tr.drawStringLeftClipped(point, 94, Colour::black, stringId, args);
1507
1508 y += 10;
1509 }
1510 }
1511
1512 // 0x0046D6E1
1513 static void drawGraphKeyCompanies(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