summaryrefslogtreecommitdiff
path: root/src/saveload/afterload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/saveload/afterload.cpp')
-rw-r--r--src/saveload/afterload.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 8ecd27b49..ae6b6a774 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -51,6 +51,7 @@
#include "../core/backup_type.hpp"
#include "../smallmap_gui.h"
#include "../news_func.h"
+#include "../order_backup.h"
#include "../error.h"
@@ -2916,6 +2917,21 @@ bool AfterLoadGame()
}
}
+ /*
+ * Only keep order-backups for network clients.
+ * If we are a network server or not networking, then we just loaded a previously
+ * saved-by-server savegame. There are no clients with a backup, so clear it.
+ * Furthermore before savegame version 192 the actual content was always corrupt.
+ */
+ if (!_networking || _network_server || IsSavegameVersionBefore(192)) {
+ /* Note: We cannot use CleanPool since that skips part of the destructor
+ * and then leaks un-reachable Orders in the order pool. */
+ OrderBackup *ob;
+ FOR_ALL_ORDER_BACKUPS(ob) {
+ delete ob;
+ }
+ }
+
/* Station acceptance is some kind of cache */
if (IsSavegameVersionBefore(127)) {