peter1138@6417: /* $Id$ */ peter1138@6417: rubidium@10429: /** @file cargotype.h Types/functions related to cargos. */ 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@10219: #include "strings_type.h" rubidium@10444: #include "landscape_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@10219: StringID name; rubidium@10219: StringID name_single; rubidium@10219: StringID units_volume; rubidium@10219: StringID quantifier; rubidium@10219: StringID 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); rubidium@9258: /* Get the cargo icon for a given cargo ID */ rubidium@9258: SpriteID GetCargoSprite(CargoID i); 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 */