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/industry_gui.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/industry_gui.cpp')
-rw-r--r-- | src/industry_gui.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 0f6d8ba62..a0177fea3 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -33,6 +33,7 @@ #include "company_base.h" #include "core/geometry_func.hpp" #include "core/random_func.hpp" +#include "core/backup_type.hpp" #include "table/strings.h" #include "table/sprites.h" @@ -522,12 +523,14 @@ public: return; } - _current_company = OWNER_NONE; + Backup<CompanyByte> cur_company(_current_company, OWNER_NONE); _generating_world = true; _ignore_restrictions = true; + DoCommandP(tile, (InteractiveRandomRange(indsp->num_table) << 8) | this->selected_type, seed, CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY), &CcBuildIndustry); + cur_company.Restore(); _ignore_restrictions = false; _generating_world = false; } else { |