summaryrefslogtreecommitdiff
path: root/src/network/network_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/network_gui.cpp')
-rw-r--r--src/network/network_gui.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 15cf24f49..dd25ad5bc 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -808,11 +808,9 @@ public:
}
case WID_NG_CLIENT:
- if (NetworkIsValidClientName(this->name_editbox.text.buf)) {
- strecpy(_settings_client.network.client_name, this->name_editbox.text.buf, lastof(_settings_client.network.client_name));
- } else {
- strecpy(_settings_client.network.client_name, "Player", lastof(_settings_client.network.client_name));
- }
+ /* Validation of the name will happen once the user tries to join or start a game, as getting
+ * error messages while typing (e.g. when you clear the name) defeats the purpose of the check. */
+ strecpy(_settings_client.network.client_name, this->name_editbox.text.buf, lastof(_settings_client.network.client_name));
break;
}
}
@@ -1245,6 +1243,8 @@ static WindowDesc _network_start_server_window_desc(
static void ShowNetworkStartServerWindow()
{
+ if (!NetworkValidateClientName()) return;
+
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
@@ -1537,6 +1537,8 @@ static WindowDesc _network_lobby_window_desc(
*/
static void ShowNetworkLobbyWindow(NetworkGameList *ngl)
{
+ if (!NetworkValidateClientName()) return;
+
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);