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