summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2010-04-11 16:38:31 +0000
committersmatz <smatz@openttd.org>2010-04-11 16:38:31 +0000
commitd2dc3a2e2b76959162cb57a641c8db45787a8583 (patch)
tree6fe9ced28c5250af4498d25eb68236cc260c5647 /src/network
parent0d4e6c46ff4af97205823014e0b4300c7a2c3044 (diff)
downloadopenttd-d2dc3a2e2b76959162cb57a641c8db45787a8583.tar.xz
(svn r19606) -Codechange: remove global variable pw_type
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_gui.cpp36
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 {