1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-01 19:09:09 +00:00

(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.

This commit is contained in:
frosch
2012-11-13 21:46:37 +00:00
parent 137adb3496
commit 1071d51508
3 changed files with 43 additions and 16 deletions

View File

@@ -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};