summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-05-30 01:55:11 +0000
committerbelugas <belugas@openttd.org>2007-05-30 01:55:11 +0000
commit0a3ebbbc224b0f8af0b8ee89db8a80fe68bee5d4 (patch)
tree5fe368163f446abb6118598ad522adbfc688f8f1
parenteecf582cc4e2883573eafefeb81a3fce03b4c624 (diff)
downloadopenttd-0a3ebbbc224b0f8af0b8ee89db8a80fe68bee5d4.tar.xz
(svn r9983) -Codechange: Use the "enabled" property of the industry spec.
-rw-r--r--src/industry_cmd.cpp35
-rw-r--r--src/smallmap_gui.cpp2
2 files changed, 21 insertions, 16 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index ed4cd1c27..2cf72a1fd 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1470,7 +1470,9 @@ int32 CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
indspec = GetIndustrySpec(p1);
/* Check if the to-be built/founded industry is available for this climate. */
- if (!HASBIT(indspec->climate_availability, _opt_ptr->landscape)) return CMD_ERROR;
+ if (!indspec->enabled) {
+ return CMD_ERROR;
+ }
/* 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)
@@ -1554,20 +1556,20 @@ void GenerateIndustries()
/* Find the total amount of industries */
for (it = IT_COAL_MINE; it < NUM_INDUSTRYTYPES; it++) {
- int num;
ind_spc = GetIndustrySpec(it);
- chance = ind_spc->appear_creation[_opt.landscape];
-
- if (chance > 0) {
- /* once the chance of appearance is determind, it have to be scaled by
- * the difficulty level. The "chance" in question is more an index into
- * the _numof_industry_table,in fact */
- num = _numof_industry_table[_opt.diff.number_industries][chance];
-
- /* These are always placed next to the coastline, so we scale by the perimeter instead. */
- num = (it == IT_OIL_REFINERY || it == IT_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
- i += num;
+ if (ind_spc->enabled) {
+ chance = ind_spc->appear_creation[_opt.landscape];
+ if (chance > 0) {
+ /* once the chance of appearance is determind, it have to be scaled by
+ * the difficulty level. The "chance" in question is more an index into
+ * the _numof_industry_table,in fact */
+ int num = _numof_industry_table[_opt.diff.number_industries][chance];
+
+ /* These are always placed next to the coastline, so we scale by the perimeter instead. */
+ num = (it == IT_OIL_REFINERY || it == IT_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
+ i += num;
+ }
}
}
@@ -1579,8 +1581,11 @@ void GenerateIndustries()
* for this landscape.
* @todo : Do we really have to pass chance as un-scaled value, since we've already
* processed that scaling above? No, don't think so. Will find a way. */
- chance = GetIndustrySpec(it)->appear_creation[_opt.landscape];
- if (chance > 0) PlaceInitialIndustry(it, chance);
+ ind_spc = GetIndustrySpec(it);
+ if (ind_spc->enabled) {
+ chance = ind_spc->appear_creation[_opt.landscape];
+ if (chance > 0) PlaceInitialIndustry(it, chance);
+ }
};
}
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index e0a13991f..10452b5cf 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -146,7 +146,7 @@ void BuildIndustriesLegend()
/* Add each name */
for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) {
indsp = GetIndustrySpec(i);
- if (HASBIT(indsp->climate_availability, _opt.landscape)) {
+ if (indsp->enabled) {
_legend_from_industries[j].legend = indsp->name;
_legend_from_industries[j].colour = indsp->map_colour;
_legend_from_industries[j].col_break = (j % 6) == 0; // break is performed on the 7th item