summaryrefslogtreecommitdiff
path: root/network_gui.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-09-01 13:35:43 +0000
committertron <tron@openttd.org>2006-09-01 13:35:43 +0000
commit8ef52bc43c3afe9139aed61a64b023f5ca49101d (patch)
tree8390bc18a0b9bc901d95d47c600997066ebe0508 /network_gui.c
parent47b0d41d63b5e835d528f82a232d75a995e31fda (diff)
downloadopenttd-8ef52bc43c3afe9139aed61a64b023f5ca49101d.tar.xz
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
Diffstat (limited to 'network_gui.c')
-rw-r--r--network_gui.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/network_gui.c b/network_gui.c
index 95d9d5213..0d951afb1 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -1395,6 +1395,24 @@ void ShowClientList(void)
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;
+ case NETWORK_COMPANY_PASSWORD: caption = STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION;
+ }
+ ShowQueryString(STR_EMPTY, caption, 20, 180, WC_NETWORK_STATUS_WINDOW, 0, CS_ALPHANUMERAL);
+}
+
+
static void NetworkJoinStatusWindowWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
@@ -1438,6 +1456,14 @@ static void NetworkJoinStatusWindowWndProc(Window *w, WindowEvent *e)
}
break;
+ case WE_ON_EDIT_TEXT_CANCEL:
+ NetworkDisconnect();
+ ShowNetworkGameWindow();
+ break;
+
+ case WE_ON_EDIT_TEXT:
+ SEND_COMMAND(PACKET_CLIENT_PASSWORD)(pw_type, e->edittext.str);
+ break;
}
}