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

Function GetStringForWidget

src/widget.cpp:32–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30WidgetDimensions WidgetDimensions::scaled = {};
31
32static std::string GetStringForWidget(const Window *w, const NWidgetCore *nwid, bool secondary = false)
33{
34 StringID stringid = nwid->GetString();
35 if (nwid->GetIndex() < 0) {
36 if (stringid == STR_NULL) return {};
37
38 return GetString(stringid + (secondary ? 1 : 0));
39 }
40
41 return w->GetWidgetString(nwid->GetIndex(), stringid + (secondary ? 1 : 0));
42}
43
44/**
45 * Scale a RectPadding to GUI zoom level.

Callers 2

SetupSmallestSizeMethod · 0.85
DrawMethod · 0.85

Calls 4

GetStringFunction · 0.70
GetStringMethod · 0.45
GetIndexMethod · 0.45
GetWidgetStringMethod · 0.45

Tested by

no test coverage detected