diff options
-rw-r--r-- | src/network/network_gui.cpp | 36 |
1 files 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<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 @@ 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 { |