MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ViewportAddStationStrings

Function ViewportAddStationStrings

src/viewport.cpp:1425–1441  ·  view source on GitHub ↗

* Add station strings to a viewport. * @param dpi Current viewport area. * @param stations List of stations to add. * @param small Add small versions of strings. */

Source from the content-addressed store, hash-verified

1423 * @param small Add small versions of strings.
1424 */
1425static void ViewportAddStationStrings(DrawPixelInfo *dpi, const std::vector<const BaseStation *> &stations, bool small)
1426{
1427 /* Transparent station signs have colour text instead of a colour panel. */
1428 ViewportStringFlags flags{IsTransparencySet(TO_SIGNS) ? ViewportStringFlag::TextColour : ViewportStringFlag::ColourRect};
1429 if (small) flags.Set(ViewportStringFlag::Small);
1430
1431 for (const BaseStation *st : stations) {
1432 std::string *str = ViewportAddString(dpi, &st->sign, flags, (st->owner == OWNER_NONE || !st->IsInUse()) ? COLOUR_GREY : _company_colours[st->owner]);
1433 if (str == nullptr) continue;
1434
1435 if (Station::IsExpected(st)) { /* Station */
1436 *str = GetString(small ? STR_STATION_NAME : STR_VIEWPORT_STATION, st->index, st->facilities);
1437 } else { /* Waypoint */
1438 *str = GetString(STR_WAYPOINT_NAME, st->index);
1439 }
1440 }
1441}
1442
1443static void ViewportAddKdtreeSigns(DrawPixelInfo *dpi)
1444{

Callers 1

ViewportAddKdtreeSignsFunction · 0.85

Calls 5

IsTransparencySetFunction · 0.85
ViewportAddStringFunction · 0.85
IsInUseMethod · 0.80
GetStringFunction · 0.70
SetMethod · 0.45

Tested by

no test coverage detected