peter1138@6417: /* $Id$ */ peter1138@6417: belugas@6449: /** @file cargotype.h */ belugas@6449: peter1138@6417: #ifndef CARGOTYPE_H peter1138@6417: #define CARGOTYPE_H peter1138@6417: rubidium@8615: #include "cargo_type.h" rubidium@8619: #include "gfx_type.h" rubidium@8794: #include "newgrf_string_type.h" peter1138@6417: peter1138@6417: typedef uint32 CargoLabel; peter1138@6417: peter1138@6637: enum TownEffect { peter1138@6637: TE_NONE, peter1138@6637: TE_PASSENGERS, peter1138@6637: TE_MAIL, peter1138@6637: TE_GOODS, peter1138@6637: TE_WATER, peter1138@6637: TE_FOOD, peter1138@6637: }; peter1138@6637: peter1138@6417: rubidium@6574: struct CargoSpec { peter1138@6417: uint8 bitnum; peter1138@6417: CargoLabel label; peter1138@6417: uint32 grfid; peter1138@6417: uint8 legend_colour; peter1138@6417: uint8 rating_colour; peter1138@6417: uint8 weight; peter1138@6417: uint16 initial_payment; peter1138@6417: uint8 transit_days[2]; peter1138@6417: peter1138@6417: bool is_freight; peter1138@6637: TownEffect town_effect; ///< The effect this cargo type has on towns peter1138@6417: uint16 multipliertowngrowth; peter1138@6685: uint8 callback_mask; peter1138@6417: rubidium@8794: GRFMappedStringID name; rubidium@8794: GRFMappedStringID name_single; rubidium@8794: GRFMappedStringID units_volume; rubidium@8794: GRFMappedStringID quantifier; rubidium@8794: GRFMappedStringID abbrev; peter1138@6417: peter1138@6417: SpriteID sprite; peter1138@6417: peter1138@6417: uint16 classes; peter1138@6691: const struct SpriteGroup *group; peter1138@6448: peter1138@6448: bool IsValid() const; rubidium@6574: }; peter1138@6417: peter1138@6417: peter1138@6439: extern uint32 _cargo_mask; peter1138@6685: extern CargoSpec _cargo[NUM_CARGO]; peter1138@6439: peter1138@6439: peter1138@6417: /* Set up the default cargo types for the given landscape type */ peter1138@6417: void SetupCargoForClimate(LandscapeID l); peter1138@6417: /* Retrieve cargo details for the given cargo ID */ peter1138@6417: const CargoSpec *GetCargo(CargoID c); peter1138@6469: /* Get the cargo ID with the cargo label */ peter1138@6469: CargoID GetCargoIDByLabel(CargoLabel cl); peter1138@6956: CargoID GetCargoIDByBitnum(uint8 bitnum); peter1138@6439: peter1138@6655: static inline bool IsCargoInClass(CargoID c, uint16 cc) peter1138@6655: { peter1138@6661: return (GetCargo(c)->classes & cc) != 0; peter1138@6655: } peter1138@6655: peter1138@6417: peter1138@6417: #endif /* CARGOTYPE_H */