diff options
author | belugas <belugas@openttd.org> | 2006-10-27 15:54:24 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2006-10-27 15:54:24 +0000 |
commit | 7effb8fd5046ad0cf2effb8dc55661b316bf48d0 (patch) | |
tree | 76955221fdc0f4a255de504bb8d452764e50ebaa /industry_cmd.c | |
parent | 6d69e03e4f0516e2c50dab3b928b3fc7a00399f5 (diff) | |
download | openttd-7effb8fd5046ad0cf2effb8dc55661b316bf48d0.tar.xz |
(svn r6965) -CodeChange : Add a climate bitmask member to IndutrySpec.
Removed a loop that used the array _build_industry_types for that purpose.
Diffstat (limited to 'industry_cmd.c')
-rw-r--r-- | industry_cmd.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index 95d20c6d1..b1ae892fd 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -1503,22 +1503,11 @@ int32 CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) SET_EXPENSES_TYPE(EXPENSES_OTHER); - /* Check if the to-be built/founded industry is available for this climate. - * Unfortunately we have no easy way of checking, except for looping the table */ - { - const byte *i; - bool found = false; + indspec = GetIndustrySpec(p1); - for (i = &_build_industry_types[_opt_ptr->landscape][0]; i != endof(_build_industry_types[_opt_ptr->landscape]); i++) { - if (*i == p1) { - found = true; - break; - } - } - if (!found) return CMD_ERROR; - } + /* Check if the to-be built/founded industry is available for this climate. */ + if (!HASBIT(indspec->climate_availability, _opt_ptr->landscape)) return CMD_ERROR; - indspec = GetIndustrySpec(p1); /* If the patch for raw-material industries is not on, you cannot build raw-material industries. * Raw material industries are industries that do not accept cargo (at least for now) * Exclude the lumber mill (only "raw" industry that can be built) */ |