From 9db3cde73af598852da13b748eef31a8207cfcf2 Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 31 May 2010 20:22:57 +0000 Subject: (svn r19914) -Codechange: Wrap a helper class around temporary assignments of _current_company to ensure proper restoration. --- src/saveload/afterload.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/saveload') 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 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 -- cgit v1.2.3-54-g00ecf