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

Function ViewportAddSignStrings

src/viewport.cpp:1401–1417  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1399 * @param small Add small versions of strings.
1400 */
1401static void ViewportAddSignStrings(DrawPixelInfo *dpi, const std::vector<const Sign *> &signs, bool small)
1402{
1403 ViewportStringFlags flags{};
1404 if (small) flags.Set(ViewportStringFlag::Small);
1405
1406 /* Signs placed by a game script don't have a frame. */
1407 ViewportStringFlags deity_flags{flags};
1408 flags.Set(IsTransparencySet(TO_SIGNS) ? ViewportStringFlag::TransparentRect : ViewportStringFlag::ColourRect);
1409
1410 for (const Sign *si : signs) {
1411 std::string *str = ViewportAddString(dpi, &si->sign, (si->owner == OWNER_DEITY) ? deity_flags : flags,
1412 (si->owner == OWNER_NONE) ? COLOUR_GREY : (si->owner == OWNER_DEITY ? INVALID_COLOUR : _company_colours[si->owner]));
1413 if (str == nullptr) continue;
1414
1415 *str = GetString(STR_SIGN_NAME, si->index);
1416 }
1417}
1418
1419/**
1420 * Add station strings to a viewport.

Callers 1

ViewportAddKdtreeSignsFunction · 0.85

Calls 4

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

Tested by

no test coverage detected