(svn r11185) -Codechange: prepare some more code for the introduction of NewIndustries. Patch by Belugas.
authorrubidium
Fri, 28 Sep 2007 21:24:25 +0000
changeset 7654 533a9c9a5e83
parent 7653 dd252420d9c2
child 7655 314256ffab9d
(svn r11185) -Codechange: prepare some more code for the introduction of NewIndustries. Patch by Belugas.
src/industry.h
src/industry_cmd.cpp
src/industry_map.h
--- a/src/industry.h	Fri Sep 28 21:15:45 2007 +0000
+++ b/src/industry.h	Fri Sep 28 21:24:25 2007 +0000
@@ -15,11 +15,11 @@
 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.
 };
--- a/src/industry_cmd.cpp	Fri Sep 28 21:15:45 2007 +0000
+++ b/src/industry_cmd.cpp	Fri Sep 28 21:24:25 2007 +0000
@@ -65,7 +65,8 @@
 
 	/* 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));
--- a/src/industry_map.h	Fri Sep 28 21:15:45 2007 +0000
+++ b/src/industry_map.h	Fri Sep 28 21:24:25 2007 +0000
@@ -109,7 +109,7 @@
 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);
 }
 
 /**