mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-13 02:52:37 +00:00
Fix #7280: Save in the right location on desync and server timeout
This commit is contained in:
parent
c91e0058c2
commit
c61acc7fc1
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user