Mercurial > hg > openttd
changeset 14994:7a1b8f9042a1 draft
(svn r19606) -Codechange: remove global variable pw_type
author | smatz <smatz@openttd.org> |
---|---|
date | Sun, 11 Apr 2010 16:38:31 +0000 |
parents | f3e5df0b5727 |
children | 807715f421a8 |
files | src/network/network_gui.cpp |
diffstat | 1 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -2116,23 +2116,6 @@ AllocateWindowDescFront<NetworkClientListWindow>(&_client_list_desc, 0); } - -static NetworkPasswordType pw_type; - - -void ShowNetworkNeedPassword(NetworkPasswordType npt) -{ - StringID caption; - - pw_type = npt; - switch (npt) { - default: NOT_REACHED(); - case NETWORK_GAME_PASSWORD: caption = STR_NETWORK_NEED_GAME_PASSWORD_CAPTION; break; - case NETWORK_COMPANY_PASSWORD: caption = STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION; break; - } - ShowQueryString(STR_EMPTY, caption, 20, 180, FindWindowById(WC_NETWORK_STATUS_WINDOW, 0), CS_ALPHANUMERAL, QSF_NONE); -} - /* Vars needed for the join-GUI */ NetworkJoinStatus _network_join_status; uint8 _network_join_waiting; @@ -2146,6 +2129,8 @@ }; struct NetworkJoinStatusWindow : Window { + NetworkPasswordType password_type; + NetworkJoinStatusWindow(const WindowDesc *desc) : Window() { this->parent = FindWindowById(WC_NETWORK_WINDOW, 0); @@ -2226,7 +2211,7 @@ NetworkDisconnect(); ShowNetworkGameWindow(); } else { - SEND_COMMAND(PACKET_CLIENT_PASSWORD)(pw_type, str); + SEND_COMMAND(PACKET_CLIENT_PASSWORD)(this->password_type, str); } } }; @@ -2257,6 +2242,21 @@ new NetworkJoinStatusWindow(&_network_join_status_window_desc); } +void ShowNetworkNeedPassword(NetworkPasswordType npt) +{ + NetworkJoinStatusWindow *w = (NetworkJoinStatusWindow *)FindWindowById(WC_NETWORK_STATUS_WINDOW, 0); + if (w == NULL) return; + w->password_type = npt; + + StringID caption; + switch (npt) { + default: NOT_REACHED(); + case NETWORK_GAME_PASSWORD: caption = STR_NETWORK_NEED_GAME_PASSWORD_CAPTION; break; + case NETWORK_COMPANY_PASSWORD: caption = STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION; break; + } + ShowQueryString(STR_EMPTY, caption, 20, 180, w, CS_ALPHANUMERAL, QSF_NONE); +} + /** Enum for NetworkGameWindow, referring to _network_game_window_widgets */ enum NetworkCompanyPasswordWindowWidgets {