diff options
author | frosch <frosch@openttd.org> | 2010-05-31 20:22:57 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-05-31 20:22:57 +0000 |
commit | 9db3cde73af598852da13b748eef31a8207cfcf2 (patch) | |
tree | 996d3e9c49ce7c3611a70ed4fa6f03774b4cafe9 /src/openttd.cpp | |
parent | 1d05fbebbef72722d400ab4f7693dde11205a7f4 (diff) | |
download | openttd-9db3cde73af598852da13b748eef31a8207cfcf2.tar.xz |
(svn r19914) -Codechange: Wrap a helper class around temporary assignments of _current_company to ensure proper restoration.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index 644781162..500ab077b 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -65,6 +65,7 @@ #include "engine_func.h" #include "core/random_func.hpp" #include "rail_gui.h" +#include "core/backup_type.hpp" #include "newgrf_commons.h" @@ -1215,8 +1216,7 @@ void StateGameLoop() /* All these actions has to be done from OWNER_NONE * for multiplayer compatibility */ - CompanyID old_company = _current_company; - _current_company = OWNER_NONE; + Backup<CompanyByte> cur_company(_current_company, OWNER_NONE); AnimateAnimatedTiles(); IncreaseDate(); @@ -1229,7 +1229,7 @@ void StateGameLoop() CallWindowTickEvent(); NewsLoop(); - _current_company = old_company; + cur_company.Restore(); } } |