diff options
author | frosch <frosch@openttd.org> | 2012-11-13 21:46:37 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-11-13 21:46:37 +0000 |
commit | 1071d51508695978adcf9a184e0a26a65fff2705 (patch) | |
tree | db442dc158e26b8f3e439edbe0b4a1b58c0de153 /src/network | |
parent | 137adb3496a47f79d4e0a15463c756341f8217a9 (diff) | |
download | openttd-1071d51508695978adcf9a184e0a26a65fff2705.tar.xz |
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/network_gui.cpp | 28 |
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}; |