diff options
author | belugas <belugas@openttd.org> | 2009-01-08 22:33:54 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2009-01-08 22:33:54 +0000 |
commit | 729cebda47bfb8385f75bc6ea962c34b25eef0db (patch) | |
tree | 5709a6aa5cc095a9f31bb034bd0d5c8966e4a090 /src/network | |
parent | 0052c85002e8e5631fa09a0b726b0c65c6350b93 (diff) | |
download | openttd-729cebda47bfb8385f75bc6ea962c34b25eef0db.tar.xz |
(svn r14927) -Codechange: constify widget numbers in network chat gui.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/network_chat_gui.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index 4a1e209b3..8968007ea 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -263,14 +263,22 @@ static void SendChat(const char *buf, DestType type, int dest) } } - struct NetworkChatWindow : public QueryStringBaseWindow { +private: + enum NetWorkChatWidgets { + NWCW_CLOSE, + NWCW_BACKGROUND, + NWCW_TEXTBOX, + NWCW_SENDBUTTON, + }; + +public: DestType dtype; int dest; NetworkChatWindow (const WindowDesc *desc, DestType type, int dest) : QueryStringBaseWindow(NETWORK_CHAT_LENGTH, desc) { - this->LowerWidget(2); + this->LowerWidget(NWCW_TEXTBOX); this->dtype = type; this->dest = dest; this->afilter = CS_ALPHANUMERAL; @@ -441,23 +449,23 @@ struct NetworkChatWindow : public QueryStringBaseWindow { this->DrawWidgets(); assert((uint)this->dtype < lengthof(chat_captions)); - DrawStringRightAligned(this->widget[2].left - 2, this->widget[2].top + 1, chat_captions[this->dtype], TC_BLACK); - this->DrawEditBox(2); + DrawStringRightAligned(this->widget[NWCW_TEXTBOX].left - 2, this->widget[NWCW_TEXTBOX].top + 1, chat_captions[this->dtype], TC_BLACK); + this->DrawEditBox(NWCW_TEXTBOX); } virtual void OnClick(Point pt, int widget) { switch (widget) { - case 3: /* Send */ - SendChat(this->text.buf, this->dtype, this->dest); + /* Send */ + case NWCW_SENDBUTTON: SendChat(this->text.buf, this->dtype, this->dest); /* FALLTHROUGH */ - case 0: /* Cancel */ delete this; break; + case NWCW_CLOSE: /* Cancel */ delete this; break; } } virtual void OnMouseLoop() { - this->HandleEditBox(2); + this->HandleEditBox(NWCW_TEXTBOX); } virtual EventState OnKeyPress(uint16 key, uint16 keycode) @@ -467,7 +475,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow { ChatTabCompletion(); } else { _chat_tab_completion_active = false; - switch (this->HandleEditBoxKey(2, key, keycode, state)) { + switch (this->HandleEditBoxKey(NWCW_TEXTBOX, key, keycode, state)) { default: NOT_REACHED(); case HEBR_EDITING: { Window *osk = FindWindowById(WC_OSK, 0); |