@@ -1669,12 +1669,13 @@ static void DoCreateNewIndustry(Industry
* @param seed random seed (possibly) used by industries
* @param founder Founder of the industry
* @return the pointer of the newly created industry, or NULL if it failed
*/
static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, DoCommandFlag flags, const IndustrySpec *indspec, uint itspec_index, uint32 seed, Owner founder)
{
assert(itspec_index < indspec->num_table);
const IndustryTileTable *it = indspec->table[itspec_index];
bool custom_shape_check = false;
if (!CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, &custom_shape_check)) return NULL;
if (HasBit(GetIndustrySpec(type)->callback_mask, CBM_IND_LOCATION)) {
@@ -1721,13 +1722,13 @@ CommandCost CmdBuildIndustry(TileIndex t
IndustryType it = GB(p1, 0, 8);
if (it >= NUM_INDUSTRYTYPES) return CMD_ERROR;
const IndustrySpec *indspec = GetIndustrySpec(it);
/* Check if the to-be built/founded industry is available for this climate. */
if (!indspec->enabled) return CMD_ERROR;
if (!indspec->enabled || indspec->num_table == 0) return CMD_ERROR;
/* If the setting 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) */
if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 0 && indspec->IsRawIndustry()) {
return CMD_ERROR;
}
@@ -1859,13 +1860,13 @@ void GenerateIndustries()
if (!CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION)) {
ResetIndustryCreationProbility(it);
chance = ind_spc->appear_creation[_settings_game.game_creation.landscape];
if (ind_spc->enabled && chance > 0) {
if (ind_spc->enabled && chance > 0 && ind_spc->num_table > 0) {
/* once the chance of appearance is determind, it have to be scaled by
* the difficulty level. The "chance" in question is more an index into
* the _numof_industry_table,in fact */
int num = (chance > NB_NUMOFINDUSTRY) ? chance : _numof_industry_table[_settings_game.difficulty.number_industries][chance];
/* These are always placed next to the coastline, so we scale by the perimeter instead. */
@@ -1882,13 +1883,13 @@ void GenerateIndustries()
/* Once the number of industries has been determined, let's really create them.
* The test for chance allows us to try create industries that are available only
* for this landscape.
* @todo : Do we really have to pass chance as un-scaled value, since we've already
* processed that scaling above? No, don't think so. Will find a way. */
ind_spc = GetIndustrySpec(it);
if (ind_spc->enabled) {
if (ind_spc->enabled && ind_spc->num_table > 0) {
if (chance > 0) PlaceInitialIndustry(it, chance);
Status change: