From 09182386fb1281684b8f35aac349ef07d13b2646 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 28 Sep 2007 21:24:25 +0000 Subject: (svn r11185) -Codechange: prepare some more code for the introduction of NewIndustries. Patch by Belugas. --- src/industry.h | 4 ++-- src/industry_cmd.cpp | 3 ++- src/industry_map.h | 2 +- 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); } /** -- cgit v1.2.3-54-g00ecf