Update to 1.10.0-beta1
This commit is contained in:
@@ -71,11 +71,15 @@ IndustryBuildData _industry_builder; ///< In-game manager of industries.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
@@ -101,7 +105,7 @@ IndustryType GetIndustryType(TileIndex tile)
|
||||
assert(IsTileType(tile, MP_INDUSTRY));
|
||||
|
||||
const Industry *ind = Industry::GetByTile(tile);
|
||||
assert(ind != NULL);
|
||||
assert(ind != nullptr);
|
||||
return ind->type;
|
||||
}
|
||||
|
||||
@@ -155,9 +159,15 @@ Industry::~Industry()
|
||||
}
|
||||
}
|
||||
|
||||
if (this->neutral_station != nullptr) {
|
||||
/* Remove possible docking tiles */
|
||||
TILE_AREA_LOOP(tile_cur, this->location) {
|
||||
ClearDockingTilesCheckingNeighbours(tile_cur);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetIndustrySpec(this->type)->behaviour & INDUSTRYBEH_PLANT_FIELDS) {
|
||||
TileArea ta(this->location.tile - TileDiffXY(min(TileX(this->location.tile), 21), min(TileY(this->location.tile), 21)), 42, 42);
|
||||
ta.ClampToMap();
|
||||
TileArea ta = TileArea(this->location.tile, 0, 0).Expand(21);
|
||||
|
||||
/* Remove the farmland and convert it to regular tiles over time. */
|
||||
TILE_AREA_LOOP(tile_cur, ta) {
|
||||
@@ -182,6 +192,10 @@ Industry::~Industry()
|
||||
|
||||
DeleteSubsidyWith(ST_INDUSTRY, this->index);
|
||||
CargoPacket::InvalidateAllFrom(ST_INDUSTRY, this->index);
|
||||
|
||||
for (Station *st : this->stations_near) {
|
||||
st->industries_near.erase(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,17 +205,16 @@ Industry::~Industry()
|
||||
void Industry::PostDestructor(size_t index)
|
||||
{
|
||||
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 0);
|
||||
Station::RecomputeIndustriesNearForAll();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a random valid industry.
|
||||
* @return random industry, NULL if there are no industries
|
||||
* @return random industry, nullptr if there are no industries
|
||||
*/
|
||||
/* static */ Industry *Industry::GetRandom()
|
||||
{
|
||||
if (Industry::GetNumItems() == 0) return NULL;
|
||||
if (Industry::GetNumItems() == 0) return nullptr;
|
||||
int num = RandomRange((uint16)Industry::GetNumItems());
|
||||
size_t index = MAX_UVALUE(size_t);
|
||||
|
||||
@@ -313,7 +326,7 @@ static void DrawTile_Industry(TileInfo *ti)
|
||||
* DrawNewIndustry will return false if ever the resolver could not
|
||||
* find any sprite to display. So in this case, we will jump on the
|
||||
* substitute gfx instead. */
|
||||
if (indts->grf_prop.spritegroup[0] != NULL && DrawNewIndustryTile(ti, ind, gfx, indts)) {
|
||||
if (indts->grf_prop.spritegroup[0] != nullptr && DrawNewIndustryTile(ti, ind, gfx, indts)) {
|
||||
return;
|
||||
} else {
|
||||
/* No sprite group (or no valid one) found, meaning no graphics associated.
|
||||
@@ -382,7 +395,7 @@ static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh)
|
||||
*/
|
||||
if (gfx >= NEW_INDUSTRYTILEOFFSET) {
|
||||
const IndustryTileSpec *indts = GetIndustryTileSpec(gfx);
|
||||
if (indts->grf_prop.spritegroup[0] != NULL && HasBit(indts->callback_mask, CBM_INDT_DRAW_FOUNDATIONS)) {
|
||||
if (indts->grf_prop.spritegroup[0] != nullptr && HasBit(indts->callback_mask, CBM_INDT_DRAW_FOUNDATIONS)) {
|
||||
uint32 callback_res = GetIndustryTileCallback(CBID_INDTILE_DRAW_FOUNDATIONS, 0, 0, gfx, Industry::GetByTile(tile), tile);
|
||||
if (callback_res != CALLBACK_FAILED && !ConvertBooleanCallback(indts->grf_prop.grffile, CBID_INDTILE_DRAW_FOUNDATIONS, callback_res)) return FOUNDATION_NONE;
|
||||
}
|
||||
@@ -472,7 +485,7 @@ static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
|
||||
td->str = STR_LAI_TOWN_INDUSTRY_DESCRIPTION_UNDER_CONSTRUCTION;
|
||||
}
|
||||
|
||||
if (is->grf_prop.grffile != NULL) {
|
||||
if (is->grf_prop.grffile != nullptr) {
|
||||
td->grf = GetGRFConfig(is->grf_prop.grffile->grfid)->GetName();
|
||||
}
|
||||
}
|
||||
@@ -516,8 +529,6 @@ static bool TransportIndustryGoods(TileIndex tile)
|
||||
const IndustrySpec *indspec = GetIndustrySpec(i->type);
|
||||
bool moved_cargo = false;
|
||||
|
||||
StationFinder stations(i->location);
|
||||
|
||||
for (uint j = 0; j < lengthof(i->produced_cargo_waiting); j++) {
|
||||
uint cw = min(i->produced_cargo_waiting[j], 255);
|
||||
if (cw > indspec->minimal_cargo && i->produced_cargo[j] != CT_INVALID) {
|
||||
@@ -528,7 +539,7 @@ static bool TransportIndustryGoods(TileIndex tile)
|
||||
|
||||
i->this_month_production[j] += cw;
|
||||
|
||||
uint am = MoveGoodsToStation(i->produced_cargo[j], cw, ST_INDUSTRY, i->index, stations.GetStations());
|
||||
uint am = MoveGoodsToStation(i->produced_cargo[j], cw, ST_INDUSTRY, i->index, &i->stations_near);
|
||||
i->this_month_transported[j] += am;
|
||||
|
||||
moved_cargo |= (am != 0);
|
||||
@@ -798,7 +809,7 @@ static void TileLoopIndustry_BubbleGenerator(TileIndex tile)
|
||||
EV_BUBBLE
|
||||
);
|
||||
|
||||
if (v != NULL) v->animation_substate = dir;
|
||||
if (v != nullptr) v->animation_substate = dir;
|
||||
}
|
||||
|
||||
static void TileLoop_Industry(TileIndex tile)
|
||||
@@ -1077,7 +1088,7 @@ static bool SearchLumberMillTrees(TileIndex tile, void *user_data)
|
||||
if (IsTileType(tile, MP_TREES) && GetTreeGrowth(tile) > 2) { ///< 3 and up means all fully grown trees
|
||||
/* found a tree */
|
||||
|
||||
Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
|
||||
_industry_sound_ctr = 1;
|
||||
_industry_sound_tile = tile;
|
||||
@@ -1105,7 +1116,7 @@ static void ChopLumberMillTrees(Industry *i)
|
||||
}
|
||||
|
||||
TileIndex tile = i->location.tile;
|
||||
if (CircularTileSearch(&tile, 40, SearchLumberMillTrees, NULL)) { // 40x40 tiles to search.
|
||||
if (CircularTileSearch(&tile, 40, SearchLumberMillTrees, nullptr)) { // 40x40 tiles to search.
|
||||
i->produced_cargo_waiting[0] = min(0xffff, i->produced_cargo_waiting[0] + 45); // Found a tree, add according value to waiting cargo.
|
||||
}
|
||||
}
|
||||
@@ -1117,11 +1128,16 @@ static void ProduceIndustryGoods(Industry *i)
|
||||
/* play a sound? */
|
||||
if ((i->counter & 0x3F) == 0) {
|
||||
uint32 r;
|
||||
uint num;
|
||||
if (Chance16R(1, 14, r) && (num = indsp->number_of_sounds) != 0 && _settings_client.sound.ambient) {
|
||||
SndPlayTileFx(
|
||||
(SoundFx)(indsp->random_sounds[((r >> 16) * num) >> 16]),
|
||||
i->location.tile);
|
||||
if (Chance16R(1, 14, r) && indsp->number_of_sounds != 0 && _settings_client.sound.ambient) {
|
||||
for (size_t j = 0; j < lengthof(i->last_month_production); j++) {
|
||||
if (i->last_month_production[j] > 0) {
|
||||
/* Play sound since last month had production */
|
||||
SndPlayTileFx(
|
||||
(SoundFx)(indsp->random_sounds[((r >> 16) * indsp->number_of_sounds) >> 16]),
|
||||
i->location.tile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1218,6 +1234,29 @@ static CommandCost CheckNewIndustry_Forest(TileIndex tile)
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a tile is within a distance from map edges, scaled by map dimensions independently.
|
||||
* Each dimension is checked independently, and dimensions smaller than 256 are not scaled.
|
||||
* @param tile Which tile to check distance of.
|
||||
* @param maxdist Normal distance on a 256x256 map.
|
||||
* @return True if the tile is near the map edge.
|
||||
*/
|
||||
static bool CheckScaledDistanceFromEdge(TileIndex tile, uint maxdist)
|
||||
{
|
||||
uint maxdist_x = maxdist;
|
||||
uint maxdist_y = maxdist;
|
||||
|
||||
if (MapSizeX() > 256) maxdist_x *= MapSizeX() / 256;
|
||||
if (MapSizeY() > 256) maxdist_y *= MapSizeY() / 256;
|
||||
|
||||
if (DistanceFromEdgeDir(tile, DIAGDIR_NE) < maxdist_x) return true;
|
||||
if (DistanceFromEdgeDir(tile, DIAGDIR_NW) < maxdist_y) return true;
|
||||
if (DistanceFromEdgeDir(tile, DIAGDIR_SW) < maxdist_x) return true;
|
||||
if (DistanceFromEdgeDir(tile, DIAGDIR_SE) < maxdist_y) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the conditions of #CHECK_REFINERY (Industry should be positioned near edge of the map).
|
||||
* @param tile %Tile to perform the checking.
|
||||
@@ -1226,7 +1265,8 @@ static CommandCost CheckNewIndustry_Forest(TileIndex tile)
|
||||
static CommandCost CheckNewIndustry_OilRefinery(TileIndex tile)
|
||||
{
|
||||
if (_game_mode == GM_EDITOR) return CommandCost();
|
||||
if (DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings_game.game_creation.oil_refinery_limit) return CommandCost();
|
||||
|
||||
if (CheckScaledDistanceFromEdge(TILE_ADDXY(tile, 1, 1), _settings_game.game_creation.oil_refinery_limit)) return CommandCost();
|
||||
|
||||
return_cmd_error(STR_ERROR_CAN_ONLY_BE_POSITIONED);
|
||||
}
|
||||
@@ -1241,8 +1281,9 @@ extern bool _ignore_restrictions;
|
||||
static CommandCost CheckNewIndustry_OilRig(TileIndex tile)
|
||||
{
|
||||
if (_game_mode == GM_EDITOR && _ignore_restrictions) return CommandCost();
|
||||
|
||||
if (TileHeight(tile) == 0 &&
|
||||
DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings_game.game_creation.oil_refinery_limit) return CommandCost();
|
||||
CheckScaledDistanceFromEdge(TILE_ADDXY(tile, 1, 1), _settings_game.game_creation.oil_refinery_limit)) return CommandCost();
|
||||
|
||||
return_cmd_error(STR_ERROR_CAN_ONLY_BE_POSITIONED);
|
||||
}
|
||||
@@ -1338,11 +1379,11 @@ static CheckNewIndustryProc * const _check_new_industry_procs[CHECK_END] = {
|
||||
* Find a town for the industry, while checking for multiple industries in the same town.
|
||||
* @param tile Position of the industry to build.
|
||||
* @param type Industry type.
|
||||
* @param[out] t Pointer to return town for the new industry, \c NULL is written if no good town can be found.
|
||||
* @param[out] t Pointer to return town for the new industry, \c nullptr is written if no good town can be found.
|
||||
* @return Succeeded or failed command.
|
||||
*
|
||||
* @pre \c *t != NULL
|
||||
* @post \c *t points to a town on success, and \c NULL on failure.
|
||||
* @pre \c *t != nullptr
|
||||
* @post \c *t points to a town on success, and \c nullptr on failure.
|
||||
*/
|
||||
static CommandCost FindTownForIndustry(TileIndex tile, int type, Town **t)
|
||||
{
|
||||
@@ -1353,7 +1394,7 @@ static CommandCost FindTownForIndustry(TileIndex tile, int type, Town **t)
|
||||
const Industry *i;
|
||||
FOR_ALL_INDUSTRIES(i) {
|
||||
if (i->type == (byte)type && i->town == *t) {
|
||||
*t = NULL;
|
||||
*t = nullptr;
|
||||
return_cmd_error(STR_ERROR_ONLY_ONE_ALLOWED_PER_TOWN);
|
||||
}
|
||||
}
|
||||
@@ -1381,8 +1422,8 @@ bool IsSlopeRefused(Slope current, Slope refused)
|
||||
/**
|
||||
* 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
|
||||
@@ -1390,14 +1431,14 @@ bool IsSlopeRefused(Slope current, Slope refused)
|
||||
* @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 = NULL)
|
||||
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);
|
||||
@@ -1422,7 +1463,7 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
|
||||
|
||||
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);
|
||||
@@ -1436,7 +1477,7 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
|
||||
}
|
||||
|
||||
/* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */
|
||||
Backup<CompanyByte> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
||||
CommandCost ret = DoCommand(cur_tile, 0, 0, DC_NONE, CMD_LANDSCAPE_CLEAR);
|
||||
cur_company.Restore();
|
||||
|
||||
@@ -1448,9 +1489,9 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
}
|
||||
} while ((++it)->ti.x != -0x80);
|
||||
}
|
||||
|
||||
if (custom_shape_check != NULL) *custom_shape_check = custom_shape;
|
||||
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
|
||||
@@ -1512,18 +1553,17 @@ static bool CheckCanTerraformSurroundingTiles(TileIndex tile, uint height, int i
|
||||
* 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);
|
||||
@@ -1532,6 +1572,8 @@ static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags,
|
||||
/* Check that all tiles in area and surrounding are clear
|
||||
* this determines that there are no obstructing items */
|
||||
|
||||
/* TileArea::Expand is not used here as we need to abort
|
||||
* instead of clamping if the bounds cannot expanded. */
|
||||
TileArea ta(tile + TileDiffXY(-_settings_game.construction.industry_platform, -_settings_game.construction.industry_platform),
|
||||
max_x + 2 + 2 * _settings_game.construction.industry_platform, max_y + 2 + 2 * _settings_game.construction.industry_platform);
|
||||
|
||||
@@ -1539,7 +1581,7 @@ static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags,
|
||||
|
||||
/* _current_company is OWNER_NONE for randomly generated industries and in editor, or the company who funded or prospected the industry.
|
||||
* Perform terraforming as OWNER_TOWN to disable autoslope and town ratings. */
|
||||
Backup<CompanyByte> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
||||
|
||||
TILE_AREA_LOOP(tile_walk, ta) {
|
||||
uint curh = TileHeight(tile_walk);
|
||||
@@ -1587,14 +1629,12 @@ static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags,
|
||||
static CommandCost CheckIfFarEnoughFromConflictingIndustry(TileIndex tile, int type)
|
||||
{
|
||||
const IndustrySpec *indspec = GetIndustrySpec(type);
|
||||
const Industry *i = NULL;
|
||||
const Industry *i = nullptr;
|
||||
|
||||
/* On a large map with many industries, it may be faster to check an area. */
|
||||
static const int dmax = 14;
|
||||
if (Industry::GetNumItems() > (size_t) (dmax * dmax * 2)) {
|
||||
const int tx = TileX(tile);
|
||||
const int ty = TileY(tile);
|
||||
TileArea tile_area = TileArea(TileXY(max(0, tx - dmax), max(0, ty - dmax)), TileXY(min(MapMaxX(), tx + dmax), min(MapMaxY(), ty + dmax)));
|
||||
TileArea tile_area = TileArea(tile, 1, 1).Expand(dmax);
|
||||
TILE_AREA_LOOP(atile, tile_area) {
|
||||
if (GetTileType(atile) == MP_INDUSTRY) {
|
||||
const Industry *i2 = Industry::GetByTile(atile);
|
||||
@@ -1644,18 +1684,49 @@ static void AdvertiseIndustryOpening(const Industry *ind)
|
||||
Game::NewEvent(new ScriptEventIndustryOpen(ind->index));
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate an industry's list of nearby stations, and if it accepts any cargo, also
|
||||
* add the industry to each station's nearby industry list.
|
||||
* @param ind Industry
|
||||
*/
|
||||
static void PopulateStationsNearby(Industry *ind)
|
||||
{
|
||||
if (ind->neutral_station != nullptr && !_settings_game.station.serve_neutral_industries) {
|
||||
/* Industry has a neutral station. Use it and ignore any other nearby stations. */
|
||||
ind->stations_near.insert(ind->neutral_station);
|
||||
ind->neutral_station->industries_near.clear();
|
||||
ind->neutral_station->industries_near.insert(ind);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get our list of nearby stations. */
|
||||
FindStationsAroundTiles(ind->location, &ind->stations_near, false);
|
||||
|
||||
/* Test if industry can accept cargo */
|
||||
uint cargo_index;
|
||||
for (cargo_index = 0; cargo_index < lengthof(ind->accepts_cargo); cargo_index++) {
|
||||
if (ind->accepts_cargo[cargo_index] != CT_INVALID) break;
|
||||
}
|
||||
if (cargo_index >= lengthof(ind->accepts_cargo)) return;
|
||||
|
||||
/* Cargo is accepted, add industry to nearby stations nearby industry list. */
|
||||
for (Station *st : ind->stations_near) {
|
||||
st->industries_near.insert(ind);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 t Nearest town.
|
||||
* @param founder Founder of the industry; OWNER_NONE in case of random construction.
|
||||
* @param i Just allocated poolitem, mostly empty.
|
||||
* @param tile North tile of the industry.
|
||||
* @param type Type of the industry.
|
||||
* @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);
|
||||
|
||||
@@ -1700,7 +1771,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
||||
/* 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;
|
||||
|
||||
@@ -1796,17 +1867,17 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
||||
|
||||
/* Plant the tiles */
|
||||
|
||||
do {
|
||||
TileIndex cur_tile = tile + ToTileIndexDiff(it->ti);
|
||||
for (const IndustryTileLayoutTile &it : layout) {
|
||||
TileIndex cur_tile = tile + ToTileIndexDiff(it.ti);
|
||||
|
||||
if (it->gfx != GFX_WATERTILE_SPECIALCHECK) {
|
||||
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);
|
||||
@@ -1814,18 +1885,18 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
Station::RecomputeIndustriesNearForAll();
|
||||
if (!_generating_world) PopulateStationsNearby(i);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1834,7 +1905,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
||||
* @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
|
||||
@@ -1842,40 +1913,40 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
||||
* @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.
|
||||
* @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 = NULL;
|
||||
*ip = nullptr;
|
||||
|
||||
SmallVector<ClearedObjectArea, 1> object_areas(_cleared_object_areas);
|
||||
CommandCost ret = CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, random_initial_bits, founder, creation_type, &custom_shape_check);
|
||||
std::vector<ClearedObjectArea> object_areas(_cleared_object_areas);
|
||||
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;
|
||||
|
||||
Town *t = NULL;
|
||||
Town *t = nullptr;
|
||||
ret = FindTownForIndustry(tile, type, &t);
|
||||
if (ret.Failed()) return ret;
|
||||
assert(t != NULL);
|
||||
assert(t != nullptr);
|
||||
|
||||
ret = CheckIfIndustryIsAllowed(tile, type, t);
|
||||
if (ret.Failed()) return ret;
|
||||
@@ -1884,8 +1955,8 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do
|
||||
|
||||
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();
|
||||
@@ -1911,7 +1982,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
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) */
|
||||
@@ -1927,15 +1998,15 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
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 = NULL;
|
||||
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) {
|
||||
/* Prospected industries are build as OWNER_TOWN to not e.g. be build on owned land of the founder */
|
||||
Backup<CompanyByte> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
||||
/* Prospecting has a chance to fail, however we cannot guarantee that something can
|
||||
* be built on the map, so the chance gets lower when the map is fuller, but there
|
||||
* is nothing we can really do about that. */
|
||||
@@ -1946,9 +2017,9 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
*/
|
||||
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++) {
|
||||
for (size_t 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;
|
||||
@@ -1959,11 +2030,11 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
cur_company.Restore();
|
||||
}
|
||||
} else {
|
||||
int layout = GB(p1, 8, 8);
|
||||
size_t layout = GB(p1, 8, 8);
|
||||
if (layout >= num_layouts) return CMD_ERROR;
|
||||
|
||||
/* Check subsequently each layout, starting with the given layout in p1 */
|
||||
for (int i = 0; i < num_layouts; i++) {
|
||||
for (size_t i = 0; i < num_layouts; i++) {
|
||||
layout = (layout + 1) % num_layouts;
|
||||
ret = CreateNewIndustryHelper(tile, it, flags, indspec, layout, random_var8f, random_initial_bits, _current_company, _current_company == OWNER_DEITY ? IACT_RANDOMCREATION : IACT_USERCREATION, &ind);
|
||||
if (ret.Succeeded()) break;
|
||||
@@ -1973,7 +2044,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
|
||||
if ((flags & DC_EXEC) && ind != NULL && _game_mode != GM_EDITOR) {
|
||||
if ((flags & DC_EXEC) && ind != nullptr && _game_mode != GM_EDITOR) {
|
||||
AdvertiseIndustryOpening(ind);
|
||||
}
|
||||
|
||||
@@ -1986,7 +2057,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
* @param tile The location to build the industry.
|
||||
* @param type The industry type to build.
|
||||
* @param creation_type The circumstances the industry is created under.
|
||||
* @return the created industry or NULL if it failed.
|
||||
* @return the created industry or nullptr if it failed.
|
||||
*/
|
||||
static Industry *CreateNewIndustry(TileIndex tile, IndustryType type, IndustryAvailabilityCallType creation_type)
|
||||
{
|
||||
@@ -1994,9 +2065,10 @@ static Industry *CreateNewIndustry(TileIndex tile, IndustryType type, IndustryAv
|
||||
|
||||
uint32 seed = Random();
|
||||
uint32 seed2 = Random();
|
||||
Industry *i = NULL;
|
||||
CommandCost ret = CreateNewIndustryHelper(tile, type, DC_EXEC, indspec, RandomRange(indspec->num_table), seed, GB(seed2, 0, 16), OWNER_NONE, creation_type, &i);
|
||||
assert(i != NULL || ret.Failed());
|
||||
Industry *i = nullptr;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -2010,7 +2082,7 @@ static uint32 GetScaledIndustryGenerationProbability(IndustryType it, bool *forc
|
||||
{
|
||||
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;
|
||||
@@ -2040,7 +2112,7 @@ static uint16 GetIndustryGamePlayProbability(IndustryType it, byte *min_number)
|
||||
|
||||
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) {
|
||||
@@ -2078,16 +2150,16 @@ static uint GetNumberOfIndustries()
|
||||
* than to try a few times before concluding it does not work.
|
||||
* @param type Industry type of the desired industry.
|
||||
* @param try_hard Try very hard to find a place. (Used to place at least one industry per type.)
|
||||
* @return Pointer to created industry, or \c NULL if creation failed.
|
||||
* @return Pointer to created industry, or \c nullptr if creation failed.
|
||||
*/
|
||||
static Industry *PlaceIndustry(IndustryType type, IndustryAvailabilityCallType creation_type, bool try_hard)
|
||||
{
|
||||
uint tries = try_hard ? 10000u : 2000u;
|
||||
for (; tries > 0; tries--) {
|
||||
Industry *ind = CreateNewIndustry(RandomTile(), type, creation_type);
|
||||
if (ind != NULL) return ind;
|
||||
if (ind != nullptr) return ind;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2097,7 +2169,7 @@ static Industry *PlaceIndustry(IndustryType type, IndustryAvailabilityCallType c
|
||||
*/
|
||||
static void PlaceInitialIndustry(IndustryType type, bool try_hard)
|
||||
{
|
||||
Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
|
||||
IncreaseGeneratingWorldProgress(GWP_INDUSTRY);
|
||||
PlaceIndustry(type, IACT_MAPGENERATION, try_hard);
|
||||
@@ -2353,7 +2425,7 @@ void IndustryBuildData::TryBuildNewIndustry()
|
||||
|
||||
/* Try to create the industry. */
|
||||
const Industry *ind = PlaceIndustry(it, IACT_RANDOMCREATION, false);
|
||||
if (ind == NULL) {
|
||||
if (ind == nullptr) {
|
||||
this->builddata[it].wait_count = this->builddata[it].max_wait + 1; // Compensate for decrementing below.
|
||||
this->builddata[it].max_wait = min(1000, this->builddata[it].max_wait + 2);
|
||||
} else {
|
||||
@@ -2430,11 +2502,7 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept
|
||||
*/
|
||||
static int WhoCanServiceIndustry(Industry *ind)
|
||||
{
|
||||
/* Find all stations within reach of the industry */
|
||||
StationList stations;
|
||||
FindStationsAroundTiles(ind->location, &stations);
|
||||
|
||||
if (stations.Length() == 0) return 0; // No stations found at all => nobody services
|
||||
if (ind->stations_near.size() == 0) return 0; // No stations found at all => nobody services
|
||||
|
||||
const Vehicle *v;
|
||||
int result = 0;
|
||||
@@ -2446,7 +2514,7 @@ static int WhoCanServiceIndustry(Industry *ind)
|
||||
bool c_accepts = false;
|
||||
bool c_produces = false;
|
||||
if (v->type == VEH_TRAIN && v->IsFrontEngine()) {
|
||||
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
|
||||
for (const Vehicle *u = v; u != nullptr; u = u->Next()) {
|
||||
CanCargoServiceIndustry(u->cargo_type, ind, &c_accepts, &c_produces);
|
||||
}
|
||||
} else if (v->type == VEH_ROAD || v->type == VEH_SHIP || v->type == VEH_AIRCRAFT) {
|
||||
@@ -2465,12 +2533,12 @@ static int WhoCanServiceIndustry(Industry *ind)
|
||||
if (o->IsType(OT_GOTO_STATION) && !(o->GetUnloadType() & OUFB_TRANSFER)) {
|
||||
/* Vehicle visits a station to load or unload */
|
||||
Station *st = Station::Get(o->GetDestination());
|
||||
assert(st != NULL);
|
||||
assert(st != nullptr);
|
||||
|
||||
/* Same cargo produced by industry is dropped here => not serviced by vehicle v */
|
||||
if ((o->GetUnloadType() & OUFB_UNLOAD) && !c_accepts) break;
|
||||
|
||||
if (stations.Contains(st)) {
|
||||
if (ind->stations_near.find(st) != ind->stations_near.end()) {
|
||||
if (v->owner == _local_company) return 2; // Company services industry
|
||||
result = 1; // Competitor services industry
|
||||
}
|
||||
@@ -2733,7 +2801,7 @@ void IndustryDailyLoop()
|
||||
return; // Nothing to do? get out
|
||||
}
|
||||
|
||||
Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
|
||||
/* perform the required industry changes for the day */
|
||||
|
||||
@@ -2746,7 +2814,7 @@ void IndustryDailyLoop()
|
||||
_industry_builder.TryBuildNewIndustry();
|
||||
} else {
|
||||
Industry *i = Industry::GetRandom();
|
||||
if (i != NULL) {
|
||||
if (i != nullptr) {
|
||||
ChangeIndustryProduction(i, false);
|
||||
SetWindowDirty(WC_INDUSTRY_VIEW, i->index);
|
||||
}
|
||||
@@ -2761,7 +2829,7 @@ void IndustryDailyLoop()
|
||||
|
||||
void IndustryMonthlyLoop()
|
||||
{
|
||||
Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_NONE, FILE_LINE);
|
||||
|
||||
_industry_builder.MonthlyLoop();
|
||||
|
||||
@@ -2864,6 +2932,13 @@ bool IndustrySpec::UsesSmoothEconomy() const
|
||||
!(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()) {
|
||||
@@ -2904,8 +2979,13 @@ extern const TileTypeProcs _tile_type_industry_procs = {
|
||||
AnimateTile_Industry, // animate_tile_proc
|
||||
TileLoop_Industry, // tile_loop_proc
|
||||
ChangeTileOwner_Industry, // change_tile_owner_proc
|
||||
NULL, // add_produced_cargo_proc
|
||||
NULL, // vehicle_enter_tile_proc
|
||||
nullptr, // add_produced_cargo_proc
|
||||
nullptr, // vehicle_enter_tile_proc
|
||||
GetFoundation_Industry, // get_foundation_proc
|
||||
TerraformTile_Industry, // terraform_tile_proc
|
||||
};
|
||||
|
||||
bool IndustryCompare::operator() (const Industry *lhs, const Industry *rhs) const
|
||||
{
|
||||
return lhs->index < rhs->index;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user