Codechange: Use EnumBitSet for IndustryBehaviours.

This commit is contained in:
Peter Nelson 2025-02-06 20:08:50 +00:00 committed by Peter Nelson
parent 9d451d6350
commit 2bb3f368e3
10 changed files with 111 additions and 112 deletions

View File

@ -427,9 +427,9 @@ static void DestructIndustry(Industry *i)
* @param image_override The image at the time the aircraft is firing.
* @param leave_at_top True iff the vehicle leaves the map at the north side.
* @param news_message The string that's used as news message.
* @param industry_flag Only attack industries that have this flag set.
* @param behaviour Only attack industries that have this behaviour set.
*/
static bool DisasterTick_Aircraft(DisasterVehicle *v, uint16_t image_override, bool leave_at_top, StringID news_message, IndustryBehaviour industry_flag)
static bool DisasterTick_Aircraft(DisasterVehicle *v, uint16_t image_override, bool leave_at_top, StringID news_message, IndustryBehaviour behaviour)
{
v->tick_counter++;
v->image_override = (v->state == 1 && HasBit(v->tick_counter, 2)) ? image_override : 0;
@ -481,7 +481,7 @@ static bool DisasterTick_Aircraft(DisasterVehicle *v, uint16_t image_override, b
IndustryID ind = GetIndustryIndex(tile);
v->dest_tile = TileIndex{ind};
if (GetIndustrySpec(Industry::Get(ind)->type)->behaviour & industry_flag) {
if (GetIndustrySpec(Industry::Get(ind)->type)->behaviour.Test(behaviour)) {
v->state = 1;
v->age = CalendarTime::MIN_DATE;
}
@ -493,13 +493,13 @@ static bool DisasterTick_Aircraft(DisasterVehicle *v, uint16_t image_override, b
/** Airplane handling. */
static bool DisasterTick_Airplane(DisasterVehicle *v)
{
return DisasterTick_Aircraft(v, SPR_F_15_FIRING, true, STR_NEWS_DISASTER_AIRPLANE_OIL_REFINERY, INDUSTRYBEH_AIRPLANE_ATTACKS);
return DisasterTick_Aircraft(v, SPR_F_15_FIRING, true, STR_NEWS_DISASTER_AIRPLANE_OIL_REFINERY, IndustryBehaviour::AirplaneAttacks);
}
/** Helicopter handling. */
static bool DisasterTick_Helicopter(DisasterVehicle *v)
{
return DisasterTick_Aircraft(v, SPR_AH_64A_FIRING, false, STR_NEWS_DISASTER_HELICOPTER_FACTORY, INDUSTRYBEH_CHOPPER_ATTACKS);
return DisasterTick_Aircraft(v, SPR_AH_64A_FIRING, false, STR_NEWS_DISASTER_HELICOPTER_FACTORY, IndustryBehaviour::ChopperAttacks);
}
/** Helicopter rotor blades; keep these spinning */
@ -775,7 +775,7 @@ static void Disaster_Airplane_Init()
Industry *found = nullptr;
for (Industry *i : Industry::Iterate()) {
if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_AIRPLANE_ATTACKS) &&
if (GetIndustrySpec(i->type)->behaviour.Test(IndustryBehaviour::AirplaneAttacks) &&
(found == nullptr || Chance16(1, 2))) {
found = i;
}
@ -801,7 +801,7 @@ static void Disaster_Helicopter_Init()
Industry *found = nullptr;
for (Industry *i : Industry::Iterate()) {
if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CHOPPER_ATTACKS) &&
if (GetIndustrySpec(i->type)->behaviour.Test(IndustryBehaviour::ChopperAttacks) &&
(found == nullptr || Chance16(1, 2))) {
found = i;
}
@ -886,7 +886,7 @@ static void Disaster_CoalMine_Init()
for (m = 0; m < 15; m++) {
for (const Industry *i : Industry::Iterate()) {
if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) {
if (GetIndustrySpec(i->type)->behaviour.Test(IndustryBehaviour::CanSubsidence) && --index < 0) {
SetDParam(0, i->town->index);
AddTileNewsItem(STR_NEWS_DISASTER_COAL_MINE_SUBSIDENCE, NT_ACCIDENT, i->location.tile + TileDiffXY(1, 1)); // keep the news, even when the mine closes

View File

@ -171,7 +171,7 @@ Industry::~Industry()
}
}
if (GetIndustrySpec(this->type)->behaviour & INDUSTRYBEH_PLANT_FIELDS) {
if (GetIndustrySpec(this->type)->behaviour.Test(IndustryBehaviour::PlantFields)) {
TileArea ta = TileArea(this->location.tile, 0, 0).Expand(21);
/* Remove the farmland and convert it to regular tiles over time. */
@ -502,7 +502,7 @@ static CommandCost ClearTile_Industry(TileIndex tile, DoCommandFlag flags)
!_cheats.magic_bulldozer.value) ||
((flags & DC_AUTO) != 0) ||
(_current_company == OWNER_WATER &&
((indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) ||
(indspec->behaviour.Test(IndustryBehaviour::BuiltOnWater) ||
HasBit(GetIndustryTileSpec(GetIndustryGfx(tile))->slopes_refused, 5)))) {
SetDParam(1, indspec->name);
return CommandCost(flags & DC_AUTO ? STR_ERROR_GENERIC_OBJECT_IN_THE_WAY : INVALID_STRING_ID);
@ -1197,9 +1197,9 @@ static void ProduceIndustryGoods(Industry *i)
/* Handle non-callback cargo production. */
if (!indsp->callback_mask.Test(IndustryCallbackMask::Production256Ticks)) ProduceIndustryGoodsHelper(i, true);
IndustryBehaviour indbehav = indsp->behaviour;
IndustryBehaviours indbehav = indsp->behaviour;
if ((indbehav & INDUSTRYBEH_PLANT_FIELDS) != 0) {
if (indbehav.Test(IndustryBehaviour::PlantFields)) {
uint16_t cb_res = CALLBACK_FAILED;
if (indsp->callback_mask.Test(IndustryCallbackMask::SpecialEffect)) {
cb_res = GetIndustryCallback(CBID_INDUSTRY_SPECIAL_EFFECT, Random(), 0, i, i->type, i->location.tile);
@ -1214,7 +1214,7 @@ static void ProduceIndustryGoods(Industry *i)
if (plant) PlantRandomFarmField(i);
}
if ((indbehav & INDUSTRYBEH_CUT_TREES) != 0) {
if (indbehav.Test(IndustryBehaviour::CutTrees)) {
uint16_t cb_res = CALLBACK_FAILED;
if (indsp->callback_mask.Test(IndustryCallbackMask::SpecialEffect)) {
cb_res = GetIndustryCallback(CBID_INDUSTRY_SPECIAL_EFFECT, Random(), 1, i, i->type, i->location.tile);
@ -1472,7 +1472,7 @@ bool IsSlopeRefused(Slope current, Slope refused)
*/
static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileLayout &layout, IndustryType type)
{
IndustryBehaviour ind_behav = GetIndustrySpec(type)->behaviour;
IndustryBehaviours ind_behav = GetIndustrySpec(type)->behaviour;
for (const IndustryTileLayoutTile &it : layout) {
IndustryGfx gfx = GetTranslatedIndustryTileID(it.gfx);
@ -1495,10 +1495,10 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
const IndustryTileSpec *its = GetIndustryTileSpec(gfx);
/* 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 CommandCost(STR_ERROR_SITE_UNSUITABLE);
if (!HasBit(its->slopes_refused, 5) && ((HasTileWaterClass(cur_tile) && IsTileOnWater(cur_tile)) != ind_behav.Test(IndustryBehaviour::BuiltOnWater))) return CommandCost(STR_ERROR_SITE_UNSUITABLE);
if ((ind_behav & (INDUSTRYBEH_ONLY_INTOWN | INDUSTRYBEH_TOWN1200_MORE)) || // Tile must be a house
((ind_behav & INDUSTRYBEH_ONLY_NEARTOWN) && IsTileType(cur_tile, MP_HOUSE))) { // Tile is allowed to be a house (and it is a house)
if (ind_behav.Any({IndustryBehaviour::OnlyInTown, IndustryBehaviour::Town1200More}) || // Tile must be a house
(ind_behav.Test(IndustryBehaviour::OnlyNearTown) && IsTileType(cur_tile, MP_HOUSE))) { // Tile is allowed to be a house (and it is a house)
if (!IsTileType(cur_tile, MP_HOUSE)) {
return CommandCost(STR_ERROR_CAN_ONLY_BE_BUILT_IN_TOWNS);
}
@ -1576,11 +1576,11 @@ static CommandCost CheckIfIndustryTileSlopes(TileIndex tile, const IndustryTileL
*/
static CommandCost CheckIfIndustryIsAllowed(TileIndex tile, IndustryType type, const Town *t)
{
if ((GetIndustrySpec(type)->behaviour & INDUSTRYBEH_TOWN1200_MORE) && t->cache.population < 1200) {
if (GetIndustrySpec(type)->behaviour.Test(IndustryBehaviour::Town1200More) && t->cache.population < 1200) {
return CommandCost(STR_ERROR_CAN_ONLY_BE_BUILT_IN_TOWNS_WITH_POPULATION_OF_1200);
}
if ((GetIndustrySpec(type)->behaviour & INDUSTRYBEH_ONLY_NEARTOWN) && DistanceMax(t->xy, tile) > 9) {
if (GetIndustrySpec(type)->behaviour.Test(IndustryBehaviour::OnlyNearTown) && DistanceMax(t->xy, tile) > 9) {
return CommandCost(STR_ERROR_CAN_ONLY_BE_BUILT_NEAR_TOWN_CENTER);
}
@ -1860,7 +1860,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
/* Clear all input cargo types */
i->accepted.clear();
/* Query actual types */
uint maxcargoes = (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) ? INDUSTRY_NUM_INPUTS : 3;
uint maxcargoes = indspec->behaviour.Test(IndustryBehaviour::CargoTypesUnlimited) ? INDUSTRY_NUM_INPUTS : 3;
for (uint j = 0; j < maxcargoes; j++) {
uint16_t res = GetIndustryCallback(CBID_INDUSTRY_INPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
if (res == CALLBACK_FAILED || GB(res, 0, 8) == UINT8_MAX) break;
@ -1872,7 +1872,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
/* Industries without "unlimited" cargo types support depend on the specific order/slots of cargo types.
* They need to be able to blank out specific slots without aborting the callback sequence,
* and solve this by returning undefined cargo indexes. Skip these. */
if (!IsValidCargoType(cargo) && !(indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED)) {
if (!IsValidCargoType(cargo) && !indspec->behaviour.Test(IndustryBehaviour::CargoTypesUnlimited)) {
/* As slots are allocated as needed now, this means we do need to add a slot for the invalid cargo. */
Industry::AcceptedCargo &a = i->accepted.emplace_back();
a.cargo = INVALID_CARGO;
@ -1898,7 +1898,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
/* Clear all output cargo types */
i->produced.clear();
/* Query actual types */
uint maxcargoes = (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) ? INDUSTRY_NUM_OUTPUTS : 2;
uint maxcargoes = indspec->behaviour.Test(IndustryBehaviour::CargoTypesUnlimited) ? INDUSTRY_NUM_OUTPUTS : 2;
for (uint j = 0; j < maxcargoes; j++) {
uint16_t res = GetIndustryCallback(CBID_INDUSTRY_OUTPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
if (res == CALLBACK_FAILED || GB(res, 0, 8) == UINT8_MAX) break;
@ -1908,7 +1908,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
}
CargoType cargo = GetCargoTranslation(GB(res, 0, 8), indspec->grf_prop.grffile);
/* Allow older GRFs to skip slots. */
if (!IsValidCargoType(cargo) && !(indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED)) {
if (!IsValidCargoType(cargo) && !indspec->behaviour.Test(IndustryBehaviour::CargoTypesUnlimited)) {
/* As slots are allocated as needed now, this means we do need to add a slot for the invalid cargo. */
Industry::ProducedCargo &p = i->produced.emplace_back();
p.cargo = INVALID_CARGO;
@ -1956,7 +1956,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
}
}
if (GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_PLANT_ON_BUILT) {
if (GetIndustrySpec(i->type)->behaviour.Test(IndustryBehaviour::PlantOnBuild)) {
for (uint j = 0; j != 50; j++) PlantRandomFarmField(i);
}
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD);
@ -2301,7 +2301,7 @@ static uint32_t GetScaledIndustryGenerationProbability(IndustryType it, bool *fo
* For simplicity we scale in both cases, though scaling the probabilities of all industries has no effect. */
chance = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? Map::ScaleBySize1D(chance) : Map::ScaleBySize(chance);
*force_at_least_one = (chance > 0) && !(ind_spc->behaviour & INDUSTRYBEH_NOBUILT_MAPCREATION) && (_game_mode != GM_EDITOR);
*force_at_least_one = (chance > 0) && !ind_spc->behaviour.Test(IndustryBehaviour::NoBuildMapCreation) && (_game_mode != GM_EDITOR);
return chance;
}
}
@ -2322,13 +2322,13 @@ static uint16_t GetIndustryGamePlayProbability(IndustryType it, uint8_t *min_num
const IndustrySpec *ind_spc = GetIndustrySpec(it);
uint8_t chance = ind_spc->appear_ingame[to_underlying(_settings_game.game_creation.landscape)];
if (!ind_spc->enabled || ind_spc->layouts.empty() ||
((ind_spc->behaviour & INDUSTRYBEH_BEFORE_1950) && TimerGameCalendar::year > 1950) ||
((ind_spc->behaviour & INDUSTRYBEH_AFTER_1960) && TimerGameCalendar::year < 1960) ||
(ind_spc->behaviour.Test(IndustryBehaviour::Before1950) && TimerGameCalendar::year > 1950) ||
(ind_spc->behaviour.Test(IndustryBehaviour::After1960) && TimerGameCalendar::year < 1960) ||
(chance = GetIndustryProbabilityCallback(it, IACT_RANDOMCREATION, chance)) == 0) {
*min_number = 0;
return 0;
}
*min_number = (ind_spc->behaviour & INDUSTRYBEH_CANCLOSE_LASTINSTANCE) ? 1 : 0;
*min_number = ind_spc->behaviour.Test(IndustryBehaviour::CanCloseLastInstance) ? 1 : 0;
return chance;
}
@ -2663,7 +2663,7 @@ void IndustryBuildData::TryBuildNewIndustry()
/**
* Protects an industry from closure if the appropriate flags and conditions are met
* INDUSTRYBEH_CANCLOSE_LASTINSTANCE must be set (which, by default, it is not) and the
* CanCloseLastInstance must be set (which, by default, it is not) and the
* count of industries of this type must one (or lower) in order to be protected
* against closure.
* @param type IndustryType been queried
@ -2674,8 +2674,8 @@ static bool CheckIndustryCloseDownProtection(IndustryType type)
const IndustrySpec *indspec = GetIndustrySpec(type);
/* oil wells (or the industries with that flag set) are always allowed to closedown */
if ((indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _settings_game.game_creation.landscape == LandscapeType::Temperate) return false;
return (indspec->behaviour & INDUSTRYBEH_CANCLOSE_LASTINSTANCE) == 0 && Industry::GetIndustryTypeCount(type) <= 1;
if (indspec->behaviour.Test(IndustryBehaviour::DontIncrProd) && _settings_game.game_creation.landscape == LandscapeType::Temperate) return false;
return !indspec->behaviour.Test(IndustryBehaviour::CanCloseLastInstance) && Industry::GetIndustryTypeCount(type) <= 1;
}
/**
@ -2843,7 +2843,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
if (standard || (!callback_enabled && (indspec->life_type & (INDUSTRYLIFE_ORGANIC | INDUSTRYLIFE_EXTRACTIVE)) != 0)) {
/* decrease or increase */
bool only_decrease = (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _settings_game.game_creation.landscape == LandscapeType::Temperate;
bool only_decrease = indspec->behaviour.Test(IndustryBehaviour::DontIncrProd) && _settings_game.game_creation.landscape == LandscapeType::Temperate;
if (original_economy) {
if (only_decrease || Chance16(1, 3)) {
@ -2883,7 +2883,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
/* Prevent production to overflow or Oil Rig passengers to be over-"produced" */
new_prod = Clamp(new_prod, 1, 255);
if (IsValidCargoType(p.cargo) && p.cargo == GetCargoTypeByLabel(CT_PASSENGERS) && !(indspec->behaviour & INDUSTRYBEH_NO_PAX_PROD_CLAMP)) {
if (IsValidCargoType(p.cargo) && p.cargo == GetCargoTypeByLabel(CT_PASSENGERS) && !indspec->behaviour.Test(IndustryBehaviour::NoPaxProdClamp)) {
new_prod = Clamp(new_prod, 0, 16);
}
@ -3118,7 +3118,7 @@ bool IndustrySpec::IsProcessingIndustry() const
{
/* Lumber mills are neither raw nor processing */
return (this->life_type & INDUSTRYLIFE_PROCESSING) != 0 &&
(this->behaviour & INDUSTRYBEH_CUT_TREES) == 0;
!this->behaviour.Test(IndustryBehaviour::CutTrees);
}
/**

View File

@ -158,7 +158,7 @@ static inline void GetAllCargoSuffixes(CargoSuffixInOut use_input, CargoSuffixTy
{
static_assert(std::tuple_size_v<std::remove_reference_t<decltype(cargoes)>> <= lengthof(suffixes));
if (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) {
if (indspec->behaviour.Test(IndustryBehaviour::CargoTypesUnlimited)) {
/* Reworked behaviour with new many-in-many-out scheme */
for (uint j = 0; j < lengthof(suffixes); j++) {
if (IsValidCargoType(cargoes[j])) {
@ -210,7 +210,7 @@ void GetCargoSuffix(CargoSuffixInOut use_input, CargoSuffixType cst, const Indus
suffix.text.clear();
suffix.display = CSD_CARGO;
if (!IsValidCargoType(cargo)) return;
if (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) {
if (indspec->behaviour.Test(IndustryBehaviour::CargoTypesUnlimited)) {
uint8_t local_id = indspec->grf_prop.grffile->cargo_map[cargo]; // should we check the value for valid?
uint cargotype = local_id << 16 | use_input;
GetCargoSuffix(cargotype, cst, ind, ind_type, indspec, suffix);

View File

@ -53,31 +53,30 @@ enum IndustryConstructionType : uint8_t {
};
/** Various industry behaviours mostly to represent original TTD specialities */
enum IndustryBehaviour : uint32_t {
INDUSTRYBEH_NONE = 0,
INDUSTRYBEH_PLANT_FIELDS = 1 << 0, ///< periodically plants fields around itself (temp and arctic farms)
INDUSTRYBEH_CUT_TREES = 1 << 1, ///< cuts trees and produce first output cargo from them (lumber mill)
INDUSTRYBEH_BUILT_ONWATER = 1 << 2, ///< is built on water (oil rig)
INDUSTRYBEH_TOWN1200_MORE = 1 << 3, ///< can only be built in towns larger than 1200 inhabitants (temperate bank)
INDUSTRYBEH_ONLY_INTOWN = 1 << 4, ///< can only be built in towns (arctic/tropic banks, water tower)
INDUSTRYBEH_ONLY_NEARTOWN = 1 << 5, ///< is always built near towns (toy shop)
INDUSTRYBEH_PLANT_ON_BUILT = 1 << 6, ///< Fields are planted around when built (all farms)
INDUSTRYBEH_DONT_INCR_PROD = 1 << 7, ///< do not increase production (oil wells) in the temperate climate
INDUSTRYBEH_BEFORE_1950 = 1 << 8, ///< can only be built before 1950 (oil wells)
INDUSTRYBEH_AFTER_1960 = 1 << 9, ///< can only be built after 1960 (oil rigs)
INDUSTRYBEH_AI_AIRSHIP_ROUTES = 1 << 10, ///< ai will attempt to establish air/ship routes to this industry (oil rig)
INDUSTRYBEH_AIRPLANE_ATTACKS = 1 << 11, ///< can be exploded by a military airplane (oil refinery)
INDUSTRYBEH_CHOPPER_ATTACKS = 1 << 12, ///< can be exploded by a military helicopter (factory)
INDUSTRYBEH_CAN_SUBSIDENCE = 1 << 13, ///< can cause a subsidence (coal mine, shaft that collapses)
enum class IndustryBehaviour : uint8_t {
PlantFields = 0, ///< periodically plants fields around itself (temp and arctic farms)
CutTrees = 1, ///< cuts trees and produce first output cargo from them (lumber mill)
BuiltOnWater = 2, ///< is built on water (oil rig)
Town1200More = 3, ///< can only be built in towns larger than 1200 inhabitants (temperate bank)
OnlyInTown = 4, ///< can only be built in towns (arctic/tropic banks, water tower)
OnlyNearTown = 5, ///< is always built near towns (toy shop)
PlantOnBuild = 6, ///< Fields are planted around when built (all farms)
DontIncrProd = 7, ///< do not increase production (oil wells) in the temperate climate
Before1950 = 8, ///< can only be built before 1950 (oil wells)
After1960 = 9, ///< can only be built after 1960 (oil rigs)
AIAirShipRoutes = 10, ///< ai will attempt to establish air/ship routes to this industry (oil rig)
AirplaneAttacks = 11, ///< can be exploded by a military airplane (oil refinery)
ChopperAttacks = 12, ///< can be exploded by a military helicopter (factory)
CanSubsidence = 13, ///< can cause a subsidence (coal mine, shaft that collapses)
/* The following flags are only used for newindustries and do no represent any normal behaviour */
INDUSTRYBEH_PROD_MULTI_HNDLING = 1 << 14, ///< Automatic production multiplier handling
INDUSTRYBEH_PRODCALLBACK_RANDOM = 1 << 15, ///< Production callback needs random bits in var 10
INDUSTRYBEH_NOBUILT_MAPCREATION = 1 << 16, ///< Do not force one instance of this type to appear on map generation
INDUSTRYBEH_CANCLOSE_LASTINSTANCE = 1 << 17, ///< Allow closing down the last instance of this type
INDUSTRYBEH_CARGOTYPES_UNLIMITED = 1 << 18, ///< Allow produced/accepted cargoes callbacks to supply more than 2 and 3 types
INDUSTRYBEH_NO_PAX_PROD_CLAMP = 1 << 19, ///< Do not clamp production of passengers. (smooth economy only)
ProdMultiHandling = 14, ///< Automatic production multiplier handling
ProdCallbackRandom = 15, ///< Production callback needs random bits in var 10
NoBuildMapCreation = 16, ///< Do not force one instance of this type to appear on map generation
CanCloseLastInstance = 17, ///< Allow closing down the last instance of this type
CargoTypesUnlimited = 18, ///< Allow produced/accepted cargoes callbacks to supply more than 2 and 3 types
NoPaxProdClamp = 19, ///< Do not clamp production of passengers. (smooth economy only)
};
DECLARE_ENUM_AS_BIT_SET(IndustryBehaviour)
using IndustryBehaviours = EnumBitSet<IndustryBehaviour, uint32_t>;
/** Flags for miscellaneous industry tile specialities */
enum IndustryTileSpecialFlags : uint8_t {
@ -117,7 +116,7 @@ struct IndustrySpec {
uint16_t input_cargo_multiplier[INDUSTRY_NUM_INPUTS][INDUSTRY_NUM_OUTPUTS]; ///< Input cargo multipliers (multiply amount of incoming cargo for the produced cargoes)
IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs
LandscapeTypes climate_availability; ///< Bitmask, giving landscape enums as bit position
IndustryBehaviour behaviour; ///< How this industry will behave, and how others entities can use it
IndustryBehaviours behaviour; ///< How this industry will behave, and how others entities can use it
uint8_t map_colour; ///< colour used for the small map
StringID name; ///< Displayed name of the industry
StringID new_industry_text; ///< Message appearing when the industry is built

View File

@ -3832,7 +3832,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
break;
case 0x1A: // Special industry flags to define special behavior
indsp->behaviour = (IndustryBehaviour)buf.ReadDWord();
indsp->behaviour = IndustryBehaviours{buf.ReadDWord()};
break;
case 0x1B: // New industry text ID

View File

@ -191,7 +191,7 @@ static uint32_t GetCountAndDistanceOfClosestInstance(uint8_t param_setID, uint8_
case 0x8A: return ClampTo<uint8_t>(GetTileZ(this->tile) * (this->ro.grffile->grf_version >= 8 ? 1 : TILE_HEIGHT));
/* Distance to the nearest water/land tile */
case 0x8B: return GetClosestWaterDistance(this->tile, (GetIndustrySpec(this->industry->type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) == 0);
case 0x8B: return GetClosestWaterDistance(this->tile, !GetIndustrySpec(this->industry->type)->behaviour.Test(IndustryBehaviour::BuiltOnWater));
/* Square of Euclidian distance from town */
case 0x8D: return ClampTo<uint16_t>(DistanceSquare(this->industry->town->xy, this->tile));
@ -216,7 +216,7 @@ static uint32_t GetCountAndDistanceOfClosestInstance(uint8_t param_setID, uint8_
case 0x42: { // waiting cargo, but only if those two callback flags are set
IndustryCallbackMasks callback = indspec->callback_mask;
if (callback.Any({IndustryCallbackMask::ProductionCargoArrival, IndustryCallbackMask::Production256Ticks})) {
if ((indspec->behaviour & INDUSTRYBEH_PROD_MULTI_HNDLING) != 0) {
if (indspec->behaviour.Test(IndustryBehaviour::ProdMultiHandling)) {
if (this->industry->prod_level == 0) return 0;
return ClampTo<uint16_t>(this->industry->GetAccepted(variable - 0x40).waiting / this->industry->prod_level);
} else {
@ -230,7 +230,7 @@ static uint32_t GetCountAndDistanceOfClosestInstance(uint8_t param_setID, uint8_
/* Manhattan distance of closes dry/water tile */
case 0x43:
if (this->tile == INVALID_TILE) break;
return GetClosestWaterDistance(this->tile, (indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) == 0);
return GetClosestWaterDistance(this->tile, !indspec->behaviour.Test(IndustryBehaviour::BuiltOnWater));
/* Layout number */
case 0x44: return this->industry->selected_layout;
@ -605,9 +605,9 @@ void IndustryProductionCallback(Industry *ind, int reason)
{
const IndustrySpec *spec = GetIndustrySpec(ind->type);
IndustriesResolverObject object(ind->location.tile, ind, ind->type);
if ((spec->behaviour & INDUSTRYBEH_PRODCALLBACK_RANDOM) != 0) object.callback_param1 = Random();
if (spec->behaviour.Test(IndustryBehaviour::ProdCallbackRandom)) object.callback_param1 = Random();
int multiplier = 1;
if ((spec->behaviour & INDUSTRYBEH_PROD_MULTI_HNDLING) != 0) multiplier = ind->prod_level;
if (spec->behaviour.Test(IndustryBehaviour::ProdMultiHandling)) multiplier = ind->prod_level;
object.callback_param2 = reason;
for (uint loop = 0;; loop++) {

View File

@ -1477,7 +1477,7 @@ bool AfterLoadGame()
for (Industry *i : Industry::Iterate()) {
uint j;
if (GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_PLANT_ON_BUILT) {
if (GetIndustrySpec(i->type)->behaviour.Test(IndustryBehaviour::PlantOnBuild)) {
for (j = 0; j != 50; j++) PlantRandomFarmField(i);
}
}
@ -1954,7 +1954,7 @@ bool AfterLoadGame()
SetWaterClassDependingOnSurroundings(t, true);
}
if (IsTileType(t, MP_INDUSTRY)) {
if ((GetIndustrySpec(GetIndustryType(t))->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0) {
if (GetIndustrySpec(GetIndustryType(t))->behaviour.Test(IndustryBehaviour::BuiltOnWater)) {
SetWaterClassDependingOnSurroundings(t, true);
} else {
SetWaterClass(t, WATER_CLASS_INVALID);

View File

@ -165,14 +165,14 @@
{
if (!IsValidIndustry(industry_id)) return false;
return (::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0;
return ::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour.Test(IndustryBehaviour::BuiltOnWater);
}
/* static */ bool ScriptIndustry::HasHeliport(IndustryID industry_id)
{
if (!IsValidIndustry(industry_id)) return false;
return (::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
return ::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour.Test(IndustryBehaviour::AIAirShipRoutes);
}
/* static */ TileIndex ScriptIndustry::GetHeliportLocation(IndustryID industry_id)
@ -194,7 +194,7 @@
{
if (!IsValidIndustry(industry_id)) return false;
return (::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
return ::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour.Test(IndustryBehaviour::AIAirShipRoutes);
}
/* static */ TileIndex ScriptIndustry::GetDockLocation(IndustryID industry_id)

View File

@ -46,7 +46,7 @@
if (!IsValidIndustryType(industry_type)) return false;
if (_settings_game.game_creation.landscape != LandscapeType::Temperate) return true;
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_DONT_INCR_PROD) == 0;
return !::GetIndustrySpec(industry_type)->behaviour.Test(IndustryBehaviour::DontIncrProd);
}
/* static */ Money ScriptIndustryType::GetConstructionCost(IndustryType industry_type)
@ -141,21 +141,21 @@
{
if (!IsValidIndustryType(industry_type)) return false;
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0;
return ::GetIndustrySpec(industry_type)->behaviour.Test(IndustryBehaviour::BuiltOnWater);
}
/* static */ bool ScriptIndustryType::HasHeliport(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
return ::GetIndustrySpec(industry_type)->behaviour.Test(IndustryBehaviour::AIAirShipRoutes);
}
/* static */ bool ScriptIndustryType::HasDock(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
return ::GetIndustrySpec(industry_type)->behaviour.Test(IndustryBehaviour::AIAirShipRoutes);
}
/* static */ IndustryType ScriptIndustryType::ResolveNewGRFID(SQInteger grfid, SQInteger grf_local_id)

View File

@ -1152,7 +1152,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_COAL, 15, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeTypes({LandscapeType::Temperate, LandscapeType::Arctic}),
INDUSTRYBEH_CAN_SUBSIDENCE,
IndustryBehaviour::CanSubsidence,
STR_INDUSTRY_NAME_COAL_MINE, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_COAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1162,7 +1162,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_COAL, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_BLACK_HOLE, LandscapeTypes({LandscapeType::Temperate, LandscapeType::Arctic}),
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_POWER_STATION, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1172,7 +1172,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_WOOD, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_PROCESSING, LandscapeType::Temperate,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_SAWMILL, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1182,7 +1182,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_WOOD, 13, CT_INVALID, 0, 30,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_ORGANIC, LandscapeTypes({LandscapeType::Temperate, LandscapeType::Arctic}),
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_FOREST, STR_NEWS_INDUSTRY_PLANTED,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM),
@ -1192,7 +1192,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_OIL, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_PROCESSING, LandscapeTypes({LandscapeType::Temperate, LandscapeType::Arctic, LandscapeType::Tropic}),
INDUSTRYBEH_AIRPLANE_ATTACKS,
IndustryBehaviour::AirplaneAttacks,
STR_INDUSTRY_NAME_OIL_REFINERY, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1202,7 +1202,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_OIL, 15, CT_PASSENGERS, 2, 5,
CT_INVALID, 0, CT_INVALID, 0, CT_INVALID, 0,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Temperate,
INDUSTRYBEH_BUILT_ONWATER | INDUSTRYBEH_AFTER_1960 | INDUSTRYBEH_AI_AIRSHIP_ROUTES,
IndustryBehaviours({IndustryBehaviour::BuiltOnWater, IndustryBehaviour::After1960, IndustryBehaviour::AIAirShipRoutes}),
STR_INDUSTRY_NAME_OIL_RIG, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_OIL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1212,7 +1212,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_GOODS, 0, CT_INVALID, 0, 5,
MCT_LIVESTOCK_FRUIT, 256, MCT_GRAIN_WHEAT_MAIZE, 256, CT_STEEL, 256,
INDUSTRYLIFE_PROCESSING, LandscapeType::Temperate,
INDUSTRYBEH_CHOPPER_ATTACKS,
IndustryBehaviour::ChopperAttacks,
STR_INDUSTRY_NAME_FACTORY, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1222,7 +1222,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_PAPER, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_PROCESSING, LandscapeType::Arctic,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_PRINTING_WORKS, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1232,7 +1232,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_STEEL, 0, CT_INVALID, 0, 5,
CT_IRON_ORE, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_PROCESSING, LandscapeType::Temperate,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_STEEL_MILL, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1242,7 +1242,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
MCT_GRAIN_WHEAT_MAIZE, 10, MCT_LIVESTOCK_FRUIT, 10, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_ORGANIC, LandscapeTypes({LandscapeType::Temperate, LandscapeType::Arctic}),
INDUSTRYBEH_PLANT_FIELDS | INDUSTRYBEH_PLANT_ON_BUILT,
IndustryBehaviours({IndustryBehaviour::PlantFields, IndustryBehaviour::PlantOnBuild}),
STR_INDUSTRY_NAME_FARM, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_FARM, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM),
@ -1252,7 +1252,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_COPPER_ORE, 10, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Tropic,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_COPPER_ORE_MINE, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1262,7 +1262,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_OIL, 12, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeTypes({LandscapeType::Temperate, LandscapeType::Arctic, LandscapeType::Tropic}),
INDUSTRYBEH_DONT_INCR_PROD | INDUSTRYBEH_BEFORE_1950,
IndustryBehaviours({IndustryBehaviour::DontIncrProd, IndustryBehaviour::Before1950}),
STR_INDUSTRY_NAME_OIL_WELLS, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_OIL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1272,7 +1272,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
MCT_VALUABLES_GOLD_DIAMONDS, 6, CT_INVALID, 0, 5,
MCT_VALUABLES_GOLD_DIAMONDS, 0, CT_INVALID, 0, CT_INVALID, 0,
INDUSTRYLIFE_BLACK_HOLE, LandscapeType::Temperate,
INDUSTRYBEH_TOWN1200_MORE,
IndustryBehaviour::Town1200More,
STR_INDUSTRY_NAME_BANK, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1282,7 +1282,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_FOOD, 0, CT_INVALID, 0, 5,
MCT_LIVESTOCK_FRUIT, 256, MCT_GRAIN_WHEAT_MAIZE, 256, CT_INVALID, 256,
INDUSTRYLIFE_PROCESSING, LandscapeTypes({LandscapeType::Arctic, LandscapeType::Tropic}),
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_FOOD_PROCESSING_PLANT, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1292,7 +1292,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_PAPER, 0, CT_INVALID, 0, 5,
CT_WOOD, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_PROCESSING, LandscapeType::Arctic,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_PAPER_MILL, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1302,7 +1302,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
MCT_VALUABLES_GOLD_DIAMONDS, 7, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Arctic,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_GOLD_MINE, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1312,7 +1312,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_INVALID, 0, CT_INVALID, 0, 5,
MCT_VALUABLES_GOLD_DIAMONDS, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_BLACK_HOLE, LandscapeTypes({LandscapeType::Arctic, LandscapeType::Tropic}),
INDUSTRYBEH_ONLY_INTOWN,
IndustryBehaviour::OnlyInTown,
STR_INDUSTRY_NAME_BANK_TROPIC_ARCTIC, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1322,7 +1322,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
MCT_VALUABLES_GOLD_DIAMONDS, 7, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Tropic,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_DIAMOND_MINE, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1332,7 +1332,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_IRON_ORE, 10, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Temperate,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_IRON_ORE_MINE, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1342,7 +1342,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
MCT_LIVESTOCK_FRUIT, 10, CT_INVALID, 0, 15,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_ORGANIC, LandscapeType::Tropic,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_FRUIT_PLANTATION, STR_NEWS_INDUSTRY_PLANTED,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_FARM, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM),
@ -1352,7 +1352,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_RUBBER, 10, CT_INVALID, 0, 15,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_ORGANIC, LandscapeType::Tropic,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_RUBBER_PLANTATION, STR_NEWS_INDUSTRY_PLANTED,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_FARM, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM),
@ -1362,7 +1362,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_WATER, 12, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Tropic,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_WATER_SUPPLY, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1372,7 +1372,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_WATER, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_BLACK_HOLE, LandscapeType::Tropic,
INDUSTRYBEH_ONLY_INTOWN,
IndustryBehaviour::OnlyInTown,
STR_INDUSTRY_NAME_WATER_TOWER, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1382,7 +1382,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_RUBBER, 256, CT_COPPER_ORE, 256, CT_WOOD, 256,
INDUSTRYLIFE_PROCESSING, LandscapeType::Tropic,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_FACTORY_2, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1392,7 +1392,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
MCT_GRAIN_WHEAT_MAIZE, 11, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_ORGANIC, LandscapeType::Tropic,
INDUSTRYBEH_PLANT_FIELDS | INDUSTRYBEH_PLANT_ON_BUILT,
IndustryBehaviours({IndustryBehaviour::PlantFields, IndustryBehaviour::PlantOnBuild}),
STR_INDUSTRY_NAME_FARM_2, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_FARM, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM),
@ -1402,7 +1402,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_WOOD, 0, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_PROCESSING, LandscapeType::Tropic,
INDUSTRYBEH_CUT_TREES,
IndustryBehaviour::CutTrees,
STR_INDUSTRY_NAME_LUMBER_MILL, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_LACK_OF_TREES, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1412,7 +1412,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_COTTON_CANDY, 13, CT_INVALID, 0, 30,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_ORGANIC, LandscapeType::Toyland,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_COTTON_CANDY_FOREST, STR_NEWS_INDUSTRY_PLANTED,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_FARM, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1422,7 +1422,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_CANDY, 0, CT_INVALID, 0, 5,
CT_SUGAR, 256, CT_TOFFEE, 256, CT_COTTON_CANDY, 256,
INDUSTRYLIFE_PROCESSING, LandscapeType::Toyland,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_CANDY_FACTORY, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1432,7 +1432,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_BATTERIES, 11, CT_INVALID, 0, 30,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_ORGANIC, LandscapeType::Toyland,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_BATTERY_FARM, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_FARM, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM),
@ -1442,7 +1442,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_COLA, 12, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Toyland,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_COLA_WELLS, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1452,7 +1452,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_TOYS, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_BLACK_HOLE, LandscapeType::Toyland,
INDUSTRYBEH_ONLY_NEARTOWN,
IndustryBehaviour::OnlyNearTown,
STR_INDUSTRY_NAME_TOY_SHOP, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1462,7 +1462,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_TOYS, 0, CT_INVALID, 0, 5,
CT_PLASTIC, 256, CT_BATTERIES, 256, CT_INVALID, 256,
INDUSTRYLIFE_PROCESSING, LandscapeType::Toyland,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_TOY_FACTORY, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1472,7 +1472,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_PLASTIC, 14, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Toyland,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_PLASTIC_FOUNTAINS, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1482,7 +1482,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_FIZZY_DRINKS, 0, CT_INVALID, 0, 5,
CT_COLA, 256, CT_BUBBLES, 256, CT_INVALID, 256,
INDUSTRYLIFE_PROCESSING, LandscapeType::Toyland,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_FIZZY_DRINK_FACTORY, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1492,7 +1492,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_BUBBLES, 13, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Toyland,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_BUBBLE_GENERATOR, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1502,7 +1502,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_TOFFEE, 10, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Toyland,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_TOFFEE_QUARRY, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
@ -1512,7 +1512,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
CT_SUGAR, 11, CT_INVALID, 0, 5,
CT_INVALID, 256, CT_INVALID, 256, CT_INVALID, 256,
INDUSTRYLIFE_EXTRACTIVE, LandscapeType::Toyland,
INDUSTRYBEH_NONE,
{},
STR_INDUSTRY_NAME_SUGAR_MINE, STR_NEWS_INDUSTRY_CONSTRUCTION,
STR_NEWS_INDUSTRY_CLOSURE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL),
};