diff --git a/lang/english.txt b/lang/english.txt index c2bbe2fe31..5cccf71fac 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -1303,6 +1303,7 @@ STR_NETWORK_CONNECTING_2 :{BLACK}(2/6) Authorising.. STR_NETWORK_CONNECTING_3 :{BLACK}(3/6) Waiting.. STR_NETWORK_CONNECTING_4 :{BLACK}(4/6) Downloading map.. STR_NETWORK_CONNECTING_5 :{BLACK}(5/6) Processing data.. +STR_NETWORK_CONNECTING_6 :{BLACK}(6/6) Registering.. STR_NETWORK_CONNECTING_SPECIAL_1 :{BLACK}Fetching game info.. STR_NETWORK_CONNECTING_SPECIAL_2 :{BLACK}Fetching company info.. diff --git a/main_gui.c b/main_gui.c index ce5f3cb1e0..765ef19355 100644 --- a/main_gui.c +++ b/main_gui.c @@ -2229,7 +2229,7 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) { DrawSprite(SPR_OTTD_T, off_x + 34, 50); DrawSprite(SPR_OTTD_T, off_x + 65, 50); DrawSprite(SPR_OTTD_D, off_x + 96, 50); - + /* DrawSprite(SPR_OTTD_R, off_x + 119, 50); DrawSprite(SPR_OTTD_A, off_x + 148, 50); @@ -2323,8 +2323,8 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) { ShowBuildRailToolbar(_last_built_railtype, 4); break; - case 'L': - ShowTerraformToolbar(); + case 'L': + ShowTerraformToolbar(); break; case 'X': @@ -2332,9 +2332,9 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) { MarkWholeScreenDirty(); break; - case WKC_BACKQUOTE: - IConsoleSwitch(); - e->keypress.cont=false; + case WKC_BACKQUOTE: + IConsoleSwitch(); + e->keypress.cont=false; break; #ifdef ENABLE_NETWORK @@ -2356,6 +2356,7 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) { void ShowSelectGameWindow(); +extern void ShowJoinStatusWindowAfterJoin(); void SetupColorsAndInitialWindow() { @@ -2405,6 +2406,10 @@ void SetupColorsAndInitialWindow() WP(w,def_d).data_1 = -1280; + /* Bring joining GUI to front till the client is really joined */ + if (_networking && !_network_server) + ShowJoinStatusWindowAfterJoin(); + break; case GM_EDITOR: w = AllocateWindow(0, 0, width, height, MainWindowWndProc, 0, NULL); diff --git a/network.h b/network.h index ae7135498f..086b42a8a2 100644 --- a/network.h +++ b/network.h @@ -109,6 +109,7 @@ typedef enum { NETWORK_JOIN_STATUS_WAITING, NETWORK_JOIN_STATUS_DOWNLOADING, NETWORK_JOIN_STATUS_PROCESSING, + NETWORK_JOIN_STATUS_REGISTERING, NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO, } NetworkJoinStatus; diff --git a/network_client.c b/network_client.c index ab87aae7df..c0e69ca5bd 100644 --- a/network_client.c +++ b/network_client.c @@ -487,8 +487,6 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP) } _opt_mod_ptr = &_opt; - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); - // Say we received the map and loaded it correctly! SEND_COMMAND(PACKET_CLIENT_MAP_OK)(); @@ -498,6 +496,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP) if (_network_playas == OWNER_SPECTATOR) { // The client wants to be a spectator.. _local_player = OWNER_SPECTATOR; + DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); } else { // send a command to make a new player _local_player = 0; diff --git a/network_gui.c b/network_gui.c index 8257e8db03..e3bb1e85eb 100644 --- a/network_gui.c +++ b/network_gui.c @@ -1271,6 +1271,15 @@ void ShowJoinStatusWindow() AllocateWindowDesc(&_network_join_status_window_desc); } +void ShowJoinStatusWindowAfterJoin() +{ + /* 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); +} diff --git a/players.c b/players.c index 039654df39..603d1ead72 100644 --- a/players.c +++ b/players.c @@ -643,6 +643,13 @@ int32 CmdPlayerCtrl(int x, int y, uint32 flags, uint32 p1, uint32 p2) switch(p1 & 0xff) { case 0: // make new player p = DoStartupNewPlayer(false); + +#ifdef ENABLE_NETWORK + if (_networking && !_network_server && _local_player == OWNER_SPECTATOR) + /* In case we are a client joining a server... */ + DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); +#endif /* ENABLE_NETWORK */ + if (p != NULL) { if (_local_player == OWNER_SPECTATOR) { _local_player = p->index;