diff options
author | belugas <belugas@openttd.org> | 2006-04-26 21:10:01 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2006-04-26 21:10:01 +0000 |
commit | 6a31b30a2091ea4f139b222778b5d435335ad828 (patch) | |
tree | 9ef9481d7eac6542fd60dc32e798aba6dea291ef | |
parent | 2f01c7d990d70b348afc6cad3107d3ddbc89a37e (diff) | |
download | openttd-6a31b30a2091ea4f139b222778b5d435335ad828.tar.xz |
(svn r4584) CodeChange : Cleanup of industry_cmd (Step-3).
Renaming GetIndustrySpecification to GetIndustrySpec. Looks better.
Removing the _industry_prod_up/down/close_strings
in favor of IndustrySpec.closure/production_up/down_text;
A few reformatting along the way.
Work of tfc_team
-rw-r--r-- | industry_cmd.c | 205 | ||||
-rw-r--r-- | table/build_industry.h | 294 |
2 files changed, 292 insertions, 207 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index f88db79d7..80840d376 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -89,126 +89,6 @@ static const IndustryType _industry_close_mode[IT_END] = { /* SUGAR_MINE */ INDUSTRYLIFE_PRODUCTION }; -static const StringID _industry_prod_up_strings[IT_END] = { - STR_4836_NEW_COAL_SEAM_FOUND_AT, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4837_NEW_OIL_RESERVES_FOUND, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4838_IMPROVED_FARMING_METHODS, - STR_4835_INCREASES_PRODUCTION, - STR_4837_NEW_OIL_RESERVES_FOUND, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4838_IMPROVED_FARMING_METHODS, - STR_4838_IMPROVED_FARMING_METHODS, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4838_IMPROVED_FARMING_METHODS, - STR_4835_INCREASES_PRODUCTION, - STR_4838_IMPROVED_FARMING_METHODS, - STR_4835_INCREASES_PRODUCTION, - STR_4838_IMPROVED_FARMING_METHODS, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, - STR_4835_INCREASES_PRODUCTION, -}; - -static const StringID _industry_prod_down_strings[IT_END] = { - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_483A_INSECT_INFESTATION_CAUSES, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_483A_INSECT_INFESTATION_CAUSES, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_483A_INSECT_INFESTATION_CAUSES, - STR_483A_INSECT_INFESTATION_CAUSES, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_483A_INSECT_INFESTATION_CAUSES, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_483A_INSECT_INFESTATION_CAUSES, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, - STR_4839_PRODUCTION_DOWN_BY_50, -}; - -static const StringID _industry_close_strings[IT_END] = { - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4834_LACK_OF_NEARBY_TREES_CAUSES, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE, - STR_4832_ANNOUNCES_IMMINENT_CLOSURE -}; - /** * Retrieve the type for this industry. Although it is accessed by a tile, * it will return the general type of industry, and not the sprite index @@ -239,10 +119,10 @@ IndustryType GetIndustryType(TileIndex tile) * Accessor for array _industry_specs. * This will ensure at once : proper access and * not allowing modifications of it. - * @param thistype of industry (which is the index in _industry_spec) + * @param thistype of industry (which is the index in _industry_specs) * @pre thistype < IT_END **/ -static const IndustrySpec *GetIndustrySpecification(IndustryType thistype) +static const IndustrySpec *GetIndustrySpec(IndustryType thistype) { assert(thistype < IT_END); return &_industry_specs[thistype]; @@ -447,11 +327,11 @@ static int32 ClearTile_Industry(TileIndex tile, byte flags) static void TransportIndustryGoods(TileIndex tile) { Industry *i = GetIndustryByTile(tile); - const IndustrySpec *spec = GetIndustrySpecification(i->type); + const IndustrySpec *indspec = GetIndustrySpec(i->type); uint cw, am; cw = min(i->cargo_waiting[0], 255); - if (cw > spec->minimal_cargo/* && i->produced_cargo[0] != 0xFF*/) { + if (cw > indspec->minimal_cargo/* && i->produced_cargo[0] != 0xFF*/) { i->cargo_waiting[0] -= cw; /* fluctuating economy? */ @@ -474,7 +354,7 @@ static void TransportIndustryGoods(TileIndex tile) } cw = min(i->cargo_waiting[1], 255); - if (cw > spec->minimal_cargo) { + if (cw > indspec->minimal_cargo) { i->cargo_waiting[1] -= cw; if (_economy.fluct <= 0) cw = (cw + 1) / 2; @@ -1352,19 +1232,19 @@ do_clear: static bool CheckIfTooCloseToIndustry(TileIndex tile, int type) { - const IndustrySpec *spec = GetIndustrySpecification(type); + const IndustrySpec *indspec = GetIndustrySpec(type); const Industry *i; // accepting industries won't be close, not even with patch - if (_patches.same_industry_close && spec->accepts_cargo[0] == CT_INVALID) + if (_patches.same_industry_close && indspec->accepts_cargo[0] == CT_INVALID) return true; FOR_ALL_INDUSTRIES(i) { // check if an industry that accepts the same goods is nearby if (i->xy != 0 && DistanceMax(tile, i->xy) <= 14 && - spec->accepts_cargo[0] != CT_INVALID && - spec->accepts_cargo[0] == i->accepts_cargo[0] && ( + indspec->accepts_cargo[0] != CT_INVALID && + indspec->accepts_cargo[0] == i->accepts_cargo[0] && ( _game_mode != GM_EDITOR || !_patches.same_industry_close || !_patches.multiple_industry_per_town @@ -1375,7 +1255,7 @@ static bool CheckIfTooCloseToIndustry(TileIndex tile, int type) // check "not close to" field. if (i->xy != 0 && - (i->type == spec->conflicting[0] || i->type == spec->conflicting[1] || i->type == spec->conflicting[2]) && + (i->type == indspec->conflicting[0] || i->type == indspec->conflicting[1] || i->type == indspec->conflicting[2]) && DistanceMax(tile, i->xy) <= 14) { _error_message = STR_INDUSTRY_TOO_CLOSE; return false; @@ -1407,7 +1287,7 @@ static Industry *AllocateIndustry(void) static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, const Town *t, byte owner) { - const IndustrySpec *spec = GetIndustrySpecification(type); + const IndustrySpec *indspec = GetIndustrySpec(type); uint32 r; int j; @@ -1415,13 +1295,13 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind i->width = i->height = 0; i->type = type; - i->produced_cargo[0] = spec->produced_cargo[0]; - i->produced_cargo[1] = spec->produced_cargo[1]; - i->accepts_cargo[0] = spec->accepts_cargo[0]; - i->accepts_cargo[1] = spec->accepts_cargo[1]; - i->accepts_cargo[2] = spec->accepts_cargo[2]; - i->production_rate[0] = spec->production_rate[0]; - i->production_rate[1] = spec->production_rate[1]; + i->produced_cargo[0] = indspec->produced_cargo[0]; + i->produced_cargo[1] = indspec->produced_cargo[1]; + i->accepts_cargo[0] = indspec->accepts_cargo[0]; + i->accepts_cargo[1] = indspec->accepts_cargo[1]; + i->accepts_cargo[2] = indspec->accepts_cargo[2]; + i->production_rate[0] = indspec->production_rate[0]; + i->production_rate[1] = indspec->production_rate[1]; if (_patches.smooth_economy) { i->production_rate[0] = min((RandomRange(256) + 128) * i->production_rate[0] >> 8 , 255); @@ -1500,7 +1380,7 @@ int32 CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) int num; const IndustryTileTable * const *itt; const IndustryTileTable *it; - const IndustrySpec *spec; + const IndustrySpec *indspec; SET_EXPENSES_TYPE(EXPENSES_OTHER); @@ -1521,25 +1401,25 @@ int32 CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (!found) return CMD_ERROR; } - spec = GetIndustrySpecification(p1); + indspec = GetIndustrySpec(p1); /* If the patch 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) * Exclude the lumber mill (only "raw" industry that can be built) */ if (!_patches.build_rawmaterial_ind && - spec->accepts_cargo[0] == CT_INVALID && - spec->accepts_cargo[1] == CT_INVALID && - spec->accepts_cargo[2] == CT_INVALID && + indspec->accepts_cargo[0] == CT_INVALID && + indspec->accepts_cargo[1] == CT_INVALID && + indspec->accepts_cargo[2] == CT_INVALID && p1 != IT_LUMBER_MILL) { return CMD_ERROR; } - if (!_check_new_industry_procs[spec->check_proc](tile, p1)) return CMD_ERROR; + if (!_check_new_industry_procs[indspec->check_proc](tile, p1)) return CMD_ERROR; t = CheckMultipleIndustryInTown(tile, p1); if (t == NULL) return CMD_ERROR; - num = spec->num_table; - itt = spec->table; + num = indspec->num_table; + itt = indspec->table; do { if (--num < 0) return_cmd_error(STR_0239_SITE_UNSUITABLE); @@ -1563,19 +1443,19 @@ Industry *CreateNewIndustry(TileIndex tile, IndustryType type) const IndustryTileTable *it; Industry *i; - const IndustrySpec *spec; + const IndustrySpec *indspec; if (!CheckSuitableIndustryPos(tile)) return NULL; - spec = GetIndustrySpecification(type); + indspec = GetIndustrySpec(type); - if (!_check_new_industry_procs[spec->check_proc](tile, type)) return NULL; + if (!_check_new_industry_procs[indspec->check_proc](tile, type)) return NULL; t = CheckMultipleIndustryInTown(tile, type); if (t == NULL) return NULL; /* pick a random layout */ - it = spec->table[RandomRange(spec->num_table)]; + it = indspec->table[RandomRange(indspec->num_table)]; if (!CheckIfIndustryTilesAreFree(tile, it, type, t)) return NULL; if (!CheckIfTooCloseToIndustry(tile, type)) return NULL; @@ -1589,13 +1469,14 @@ Industry *CreateNewIndustry(TileIndex tile, IndustryType type) } static const byte _numof_industry_table[4][12] = { - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5}, - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, - {0, 2, 3, 4, 6, 7, 8, 9, 10, 10, 10}, + // difficulty settings for number of industries + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //none + {0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5}, //low + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, //normal + {0, 2, 3, 4, 6, 7, 8, 9, 10, 10, 10}, //high }; -static void PlaceInitialIndustry(byte type, int amount) +static void PlaceInitialIndustry(IndustryType type, int amount) { int num = _numof_industry_table[_opt.diff.number_industries][amount]; @@ -1638,6 +1519,7 @@ static void ExtChangeIndustryProduction(Industry *i) { bool closeit = true; int j; + const IndustrySpec *indspec = GetIndustrySpec(i->type); switch (_industry_close_mode[i->type]) { case INDUSTRYLIFE_NOT_CLOSABLE: @@ -1669,7 +1551,7 @@ static void ExtChangeIndustryProduction(Industry *i) percent = new * 100 / old - 100; i->production_rate[j] = new; - if (new >= GetIndustrySpecification(i->type)->production_rate[j] / 4) + if (new >= indspec->production_rate[j] / 4) closeit = false; mag = abs(percent); @@ -1692,7 +1574,7 @@ static void ExtChangeIndustryProduction(Industry *i) i->prod_level = 0; SetDParam(0, i->index); AddNewsItem( - _industry_close_strings[i->type], + indspec->closure_text, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0 ); @@ -1784,6 +1666,7 @@ static void ChangeIndustryProduction(Industry *i) bool only_decrease = false; StringID str = STR_NULL; int type = i->type; + const IndustrySpec *indspec = GetIndustrySpec(type); switch (_industry_close_mode[type]) { case INDUSTRYLIFE_NOT_CLOSABLE: @@ -1813,19 +1696,19 @@ static void ChangeIndustryProduction(Industry *i) b = 0xFF; i->production_rate[1] = b; - str = _industry_prod_up_strings[type]; + str = indspec->production_up_text; } } else { /* Decrease production */ if (i->prod_level == 4) { i->prod_level = 0; - str = _industry_close_strings[type]; + str = indspec->closure_text; } else { i->prod_level >>= 1; i->production_rate[0] = (i->production_rate[0] + 1) >> 1; i->production_rate[1] = (i->production_rate[1] + 1) >> 1; - str = _industry_prod_down_strings[type]; + str = indspec->production_down_text; } } } @@ -1835,7 +1718,7 @@ static void ChangeIndustryProduction(Industry *i) /* maybe close */ if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1,2)) { i->prod_level = 0; - str = _industry_close_strings[type]; + str = indspec->closure_text; } break; } diff --git a/table/build_industry.h b/table/build_industry.h index 2b3f67a69..7f6fe2710 100644 --- a/table/build_industry.h +++ b/table/build_industry.h @@ -7,14 +7,25 @@ typedef struct IndustryTileTable { } IndustryTileTable; typedef struct IndustrySpec { + /** Tables with the 'layout' of different composition of GFXes */ const IndustryTileTable *const *table; + /** Number of elements in the table */ byte num_table; + /** Industries this industry cannot be close to */ IndustryType conflicting[3]; + /** index to a procedure to check for conflicting circumstances */ + byte check_proc; + CargoID produced_cargo[2]; byte production_rate[2]; - CargoID accepts_cargo[3]; + /** The minimum amount of cargo transported to the stations; if the + * waiting cargo is less than this number, no cargo is moved to it*/ byte minimal_cargo; - byte check_proc; + CargoID accepts_cargo[3]; + + StringID closure_text; + StringID production_up_text; + StringID production_down_text; } IndustrySpec; #define MK(x,y, m) {{x, y}, m} @@ -1094,60 +1105,251 @@ typedef enum CheckProcs { CHECK_END, } CheckProc; -#define MK(tbl, a,b,c, p1,p2, r1,r2, a1,a2,a3, m1, proc) {tbl,lengthof(tbl),{a,b,c},{p1,p2},{r1,r2},{a1,a2,a3},m1,proc} +#define MK(tbl, c1, c2, c3, proc, p1, r1, p2, r2, m, a1, a2, a3, s1, s2, s3) \ + {tbl, lengthof(tbl), {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m, \ + {a1, a2, a3}, s1, s2, s3} static const IndustrySpec _industry_specs[] = { -/* name not close to produce prodrate accepts min checkproc */ - MK(_tile_table_coal_mine, 1,255,255, 1,255, 15, 0, 255,255,255, 5, CHECK_NOTHING), - MK(_tile_table_power_station, 0,255,255, 255,255, 0, 0, 1,255,255, 5, CHECK_NOTHING), - MK(_tile_table_sawmill, 3,255,255, 5,255, 0, 0, 7,255,255, 5, CHECK_NOTHING), - MK(_tile_table_forest, 2, 14,255, 7,255, 13, 0, 255,255,255, 30, CHECK_FOREST), - MK(_tile_table_oil_refinery, 5,255,255, 5,255, 0, 0, 3,255,255, 5, CHECK_OIL), - MK(_tile_table_oil_rig, 4,255,255, 3, 0, 15, 2, 255,255,255, 5, CHECK_OIL), - MK(_tile_table_factory, 9, 8,255, 5,255, 0, 0, 4, 6, 9, 5, CHECK_NOTHING), - MK(_tile_table_printing_works, 14,255,255, 5,255, 0, 0, 9,255,255, 5, CHECK_NOTHING), - MK(_tile_table_steel_mill, 18, 6,255, 9,255, 0, 0, 8,255,255, 5, CHECK_NOTHING), - MK(_tile_table_farm, 6, 13,255, 6, 4, 10,10, 255,255,255, 5, CHECK_FARM), - MK(_tile_table_copper_mine, 23,255,255, 8,255, 10, 0, 255,255,255, 5, CHECK_NOTHING), - MK(_tile_table_oil_well, 4,255,255, 3,255, 12, 0, 255,255,255, 5, CHECK_NOTHING), - MK(_tile_table_bank, 12,255,255, 10,255, 6, 0, 10,255,255, 2, CHECK_NOTHING), - MK(_tile_table_food_process, 9, 19, 24, 11,255, 0, 0, 4, 6,255, 5, CHECK_NOTHING), - MK(_tile_table_paper_mill, 3, 7,255, 9,255, 0, 0, 7,255,255, 5, CHECK_NOTHING), - MK(_tile_table_gold_mine, 16,255,255, 10,255, 7, 0, 255,255,255, 5, CHECK_NOTHING), - MK(_tile_table_bank2, 15, 17,255, 255,255, 0, 0, 10,255,255, 5, CHECK_NOTHING), - MK(_tile_table_diamond_mine, 16,255,255, 10,255, 7, 0, 255,255,255, 5, CHECK_NOTHING), - MK(_tile_table_iron_mine, 8,255,255, 8,255, 10, 0, 255,255,255, 5, CHECK_NOTHING), - MK(_tile_table_fruit_plantation, 13,255,255, 4,255, 10, 0, 255,255,255, 15, CHECK_PLANTATION), - MK(_tile_table_rubber_plantation,23,255,255, 1,255, 10, 0, 255,255,255, 15, CHECK_PLANTATION), - MK(_tile_table_water_supply, 22,255,255, 9,255, 12, 0, 255,255,255, 5, CHECK_WATER), - MK(_tile_table_water_tower, 21,255,255, 255,255, 0, 0, 9,255,255, 5, CHECK_WATER), - MK(_tile_table_factory2, 10, 20, 25, 5,255, 0, 0, 1, 8, 7, 5, CHECK_PLANTATION), - MK(_tile_table_farm2, 13,255,255, 6,255, 11, 0, 255,255,255, 5, CHECK_PLANTATION), - MK(_tile_table_lumber_mill, 23,255,255, 7,255, 0, 0, 255,255,255, 5, CHECK_LUMBERMILL), - MK(_tile_table_cotton_candy, 27,255,255, 8,255, 13, 0, 255,255,255, 30, CHECK_NOTHING), - MK(_tile_table_candy_factory, 26, 35, 36, 5,255, 0, 0, 1, 6, 8, 5, CHECK_NOTHING), - MK(_tile_table_battery_farm, 31,255,255, 4,255, 11, 0, 255,255,255, 30, CHECK_NOTHING), - MK(_tile_table_cola_wells, 33,255,255, 7,255, 12, 0, 255,255,255, 5, CHECK_NOTHING), - MK(_tile_table_toy_shop, 31,255,255, 255,255, 0, 0, 3,255,255, 5, CHECK_NOTHING), - MK(_tile_table_toy_factory, 30, 28, 32, 3,255, 0, 0, 10, 4,255, 5, CHECK_NOTHING), - MK(_tile_table_plastic_fountain, 31,255,255, 10,255, 14, 0, 255,255,255, 5, CHECK_NOTHING), - MK(_tile_table_fizzy_drink, 29, 34,255, 11,255, 0, 0, 7, 9,255, 5, CHECK_NOTHING), - MK(_tile_table_bubble_generator, 33,255,255, 9,255, 13, 0, 255,255,255, 5, CHECK_BUBBLEGEN), - MK(_tile_table_toffee_quarry, 27,255,255, 6,255, 10, 0, 255,255,255, 5, CHECK_NOTHING), - MK(_tile_table_sugar_mine, 27,255,255, 1,255, 11, 0, 255,255,255, 5, CHECK_NOTHING), + /* Format: + tile table + cannot be close to these industries (3 times) check proc + (produced cargo + rate) (twice) minimum cargo moved to station + 3 accepted cargo + messages : Closure production up production down */ + MK(_tile_table_coal_mine, + IT_POWER_STATION, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_COAL, 15, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4836_NEW_COAL_SEAM_FOUND_AT, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_power_station, + IT_COAL_MINE, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_INVALID, 0, CT_INVALID, 0, 5, + CT_COAL, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_sawmill, + IT_FOREST, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_GOODS, 0, CT_INVALID, 0, 5, + CT_WOOD, CT_INVALID, CT_INVALID, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_forest, + IT_SAWMILL, IT_PAPER_MILL, IT_INVALID, CHECK_FOREST, + CT_WOOD, 13, CT_INVALID, 0, 30, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_483A_INSECT_INFESTATION_CAUSES), + + MK(_tile_table_oil_refinery, + IT_OIL_RIG, IT_INVALID, IT_INVALID, CHECK_OIL, + CT_GOODS, 0, CT_INVALID, 0, 5, + CT_OIL, CT_INVALID, CT_INVALID, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_oil_rig, + IT_OIL_REFINERY, IT_INVALID, IT_INVALID, CHECK_OIL, + CT_OIL, 15, CT_PASSENGERS, 2, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4837_NEW_OIL_RESERVES_FOUND, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_factory, + IT_FARM, IT_STEEL_MILL, IT_INVALID, CHECK_NOTHING, + CT_GOODS, 0, CT_INVALID, 0, 5, + CT_LIVESTOCK, CT_GRAIN, CT_STEEL, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_printing_works, + IT_PAPER_MILL, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_GOODS, 0, CT_INVALID, 0, 5, + CT_PAPER, CT_INVALID, CT_INVALID, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_steel_mill, + IT_IRON_MINE, IT_FACTORY, IT_INVALID, CHECK_NOTHING, + CT_STEEL, 0, CT_INVALID, 0, 5, + CT_IRON_ORE, CT_INVALID, CT_INVALID, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_farm, + IT_FACTORY, IT_FOOD_PROCESS, IT_INVALID, CHECK_FARM, + CT_GRAIN, 10, CT_LIVESTOCK, 10, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES), + + MK(_tile_table_copper_mine, + IT_FACTORY_2, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_COPPER_ORE, 10, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_oil_well, + IT_OIL_REFINERY, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_OIL, 12, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4837_NEW_OIL_RESERVES_FOUND, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_bank, + IT_BANK_TEMP, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_VALUABLES, 6, CT_INVALID, 0, 5, + CT_VALUABLES, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_food_process, + IT_FRUIT_PLANTATION, IT_FARM, IT_FARM_2, CHECK_NOTHING, + CT_FOOD, 0, CT_INVALID, 0, 5, + CT_FRUIT, CT_MAIZE, CT_INVALID, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_paper_mill, + IT_FOREST, IT_PRINTING_WORKS, IT_INVALID, CHECK_NOTHING, + CT_PAPER, 0, CT_INVALID, 0, 5, + CT_WOOD, CT_INVALID, CT_INVALID, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_gold_mine, + IT_BANK_TROPIC_ARCTIC, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_GOLD, 7, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_bank2, + IT_GOLD_MINE, IT_DIAMOND_MINE, IT_INVALID, CHECK_NOTHING, + CT_INVALID, 0, CT_INVALID, 0, 5, + CT_GOLD, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_diamond_mine, + IT_BANK_TROPIC_ARCTIC, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_DIAMONDS, 7, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_iron_mine, + IT_STEEL_MILL, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_IRON_ORE, 10, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_fruit_plantation, + IT_FOOD_PROCESS, IT_INVALID, IT_INVALID, CHECK_PLANTATION, + CT_FRUIT, 10, CT_INVALID, 0, 15, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES), + + MK(_tile_table_rubber_plantation, + IT_FACTORY_2, IT_INVALID, IT_INVALID, CHECK_PLANTATION, + CT_RUBBER, 10, CT_INVALID, 0, 15, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES), + + MK(_tile_table_water_supply, + IT_WATER_TOWER, IT_INVALID, IT_INVALID, CHECK_WATER, + CT_WATER, 12, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_water_tower, + IT_WATER_SUPPLY, IT_INVALID, IT_INVALID, CHECK_WATER, + CT_INVALID, 0, CT_INVALID, 0, 5, + CT_WATER, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_factory2, + IT_RUBBER_PLANTATION, IT_COPPER_MINE, IT_LUMBER_MILL, CHECK_PLANTATION, + CT_GOODS, 0, CT_INVALID, 0, 5, + CT_RUBBER, CT_COPPER_ORE, CT_WOOD, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_farm2, + IT_FOOD_PROCESS, IT_INVALID, IT_INVALID, CHECK_PLANTATION, + CT_MAIZE, 11, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES), + + MK(_tile_table_lumber_mill, + IT_FACTORY_2, IT_INVALID, IT_INVALID, CHECK_LUMBERMILL, + CT_WOOD, 0, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4834_LACK_OF_NEARBY_TREES_CAUSES, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_cotton_candy, + IT_CANDY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_COTTON_CANDY, 13, CT_INVALID, 0, 30, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_candy_factory, + IT_COTTON_CANDY, IT_TOFFEE_QUARRY, IT_SUGAR_MINE, CHECK_NOTHING, + CT_CANDY, 0, CT_INVALID, 0, 5, + CT_SUGAR, CT_TOFFEE, CT_COTTON_CANDY, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_battery_farm, + IT_TOY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_BATTERIES, 11, CT_INVALID, 0, 30, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES), + + MK(_tile_table_cola_wells, + IT_FIZZY_DRINK_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_COLA, 12, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_toy_shop, + IT_TOY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_INVALID, 0, CT_INVALID, 0, 5, + CT_TOYS, CT_INVALID, CT_INVALID, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_toy_factory, + IT_PLASTIC_FOUNTAINS, IT_BATTERY_FARM, IT_TOY_SHOP, CHECK_NOTHING, + CT_TOYS, 0, CT_INVALID, 0, 5, + CT_PLASTIC, CT_BATTERIES, CT_INVALID, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_plastic_fountain, + IT_TOY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_PLASTIC, 14, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_fizzy_drink, + IT_COLA_WELLS, IT_BUBBLE_GENERATOR, IT_INVALID, CHECK_NOTHING, + CT_FIZZY_DRINKS, 0, CT_INVALID, 0, 5, + CT_COLA, CT_BUBBLES, CT_INVALID, + STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_bubble_generator, + IT_FIZZY_DRINK_FACTORY, IT_INVALID, IT_INVALID, CHECK_BUBBLEGEN, + CT_BUBBLES, 13, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_toffee_quarry, + IT_CANDY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_TOFFEE, 10, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), + + MK(_tile_table_sugar_mine, + IT_CANDY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING, + CT_SUGAR, 11, CT_INVALID, 0, 5, + CT_INVALID, CT_INVALID, CT_INVALID, + STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50), }; #undef MK const byte _industry_type_costs[] = { - 210, 30, 28, 200, 31, 240, 26, 26, 27, 250, 205, 220, 193, 26, - 28, 208, 19, 213, 220, 225, 218, 199, 14, 26, 250, 17, 195, 26, + 210, 30, 28, 200, 31, 240, 26, 26, 27, 250, 205, 220, 193, 26, + 28, 208, 19, 213, 220, 225, 218, 199, 14, 26, 250, 17, 195, 26, 187, 193, 17, 20, 192, 22, 203, 213, 210 }; const byte _build_industry_types[4][12] = { - { 1, 2, 4, 6, 8, 0, 3, 5, 9, 11, 18 }, - { 1, 14, 4, 13, 7, 0, 3, 9, 11, 15 }, - { 25, 13, 4, 23, 22, 11, 17, 10, 24, 19, 20, 21 }, + { 1, 2, 4, 6, 8, 0, 3, 5, 9, 11, 18 }, + { 1, 14, 4, 13, 7, 0, 3, 9, 11, 15 }, + { 25, 13, 4, 23, 22, 11, 17, 10, 24, 19, 20, 21 }, { 27, 30, 31, 33, 26, 28, 29, 32, 34, 35, 36 }, }; |