Changeset - r23867:be2be375b64c
[Not reviewed]
master
0 11 0
Niels Martin Hansen - 5 years ago 2019-10-04 19:26:44
nielsm@indvikleren.dk
Codechange: Use std::vector for industry tile layouts
11 files changed with 252 insertions and 335 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -68,17 +68,21 @@ IndustryBuildData _industry_builder; ///
 
 * industry and industry tiles.
 
 * It adjusts the enabling of the industry too, based on climate availability.
 
 * This will allow for clearer testings
 
 */
 
void ResetIndustries()
 
{
 
	memset(&_industry_specs, 0, sizeof(_industry_specs));
 
	memcpy(&_industry_specs, &_origin_industry_specs, sizeof(_origin_industry_specs));
 

	
 
	/* once performed, enable only the current climate industries */
 
	for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) {
 
		/* Reset the spec to default */
 
		if (i < lengthof(_origin_industry_specs)) {
 
			_industry_specs[i] = _origin_industry_specs[i];
 
		} else {
 
			_industry_specs[i] = IndustrySpec{};
 
		}
 

	
 
		/* Enable only the current climate industries */
 
		_industry_specs[i].enabled = i < NEW_INDUSTRYOFFSET &&
 
				HasBit(_origin_industry_specs[i].climate_availability, _settings_game.game_creation.landscape);
 
	}
 

	
 
	memset(&_industry_tile_specs, 0, sizeof(_industry_tile_specs));
 
	memcpy(&_industry_tile_specs, &_origin_industry_tile_specs, sizeof(_origin_industry_tile_specs));
 
@@ -1415,29 +1419,29 @@ bool IsSlopeRefused(Slope current, Slope
 
	return false;
 
}
 

	
 
/**
 
 * Are the tiles of the industry free?
 
 * @param tile                    Position to check.
 
 * @param it                      Industry tiles table.
 
 * @param itspec_index            The index of the itsepc to build/fund
 
 * @param layout                  Industry tiles table.
 
 * @param layout_index            The index of the layout to build/fund
 
 * @param type                    Type of the industry.
 
 * @param initial_random_bits     The random bits the industry is going to have after construction.
 
 * @param founder                 Industry founder
 
 * @param creation_type           The circumstances the industry is created under.
 
 * @param[out] custom_shape_check Perform custom check for the site.
 
 * @return Failed or succeeded command.
 
 */
 
static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable *it, uint itspec_index, int type, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type, bool *custom_shape_check = nullptr)
 
static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileLayout &layout, size_t layout_index, int type, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type, bool *custom_shape_check = nullptr)
 
{
 
	bool refused_slope = false;
 
	bool custom_shape = false;
 

	
 
	do {
 
		IndustryGfx gfx = GetTranslatedIndustryTileID(it->gfx);
 
		TileIndex cur_tile = TileAddWrap(tile, it->ti.x, it->ti.y);
 
	for (const IndustryTileLayoutTile &it : layout) {
 
		IndustryGfx gfx = GetTranslatedIndustryTileID(it.gfx);
 
		TileIndex cur_tile = TileAddWrap(tile, it.ti.x, it.ti.y);
 

	
 
		if (!IsValidTile(cur_tile)) {
 
			return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 
		}
 

	
 
		if (gfx == GFX_WATERTILE_SPECIALCHECK) {
 
@@ -1456,13 +1460,13 @@ static CommandCost CheckIfIndustryTilesA
 

	
 
			/* Perform land/water check if not disabled */
 
			if (!HasBit(its->slopes_refused, 5) && ((HasTileWaterClass(cur_tile) && IsTileOnWater(cur_tile)) == !(ind_behav & INDUSTRYBEH_BUILT_ONWATER))) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 

	
 
			if (HasBit(its->callback_mask, CBM_INDT_SHAPE_CHECK)) {
 
				custom_shape = true;
 
				CommandCost ret = PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, itspec_index, initial_random_bits, founder, creation_type);
 
				CommandCost ret = PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, layout_index, initial_random_bits, founder, creation_type);
 
				if (ret.Failed()) return ret;
 
			} else {
 
				Slope tileh = GetTileSlope(cur_tile);
 
				refused_slope |= IsSlopeRefused(tileh, its->slopes_refused);
 
			}
 

	
 
@@ -1482,13 +1486,13 @@ static CommandCost CheckIfIndustryTilesA
 
				/* Clear the tiles, but do not affect town ratings */
 
				CommandCost ret = DoCommand(cur_tile, 0, 0, DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, CMD_LANDSCAPE_CLEAR);
 

	
 
				if (ret.Failed()) return ret;
 
			}
 
		}
 
	} while ((++it)->ti.x != -0x80);
 
	}
 

	
 
	if (custom_shape_check != nullptr) *custom_shape_check = custom_shape;
 

	
 
	/* It is almost impossible to have a fully flat land in TG, so what we
 
	 *  do is that we check if we can make the land flat later on. See
 
	 *  CheckIfCanLevelIndustryPlatform(). */
 
@@ -1546,24 +1550,23 @@ static bool CheckCanTerraformSurrounding
 
}
 

	
 
/**
 
 * This function tries to flatten out the land below an industry, without
 
 *  damaging the surroundings too much.
 
 */
 
static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileTable *it, int type)
 
static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileLayout &layout, int type)
 
{
 
	const int MKEND = -0x80;   // used for last element in an IndustryTileTable (see build_industry.h)
 
	int max_x = 0;
 
	int max_y = 0;
 

	
 
	/* Finds dimensions of largest variant of this industry */
 
	do {
 
		if (it->gfx == 0xFF) continue;  //  FF been a marquer for a check on clear water, skip it
 
		if (it->ti.x > max_x) max_x = it->ti.x;
 
		if (it->ti.y > max_y) max_y = it->ti.y;
 
	} while ((++it)->ti.x != MKEND);
 
	for (const IndustryTileLayoutTile &it : layout) {
 
		if (it.gfx == GFX_WATERTILE_SPECIALCHECK) continue; // watercheck tiles don't count for footprint size
 
		if (it.ti.x > max_x) max_x = it.ti.x;
 
		if (it.ti.y > max_y) max_y = it.ti.y;
 
	}
 

	
 
	/* Remember level height */
 
	uint h = TileHeight(tile);
 

	
 
	if (TileX(tile) <= _settings_game.construction.industry_platform + 1U || TileY(tile) <= _settings_game.construction.industry_platform + 1U) return false;
 
	/* Check that all tiles in area and surrounding are clear
 
@@ -1714,19 +1717,19 @@ static void PopulateStationsNearby(Indus
 

	
 
/**
 
 * Put an industry on the map.
 
 * @param i       Just allocated poolitem, mostly empty.
 
 * @param tile    North tile of the industry.
 
 * @param type    Type of the industry.
 
 * @param it      Industrylayout to build.
 
 * @param layout  Number of the layout.
 
 * @param layout              Industrylayout to build.
 
 * @param layout_index        Number of the industry layout.
 
 * @param t       Nearest town.
 
 * @param founder Founder of the industry; OWNER_NONE in case of random construction.
 
 * @param initial_random_bits Random bits for the industry.
 
 */
 
static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, const IndustryTileTable *it, byte layout, Town *t, Owner founder, uint16 initial_random_bits)
 
static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, const IndustryTileLayout &layout, size_t layout_index, Town *t, Owner founder, uint16 initial_random_bits)
 
{
 
	const IndustrySpec *indspec = GetIndustrySpec(type);
 

	
 
	i->location = TileArea(tile, 1, 1);
 
	i->type = type;
 
	Industry::IncIndustryTypeCount(type);
 
@@ -1765,13 +1768,13 @@ static void DoCreateNewIndustry(Industry
 
	i->construction_type = (_game_mode == GM_EDITOR) ? ICT_SCENARIO_EDITOR :
 
			(_generating_world ? ICT_MAP_GENERATION : ICT_NORMAL_GAMEPLAY);
 

	
 
	/* Adding 1 here makes it conform to specs of var44 of varaction2 for industries
 
	 * 0 = created prior of newindustries
 
	 * else, chosen layout + 1 */
 
	i->selected_layout = layout + 1;
 
	i->selected_layout = (byte)(layout_index + 1);
 

	
 
	i->prod_level = PRODLEVEL_DEFAULT;
 

	
 
	/* Call callbacks after the regular fields got initialised. */
 

	
 
	if (HasBit(indspec->callback_mask, CBM_IND_PROD_CHANGE_BUILD)) {
 
@@ -1861,35 +1864,35 @@ static void DoCreateNewIndustry(Industry
 
			i->produced_cargo[j] = cargo;
 
		}
 
	}
 

	
 
	/* Plant the tiles */
 

	
 
	do {
 
		TileIndex cur_tile = tile + ToTileIndexDiff(it->ti);
 

	
 
		if (it->gfx != GFX_WATERTILE_SPECIALCHECK) {
 
	for (const IndustryTileLayoutTile &it : layout) {
 
		TileIndex cur_tile = tile + ToTileIndexDiff(it.ti);
 

	
 
		if (it.gfx != GFX_WATERTILE_SPECIALCHECK) {
 
			i->location.Add(cur_tile);
 

	
 
			WaterClass wc = (IsWaterTile(cur_tile) ? GetWaterClass(cur_tile) : WATER_CLASS_INVALID);
 

	
 
			DoCommand(cur_tile, 0, 0, DC_EXEC | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, CMD_LANDSCAPE_CLEAR);
 

	
 
			MakeIndustry(cur_tile, i->index, it->gfx, Random(), wc);
 
			MakeIndustry(cur_tile, i->index, it.gfx, Random(), wc);
 

	
 
			if (_generating_world) {
 
				SetIndustryConstructionCounter(cur_tile, 3);
 
				SetIndustryConstructionStage(cur_tile, 2);
 
			}
 

	
 
			/* it->gfx is stored in the map. But the translated ID cur_gfx is the interesting one */
 
			IndustryGfx cur_gfx = GetTranslatedIndustryTileID(it->gfx);
 
			IndustryGfx cur_gfx = GetTranslatedIndustryTileID(it.gfx);
 
			const IndustryTileSpec *its = GetIndustryTileSpec(cur_gfx);
 
			if (its->animation.status != ANIM_STATUS_NO_ANIMATION) AddAnimatedTile(cur_tile);
 
		}
 
	} while ((++it)->ti.x != -0x80);
 
	}
 

	
 
	if (GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_PLANT_ON_BUILT) {
 
		for (uint j = 0; j != 50; j++) PlantRandomFarmField(i);
 
	}
 
	InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 0);
 

	
 
@@ -1899,44 +1902,44 @@ 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 layout_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 nullptr 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)
 
static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, DoCommandFlag flags, const IndustrySpec *indspec, size_t layout_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];
 
	assert(layout_index < indspec->layouts.size());
 
	const IndustryTileLayout &layout = indspec->layouts[layout_index];
 
	bool custom_shape_check = false;
 

	
 
	*ip = nullptr;
 

	
 
	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);
 
	CommandCost ret = CheckIfIndustryTilesAreFree(tile, layout, layout_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);
 
		ret = CheckIfCallBackAllowsCreation(tile, type, layout_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)) {
 
			!_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, layout, type)) {
 
		return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 
	}
 

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

	
 
@@ -1949,14 +1952,14 @@ static CommandCost CreateNewIndustryHelp
 
	if (ret.Failed()) return ret;
 

	
 
	if (!Industry::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_INDUSTRIES);
 

	
 
	if (flags & DC_EXEC) {
 
		*ip = new Industry(tile);
 
		if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, it, type);
 
		DoCreateNewIndustry(*ip, tile, type, it, itspec_index, t, founder, random_initial_bits);
 
		if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, layout, type);
 
		DoCreateNewIndustry(*ip, tile, type, layout, layout_index, t, founder, random_initial_bits);
 
	}
 

	
 
	return CommandCost();
 
}
 

	
 
/**
 
@@ -1976,13 +1979,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 || indspec->num_table == 0) return CMD_ERROR;
 
	if (!indspec->enabled || indspec->layouts.empty()) 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 && _current_company != OWNER_DEITY && _settings_game.construction.raw_industry_construction == 0 && indspec->IsRawIndustry()) {
 
		return CMD_ERROR;
 
	}
 
@@ -1992,13 +1995,13 @@ CommandCost CmdBuildIndustry(TileIndex t
 
	}
 

	
 
	Randomizer randomizer;
 
	randomizer.SetSeed(p2);
 
	uint16 random_initial_bits = GB(p2, 0, 16);
 
	uint32 random_var8f = randomizer.Next();
 
	int num_layouts = indspec->num_table;
 
	size_t num_layouts = indspec->layouts.size();
 
	CommandCost ret = CommandCost(STR_ERROR_SITE_UNSUITABLE);
 
	const bool deity_prospect = _current_company == OWNER_DEITY && !HasBit(p1, 16);
 

	
 
	Industry *ind = nullptr;
 
	if (deity_prospect || (_game_mode != GM_EDITOR && _current_company != OWNER_DEITY && _settings_game.construction.raw_industry_construction == 2 && indspec->IsRawIndustry())) {
 
		if (flags & DC_EXEC) {
 
@@ -2011,13 +2014,13 @@ CommandCost CmdBuildIndustry(TileIndex t
 
				for (int i = 0; i < 5000; i++) {
 
					/* We should not have more than one Random() in a function call
 
					 * because parameter evaluation order is not guaranteed in the c++ standard
 
					 */
 
					tile = RandomTile();
 
					/* Start with a random layout */
 
					int layout = RandomRange(num_layouts);
 
					size_t layout = RandomRange((uint32)num_layouts);
 
					/* Check now each layout, starting with the random one */
 
					for (int j = 0; j < num_layouts; j++) {
 
						layout = (layout + 1) % num_layouts;
 
						ret = CreateNewIndustryHelper(tile, it, flags, indspec, layout, random_var8f, random_initial_bits, cur_company.GetOriginalValue(), _current_company == OWNER_DEITY ? IACT_RANDOMCREATION : IACT_PROSPECTCREATION, &ind);
 
						if (ret.Succeeded()) break;
 
					}
 
@@ -2060,13 +2063,14 @@ static Industry *CreateNewIndustry(TileI
 
{
 
	const IndustrySpec *indspec = GetIndustrySpec(type);
 

	
 
	uint32 seed = Random();
 
	uint32 seed2 = Random();
 
	Industry *i = nullptr;
 
	CommandCost ret = CreateNewIndustryHelper(tile, type, DC_EXEC, indspec, RandomRange(indspec->num_table), seed, GB(seed2, 0, 16), OWNER_NONE, creation_type, &i);
 
	size_t layout_index = RandomRange((uint32)indspec->layouts.size());
 
	CommandCost ret = CreateNewIndustryHelper(tile, type, DC_EXEC, indspec, layout_index, seed, GB(seed2, 0, 16), OWNER_NONE, creation_type, &i);
 
	assert(i != nullptr || ret.Failed());
 
	return i;
 
}
 

	
 
/**
 
 * Compute the appearance probability for an industry during map creation.
 
@@ -2075,13 +2079,13 @@ static Industry *CreateNewIndustry(TileI
 
 * @return Relative probability for the industry to appear.
 
 */
 
static uint32 GetScaledIndustryGenerationProbability(IndustryType it, bool *force_at_least_one)
 
{
 
	const IndustrySpec *ind_spc = GetIndustrySpec(it);
 
	uint32 chance = ind_spc->appear_creation[_settings_game.game_creation.landscape] * 16; // * 16 to increase precision
 
	if (!ind_spc->enabled || ind_spc->num_table == 0 ||
 
	if (!ind_spc->enabled || ind_spc->layouts.empty() ||
 
			(_game_mode != GM_EDITOR && _settings_game.difficulty.industry_density == ID_FUND_ONLY) ||
 
			(chance = GetIndustryProbabilityCallback(it, IACT_MAPGENERATION, chance)) == 0) {
 
		*force_at_least_one = false;
 
		return 0;
 
	} else {
 
		/* We want industries appearing at coast to appear less often on bigger maps, as length of coast increases slower than map area.
 
@@ -2105,13 +2109,13 @@ static uint16 GetIndustryGamePlayProbabi
 
		*min_number = 0;
 
		return 0;
 
	}
 

	
 
	const IndustrySpec *ind_spc = GetIndustrySpec(it);
 
	byte chance = ind_spc->appear_ingame[_settings_game.game_creation.landscape];
 
	if (!ind_spc->enabled || ind_spc->num_table == 0 ||
 
	if (!ind_spc->enabled || ind_spc->layouts.empty() ||
 
			((ind_spc->behaviour & INDUSTRYBEH_BEFORE_1950) && _cur_year > 1950) ||
 
			((ind_spc->behaviour & INDUSTRYBEH_AFTER_1960) && _cur_year < 1960) ||
 
			(chance = GetIndustryProbabilityCallback(it, IACT_RANDOMCREATION, chance)) == 0) {
 
		*min_number = 0;
 
		return 0;
 
	}
 
@@ -2925,12 +2929,19 @@ bool IndustrySpec::UsesSmoothEconomy() c
 
{
 
	return _settings_game.economy.smooth_economy &&
 
		!(HasBit(this->callback_mask, CBM_IND_PRODUCTION_256_TICKS) || HasBit(this->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 
		!(HasBit(this->callback_mask, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(this->callback_mask, CBM_IND_PRODUCTION_CHANGE) || HasBit(this->callback_mask, CBM_IND_PROD_CHANGE_BUILD)); // production change callbacks
 
}
 

	
 
IndustrySpec::~IndustrySpec()
 
{
 
	if (HasBit(this->cleanup_flag, CLEAN_RANDOMSOUNDS)) {
 
		free(this->random_sounds);
 
	}
 
}
 

	
 
static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
 
{
 
	if (AutoslopeEnabled()) {
 
		/* We imitate here TTDP's behaviour:
 
		 *  - Both new and old slope must not be steep.
 
		 *  - TileMaxZ must not be changed.
src/industry_gui.cpp
Show inline comments
 
@@ -644,12 +644,13 @@ public:
 
	void OnPlaceObject(Point pt, TileIndex tile) override
 
	{
 
		bool success = true;
 
		/* We do not need to protect ourselves against "Random Many Industries" in this mode */
 
		const IndustrySpec *indsp = GetIndustrySpec(this->selected_type);
 
		uint32 seed = InteractiveRandom();
 
		uint32 layout_index = InteractiveRandomRange((uint32)indsp->layouts.size());
 

	
 
		if (_game_mode == GM_EDITOR) {
 
			/* Show error if no town exists at all */
 
			if (Town::GetNumItems() == 0) {
 
				SetDParam(0, indsp->name);
 
				ShowErrorMessage(STR_ERROR_CAN_T_BUILD_HERE, STR_ERROR_MUST_FOUND_TOWN_FIRST, WL_INFO, pt.x, pt.y);
 
@@ -657,20 +658,20 @@ public:
 
			}
 

	
 
			Backup<CompanyID> cur_company(_current_company, OWNER_NONE, FILE_LINE);
 
			_generating_world = true;
 
			_ignore_restrictions = true;
 

	
 
			DoCommandP(tile, (InteractiveRandomRange(indsp->num_table) << 8) | this->selected_type, seed,
 
			DoCommandP(tile, (layout_index << 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 {
 
			success = DoCommandP(tile, (InteractiveRandomRange(indsp->num_table) << 8) | this->selected_type, seed, CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY));
 
			success = DoCommandP(tile, (layout_index << 8) | this->selected_type, seed, CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY));
 
		}
 

	
 
		/* If an industry has been built, just reset the cursor and the system */
 
		if (success && !_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	}
 

	
src/industrytype.h
Show inline comments
 
@@ -10,23 +10,23 @@
 
/** @file industrytype.h %Industry type specs. */
 

	
 
#ifndef INDUSTRYTYPE_H
 
#define INDUSTRYTYPE_H
 

	
 
#include <array>
 
#include <vector>
 
#include "map_type.h"
 
#include "slope_type.h"
 
#include "industry_type.h"
 
#include "landscape_type.h"
 
#include "cargo_type.h"
 
#include "newgrf_animation_type.h"
 
#include "newgrf_commons.h"
 

	
 
enum IndustryCleanupType {
 
	CLEAN_RANDOMSOUNDS,    ///< Free the dynamically allocated sounds table
 
	CLEAN_TILELAYOUT,      ///< Free the dynamically allocated tile layout structure
 
};
 

	
 
/** Available types of industry lifetimes. */
 
enum IndustryLifeType {
 
	INDUSTRYLIFE_BLACK_HOLE =      0, ///< Like power plants and banks
 
	INDUSTRYLIFE_EXTRACTIVE = 1 << 0, ///< Like mines
 
@@ -90,23 +90,26 @@ enum IndustryTileSpecialFlags {
 
	INDTILE_SPECIAL_NONE                  = 0,
 
	INDTILE_SPECIAL_NEXTFRAME_RANDOMBITS  = 1 << 0, ///< Callback 0x26 needs random bits
 
	INDTILE_SPECIAL_ACCEPTS_ALL_CARGO     = 1 << 1, ///< Tile always accepts all cargoes the associated industry accepts
 
};
 
DECLARE_ENUM_AS_BIT_SET(IndustryTileSpecialFlags)
 

	
 
struct IndustryTileTable {
 
/** Definition of one tile in an industry tile layout */
 
struct IndustryTileLayoutTile {
 
	TileIndexDiffC ti;
 
	IndustryGfx gfx;
 
};
 

	
 
/** A complete tile layout for an industry is a list of tiles */
 
using IndustryTileLayout = std::vector<IndustryTileLayoutTile>;
 

	
 
/**
 
 * Defines the data structure for constructing industry.
 
 */
 
struct IndustrySpec {
 
	const IndustryTileTable * const *table;     ///< List of the tiles composing the industry
 
	byte num_table;                             ///< Number of elements in the table
 
	std::vector<IndustryTileLayout> layouts;    ///< List of possible tile layouts for the industry
 
	uint8 cost_multiplier;                      ///< Base construction cost multiplier.
 
	uint32 removal_cost_multiplier;             ///< Base removal cost multiplier.
 
	uint32 prospecting_chance;                  ///< Chance prospecting succeeds
 
	IndustryType conflicting[3];                ///< Industries this industry cannot be close to
 
	byte check_proc;                            ///< Index to a procedure to check for conflicting circumstances
 
	CargoID produced_cargo[INDUSTRY_NUM_OUTPUTS];
 
@@ -140,12 +143,14 @@ struct IndustrySpec {
 

	
 
	bool IsRawIndustry() const;
 
	bool IsProcessingIndustry() const;
 
	Money GetConstructionCost() const;
 
	Money GetRemovalCost() const;
 
	bool UsesSmoothEconomy() const;
 

	
 
	~IndustrySpec();
 
};
 

	
 
/**
 
 * Defines the data structure of each individual tile of an industry.
 
 * @note A tile can at most accept 3 types of cargo, even if an industry as a whole can accept more types.
 
 */
src/newgrf.cpp
Show inline comments
 
@@ -3368,42 +3368,28 @@ static ChangeInfoResult IgnoreIndustryPr
 
	return ret;
 
}
 

	
 
/**
 
 * Validate the industry layout; e.g. to prevent duplicate tiles.
 
 * @param layout The layout to check.
 
 * @param size The size of the layout.
 
 * @return True if the layout is deemed valid.
 
 */
 
static bool ValidateIndustryLayout(const IndustryTileTable *layout, int size)
 
{
 
	for (int i = 0; i < size - 1; i++) {
 
		for (int j = i + 1; j < size; j++) {
 
static bool ValidateIndustryLayout(const IndustryTileLayout &layout)
 
{
 
	const size_t size = layout.size();
 
	for (size_t i = 0; i < size - 1; i++) {
 
		for (size_t j = i + 1; j < size; j++) {
 
			if (layout[i].ti.x == layout[j].ti.x &&
 
					layout[i].ti.y == layout[j].ti.y) {
 
				return false;
 
			}
 
		}
 
	}
 
	return true;
 
}
 

	
 
/** Clean the tile table of the IndustrySpec if it's needed. */
 
static void CleanIndustryTileTable(IndustrySpec *ind)
 
{
 
	if (HasBit(ind->cleanup_flag, CLEAN_TILELAYOUT) && ind->table != nullptr) {
 
		for (int j = 0; j < ind->num_table; j++) {
 
			/* remove the individual layouts */
 
			free(ind->table[j]);
 
		}
 
		/* remove the layouts pointers */
 
		free(ind->table);
 
		ind->table = nullptr;
 
	}
 
}
 

	
 
/**
 
 * Define properties for industries
 
 * @param indid Local ID of the industry.
 
 * @param numinfo Number of subsequent industry IDs to change the property for.
 
 * @param prop The property to change.
 
 * @param buf The property value.
 
@@ -3449,16 +3435,16 @@ static ChangeInfoResult IndustriesChange
 
				}
 

	
 
				/* Allocate space for this industry.
 
				 * Only need to do it once. If ever it is called again, it should not
 
				 * do anything */
 
				if (*indspec == nullptr) {
 
					*indspec = CallocT<IndustrySpec>(1);
 
					*indspec = new IndustrySpec;
 
					indsp = *indspec;
 

	
 
					memcpy(indsp, &_origin_industry_specs[subs_id], sizeof(_industry_specs[subs_id]));
 
					*indsp = _origin_industry_specs[subs_id];
 
					indsp->enabled = true;
 
					indsp->grf_prop.local_id = indid + i;
 
					indsp->grf_prop.subst_id = subs_id;
 
					indsp->grf_prop.grffile = _cur.grffile;
 
					/* If the grf industry needs to check its surrounding upon creation, it should
 
					 * rely on callbacks, not on the original placement functions */
 
@@ -3478,118 +3464,107 @@ static ChangeInfoResult IndustriesChange
 
				indsp->grf_prop.override = ovrid;
 
				_industry_mngr.Add(indid + i, _cur.grffile->grfid, ovrid);
 
				break;
 
			}
 

	
 
			case 0x0A: { // Set industry layout(s)
 
				byte new_num_layouts = buf->ReadByte(); // Number of layaouts
 
				/* We read the total size in bytes, but we can't rely on the
 
				 * newgrf to provide a sane value. First assume the value is
 
				 * sane but later on we make sure we enlarge the array if the
 
				 * newgrf contains more data. Each tile uses either 3 or 5
 
				 * bytes, so to play it safe we assume 3. */
 
				uint32 def_num_tiles = buf->ReadDWord() / 3 + 1;
 
				IndustryTileTable **tile_table = CallocT<IndustryTileTable*>(new_num_layouts); // Table with tiles to compose an industry
 
				IndustryTileTable *itt = CallocT<IndustryTileTable>(def_num_tiles); // Temporary array to read the tile layouts from the GRF
 
				uint size;
 
				const IndustryTileTable *copy_from;
 

	
 
				try {
 
				byte new_num_layouts = buf->ReadByte();
 
				uint32 definition_size = buf->ReadDWord();
 
				uint32 bytes_read = 0;
 
				std::vector<IndustryTileLayout> new_layouts;
 
				IndustryTileLayout layout;
 

	
 
					for (byte j = 0; j < new_num_layouts; j++) {
 
					layout.clear();
 

	
 
						for (uint k = 0;; k++) {
 
							if (k >= def_num_tiles) {
 
						if (bytes_read >= definition_size) {
 
								grfmsg(3, "IndustriesChangeInfo: Incorrect size for industry tile layout definition for industry %u.", indid);
 
								/* Size reported by newgrf was not big enough so enlarge the array. */
 
								def_num_tiles *= 2;
 
								itt = ReallocT<IndustryTileTable>(itt, def_num_tiles);
 
							}
 

	
 
							itt[k].ti.x = buf->ReadByte(); // Offsets from northermost tile
 

	
 
							if (itt[k].ti.x == 0xFE && k == 0) {
 
							/* Avoid warning twice */
 
							definition_size = UINT32_MAX;
 
						}
 

	
 
						layout.push_back(IndustryTileLayoutTile{});
 
						IndustryTileLayoutTile &it = layout.back();
 

	
 
						it.ti.x = buf->ReadByte(); // Offsets from northermost tile
 
						++bytes_read;
 

	
 
						if (it.ti.x == 0xFE && k == 0) {
 
								/* This means we have to borrow the layout from an old industry */
 
								IndustryType type = buf->ReadByte();  // industry holding required layout
 
								byte laynbr = buf->ReadByte();        // layout number to borrow
 

	
 
								copy_from = _origin_industry_specs[type].table[laynbr];
 
								for (size = 1;; size++) {
 
									if (copy_from[size - 1].ti.x == -0x80 && copy_from[size - 1].ti.y == 0) break;
 
								}
 
								break;
 
							}
 

	
 
							itt[k].ti.y = buf->ReadByte(); // Or table definition finalisation
 

	
 
							if (itt[k].ti.x == 0 && itt[k].ti.y == 0x80) {
 
								/*  Not the same terminator.  The one we are using is rather
 
								 x = -80, y = x .  So, adjust it. */
 
								itt[k].ti.x = -0x80;
 
								itt[k].ti.y =  0;
 
								itt[k].gfx  =  0;
 

	
 
								size = k + 1;
 
								copy_from = itt;
 
								break;
 
							}
 

	
 
							itt[k].gfx = buf->ReadByte();
 

	
 
							if (itt[k].gfx == 0xFE) {
 
							IndustryType type = buf->ReadByte();
 
							byte laynbr = buf->ReadByte();
 
							bytes_read += 2;
 

	
 
							if (type >= lengthof(_origin_industry_specs)) {
 
								grfmsg(1, "IndustriesChangeInfo: Invalid original industry number for layout import, industry %u", indid);
 
								DisableGrf(STR_NEWGRF_ERROR_INVALID_ID);
 
								return CIR_DISABLED;
 
							}
 
							if (laynbr >= _origin_industry_specs[type].layouts.size()) {
 
								grfmsg(1, "IndustriesChangeInfo: Invalid original industry layout index for layout import, industry %u", indid);
 
								DisableGrf(STR_NEWGRF_ERROR_INVALID_ID);
 
								return CIR_DISABLED;
 
							}
 
							layout = _origin_industry_specs[type].layouts[laynbr];
 
							break;
 
						}
 

	
 
						it.ti.y = buf->ReadByte(); // Or table definition finalisation
 
						++bytes_read;
 

	
 
						if (it.ti.x == 0 && it.ti.y == 0x80) {
 
							/* Terminator, remove and finish up */
 
							layout.pop_back();
 
							break;
 
						}
 

	
 
						it.gfx = buf->ReadByte();
 
						++bytes_read;
 

	
 
						if (it.gfx == 0xFE) {
 
								/* Use a new tile from this GRF */
 
								int local_tile_id = buf->ReadWord();
 
							bytes_read += 2;
 

	
 
								/* Read the ID from the _industile_mngr. */
 
								int tempid = _industile_mngr.GetID(local_tile_id, _cur.grffile->grfid);
 

	
 
								if (tempid == INVALID_INDUSTRYTILE) {
 
									grfmsg(2, "IndustriesChangeInfo: Attempt to use industry tile %u with industry id %u, not yet defined. Ignoring.", local_tile_id, indid);
 
								} else {
 
									/* Declared as been valid, can be used */
 
									itt[k].gfx = tempid;
 
								}
 
							} else if (itt[k].gfx == 0xFF) {
 
								itt[k].ti.x = (int8)GB(itt[k].ti.x, 0, 8);
 
								itt[k].ti.y = (int8)GB(itt[k].ti.y, 0, 8);
 
								it.gfx = tempid;
 
							}
 
						} else if (it.gfx == 0xFF) {
 
							it.ti.x = (int8)GB(it.ti.x, 0, 8);
 
							it.ti.y = (int8)GB(it.ti.y, 0, 8);
 

	
 
								/* When there were only 256x256 maps, TileIndex was a uint16 and
 
								 * itt[k].ti was just a TileIndexDiff that was added to it.
 
								* it.ti was just a TileIndexDiff that was added to it.
 
								 * As such negative "x" values were shifted into the "y" position.
 
								 *   x = -1, y = 1 -> x = 255, y = 0
 
								 * Since GRF version 8 the position is interpreted as pair of independent int8.
 
								 * For GRF version < 8 we need to emulate the old shifting behaviour.
 
								 */
 
								if (_cur.grffile->grf_version < 8 && itt[k].ti.x < 0) itt[k].ti.y += 1;
 
							}
 
						}
 

	
 
						if (!ValidateIndustryLayout(copy_from, size)) {
 
							if (_cur.grffile->grf_version < 8 && it.ti.x < 0) it.ti.y += 1;
 
						}
 
					}
 

	
 
					if (!ValidateIndustryLayout(layout)) {
 
							/* The industry layout was not valid, so skip this one. */
 
							grfmsg(1, "IndustriesChangeInfo: Invalid industry layout for industry id %u. Ignoring", indid);
 
							new_num_layouts--;
 
							j--;
 
						} else {
 
							tile_table[j] = CallocT<IndustryTileTable>(size);
 
							memcpy(tile_table[j], copy_from, sizeof(*copy_from) * size);
 
						}
 
					}
 
				} catch (...) {
 
					for (int i = 0; i < new_num_layouts; i++) {
 
						free(tile_table[i]);
 
					}
 
					free(tile_table);
 
					free(itt);
 
					throw;
 
				}
 

	
 
				/* Clean the tile table if it was already set by a previous prop A. */
 
				CleanIndustryTileTable(indsp);
 
						new_layouts.push_back(layout);
 
					}
 
				}
 

	
 
				/* Install final layout construction in the industry spec */
 
				indsp->num_table = new_num_layouts;
 
				indsp->table = tile_table;
 
				SetBit(indsp->cleanup_flag, CLEAN_TILELAYOUT);
 
				free(itt);
 
				indsp->layouts = new_layouts;
 
				break;
 
			}
 

	
 
			case 0x0B: // Industry production flags
 
				indsp->life_type = (IndustryLifeType)buf->ReadByte();
 
				break;
 
@@ -8495,23 +8470,13 @@ static void ResetCustomIndustries()
 

	
 
		/* We are verifiying both tiles and industries specs loaded from the grf file
 
		 * First, let's deal with industryspec */
 
		if (industryspec != nullptr) {
 
			for (uint i = 0; i < NUM_INDUSTRYTYPES_PER_GRF; i++) {
 
				IndustrySpec *ind = industryspec[i];
 
				if (ind == nullptr) continue;
 

	
 
				/* We need to remove the sounds array */
 
				if (HasBit(ind->cleanup_flag, CLEAN_RANDOMSOUNDS)) {
 
					free(ind->random_sounds);
 
				}
 

	
 
				/* We need to remove the tiles layouts */
 
				CleanIndustryTileTable(ind);
 

	
 
				free(ind);
 
				delete ind;
 
			}
 

	
 
			free(industryspec);
 
			industryspec = nullptr;
 
		}
 

	
src/newgrf_commons.cpp
Show inline comments
 
@@ -276,13 +276,13 @@ void IndustryOverrideManager::SetEntityS
 
	if (ind_id == invalid_ID) {
 
		grfmsg(1, "Industry.SetEntitySpec: Too many industries allocated. Ignoring.");
 
		return;
 
	}
 

	
 
	/* Now that we know we can use the given id, copy the spec to its final destination... */
 
	memcpy(&_industry_specs[ind_id], inds, sizeof(*inds));
 
	_industry_specs[ind_id] = *inds;
 
	/* ... and mark it as usable*/
 
	_industry_specs[ind_id].enabled = true;
 
}
 

	
 
void IndustryTileOverrideManager::SetEntitySpec(const IndustryTileSpec *its)
 
{
src/newgrf_industries.cpp
Show inline comments
 
@@ -517,22 +517,22 @@ uint16 GetIndustryCallback(CallbackID ca
 
 * @param seed Seed for the random generator.
 
 * @param initial_random_bits The random bits the industry is going to have after construction.
 
 * @param founder Industry founder
 
 * @param creation_type The circumstances the industry is created under.
 
 * @return Succeeded or failed command.
 
 */
 
CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint layout, uint32 seed, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type)
 
CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, size_t layout, uint32 seed, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type)
 
{
 
	const IndustrySpec *indspec = GetIndustrySpec(type);
 

	
 
	Industry ind;
 
	ind.index = INVALID_INDUSTRY;
 
	ind.location.tile = tile;
 
	ind.location.w = 0; // important to mark the industry invalid
 
	ind.type = type;
 
	ind.selected_layout = layout;
 
	ind.selected_layout = (byte)layout;
 
	ind.town = ClosestTownFromTile(tile, UINT_MAX);
 
	ind.random = initial_random_bits;
 
	ind.founder = founder;
 
	ind.psa = nullptr;
 

	
 
	IndustriesResolverObject object(tile, &ind, type, seed, CBID_INDUSTRY_LOCATION, 0, creation_type);
src/newgrf_industries.h
Show inline comments
 
@@ -86,13 +86,13 @@ enum IndustryAvailabilityCallType {
 
};
 

	
 
/* in newgrf_industry.cpp */
 
uint16 GetIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile);
 
uint32 GetIndustryIDAtOffset(TileIndex new_tile, const Industry *i, uint32 cur_grfid);
 
void IndustryProductionCallback(Industry *ind, int reason);
 
CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint layout, uint32 seed, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type);
 
CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, size_t layout, uint32 seed, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type);
 
uint32 GetIndustryProbabilityCallback(IndustryType type, IndustryAvailabilityCallType creation_type, uint32 default_prob);
 
bool IndustryTemporarilyRefusesCargo(Industry *ind, CargoID cargo_type);
 

	
 
IndustryType MapNewGRFIndustryType(IndustryType grf_type, uint32 grf_id);
 

	
 
/* in newgrf_industrytiles.cpp*/
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -209,29 +209,29 @@ extern bool IsSlopeRefused(Slope current
 
 * Check the slope of a tile of a new industry.
 
 * @param ind_base_tile Base tile of the industry.
 
 * @param ind_tile      Tile to check.
 
 * @param its           Tile specification.
 
 * @param type          Industry type.
 
 * @param gfx           Gfx of the tile.
 
 * @param itspec_index  Layout.
 
 * @param layout_index  Layout.
 
 * @param initial_random_bits Random bits of industry after construction
 
 * @param founder       Industry founder
 
 * @param creation_type The circumstances the industry is created under.
 
 * @return Succeeded or failed command.
 
 */
 
CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, uint itspec_index, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type)
 
CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, size_t layout_index, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type)
 
{
 
	Industry ind;
 
	ind.index = INVALID_INDUSTRY;
 
	ind.location.tile = ind_base_tile;
 
	ind.location.w = 0;
 
	ind.type = type;
 
	ind.random = initial_random_bits;
 
	ind.founder = founder;
 

	
 
	uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, creation_type << 8 | itspec_index, gfx, &ind, ind_tile);
 
	uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, creation_type << 8 | (uint32)layout_index, gfx, &ind, ind_tile);
 
	if (callback_res == CALLBACK_FAILED) {
 
		if (!IsSlopeRefused(GetTileSlope(ind_tile), its->slopes_refused)) return CommandCost();
 
		return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 
	}
 
	if (its->grf_prop.grffile->grf_version < 7) {
 
		if (callback_res != 0) return CommandCost();
src/newgrf_industrytiles.h
Show inline comments
 
@@ -54,13 +54,13 @@ struct IndustryTileResolverObject : publ
 
		}
 
	}
 
};
 

	
 
bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds);
 
uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile);
 
CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, uint itspec_index, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type);
 
CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, size_t layout_index, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type);
 

	
 
void AnimateNewIndustryTile(TileIndex tile);
 
bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32 random = Random());
 
bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigger iat);
 

	
 

	
src/script/api/script_industrytype.cpp
Show inline comments
 
@@ -120,13 +120,14 @@
 
/* static */ bool ScriptIndustryType::BuildIndustry(IndustryType industry_type, TileIndex tile)
 
{
 
	EnforcePrecondition(false, CanBuildIndustry(industry_type));
 
	EnforcePrecondition(false, ScriptMap::IsValidTile(tile));
 

	
 
	uint32 seed = ::InteractiveRandom();
 
	return ScriptObject::DoCommand(tile, (1 << 16) | (::InteractiveRandomRange(::GetIndustrySpec(industry_type)->num_table) << 8) | industry_type, seed, CMD_BUILD_INDUSTRY);
 
	uint32 layout_index = ::InteractiveRandomRange((uint32)::GetIndustrySpec(industry_type)->layouts.size());
 
	return ScriptObject::DoCommand(tile, (1 << 16) | (layout_index << 8) | industry_type, seed, CMD_BUILD_INDUSTRY);
 
}
 

	
 
/* static */ bool ScriptIndustryType::ProspectIndustry(IndustryType industry_type)
 
{
 
	EnforcePrecondition(false, CanProspectIndustry(industry_type));
 

	
src/table/build_industry.h
Show inline comments
 
@@ -19,141 +19,127 @@
 
 * @param m index of the tile.
 
 * @see _industry_specs
 
 * @see IndustryTileTable
 
 */
 
#define MK(x, y, m) {{x, y}, m}
 

	
 
/**
 
 * Terminator of industry tiles layout definition
 
 */
 
#define MKEND {{-0x80, 0}, 0}
 

	
 
static const IndustryTileTable _tile_table_coal_mine_0[] = {
 
static const IndustryTileLayout _tile_table_coal_mine_0 {
 
	MK(1, 1, 0),
 
	MK(1, 2, 2),
 
	MK(0, 0, 5),
 
	MK(1, 0, 6),
 
	MK(2, 0, 3),
 
	MK(2, 2, 3),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_coal_mine_1[] = {
 
static const IndustryTileLayout _tile_table_coal_mine_1 {
 
	MK(1, 1, 0),
 
	MK(1, 2, 2),
 
	MK(2, 0, 0),
 
	MK(2, 1, 2),
 
	MK(1, 0, 3),
 
	MK(0, 0, 3),
 
	MK(0, 1, 4),
 
	MK(0, 2, 4),
 
	MK(2, 2, 4),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_coal_mine_2[] = {
 
static const IndustryTileLayout _tile_table_coal_mine_2 {
 
	MK(0, 0, 0),
 
	MK(0, 1, 2),
 
	MK(0, 2, 5),
 
	MK(1, 0, 3),
 
	MK(1, 1, 3),
 
	MK(1, 2, 6),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_coal_mine_3[] = {
 
static const IndustryTileLayout _tile_table_coal_mine_3 {
 
	MK(0, 1, 0),
 
	MK(0, 2, 2),
 
	MK(0, 3, 4),
 
	MK(1, 0, 5),
 
	MK(1, 1, 0),
 
	MK(1, 2, 2),
 
	MK(1, 3, 3),
 
	MK(2, 0, 6),
 
	MK(2, 1, 4),
 
	MK(2, 2, 3),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_coal_mine[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_coal_mine {
 
	_tile_table_coal_mine_0,
 
	_tile_table_coal_mine_1,
 
	_tile_table_coal_mine_2,
 
	_tile_table_coal_mine_3,
 
};
 

	
 
static const IndustryTileTable _tile_table_power_station_0[] = {
 
static const IndustryTileLayout _tile_table_power_station_0 {
 
	MK(0, 0, 7),
 
	MK(0, 1, 9),
 
	MK(1, 0, 7),
 
	MK(1, 1, 8),
 
	MK(2, 0, 7),
 
	MK(2, 1, 8),
 
	MK(3, 0, 10),
 
	MK(3, 1, 10),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_power_station_1[] = {
 
static const IndustryTileLayout _tile_table_power_station_1 {
 
	MK(0, 1, 7),
 
	MK(0, 2, 7),
 
	MK(1, 0, 8),
 
	MK(1, 1, 8),
 
	MK(1, 2, 7),
 
	MK(2, 0, 9),
 
	MK(2, 1, 10),
 
	MK(2, 2, 9),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_power_station_2[] = {
 
static const IndustryTileLayout _tile_table_power_station_2 {
 
	MK(0, 0, 7),
 
	MK(0, 1, 7),
 
	MK(1, 0, 9),
 
	MK(1, 1, 8),
 
	MK(2, 0, 10),
 
	MK(2, 1, 9),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_power_station[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_power_station {
 
	_tile_table_power_station_0,
 
	_tile_table_power_station_1,
 
	_tile_table_power_station_2,
 
};
 

	
 
static const IndustryTileTable _tile_table_sawmill_0[] = {
 
static const IndustryTileLayout _tile_table_sawmill_0 {
 
	MK(1, 0, 14),
 
	MK(1, 1, 12),
 
	MK(1, 2, 11),
 
	MK(2, 0, 14),
 
	MK(2, 1, 13),
 
	MK(0, 0, 15),
 
	MK(0, 1, 15),
 
	MK(0, 2, 12),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_sawmill_1[] = {
 
static const IndustryTileLayout _tile_table_sawmill_1 {
 
	MK(0, 0, 15),
 
	MK(0, 1, 11),
 
	MK(0, 2, 14),
 
	MK(1, 0, 15),
 
	MK(1, 1, 13),
 
	MK(1, 2, 12),
 
	MK(2, 0, 11),
 
	MK(2, 1, 13),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_sawmill[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_sawmill {
 
	_tile_table_sawmill_0,
 
	_tile_table_sawmill_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_forest_0[] = {
 
static const IndustryTileLayout _tile_table_forest_0 {
 
	MK(0, 0, 16),
 
	MK(0, 1, 16),
 
	MK(0, 2, 16),
 
	MK(0, 3, 16),
 
	MK(1, 0, 16),
 
	MK(1, 1, 16),
 
@@ -166,16 +152,15 @@ static const IndustryTileTable _tile_tab
 
	MK(3, 0, 16),
 
	MK(3, 1, 16),
 
	MK(3, 2, 16),
 
	MK(3, 3, 16),
 
	MK(1, 4, 16),
 
	MK(2, 4, 16),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_forest_1[] = {
 
static const IndustryTileLayout _tile_table_forest_1 {
 
	MK(0, 0, 16),
 
	MK(1, 0, 16),
 
	MK(2, 0, 16),
 
	MK(3, 0, 16),
 
	MK(4, 0, 16),
 
	MK(0, 1, 16),
 
@@ -193,21 +178,20 @@ static const IndustryTileTable _tile_tab
 
	MK(2, 3, 16),
 
	MK(3, 3, 16),
 
	MK(4, 3, 16),
 
	MK(1, 4, 16),
 
	MK(2, 4, 16),
 
	MK(3, 4, 16),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_forest[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_forest {
 
	_tile_table_forest_0,
 
	_tile_table_forest_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_oil_refinery_0[] = {
 
static const IndustryTileLayout _tile_table_oil_refinery_0 {
 
	MK(0, 0, 20),
 
	MK(0, 1, 21),
 
	MK(0, 2, 22),
 
	MK(0, 3, 21),
 
	MK(1, 0, 20),
 
	MK(1, 1, 19),
 
@@ -217,16 +201,15 @@ static const IndustryTileTable _tile_tab
 
	MK(2, 2, 18),
 
	MK(2, 3, 18),
 
	MK(3, 2, 18),
 
	MK(3, 3, 18),
 
	MK(2, 0, 23),
 
	MK(3, 1, 23),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_oil_refinery_1[] = {
 
static const IndustryTileLayout _tile_table_oil_refinery_1 {
 
	MK(0, 0, 18),
 
	MK(0, 1, 18),
 
	MK(0, 2, 21),
 
	MK(0, 3, 22),
 
	MK(0, 4, 20),
 
	MK(1, 0, 18),
 
@@ -236,21 +219,20 @@ static const IndustryTileTable _tile_tab
 
	MK(2, 0, 18),
 
	MK(2, 1, 18),
 
	MK(2, 2, 19),
 
	MK(2, 3, 22),
 
	MK(1, 4, 23),
 
	MK(2, 4, 23),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_oil_refinery[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_oil_refinery {
 
	_tile_table_oil_refinery_0,
 
	_tile_table_oil_refinery_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_oil_rig_0[] = {
 
static const IndustryTileLayout _tile_table_oil_rig_0 {
 
	MK(0, 0, 24),
 
	MK(0, 1, 24),
 
	MK(0, 2, 25),
 
	MK(1, 0, 26),
 
	MK(1, 1, 27),
 
	MK(1, 2, 28),
 
@@ -303,110 +285,104 @@ static const IndustryTileTable _tile_tab
 
	MK(-1, 3, 255),
 
	MK(0, 3, 255),
 
	MK(1, 3, 255),
 
	MK(2, 3, 255),
 
	MK(2, 2, 255),
 
	MK(2, 1, 255),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_oil_rig[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_oil_rig {
 
	_tile_table_oil_rig_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_factory_0[] = {
 
static const IndustryTileLayout _tile_table_factory_0 {
 
	MK(0, 0, 39),
 
	MK(0, 1, 40),
 
	MK(1, 0, 41),
 
	MK(1, 1, 42),
 
	MK(0, 2, 39),
 
	MK(0, 3, 40),
 
	MK(1, 2, 41),
 
	MK(1, 3, 42),
 
	MK(2, 1, 39),
 
	MK(2, 2, 40),
 
	MK(3, 1, 41),
 
	MK(3, 2, 42),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_factory_1[] = {
 
static const IndustryTileLayout _tile_table_factory_1 {
 
	MK(0, 0, 39),
 
	MK(0, 1, 40),
 
	MK(1, 0, 41),
 
	MK(1, 1, 42),
 
	MK(2, 0, 39),
 
	MK(2, 1, 40),
 
	MK(3, 0, 41),
 
	MK(3, 1, 42),
 
	MK(1, 2, 39),
 
	MK(1, 3, 40),
 
	MK(2, 2, 41),
 
	MK(2, 3, 42),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_factory[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_factory {
 
	_tile_table_factory_0,
 
	_tile_table_factory_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_printing_works_0[] = {
 
static const IndustryTileLayout _tile_table_printing_works_0 {
 
	MK(0, 0, 43),
 
	MK(0, 1, 44),
 
	MK(1, 0, 45),
 
	MK(1, 1, 46),
 
	MK(0, 2, 43),
 
	MK(0, 3, 44),
 
	MK(1, 2, 45),
 
	MK(1, 3, 46),
 
	MK(2, 1, 43),
 
	MK(2, 2, 44),
 
	MK(3, 1, 45),
 
	MK(3, 2, 46),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_printing_works_1[] = {
 
static const IndustryTileLayout _tile_table_printing_works_1 {
 
	MK(0, 0, 43),
 
	MK(0, 1, 44),
 
	MK(1, 0, 45),
 
	MK(1, 1, 46),
 
	MK(2, 0, 43),
 
	MK(2, 1, 44),
 
	MK(3, 0, 45),
 
	MK(3, 1, 46),
 
	MK(1, 2, 43),
 
	MK(1, 3, 44),
 
	MK(2, 2, 45),
 
	MK(2, 3, 46),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_printing_works[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_printing_works {
 
	_tile_table_printing_works_0,
 
	_tile_table_printing_works_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_steel_mill_0[] = {
 
static const IndustryTileLayout _tile_table_steel_mill_0 {
 
	MK(2, 1, 52),
 
	MK(2, 2, 53),
 
	MK(3, 1, 54),
 
	MK(3, 2, 55),
 
	MK(0, 0, 56),
 
	MK(1, 0, 57),
 
	MK(0, 1, 56),
 
	MK(1, 1, 57),
 
	MK(0, 2, 56),
 
	MK(1, 2, 57),
 
	MK(2, 0, 56),
 
	MK(3, 0, 57),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_steel_mill_1[] = {
 
static const IndustryTileLayout _tile_table_steel_mill_1 {
 
	MK(0, 0, 52),
 
	MK(0, 1, 53),
 
	MK(1, 0, 54),
 
	MK(1, 1, 55),
 
	MK(2, 0, 52),
 
	MK(2, 1, 53),
 
@@ -415,151 +391,141 @@ static const IndustryTileTable _tile_tab
 
	MK(0, 2, 56),
 
	MK(1, 2, 57),
 
	MK(2, 2, 56),
 
	MK(3, 2, 57),
 
	MK(1, 3, 56),
 
	MK(2, 3, 57),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_steel_mill[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_steel_mill {
 
	_tile_table_steel_mill_0,
 
	_tile_table_steel_mill_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_farm_0[] = {
 
static const IndustryTileLayout _tile_table_farm_0 {
 
	MK(1, 0, 33),
 
	MK(1, 1, 34),
 
	MK(1, 2, 36),
 
	MK(0, 0, 37),
 
	MK(0, 1, 37),
 
	MK(0, 2, 36),
 
	MK(2, 0, 35),
 
	MK(2, 1, 38),
 
	MK(2, 2, 38),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_farm_1[] = {
 
static const IndustryTileLayout _tile_table_farm_1 {
 
	MK(1, 1, 33),
 
	MK(1, 2, 34),
 
	MK(0, 0, 35),
 
	MK(0, 1, 36),
 
	MK(0, 2, 36),
 
	MK(0, 3, 35),
 
	MK(1, 0, 37),
 
	MK(1, 3, 38),
 
	MK(2, 0, 37),
 
	MK(2, 1, 37),
 
	MK(2, 2, 38),
 
	MK(2, 3, 38),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_farm_2[] = {
 
static const IndustryTileLayout _tile_table_farm_2 {
 
	MK(2, 0, 33),
 
	MK(2, 1, 34),
 
	MK(0, 0, 36),
 
	MK(0, 1, 36),
 
	MK(0, 2, 37),
 
	MK(0, 3, 37),
 
	MK(1, 0, 35),
 
	MK(1, 1, 38),
 
	MK(1, 2, 38),
 
	MK(1, 3, 37),
 
	MK(2, 2, 37),
 
	MK(2, 3, 35),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_farm[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_farm {
 
	_tile_table_farm_0,
 
	_tile_table_farm_1,
 
	_tile_table_farm_2,
 
};
 

	
 
static const IndustryTileTable _tile_table_copper_mine_0[] = {
 
static const IndustryTileLayout _tile_table_copper_mine_0 {
 
	MK(0, 0, 47),
 
	MK(0, 1, 49),
 
	MK(0, 2, 51),
 
	MK(1, 0, 47),
 
	MK(1, 1, 49),
 
	MK(1, 2, 50),
 
	MK(2, 0, 51),
 
	MK(2, 1, 51),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_copper_mine_1[] = {
 
static const IndustryTileLayout _tile_table_copper_mine_1 {
 
	MK(0, 0, 50),
 
	MK(0, 1, 47),
 
	MK(0, 2, 49),
 
	MK(1, 0, 47),
 
	MK(1, 1, 49),
 
	MK(1, 2, 51),
 
	MK(2, 0, 51),
 
	MK(2, 1, 47),
 
	MK(2, 2, 49),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_copper_mine[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_copper_mine {
 
	_tile_table_copper_mine_0,
 
	_tile_table_copper_mine_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_oil_well_0[] = {
 
static const IndustryTileLayout _tile_table_oil_well_0 {
 
	MK(0, 0, 29),
 
	MK(1, 0, 29),
 
	MK(2, 0, 29),
 
	MK(0, 1, 29),
 
	MK(0, 2, 29),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_oil_well_1[] = {
 
static const IndustryTileLayout _tile_table_oil_well_1 {
 
	MK(0, 0, 29),
 
	MK(1, 0, 29),
 
	MK(1, 1, 29),
 
	MK(2, 2, 29),
 
	MK(2, 3, 29),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_oil_well[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_oil_well {
 
	_tile_table_oil_well_0,
 
	_tile_table_oil_well_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_bank_0[] = {
 
static const IndustryTileLayout _tile_table_bank_0 {
 
	MK(0, 0, 58),
 
	MK(1, 0, 59),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_bank[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_bank {
 
	_tile_table_bank_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_food_process_0[] = {
 
static const IndustryTileLayout _tile_table_food_process_0 {
 
	MK(0, 0, 60),
 
	MK(1, 0, 60),
 
	MK(2, 0, 60),
 
	MK(0, 1, 60),
 
	MK(1, 1, 60),
 
	MK(2, 1, 60),
 
	MK(0, 2, 61),
 
	MK(1, 2, 61),
 
	MK(2, 2, 63),
 
	MK(0, 3, 62),
 
	MK(1, 3, 62),
 
	MK(2, 3, 63),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_food_process_1[] = {
 
static const IndustryTileLayout _tile_table_food_process_1 {
 
	MK(0, 0, 61),
 
	MK(1, 0, 60),
 
	MK(2, 0, 61),
 
	MK(3, 0, 61),
 
	MK(0, 1, 62),
 
	MK(1, 1, 63),
 
@@ -568,41 +534,39 @@ static const IndustryTileTable _tile_tab
 
	MK(0, 2, 60),
 
	MK(1, 2, 60),
 
	MK(2, 2, 60),
 
	MK(3, 2, 60),
 
	MK(0, 3, 62),
 
	MK(1, 3, 62),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_food_process[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_food_process {
 
	_tile_table_food_process_0,
 
	_tile_table_food_process_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_paper_mill_0[] = {
 
static const IndustryTileLayout _tile_table_paper_mill_0 {
 
	MK(0, 0, 64),
 
	MK(1, 0, 65),
 
	MK(2, 0, 66),
 
	MK(3, 0, 67),
 
	MK(0, 1, 68),
 
	MK(1, 1, 69),
 
	MK(2, 1, 67),
 
	MK(3, 1, 67),
 
	MK(0, 2, 66),
 
	MK(1, 2, 71),
 
	MK(2, 2, 71),
 
	MK(3, 2, 70),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_paper_mill[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_paper_mill {
 
	_tile_table_paper_mill_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_gold_mine_0[] = {
 
static const IndustryTileLayout _tile_table_gold_mine_0 {
 
	MK(0, 0, 72),
 
	MK(0, 1, 73),
 
	MK(0, 2, 74),
 
	MK(0, 3, 75),
 
	MK(1, 0, 76),
 
	MK(1, 1, 77),
 
@@ -613,47 +577,44 @@ static const IndustryTileTable _tile_tab
 
	MK(2, 2, 82),
 
	MK(2, 3, 83),
 
	MK(3, 0, 84),
 
	MK(3, 1, 85),
 
	MK(3, 2, 86),
 
	MK(3, 3, 87),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_gold_mine[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_gold_mine {
 
	_tile_table_gold_mine_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_bank2_0[] = {
 
static const IndustryTileLayout _tile_table_bank2_0 {
 
	MK(0, 0, 89),
 
	MK(1, 0, 90),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_bank2[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_bank2 {
 
	_tile_table_bank2_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_diamond_mine_0[] = {
 
static const IndustryTileLayout _tile_table_diamond_mine_0 {
 
	MK(0, 0, 91),
 
	MK(0, 1, 92),
 
	MK(0, 2, 93),
 
	MK(1, 0, 94),
 
	MK(1, 1, 95),
 
	MK(1, 2, 96),
 
	MK(2, 0, 97),
 
	MK(2, 1, 98),
 
	MK(2, 2, 99),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_diamond_mine[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_diamond_mine {
 
	_tile_table_diamond_mine_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_iron_mine_0[] = {
 
static const IndustryTileLayout _tile_table_iron_mine_0 {
 
	MK(0, 0, 100),
 
	MK(0, 1, 101),
 
	MK(0, 2, 102),
 
	MK(0, 3, 103),
 
	MK(1, 0, 104),
 
	MK(1, 1, 105),
 
@@ -664,20 +625,19 @@ static const IndustryTileTable _tile_tab
 
	MK(2, 2, 110),
 
	MK(2, 3, 111),
 
	MK(3, 0, 112),
 
	MK(3, 1, 113),
 
	MK(3, 2, 114),
 
	MK(3, 3, 115),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_iron_mine[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_iron_mine {
 
	_tile_table_iron_mine_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_fruit_plantation_0[] = {
 
static const IndustryTileLayout _tile_table_fruit_plantation_0 {
 
	MK(0, 0, 116),
 
	MK(0, 1, 116),
 
	MK(0, 2, 116),
 
	MK(0, 3, 116),
 
	MK(1, 0, 116),
 
	MK(1, 1, 116),
 
@@ -692,20 +652,19 @@ static const IndustryTileTable _tile_tab
 
	MK(3, 2, 116),
 
	MK(3, 3, 116),
 
	MK(4, 0, 116),
 
	MK(4, 1, 116),
 
	MK(4, 2, 116),
 
	MK(4, 3, 116),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_fruit_plantation[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_fruit_plantation {
 
	_tile_table_fruit_plantation_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_rubber_plantation_0[] = {
 
static const IndustryTileLayout _tile_table_rubber_plantation_0 {
 
	MK(0, 0, 117),
 
	MK(0, 1, 117),
 
	MK(0, 2, 117),
 
	MK(0, 3, 117),
 
	MK(1, 0, 117),
 
	MK(1, 1, 117),
 
@@ -720,133 +679,124 @@ static const IndustryTileTable _tile_tab
 
	MK(3, 2, 117),
 
	MK(3, 3, 117),
 
	MK(4, 0, 117),
 
	MK(4, 1, 117),
 
	MK(4, 2, 117),
 
	MK(4, 3, 117),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_rubber_plantation[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_rubber_plantation {
 
	_tile_table_rubber_plantation_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_water_supply_0[] = {
 
static const IndustryTileLayout _tile_table_water_supply_0 {
 
	MK(0, 0, 118),
 
	MK(0, 1, 119),
 
	MK(1, 0, 118),
 
	MK(1, 1, 119),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_water_supply[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_water_supply {
 
	_tile_table_water_supply_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_water_tower_0[] = {
 
static const IndustryTileLayout _tile_table_water_tower_0 {
 
	MK(0, 0, 120),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_water_tower[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_water_tower {
 
	_tile_table_water_tower_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_factory2_0[] = {
 
static const IndustryTileLayout _tile_table_factory2_0 {
 
	MK(0, 0, 121),
 
	MK(0, 1, 122),
 
	MK(1, 0, 123),
 
	MK(1, 1, 124),
 
	MK(0, 2, 121),
 
	MK(0, 3, 122),
 
	MK(1, 2, 123),
 
	MK(1, 3, 124),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_factory2_1[] = {
 
static const IndustryTileLayout _tile_table_factory2_1 {
 
	MK(0, 0, 121),
 
	MK(0, 1, 122),
 
	MK(1, 0, 123),
 
	MK(1, 1, 124),
 
	MK(2, 0, 121),
 
	MK(2, 1, 122),
 
	MK(3, 0, 123),
 
	MK(3, 1, 124),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_factory2[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_factory2 {
 
	_tile_table_factory2_0,
 
	_tile_table_factory2_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_farm2_0[] = {
 
static const IndustryTileLayout _tile_table_farm2_0 {
 
	MK(1, 0, 33),
 
	MK(1, 1, 34),
 
	MK(1, 2, 36),
 
	MK(0, 0, 37),
 
	MK(0, 1, 37),
 
	MK(0, 2, 36),
 
	MK(2, 0, 35),
 
	MK(2, 1, 38),
 
	MK(2, 2, 38),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_farm2_1[] = {
 
static const IndustryTileLayout _tile_table_farm2_1 {
 
	MK(1, 1, 33),
 
	MK(1, 2, 34),
 
	MK(0, 0, 35),
 
	MK(0, 1, 36),
 
	MK(0, 2, 36),
 
	MK(0, 3, 35),
 
	MK(1, 0, 37),
 
	MK(1, 3, 38),
 
	MK(2, 0, 37),
 
	MK(2, 1, 37),
 
	MK(2, 2, 38),
 
	MK(2, 3, 38),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_farm2_2[] = {
 
static const IndustryTileLayout _tile_table_farm2_2 {
 
	MK(2, 0, 33),
 
	MK(2, 1, 34),
 
	MK(0, 0, 36),
 
	MK(0, 1, 36),
 
	MK(0, 2, 37),
 
	MK(0, 3, 37),
 
	MK(1, 0, 35),
 
	MK(1, 1, 38),
 
	MK(1, 2, 38),
 
	MK(1, 3, 37),
 
	MK(2, 2, 37),
 
	MK(2, 3, 35),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_farm2[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_farm2 {
 
	_tile_table_farm2_0,
 
	_tile_table_farm2_1,
 
	_tile_table_farm2_2,
 
};
 

	
 
static const IndustryTileTable _tile_table_lumber_mill_0[] = {
 
static const IndustryTileLayout _tile_table_lumber_mill_0 {
 
	MK(0, 0, 125),
 
	MK(0, 1, 126),
 
	MK(1, 0, 127),
 
	MK(1, 1, 128),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_lumber_mill[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_lumber_mill {
 
	_tile_table_lumber_mill_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_cotton_candy_0[] = {
 
static const IndustryTileLayout _tile_table_cotton_candy_0 {
 
	MK(0, 0, 129),
 
	MK(0, 1, 129),
 
	MK(0, 2, 129),
 
	MK(0, 3, 129),
 
	MK(1, 0, 129),
 
	MK(1, 1, 129),
 
@@ -859,16 +809,15 @@ static const IndustryTileTable _tile_tab
 
	MK(3, 0, 129),
 
	MK(3, 1, 129),
 
	MK(3, 2, 129),
 
	MK(3, 3, 129),
 
	MK(1, 4, 129),
 
	MK(2, 4, 129),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_cotton_candy_1[] = {
 
static const IndustryTileLayout _tile_table_cotton_candy_1 {
 
	MK(0, 0, 129),
 
	MK(1, 0, 129),
 
	MK(2, 0, 129),
 
	MK(3, 0, 129),
 
	MK(4, 0, 129),
 
	MK(0, 1, 129),
 
@@ -886,58 +835,55 @@ static const IndustryTileTable _tile_tab
 
	MK(2, 3, 129),
 
	MK(3, 3, 129),
 
	MK(4, 3, 129),
 
	MK(1, 4, 129),
 
	MK(2, 4, 129),
 
	MK(3, 4, 129),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_cotton_candy[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_cotton_candy {
 
	_tile_table_cotton_candy_0,
 
	_tile_table_cotton_candy_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_candy_factory_0[] = {
 
static const IndustryTileLayout _tile_table_candy_factory_0 {
 
	MK(0, 0, 131),
 
	MK(0, 1, 132),
 
	MK(1, 0, 133),
 
	MK(1, 1, 134),
 
	MK(0, 2, 131),
 
	MK(0, 3, 132),
 
	MK(1, 2, 133),
 
	MK(1, 3, 134),
 
	MK(2, 1, 131),
 
	MK(2, 2, 132),
 
	MK(3, 1, 133),
 
	MK(3, 2, 134),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_candy_factory_1[] = {
 
static const IndustryTileLayout _tile_table_candy_factory_1 {
 
	MK(0, 0, 131),
 
	MK(0, 1, 132),
 
	MK(1, 0, 133),
 
	MK(1, 1, 134),
 
	MK(2, 0, 131),
 
	MK(2, 1, 132),
 
	MK(3, 0, 133),
 
	MK(3, 1, 134),
 
	MK(1, 2, 131),
 
	MK(1, 3, 132),
 
	MK(2, 2, 133),
 
	MK(2, 3, 134),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_candy_factory[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_candy_factory {
 
	_tile_table_candy_factory_0,
 
	_tile_table_candy_factory_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_battery_farm_0[] = {
 
static const IndustryTileLayout _tile_table_battery_farm_0 {
 
	MK(0, 0, 135),
 
	MK(0, 1, 135),
 
	MK(0, 2, 135),
 
	MK(0, 3, 135),
 
	MK(1, 0, 135),
 
	MK(1, 1, 135),
 
@@ -952,155 +898,143 @@ static const IndustryTileTable _tile_tab
 
	MK(3, 2, 135),
 
	MK(3, 3, 135),
 
	MK(4, 0, 135),
 
	MK(4, 1, 135),
 
	MK(4, 2, 135),
 
	MK(4, 3, 135),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_battery_farm[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_battery_farm {
 
	_tile_table_battery_farm_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_cola_wells_0[] = {
 
static const IndustryTileLayout _tile_table_cola_wells_0 {
 
	MK(0, 0, 137),
 
	MK(0, 1, 137),
 
	MK(0, 2, 137),
 
	MK(1, 0, 137),
 
	MK(1, 1, 137),
 
	MK(1, 2, 137),
 
	MK(2, 1, 137),
 
	MK(2, 2, 137),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_cola_wells_1[] = {
 
static const IndustryTileLayout _tile_table_cola_wells_1 {
 
	MK(0, 1, 137),
 
	MK(0, 2, 137),
 
	MK(0, 3, 137),
 
	MK(1, 0, 137),
 
	MK(1, 1, 137),
 
	MK(1, 2, 137),
 
	MK(2, 1, 137),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_cola_wells[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_cola_wells {
 
	_tile_table_cola_wells_0,
 
	_tile_table_cola_wells_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_toy_shop_0[] = {
 
static const IndustryTileLayout _tile_table_toy_shop_0 {
 
	MK(0, 0, 138),
 
	MK(0, 1, 139),
 
	MK(1, 0, 140),
 
	MK(1, 1, 141),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_toy_shop[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_toy_shop {
 
	_tile_table_toy_shop_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_toy_factory_0[] = {
 
static const IndustryTileLayout _tile_table_toy_factory_0 {
 
	MK(0, 0, 147),
 
	MK(0, 1, 142),
 
	MK(1, 0, 147),
 
	MK(1, 1, 143),
 
	MK(2, 0, 147),
 
	MK(2, 1, 144),
 
	MK(3, 0, 146),
 
	MK(3, 1, 145),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_toy_factory[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_toy_factory {
 
	_tile_table_toy_factory_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_plastic_fountain_0[] = {
 
static const IndustryTileLayout _tile_table_plastic_fountain_0 {
 
	MK(0, 0, 148),
 
	MK(0, 1, 151),
 
	MK(0, 2, 154),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable _tile_table_plastic_fountain_1[] = {
 
static const IndustryTileLayout _tile_table_plastic_fountain_1 {
 
	MK(0, 0, 148),
 
	MK(1, 0, 151),
 
	MK(2, 0, 154),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_plastic_fountain[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_plastic_fountain {
 
	_tile_table_plastic_fountain_0,
 
	_tile_table_plastic_fountain_1,
 
};
 

	
 
static const IndustryTileTable _tile_table_fizzy_drink_0[] = {
 
static const IndustryTileLayout _tile_table_fizzy_drink_0 {
 
	MK(0, 0, 156),
 
	MK(0, 1, 157),
 
	MK(1, 0, 158),
 
	MK(1, 1, 159),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_fizzy_drink[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_fizzy_drink {
 
	_tile_table_fizzy_drink_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_bubble_generator_0[] = {
 
static const IndustryTileLayout _tile_table_bubble_generator_0 {
 
	MK(0, 0, 163),
 
	MK(0, 1, 160),
 
	MK(1, 0, 163),
 
	MK(1, 1, 161),
 
	MK(2, 0, 163),
 
	MK(2, 1, 162),
 
	MK(0, 2, 163),
 
	MK(0, 3, 160),
 
	MK(1, 2, 163),
 
	MK(1, 3, 161),
 
	MK(2, 2, 163),
 
	MK(2, 3, 162),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_bubble_generator[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_bubble_generator {
 
	_tile_table_bubble_generator_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_toffee_quarry_0[] = {
 
static const IndustryTileLayout _tile_table_toffee_quarry_0 {
 
	MK(0, 0, 164),
 
	MK(1, 0, 165),
 
	MK(2, 0, 166),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_toffee_quarry[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_toffee_quarry {
 
	_tile_table_toffee_quarry_0,
 
};
 

	
 
static const IndustryTileTable _tile_table_sugar_mine_0[] = {
 
static const IndustryTileLayout _tile_table_sugar_mine_0 {
 
	MK(0, 0, 167),
 
	MK(0, 1, 168),
 
	MK(1, 0, 169),
 
	MK(1, 1, 170),
 
	MK(2, 0, 171),
 
	MK(2, 1, 172),
 
	MK(3, 0, 173),
 
	MK(3, 1, 174),
 
	MKEND
 
};
 

	
 
static const IndustryTileTable * const _tile_table_sugar_mine[] = {
 
static const std::vector<IndustryTileLayout> _tile_table_sugar_mine {
 
	_tile_table_sugar_mine_0,
 
};
 

	
 
#undef MK
 
#undef MKEND
 

	
 
/** Array with saw sound, for sawmill */
 
static const uint8 _sawmill_sounds[] = { SND_28_SAWMILL };
 

	
 
/** Array with whistle sound, for factory */
 
static const uint8 _factory_sounds[] = { SND_03_FACTORY_WHISTLE };
 
@@ -1192,13 +1126,13 @@ enum IndustryTypes {
 
 * @param s2   text for production up
 
 * @param s3   text for production down
 
 */
 

	
 
#define MI(tbl, sndc, snd, d, pc, ai1, ai2, ai3, ai4, ag1, ag2, ag3, ag4, col, \
 
			c1, c2, c3, proc, p1, r1, p2, r2, m, a1, im1, a2, im2, a3, im3, pr, clim, bev, in, intx, s1, s2, s3) \
 
		{tbl, lengthof(tbl), d, 0, pc, {c1, c2, c3}, proc, \
 
		{tbl, d, 0, pc, {c1, c2, c3}, proc, \
 
		{p1, p2, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID}, \
 
		{r1, r2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, m, \
 
		{a1, a2, a3, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID}, \
 
		{{im1, 0}, {im2, 0}, {im3, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, \
 
		pr, clim, bev, col, in, intx, s1, s2, s3, STR_UNDEFINED, {ai1, ai2, ai3, ai4}, {ag1, ag2, ag3, ag4}, \
 
		sndc, snd, 0, 0, true, GRFFileProps(INVALID_INDUSTRYTYPE)}
0 comments (0 inline, 0 general)