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.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 9a128e404..59c743012 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -52,6 +52,7 @@
#include "../engine_base.h"
#include "../engine_func.h"
#include "../rail_gui.h"
+#include "../core/backup_type.hpp"
#include "table/strings.h"
@@ -1570,8 +1571,9 @@ bool AfterLoadGame()
if (IsBuoyTile(t) || IsDriveThroughStopTile(t) || IsTileType(t, MP_WATER)) {
Owner o = GetTileOwner(t);
if (o < MAX_COMPANIES && !Company::IsValidID(o)) {
- _current_company = o;
+ Backup<CompanyByte> cur_company(_current_company, o);
ChangeTileOwner(t, o, INVALID_OWNER);
+ cur_company.Restore();
}
if (IsBuoyTile(t)) {
/* reset buoy owner to OWNER_NONE in the station struct