MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / DrawLabel

Method DrawLabel

engine/Poseidon/UI/Map/UIMapExt.cpp:1708–1940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1706}
1707
1708void CStaticMapArcadeViewer::DrawLabel(struct SignInfo& info, PackedColor color)
1709{
1710 RString text;
1711 // additional text
1712 AutoArray<RString> addText;
1713
1714 Point3 pos;
1715 switch (info._type)
1716 {
1717 case signNone:
1718 break;
1719 case signArcadeUnit:
1720 {
1721 ArcadeUnitInfo* uInfo = nullptr;
1722 if (info._indexGroup == -1)
1723 {
1724 // empty vehicle
1725 uInfo = &_template->emptyVehicles[info._index];
1726 }
1727 else
1728 {
1729 ArcadeGroupInfo& gInfo = _template->groups[info._indexGroup];
1730 uInfo = &gInfo.units[info._index];
1731 }
1732 text = Pars >> "CfgVehicles" >> uInfo->vehicle >> "displayName";
1733 if (uInfo->name && uInfo->name.GetLength() > 0)
1734 {
1735 text = text + RString(" - ");
1736 text = text + uInfo->name;
1737 }
1738 pos = uInfo->position;
1739
1740 RString cond;
1741 if (uInfo->presence < 0.9999f)
1742 {
1743 cond = Format("%d %%", toInt(uInfo->presence * 100));
1744 }
1745 if (strcmp(uInfo->presenceCondition, "true"))
1746 {
1747 cond = CatWords(cond, RString("? ") + ShortExpress(uInfo->presenceCondition));
1748 }
1749 if (cond.GetLength() > 0)
1750 {
1751 addText.Add(cond);
1752 }
1753 if (uInfo->init.GetLength() > 0)
1754 {
1755 addText.Add(ShortExpress(uInfo->init));
1756 }
1757
1758 break;
1759 }
1760 case signArcadeWaypoint:
1761 {
1762 PoseidonAssert(info._indexGroup >= 0);
1763 PoseidonAssert(info._indexGroup < _template->groups.Size());
1764 ArcadeGroupInfo& gInfo = _template->groups[info._indexGroup];
1765 PoseidonAssert(info._index < gInfo.waypoints.Size());

Callers

nothing calls this directly

Calls 15

CatWordsFunction · 0.85
ShortExpressFunction · 0.85
LocalizeStringFunction · 0.85
saturateMaxFunction · 0.85
RStringClass · 0.50
FormatFunction · 0.50
toIntFunction · 0.50
Rect2DPixelClass · 0.50
PackedColorRGBFunction · 0.50
Rect2DFloatClass · 0.50
Point2DFloatClass · 0.50
GetLengthMethod · 0.45

Tested by

no test coverage detected