summaryrefslogtreecommitdiff
path: root/src/industry_cmd.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-05-29 17:41:59 +0000
committerbelugas <belugas@openttd.org>2007-05-29 17:41:59 +0000
commit0cb8413a8f00d04d47a9139cd6bb353a70c2725a (patch)
tree1aeb23997834a9c170eaccd145921f1387c70451 /src/industry_cmd.cpp
parent0af97d4ab2fea4f9aef04d8eb1c77b80c2f1d5c6 (diff)
downloadopenttd-0cb8413a8f00d04d47a9139cd6bb353a70c2725a.tar.xz
(svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
It will be initialized by the original data upon game start. Rename some enums to be more consistent too
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r--src/industry_cmd.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 6645c83a6..ed4cd1c27 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -37,6 +37,28 @@ void BuildOilRig(TileIndex tile);
static byte _industry_sound_ctr;
static TileIndex _industry_sound_tile;
+IndustrySpec _industry_specs[NUM_INDUSTRYTYPES];
+IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES];
+
+/** This function initialize the spec arrays of both
+ * industry and industry tiles.
+ * It adjusts the enabling of the industry too, based on climate availability.
+ * This will allow for clearer testings */
+void ResetIndustries()
+{
+ memset(&_industry_specs, 0, sizeof(_industry_specs));
+ memcpy(&_industry_specs, &_origin_industry_specs, sizeof(_origin_industry_specs));
+
+ /* once performed, enable only the current climate industries */
+ for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) {
+ _industry_specs[i].enabled = HASBIT(_origin_industry_specs[i].climate_availability, _opt.landscape);
+ }
+
+
+ memset(&_industry_tile_specs, 0, sizeof(_industry_tile_specs));
+ memcpy(&_industry_tile_specs, &_origin_industry_tile_specs, sizeof(_origin_industry_tile_specs));
+}
+
/**
* Called if a new block is added to the industry-pool
*/
@@ -346,7 +368,7 @@ static void TransportIndustryGoods(TileIndex tile)
if (am != 0) {
uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production;
- if (newgfx != INDUTILE_NOANIM) {
+ if (newgfx != INDUSTRYTILE_NOANIM) {
ResetIndustryConstructionStage(tile);
SetIndustryCompleted(tile, true);
SetIndustryGfx(tile, newgfx);
@@ -632,7 +654,7 @@ static void TileLoop_Industry(TileIndex tile)
TransportIndustryGoods(tile);
newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_next;
- if (newgfx != INDUTILE_NOANIM) {
+ if (newgfx != INDUSTRYTILE_NOANIM) {
ResetIndustryConstructionStage(tile);
SetIndustryGfx(tile, newgfx);
MarkTileDirtyByTile(tile);