summaryrefslogtreecommitdiff
path: root/src/network/network_client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/network_client.cpp')
-rw-r--r--src/network/network_client.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 5858859cb..a12215bbc 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -1251,6 +1251,20 @@ void NetworkClientsToSpectators(CompanyID cid)
}
/**
+ * 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.
+ */
+bool NetworkIsValidClientName(const char *client_name)
+{
+ if (StrEmpty(client_name)) return false;
+ if (*client_name == ' ') return false;
+ return true;
+}
+
+/**
* Send the server our name.
*/
void NetworkUpdateClientName()