src/industry.h
branchNewGRF_ports
changeset 6870 ca3fd1fbe311
parent 6868 7eb395287b3d
child 6871 5a9dc001e1ad
--- a/src/industry.h	Thu Sep 06 19:42:48 2007 +0000
+++ b/src/industry.h	Sat Oct 06 21:16:00 2007 +0000
@@ -7,18 +7,19 @@
 
 #include "oldpool.h"
 #include "helpers.hpp"
+#include "newgrf_storage.h"
 
-typedef byte IndustryGfx;
+typedef uint16 IndustryGfx;
 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.
 };
@@ -81,6 +82,11 @@
 	INDUSTRYBEH_AIRPLANE_ATTACKS      = 1 << 11, ///< can be exploded by a military airplane (oil refinery)
 	INDUSTRYBEH_CHOPPER_ATTACKS       = 1 << 12, ///< can be exploded by a military helicopter (factory)
 	INDUSTRYBEH_CAN_SUBSIDENCE        = 1 << 13, ///< can cause a subsidence (coal mine, shaft that collapses)
+	/* The following flags are only used for newindustries and do no represent any normal behaviour */
+	INDUSTRYBEH_PROD_MULTI_HNDLING    = 1 << 14, ///< Automatic production multiplier handling
+	INDUSTRYBEH_PRODCALLBACK_RANDOM   = 1 << 15, ///< Production callback needs random bits in var 10
+	INDUSTRYBEH_NOBUILT_MAPCREATION   = 1 << 16, ///< Do not force one instance of this type to appear on map generation
+	INDUSTRYBEH_CANCLOSE_LASTINSTANCE = 1 << 17, ///< Allow closing down the last instance of this type
 };
 
 
@@ -93,14 +99,18 @@
  * Defines the internal data of a functionnal industry
  */
 struct Industry : PoolItem<Industry, IndustryID, &_Industry_pool> {
+	typedef PersistentStorageArray<uint32, 16> PersistentStorage;
+
 	TileIndex xy;                       ///< coordinates of the primary tile the industry is built one
 	byte width;
 	byte height;
 	const Town *town;                   ///< Nearest town
+	CargoID produced_cargo[2];          ///< 2 production cargo slots
 	uint16 produced_cargo_waiting[2];   ///< amount of cargo produced per cargo
 	uint16 incoming_cargo_waiting[3];   ///< incoming cargo waiting to be processed
 	byte production_rate[2];            ///< production rate for each cargo
 	byte prod_level;                    ///< general production level
+	CargoID accepts_cargo[3];           ///< 3 input cargo slots
 	uint16 this_month_production[2];    ///< stats of this month's production per cargo
 	uint16 this_month_transported[2];   ///< stats of this month's transport per cargo
 	byte last_month_pct_transported[2]; ///< percentage transported per cargo in the last full month
@@ -120,6 +130,8 @@
 	Date last_cargo_accepted_at;        ///< Last day cargo was accepted by this industry
 	byte selected_layout;               ///< Which tile layout was used when creating the industry
 
+	PersistentStorage psa;              ///< Persistent storage for NewGRF industries.
+
 	Industry(TileIndex tile = 0) : xy(tile) {}
 	~Industry();