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

Function GetParamMaxDigits

src/strings.cpp:218–226  ·  view source on GitHub ↗

* Get some number that is suitable for string size computations. * @param count Number of digits which shall be displayable. * @param size Font of the number * @returns Number to use for string size computations. */

Source from the content-addressed store, hash-verified

216 * @returns Number to use for string size computations.
217 */
218uint64_t GetParamMaxDigits(uint count, FontSize size)
219{
220 auto [front, next] = GetBroadestDigit(size);
221 uint64_t val = count > 1 ? front : next;
222 for (; count > 1; count--) {
223 val = 10 * val + next;
224 }
225 return val;
226}
227
228/**
229 * Get some number that is suitable for string size computations.

Callers 13

UpdateWidgetSizeMethod · 0.85
GetParamMaxValueFunction · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
GetUnitNumberWidthFunction · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85

Calls 1

GetBroadestDigitFunction · 0.85

Tested by

no test coverage detected