Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef INDUSTRYTYPE_H
00013 #define INDUSTRYTYPE_H
00014
00015 #include "map_type.h"
00016 #include "slope_type.h"
00017 #include "industry_type.h"
00018 #include "landscape_type.h"
00019 #include "cargo_type.h"
00020 #include "newgrf_animation_type.h"
00021 #include "newgrf_commons.h"
00022
00023 enum IndustryCleanupType {
00024 CLEAN_RANDOMSOUNDS,
00025 CLEAN_TILELAYOUT,
00026 };
00027
00029 enum IndustryLifeType {
00030 INDUSTRYLIFE_BLACK_HOLE = 0,
00031 INDUSTRYLIFE_EXTRACTIVE = 1 << 0,
00032 INDUSTRYLIFE_ORGANIC = 1 << 1,
00033 INDUSTRYLIFE_PROCESSING = 1 << 2,
00034 };
00035
00040 enum CheckProc {
00041 CHECK_NOTHING,
00042 CHECK_FOREST,
00043 CHECK_REFINERY,
00044 CHECK_FARM,
00045 CHECK_PLANTATION,
00046 CHECK_WATER,
00047 CHECK_LUMBERMILL,
00048 CHECK_BUBBLEGEN,
00049 CHECK_OIL_RIG,
00050 CHECK_END,
00051 };
00052
00054 enum IndustryConstructionType {
00055 ICT_UNKNOWN,
00056 ICT_NORMAL_GAMEPLAY,
00057 ICT_MAP_GENERATION,
00058 ICT_SCENARIO_EDITOR,
00059 };
00060
00062 enum IndustryBehaviour {
00063 INDUSTRYBEH_NONE = 0,
00064 INDUSTRYBEH_PLANT_FIELDS = 1 << 0,
00065 INDUSTRYBEH_CUT_TREES = 1 << 1,
00066 INDUSTRYBEH_BUILT_ONWATER = 1 << 2,
00067 INDUSTRYBEH_TOWN1200_MORE = 1 << 3,
00068 INDUSTRYBEH_ONLY_INTOWN = 1 << 4,
00069 INDUSTRYBEH_ONLY_NEARTOWN = 1 << 5,
00070 INDUSTRYBEH_PLANT_ON_BUILT = 1 << 6,
00071 INDUSTRYBEH_DONT_INCR_PROD = 1 << 7,
00072 INDUSTRYBEH_BEFORE_1950 = 1 << 8,
00073 INDUSTRYBEH_AFTER_1960 = 1 << 9,
00074 INDUSTRYBEH_AI_AIRSHIP_ROUTES = 1 << 10,
00075 INDUSTRYBEH_AIRPLANE_ATTACKS = 1 << 11,
00076 INDUSTRYBEH_CHOPPER_ATTACKS = 1 << 12,
00077 INDUSTRYBEH_CAN_SUBSIDENCE = 1 << 13,
00078
00079 INDUSTRYBEH_PROD_MULTI_HNDLING = 1 << 14,
00080 INDUSTRYBEH_PRODCALLBACK_RANDOM = 1 << 15,
00081 INDUSTRYBEH_NOBUILT_MAPCREATION = 1 << 16,
00082 INDUSTRYBEH_CANCLOSE_LASTINSTANCE = 1 << 17,
00083 };
00084 DECLARE_ENUM_AS_BIT_SET(IndustryBehaviour)
00085
00086
00087 enum IndustryTileSpecialFlags {
00088 INDTILE_SPECIAL_NONE = 0,
00089 INDTILE_SPECIAL_NEXTFRAME_RANDOMBITS = 1 << 0,
00090 };
00091 DECLARE_ENUM_AS_BIT_SET(IndustryTileSpecialFlags)
00092
00093 struct IndustryTileTable {
00094 TileIndexDiffC ti;
00095 IndustryGfx gfx;
00096 };
00097
00101 struct IndustrySpec {
00102 const IndustryTileTable * const *table;
00103 byte num_table;
00104 uint8 cost_multiplier;
00105 uint32 removal_cost_multiplier;
00106 uint32 prospecting_chance;
00107 IndustryType conflicting[3];
00108 byte check_proc;
00109 CargoID produced_cargo[2];
00110 byte production_rate[2];
00115 byte minimal_cargo;
00116 CargoID accepts_cargo[3];
00117 uint16 input_cargo_multiplier[3][2];
00118 IndustryLifeType life_type;
00119 byte climate_availability;
00120 IndustryBehaviour behaviour;
00121 byte map_colour;
00122 StringID name;
00123 StringID new_industry_text;
00124 StringID closure_text;
00125 StringID production_up_text;
00126 StringID production_down_text;
00127 StringID station_name;
00128 byte appear_ingame[NUM_LANDSCAPE];
00129 byte appear_creation[NUM_LANDSCAPE];
00130 uint8 number_of_sounds;
00131 const uint8 *random_sounds;
00132
00133 uint16 callback_mask;
00134 uint8 cleanup_flag;
00135 bool enabled;
00136 GRFFileProps grf_prop;
00137
00138 bool IsRawIndustry() const;
00139 bool IsProcessingIndustry() const;
00140 Money GetConstructionCost() const;
00141 Money GetRemovalCost() const;
00142 bool UsesSmoothEconomy() const;
00143 };
00144
00148 struct IndustryTileSpec {
00149 CargoID accepts_cargo[3];
00150 uint8 acceptance[3];
00151 Slope slopes_refused;
00152 byte anim_production;
00153 byte anim_next;
00154
00158 bool anim_state;
00159
00160 uint8 callback_mask;
00161 AnimationInfo animation;
00162 IndustryTileSpecialFlags special_flags;
00163 bool enabled;
00164 GRFFileProps grf_prop;
00165 };
00166
00167
00168 const IndustrySpec *GetIndustrySpec(IndustryType thistype);
00169 const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx);
00170 void ResetIndustries();
00171
00172
00173 extern IndustrySpec _industry_specs[NUM_INDUSTRYTYPES];
00174 extern IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES];
00175
00176
00177 void SortIndustryTypes();
00178
00179 extern IndustryType _sorted_industry_types[NUM_INDUSTRYTYPES];
00180
00186 static inline IndustryGfx GetTranslatedIndustryTileID(IndustryGfx gfx)
00187 {
00188
00189
00190
00191
00192
00193 if (gfx != 0xFF) {
00194 assert(gfx < INVALID_INDUSTRYTILE);
00195 const IndustryTileSpec *it = &_industry_tile_specs[gfx];
00196 return it->grf_prop.override == INVALID_INDUSTRYTILE ? gfx : it->grf_prop.override;
00197 } else {
00198 return gfx;
00199 }
00200 }
00201
00202 static const uint8 IT_INVALID = 255;
00203
00204 #endif