mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-19 12:39:11 +00:00
(svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
This commit is contained in:
@@ -468,14 +468,14 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
|
||||
_chat_tab_completion_active = false;
|
||||
switch (this->HandleEditBoxKey(2, key, keycode, state)) {
|
||||
default: NOT_REACHED();
|
||||
case 0: {
|
||||
case HEBR_EDITING: {
|
||||
Window *osk = FindWindowById(WC_OSK, 0);
|
||||
if (osk != NULL && osk->parent == this) osk->OnInvalidateData();
|
||||
} break;
|
||||
case 1: /* Return */
|
||||
case HEBR_CONFIRM:
|
||||
SendChat(this->text.buf, this->dtype, this->dest);
|
||||
/* FALLTHROUGH */
|
||||
case 2: /* Escape */ delete this; break;
|
||||
case HEBR_CANCEL: delete this; break;
|
||||
}
|
||||
}
|
||||
return state;
|
||||
|
@@ -668,7 +668,7 @@ public:
|
||||
return state;
|
||||
}
|
||||
|
||||
if (this->HandleEditBoxKey(NGWW_CLIENT, key, keycode, state) == 1) return state; // enter pressed
|
||||
if (this->HandleEditBoxKey(NGWW_CLIENT, key, keycode, state) == HEBR_CONFIRM) return state;
|
||||
|
||||
/* The name is only allowed when it starts with a letter! */
|
||||
if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
|
||||
@@ -1047,7 +1047,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
|
||||
{
|
||||
EventState state = ES_NOT_HANDLED;
|
||||
if (this->field == NSSW_GAMENAME) {
|
||||
if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == 1) return state; // enter pressed
|
||||
if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == HEBR_CONFIRM) return state;
|
||||
|
||||
ttd_strlcpy(_settings_client.network.server_name, this->text.buf, sizeof(_settings_client.network.server_name));
|
||||
}
|
||||
@@ -1906,11 +1906,13 @@ struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
|
||||
{
|
||||
EventState state;
|
||||
switch (this->HandleEditBoxKey(4, key, keycode, state)) {
|
||||
case 1: // Return
|
||||
default: break;
|
||||
|
||||
case HEBR_CONFIRM:
|
||||
this->OnOk();
|
||||
/* FALL THROUGH */
|
||||
|
||||
case 2: // Escape
|
||||
case HEBR_CANCEL:
|
||||
delete this;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user