(svn r6965) -CodeChange : Add a climate bitmask member to IndutrySpec.

Removed a loop that used the array _build_industry_types for that purpose.
This commit is contained in:
belugas
2006-10-27 15:54:24 +00:00
parent 250b9b0436
commit 2cdb58d906
3 changed files with 48 additions and 56 deletions

View File

@@ -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;
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;
}
indspec = GetIndustrySpec(p1);
/* Check if the to-be built/founded industry is available for this climate. */
if (!HASBIT(indspec->climate_availability, _opt_ptr->landscape)) return CMD_ERROR;
/* 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) */