summaryrefslogtreecommitdiff
path: root/network_gui.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-12-30 01:52:09 +0000
committerDarkvater <darkvater@openttd.org>2006-12-30 01:52:09 +0000
commitf475636186a7c4d3aac9ae8998cdd3cd9f3983f9 (patch)
tree1966fa0f816ba2f76eb61aa26361eda5de1eb0eb /network_gui.c
parentc87fcab77216fa2a3c8a5a334c32099665b1241d (diff)
downloadopenttd-f475636186a7c4d3aac9ae8998cdd3cd9f3983f9.tar.xz
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
some code for SetupColorsAndInitialWindow. Because we know that after a successful load all windows are removed we can setup default windows in this function, and show ShowJoinStatusWindow in PACKET_SERVER_MAP. -Setup the global _network_join_status for ShowJoinStatusWindow in the only two places where the function is called, instead of inside it. -Turn the join status window into a modal window of the network window so it stays on top.
Diffstat (limited to 'network_gui.c')
-rw-r--r--network_gui.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/network_gui.c b/network_gui.c
index 4c994872c..d0dd5df4c 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -1416,8 +1416,7 @@ static void NetworkJoinStatusWindowWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch (e->we.click.widget) {
- case 0: /* Close 'X' */
- case 3: /* Disconnect button */
+ case 2: /* Disconnect button */
NetworkDisconnect();
DeleteWindow(w);
SwitchMode(SM_MENU);
@@ -1439,8 +1438,7 @@ static void NetworkJoinStatusWindowWndProc(Window *w, WindowEvent *e)
}
static const Widget _network_join_status_window_widget[] = {
-{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, RESIZE_NONE, 14, 11, 249, 0, 13, STR_NETWORK_CONNECTING, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_CAPTION, RESIZE_NONE, 14, 0, 249, 0, 13, STR_NETWORK_CONNECTING, STR_018C_WINDOW_TITLE_DRAG_THIS},
{ WWT_PANEL, RESIZE_NONE, 14, 0, 249, 14, 84, 0x0, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 75, 175, 69, 80, STR_NETWORK_DISCONNECT, STR_NULL},
{ WIDGETS_END},
@@ -1449,26 +1447,18 @@ static const Widget _network_join_status_window_widget[] = {
static const WindowDesc _network_join_status_window_desc = {
WDP_CENTER, WDP_CENTER, 250, 85,
WC_NETWORK_STATUS_WINDOW, 0,
- WDF_STD_TOOLTIPS | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL,
_network_join_status_window_widget,
NetworkJoinStatusWindowWndProc,
};
void ShowJoinStatusWindow(void)
{
+ Window *w;
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
- _network_join_status = NETWORK_JOIN_STATUS_CONNECTING;
- AllocateWindowDesc(&_network_join_status_window_desc);
-}
-
-void ShowJoinStatusWindowAfterJoin(void)
-{
- /* This is a special instant of ShowJoinStatusWindow, because
- it is opened after the map is loaded, but the client maybe is not
- done registering itself to the server */
- DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
- _network_join_status = NETWORK_JOIN_STATUS_REGISTERING;
- AllocateWindowDesc(&_network_join_status_window_desc);
+ w = AllocateWindowDesc(&_network_join_status_window_desc);
+ /* Parent the status window to the lobby */
+ if (w != NULL) w->parent = FindWindowById(WC_NETWORK_WINDOW, 0);
}
static void SendChat(const char *buf, DestType type, byte dest)