summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-09-28 21:24:25 +0000
committerrubidium <rubidium@openttd.org>2007-09-28 21:24:25 +0000
commit136d726b6fc8839779380c4af67e56a053a22be1 (patch)
treeb0d101f161a3c5692c94b90fbf31a20979bfd709
parentbeeae81f605bed24081d7d389ad85961e479b461 (diff)
downloadopenttd-136d726b6fc8839779380c4af67e56a053a22be1.tar.xz
(svn r11185) -Codechange: prepare some more code for the introduction of NewIndustries. Patch by Belugas.
-rw-r--r--src/industry.h4
-rw-r--r--src/industry_cmd.cpp3
-rw-r--r--src/industry_map.h2
3 files changed, 5 insertions, 4 deletions
diff --git a/src/industry.h b/src/industry.h
index d1d71abce..2745787d4 100644
--- a/src/industry.h
+++ b/src/industry.h
@@ -15,11 +15,11 @@ typedef uint8 IndustryType;
enum {
INVALID_INDUSTRY = 0xFFFF,
NEW_INDUSTRYOFFSET = 37, ///< original number of industries
- NUM_INDUSTRYTYPES = 37, ///< total number of industries, new and old
+ NUM_INDUSTRYTYPES = 64, ///< total number of industries, new and old
INDUSTRYTILE_NOANIM = 0xFF, ///< flag to mark industry tiles as having no animation
NEW_INDUSTRYTILEOFFSET = 175, ///< original number of tiles
INVALID_INDUSTRYTYPE = NUM_INDUSTRYTYPES, ///< one above amount is considered invalid
- NUM_INDUSTRYTILES = NEW_INDUSTRYTILEOFFSET, ///< total number of industry tiles, new and old
+ NUM_INDUSTRYTILES = 512, ///< total number of industry tiles, new and old
INVALID_INDUSTRYTILE = NUM_INDUSTRYTILES, ///< one above amount is considered invalid
INDUSTRY_COMPLETED = 3, ///< final stage of industry construction.
};
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 4fd566b17..c12ac659c 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -65,7 +65,8 @@ void ResetIndustries()
/* 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);
+ _industry_specs[i].enabled = i < NEW_INDUSTRYOFFSET &&
+ HASBIT(_origin_industry_specs[i].climate_availability, _opt.landscape);
}
memset(&_industry_tile_specs, 0, sizeof(_industry_tile_specs));
diff --git a/src/industry_map.h b/src/industry_map.h
index 80c05cc09..370f9b37d 100644
--- a/src/industry_map.h
+++ b/src/industry_map.h
@@ -109,7 +109,7 @@ static inline void SetIndustryCompleted(TileIndex tile, bool isCompleted)
static inline byte GetIndustryConstructionStage(TileIndex tile)
{
assert(IsTileType(tile, MP_INDUSTRY));
- return GB(_m[tile].m1, 0, 2);
+ return IsIndustryCompleted(tile) ? (byte)INDUSTRY_COMPLETED : GB(_m[tile].m1, 0, 2);
}
/**