From d2dc3a2e2b76959162cb57a641c8db45787a8583 Mon Sep 17 00:00:00 2001 From: smatz Date: Sun, 11 Apr 2010 16:38:31 +0000 Subject: (svn r19606) -Codechange: remove global variable pw_type --- src/network/network_gui.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index d9f4b7184..de6d42f82 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -2116,23 +2116,6 @@ void ShowClientList() AllocateWindowDescFront(&_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 @@ enum NetworkJoinStatusWidgets { }; struct NetworkJoinStatusWindow : Window { + NetworkPasswordType password_type; + NetworkJoinStatusWindow(const WindowDesc *desc) : Window() { this->parent = FindWindowById(WC_NETWORK_WINDOW, 0); @@ -2226,7 +2211,7 @@ struct NetworkJoinStatusWindow : Window { NetworkDisconnect(); ShowNetworkGameWindow(); } else { - SEND_COMMAND(PACKET_CLIENT_PASSWORD)(pw_type, str); + SEND_COMMAND(PACKET_CLIENT_PASSWORD)(this->password_type, str); } } }; @@ -2257,6 +2242,21 @@ void ShowJoinStatusWindow() 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 { -- cgit v1.2.3-70-g09d2