summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-02-11 23:20:35 +0000
committerrubidium <rubidium@openttd.org>2011-02-11 23:20:35 +0000
commitd8cada7563228809936c0a2b21c5c098848636eb (patch)
tree333bca95298c90933452c0036a4d09c5e832cd58 /src/saveload
parent1dc5ba22105bc12ab13e79f3a8a22952d82f7c8e (diff)
downloadopenttd-d8cada7563228809936c0a2b21c5c098848636eb.tar.xz
(svn r22064) -Fix [FS#4497] (r21399): crash when disconnecting and reconnecting while the server is still saving the savegame
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/saveload.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 62c0ff9f5..bff6b05d7 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -2382,13 +2382,20 @@ static SaveOrLoadResult SaveFileToDisk(bool threaded)
} catch (...) {
ClearSaveLoadState();
- /* Skip the "colour" character */
- DEBUG(sl, 0, "%s", GetSaveLoadErrorString() + 3);
+ AsyncSaveFinishProc asfp = SaveFileDone;
+
+ /* We don't want to shout when saving is just
+ * cancelled due to a client disconnecting. */
+ if (_sl.error_str != STR_NETWORK_ERROR_LOSTCONNECTION) {
+ /* Skip the "colour" character */
+ DEBUG(sl, 0, "%s", GetSaveLoadErrorString() + 3);
+ asfp = SaveFileError;
+ }
if (threaded) {
- SetAsyncSaveFinish(SaveFileError);
+ SetAsyncSaveFinish(asfp);
} else {
- SaveFileError();
+ asfp();
}
return SL_ERROR;
}