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

Function NetworkIsValidClientName

src/network/network_client.cpp:1245–1250  ·  view source on GitHub ↗

* Check whether the given client name is deemed valid for use in network games. * An empty name (null or '') is not valid as that is essentially no name at all. * A name starting with white space is not valid for tab completion purposes. * @param client_name The client name to check for validity. * @return True iff the name is valid. */

Source from the content-addressed store, hash-verified

1243 * @return True iff the name is valid.
1244 */
1245bool NetworkIsValidClientName(std::string_view client_name)
1246{
1247 if (client_name.empty()) return false;
1248 if (client_name[0] == ' ') return false;
1249 return true;
1250}
1251
1252/**
1253 * Trim the given client name in place, i.e. remove leading and trailing spaces.

Callers 5

ConClientNickChangeFunction · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected