summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_gui.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index d01f20e28..99256bda9 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -851,18 +851,25 @@ public:
break;
default:
- /* The name is only allowed when it starts with a letter! */
- if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
- strecpy(_settings_client.network.client_name, this->edit_str_buf, lastof(_settings_client.network.client_name));
- } else {
- strecpy(_settings_client.network.client_name, "Player", lastof(_settings_client.network.client_name));
- }
+ this->OnOSKInput(WID_NG_CLIENT);
break;
}
return state;
}
+ virtual void OnOSKInput(int wid)
+ {
+ if (wid == WID_NG_CLIENT) {
+ /* The name is only allowed when it starts with a letter! */
+ if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
+ strecpy(_settings_client.network.client_name, this->edit_str_buf, lastof(_settings_client.network.client_name));
+ } else {
+ strecpy(_settings_client.network.client_name, "Player", lastof(_settings_client.network.client_name));
+ }
+ }
+ }
+
virtual void OnQueryTextFinished(char *str)
{
if (!StrEmpty(str)) NetworkAddServer(str);
@@ -1183,13 +1190,20 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
break;
default:
- strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name));
+ this->OnOSKInput(WID_NSS_GAMENAME);
break;
}
return state;
}
+ virtual void OnOSKInput(int wid)
+ {
+ if (wid == WID_NSS_GAMENAME) {
+ strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name));
+ }
+ }
+
virtual void OnTimeout()
{
static const int raise_widgets[] = {WID_NSS_CLIENTS_BTND, WID_NSS_CLIENTS_BTNU, WID_NSS_COMPANIES_BTND, WID_NSS_COMPANIES_BTNU, WID_NSS_SPECTATORS_BTND, WID_NSS_SPECTATORS_BTNU, WIDGET_LIST_END};