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

Function drawGraphKeyCompanies

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

0x0046D6E1

Source from the content-addressed store, hash-verified

1511
1512 // 0x0046D6E1
1513 static void drawGraphKeyCompanies(Window* self, Gfx::DrawingContext& drawingCtx, uint16_t x, uint16_t& y)
1514 {
1515 auto tr = Gfx::TextRenderer(drawingCtx);
1516
1517 for (const auto& company : CompanyManager::companies())
1518 {
1519 auto index = company.id();
1520 auto colour = Colours::getShade(company.mainColours.primary, 6);
1521
1522 if (!(self->var_854 & (1 << enumValue(index))) || !(mapFrameNumber & (1 << 2)))
1523 {
1524 drawingCtx.drawRect(x, y + 3, 5, 5, colour, Gfx::RectFlags::none);
1525 }
1526
1527 FormatArguments args{};
1528 args.push(company.name);
1529
1530 auto stringId = StringIds::small_black_string;
1531
1532 if (self->var_854 & (1 << enumValue(index)))
1533 {
1534 stringId = StringIds::small_white_string;
1535 }
1536
1537 auto point = Point(x + 6, y);
1538 tr.drawStringLeftClipped(point, 94, Colour::black, stringId, args);
1539
1540 y += 10;
1541 }
1542 }
1543
1544 // 0x0046D81F
1545 static void formatVehicleString(Window* self, FormatArguments& args)

Callers 1

drawFunction · 0.85

Calls 8

TextRendererClass · 0.85
companiesFunction · 0.85
getShadeFunction · 0.85
enumValueFunction · 0.85
drawStringLeftClippedMethod · 0.80
idMethod · 0.45
drawRectMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected