peter1138@6091: /* $Id$ */ peter1138@6091: rubidium@9111: /** @file cargotype.h Types/functions related to cargos. */ belugas@6123: peter1138@6091: #ifndef CARGOTYPE_H peter1138@6091: #define CARGOTYPE_H peter1138@6091: rubidium@8119: #include "cargo_type.h" rubidium@8123: #include "gfx_type.h" rubidium@8959: #include "strings_type.h" rubidium@9126: #include "landscape_type.h" peter1138@6091: peter1138@6091: typedef uint32 CargoLabel; peter1138@6091: peter1138@6311: enum TownEffect { peter1138@6311: TE_NONE, peter1138@6311: TE_PASSENGERS, peter1138@6311: TE_MAIL, peter1138@6311: TE_GOODS, peter1138@6311: TE_WATER, peter1138@6311: TE_FOOD, peter1138@6311: }; peter1138@6311: peter1138@6091: rubidium@6248: struct CargoSpec { peter1138@6091: uint8 bitnum; peter1138@6091: CargoLabel label; peter1138@6091: uint8 legend_colour; peter1138@6091: uint8 rating_colour; peter1138@6091: uint8 weight; peter1138@6091: uint16 initial_payment; peter1138@6091: uint8 transit_days[2]; peter1138@6091: peter1138@6091: bool is_freight; peter1138@6311: TownEffect town_effect; ///< The effect this cargo type has on towns peter1138@6091: uint16 multipliertowngrowth; peter1138@6359: uint8 callback_mask; peter1138@6091: rubidium@8959: StringID name; rubidium@8959: StringID name_single; rubidium@8959: StringID units_volume; rubidium@8959: StringID quantifier; rubidium@8959: StringID abbrev; peter1138@6091: peter1138@6091: SpriteID sprite; peter1138@6091: peter1138@6091: uint16 classes; frosch@9750: const struct GRFFile *grffile; ///< NewGRF where 'group' belongs to peter1138@6365: const struct SpriteGroup *group; peter1138@6122: peter1138@6122: bool IsValid() const; rubidium@6248: }; peter1138@6091: peter1138@6091: peter1138@6113: extern uint32 _cargo_mask; peter1138@6359: extern CargoSpec _cargo[NUM_CARGO]; peter1138@6113: peter1138@6113: peter1138@6091: /* Set up the default cargo types for the given landscape type */ peter1138@6091: void SetupCargoForClimate(LandscapeID l); peter1138@6091: /* Retrieve cargo details for the given cargo ID */ peter1138@6091: const CargoSpec *GetCargo(CargoID c); rubidium@8762: /* Get the cargo icon for a given cargo ID */ rubidium@8762: SpriteID GetCargoSprite(CargoID i); peter1138@6143: /* Get the cargo ID with the cargo label */ peter1138@6143: CargoID GetCargoIDByLabel(CargoLabel cl); peter1138@6460: CargoID GetCargoIDByBitnum(uint8 bitnum); peter1138@6113: peter1138@6329: static inline bool IsCargoInClass(CargoID c, uint16 cc) peter1138@6329: { peter1138@6335: return (GetCargo(c)->classes & cc) != 0; peter1138@6329: } peter1138@6329: peter1138@6091: peter1138@6091: #endif /* CARGOTYPE_H */