1
0
Fork 0

(svn r11185) -Codechange: prepare some more code for the introduction of NewIndustries. Patch by Belugas.

release/0.6
rubidium 2007-09-28 21:24:25 +00:00
parent beeae81f60
commit 136d726b6f
3 changed files with 5 additions and 4 deletions

View File

@ -15,11 +15,11 @@ typedef uint8 IndustryType;
enum { enum {
INVALID_INDUSTRY = 0xFFFF, INVALID_INDUSTRY = 0xFFFF,
NEW_INDUSTRYOFFSET = 37, ///< original number of industries 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 INDUSTRYTILE_NOANIM = 0xFF, ///< flag to mark industry tiles as having no animation
NEW_INDUSTRYTILEOFFSET = 175, ///< original number of tiles NEW_INDUSTRYTILEOFFSET = 175, ///< original number of tiles
INVALID_INDUSTRYTYPE = NUM_INDUSTRYTYPES, ///< one above amount is considered invalid 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 INVALID_INDUSTRYTILE = NUM_INDUSTRYTILES, ///< one above amount is considered invalid
INDUSTRY_COMPLETED = 3, ///< final stage of industry construction. INDUSTRY_COMPLETED = 3, ///< final stage of industry construction.
}; };

View File

@ -65,7 +65,8 @@ void ResetIndustries()
/* once performed, enable only the current climate industries */ /* once performed, enable only the current climate industries */
for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) { 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)); memset(&_industry_tile_specs, 0, sizeof(_industry_tile_specs));

View File

@ -109,7 +109,7 @@ static inline void SetIndustryCompleted(TileIndex tile, bool isCompleted)
static inline byte GetIndustryConstructionStage(TileIndex tile) static inline byte GetIndustryConstructionStage(TileIndex tile)
{ {
assert(IsTileType(tile, MP_INDUSTRY)); assert(IsTileType(tile, MP_INDUSTRY));
return GB(_m[tile].m1, 0, 2); return IsIndustryCompleted(tile) ? (byte)INDUSTRY_COMPLETED : GB(_m[tile].m1, 0, 2);
} }
/** /**