File diff r23537:f6a6d4ce4bd5 → r23538:8df50944b27a
src/industry_cmd.cpp
Show inline comments
 
@@ -1863,49 +1863,49 @@ static void DoCreateNewIndustry(Industry
 
/**
 
 * Helper function for Build/Fund an industry
 
 * @param tile tile where industry is built
 
 * @param type of industry to build
 
 * @param flags of operations to conduct
 
 * @param indspec pointer to industry specifications
 
 * @param itspec_index the index of the itsepc to build/fund
 
 * @param random_var8f random seed (possibly) used by industries
 
 * @param random_initial_bits The random bits the industry is going to have after construction.
 
 * @param founder Founder of the industry
 
 * @param creation_type The circumstances the industry is created under.
 
 * @param[out] ip Pointer to store newly created industry.
 
 * @return Succeeded or failed command.
 
 *
 
 * @post \c *ip contains the newly created industry if all checks are successful and the \a flags request actual creation, else it contains \c NULL afterwards.
 
 */
 
static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, DoCommandFlag flags, const IndustrySpec *indspec, uint itspec_index, uint32 random_var8f, uint16 random_initial_bits, Owner founder, IndustryAvailabilityCallType creation_type, Industry **ip)
 
{
 
	assert(itspec_index < indspec->num_table);
 
	const IndustryTileTable *it = indspec->table[itspec_index];
 
	bool custom_shape_check = false;
 

	
 
	*ip = NULL;
 

	
 
	SmallVector<ClearedObjectArea, 1> object_areas(_cleared_object_areas);
 
	std::vector<ClearedObjectArea> object_areas(_cleared_object_areas);
 
	CommandCost ret = CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, random_initial_bits, founder, creation_type, &custom_shape_check);
 
	_cleared_object_areas = object_areas;
 
	if (ret.Failed()) return ret;
 

	
 
	if (HasBit(GetIndustrySpec(type)->callback_mask, CBM_IND_LOCATION)) {
 
		ret = CheckIfCallBackAllowsCreation(tile, type, itspec_index, random_var8f, random_initial_bits, founder, creation_type);
 
	} else {
 
		ret = _check_new_industry_procs[indspec->check_proc](tile);
 
	}
 
	if (ret.Failed()) return ret;
 

	
 
	if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world &&
 
			!_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, it, type)) {
 
		return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 
	}
 

	
 
	ret = CheckIfFarEnoughFromConflictingIndustry(tile, type);
 
	if (ret.Failed()) return ret;
 

	
 
	Town *t = NULL;
 
	ret = FindTownForIndustry(tile, type, &t);
 
	if (ret.Failed()) return ret;
 
	assert(t != NULL);