|
@@ -95,96 +95,97 @@ struct IndustryTileTable {
|
|
|
/** Data related to the handling of grf files. Common to both industry and industry tile */
|
|
|
struct GRFFileProps {
|
|
|
uint8 subst_id;
|
|
|
uint16 local_id; ///< id defined by the grf file for this industry
|
|
|
struct SpriteGroup *spritegroup; ///< pointer to the different sprites of the industry
|
|
|
const struct GRFFile *grffile; ///< grf file that introduced this house
|
|
|
uint8 override; ///< id of the entity been replaced by
|
|
|
bool enabled; ///< entity still avaible (by default true).newgrf can disable it, though
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Defines the data structure for constructing industry.
|
|
|
*/
|
|
|
struct IndustrySpec {
|
|
|
const IndustryTileTable *const *table;///< List of the tiles composing the industry
|
|
|
byte num_table; ///< Number of elements in the table
|
|
|
byte cost_multiplier; ///< Base cost multiplier. Watch out for this one, << 5 VS << 8
|
|
|
IndustryType conflicting[3]; ///< Industries this industry cannot be close to
|
|
|
byte check_proc; ///< Index to a procedure to check for conflicting circumstances
|
|
|
CargoID produced_cargo[2];
|
|
|
byte production_rate[2];
|
|
|
byte minimal_cargo; ///< minimum amount of cargo transported to the stations
|
|
|
///< If the waiting cargo is less than this number, no cargo is moved to it
|
|
|
CargoID accepts_cargo[3]; ///< 3 accepted cargos
|
|
|
uint16 input_cargo_multiplier[3][2]; ///< Input cargo multipliers (multiply amount of incoming cargo for the produced cargos)
|
|
|
IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs
|
|
|
byte climate_availability; ///< Bitmask, giving landscape enums as bit position
|
|
|
IndustyBehaviour behaviour; ///< How this industry will behave, and how others entities can use it
|
|
|
byte map_colour; ///< colour used for the small map
|
|
|
StringID name; ///< Displayed name of the industry
|
|
|
StringID new_industry_text; ///< Message appearing when the industry is built
|
|
|
StringID closure_text; ///< Message appearing when the industry closes
|
|
|
StringID production_up_text; ///< Message appearing when the industry's production is increasing
|
|
|
StringID production_down_text; ///< Message appearing when the industry's production is decreasing
|
|
|
byte appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game
|
|
|
byte appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation
|
|
|
uint8 number_of_sounds; ///< Number of sounds available in the sounds array
|
|
|
const uint8 *random_sounds; ///< array of random sounds.
|
|
|
/* Newgrf data */
|
|
|
uint16 callback_flags; ///< Flags telling which grf callback is set
|
|
|
struct GRFFileProps grf_prop; ///< properties related the the grf file
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Defines the data structure of each indivudual tile of an industry.
|
|
|
*/
|
|
|
struct IndustryTileSpec {
|
|
|
CargoID accepts_cargo[3]; ///< Cargo accepted by this tile
|
|
|
uint8 acceptance[3]; ///< Level of aceptance per cargo type
|
|
|
Slope slopes_refused; ///< slope pattern on which this tile cannot be built
|
|
|
byte anim_production; ///< Animation frame to start when goods are produced
|
|
|
byte anim_next; ///< Next frame in an animation
|
|
|
bool anim_state; ///< When true, the tile has to be drawn using the animation
|
|
|
///< state instead of the construction state
|
|
|
/* Newgrf data */
|
|
|
uint8 callback_flags; ///< Flags telling which grf callback is set
|
|
|
struct GRFFileProps grf_prop;
|
|
|
};
|
|
|
|
|
|
/* industry_cmd.cpp*/
|
|
|
const IndustrySpec *GetIndustrySpec(IndustryType thistype); ///< Array of industries default data
|
|
|
const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx); ///< Array of industry tiles default data
|
|
|
void ResetIndustries();
|
|
|
void PlantRandomFarmField(const Industry *i);
|
|
|
|
|
|
/* smallmap_gui.cpp */
|
|
|
void BuildIndustriesLegend();
|
|
|
|
|
|
DECLARE_OLD_POOL(Industry, Industry, 3, 8000)
|
|
|
|
|
|
/**
|
|
|
* Check if an Industry really exists.
|
|
|
* @param industry to check
|
|
|
* @return true if position is a valid one
|
|
|
*/
|
|
|
static inline bool IsValidIndustry(const Industry *industry)
|
|
|
{
|
|
|
return industry->xy != 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Check if an Industry exists whithin the pool of industries
|
|
|
* @param index of the desired industry
|
|
|
* @return true if it is inside the pool
|
|
|
*/
|
|
|
static inline bool IsValidIndustryID(IndustryID index)
|
|
|
{
|
|
|
return index < GetIndustryPoolSize() && IsValidIndustry(GetIndustry(index));
|
|
|
}
|
|
|
|
|
|
VARDEF int _total_industries; //general counter
|
|
|
|
|
|
static inline IndustryID GetMaxIndustryIndex()
|
|
|
{
|
|
|
/* TODO - This isn't the real content of the function, but
|
|
|
* with the new pool-system this will be replaced with one that
|
|
|
* _really_ returns the highest index. Now it just returns
|