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

Function GenPresidentName

src/strings.cpp:1972–1985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1970}
1971
1972static void GenPresidentName(StringBuilder &builder, uint32_t seed)
1973{
1974 builder.PutChar(_initial_name_letters[std::size(_initial_name_letters) * GB(seed, 0, 8) >> 8]);
1975 builder += ". ";
1976
1977 /* The second initial is optional. */
1978 size_t index = (std::size(_initial_name_letters) + 35) * GB(seed, 8, 8) >> 8;
1979 if (index < std::size(_initial_name_letters)) {
1980 builder.PutChar(_initial_name_letters[index]);
1981 builder += ". ";
1982 }
1983
1984 builder += GetSurname(seed);
1985}
1986
1987static bool GetSpecialNameString(StringBuilder &builder, StringID string, StringParameters &args)
1988{

Callers 1

GetSpecialNameStringFunction · 0.85

Calls 4

GBFunction · 0.85
GetSurnameFunction · 0.85
PutCharMethod · 0.80
sizeFunction · 0.50

Tested by

no test coverage detected