From c61acc7fc1fc6bbc1e5b1d0a782e74ecf16a9a23 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Thu, 28 Feb 2019 19:36:27 +0100 Subject: Fix #7280: Save in the right location on desync and server timeout --- src/network/network_client.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index b4d0a06f7..0cb7728e6 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -125,6 +125,7 @@ struct PacketReader : LoadFilter { void ClientNetworkEmergencySave() { if (!_settings_client.gui.autosave_on_network_disconnect) return; + if (!_networking) return; const char *filename = "netsave.sav"; DEBUG(net, 0, "Client: Performing emergency save (%s)", filename); @@ -212,6 +213,8 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res) SendError(errorno); } + ClientNetworkEmergencySave(); + _switch_mode = SM_MENU; this->CloseConnection(res); _networking = false; @@ -1173,7 +1176,6 @@ void ClientNetworkGameSocketHandler::CheckConnection() if (lag > 20) { this->NetworkGameSocketHandler::CloseConnection(); ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, WL_CRITICAL); - ClientNetworkEmergencySave(); return; } -- cgit v1.2.3-70-g09d2