diff options
author | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-02-28 19:36:27 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-03-03 12:12:32 +0100 |
commit | c61acc7fc1fc6bbc1e5b1d0a782e74ecf16a9a23 (patch) | |
tree | d844afc46f7527aa687d86f8b041e556b78feca2 /src | |
parent | c91e0058c27ac3f837de2735e2ce5fcfcd50b6ab (diff) | |
download | openttd-c61acc7fc1fc6bbc1e5b1d0a782e74ecf16a9a23.tar.xz |
Fix #7280: Save in the right location on desync and server timeout
Diffstat (limited to 'src')
-rw-r--r-- | src/network/network_client.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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; } |