From: Holger Schemel Date: Fri, 12 Oct 2018 16:04:30 +0000 (+0200) Subject: fixed bug with handling networking packets if request dialog is active X-Git-Tag: 4.1.2.0~137 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ef4236ac56bedd0e83777505c4ed63fbf4a74698;p=rocksndiamonds.git fixed bug with handling networking packets if request dialog is active Before, it was possible for a network client to start a new game while another client was still about answering a request dialog (like asking if a tape for a solved level should be saved), causing synchronization problems with network packet handling. With this bugfix, handling network packets is paused during a request. --- diff --git a/src/game.c b/src/game.c index b80d8585..c0fa1680 100644 --- a/src/game.c +++ b/src/game.c @@ -4196,6 +4196,7 @@ void InitGame(void) game.restart_level = FALSE; game.restart_game_message = NULL; + game.request_active = FALSE; if (level.game_engine_type == GAME_ENGINE_TYPE_MM) InitGameActions_MM(); diff --git a/src/game.h b/src/game.h index 947d4662..3b79cb5d 100644 --- a/src/game.h +++ b/src/game.h @@ -208,6 +208,9 @@ struct GameInfo /* trigger message to ask for restarting the game */ char *restart_game_message; + /* values for special request dialog control */ + boolean request_active; + /* values for special game control */ int centered_player_nr; int centered_player_nr_next; diff --git a/src/init.c b/src/init.c index a7657670..2167984b 100644 --- a/src/init.c +++ b/src/init.c @@ -5113,6 +5113,7 @@ static void InitGameInfo(void) { game.restart_level = FALSE; game.restart_game_message = NULL; + game.request_active = FALSE; } static void InitPlayerInfo(void) diff --git a/src/network.c b/src/network.c index f67f819c..73887cd5 100644 --- a/src/network.c +++ b/src/network.c @@ -1049,6 +1049,10 @@ static void HandleNetworkingDisconnect(void) void HandleNetworking(void) { + /* do not handle any networking packets if request dialog is active */ + if (game.request_active) + return; + char *error_message = HandleNetworkingPackets(); if (error_message != NULL) diff --git a/src/tools.c b/src/tools.c index f89b2b25..e9d11c13 100644 --- a/src/tools.c +++ b/src/tools.c @@ -4243,6 +4243,8 @@ static int RequestHandleEvents(unsigned int req_state) int sx, sy; int result; + game.request_active = TRUE; + setRequestPosition(&sx, &sy, FALSE); button_status = MB_RELEASED; @@ -4543,6 +4545,8 @@ static int RequestHandleEvents(unsigned int req_state) BackToFront(); } + game.request_active = FALSE; + return result; }