From 6250b90a6bfe73d96ec02e9bc81af323f55b857d Mon Sep 17 00:00:00 2001 From: Darkvater Date: Sat, 30 Dec 2006 01:52:09 +0000 Subject: (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. --- network_client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'network_client.c') diff --git a/network_client.c b/network_client.c index ef0ae0e03..39a12c28c 100644 --- a/network_client.c +++ b/network_client.c @@ -497,6 +497,8 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP) _switch_mode_errorstr = STR_NETWORK_ERR_SAVEGAMEERROR; return NETWORK_RECV_STATUS_SAVEGAME; } + /* If the savegame has successfully loaded, ALL windows have been removed, + * only toolbar/statusbar and gamefield are visible */ _opt_ptr = &_opt; // during a network game you are always in-game @@ -510,18 +512,16 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP) SetLocalPlayer(PLAYER_SPECTATOR); - if (_network_playas == PLAYER_SPECTATOR) { - // The client wants to be a spectator.. - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); - } else { + if (_network_playas != PLAYER_SPECTATOR) { /* We have arrived and ready to start playing; send a command to make a new player; * the server will give us a client-id and let us in */ + _network_join_status = NETWORK_JOIN_STATUS_REGISTERING; + ShowJoinStatusWindow(); NetworkSend_Command(0, 0, 0, CMD_PLAYER_CTRL, NULL); } } else { // take control over an existing company SetLocalPlayer(_network_playas); - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); } } -- cgit v1.2.3-70-g09d2