cargotype.h
Go to the documentation of this file.00001
00002
00005 #ifndef CARGOTYPE_H
00006 #define CARGOTYPE_H
00007
00008 #include "cargo_type.h"
00009 #include "gfx_type.h"
00010 #include "newgrf_string_type.h"
00011
00012 typedef uint32 CargoLabel;
00013
00014 enum TownEffect {
00015 TE_NONE,
00016 TE_PASSENGERS,
00017 TE_MAIL,
00018 TE_GOODS,
00019 TE_WATER,
00020 TE_FOOD,
00021 };
00022
00023
00024 struct CargoSpec {
00025 uint8 bitnum;
00026 CargoLabel label;
00027 uint32 grfid;
00028 uint8 legend_colour;
00029 uint8 rating_colour;
00030 uint8 weight;
00031 uint16 initial_payment;
00032 uint8 transit_days[2];
00033
00034 bool is_freight;
00035 TownEffect town_effect;
00036 uint16 multipliertowngrowth;
00037 uint8 callback_mask;
00038
00039 GRFMappedStringID name;
00040 GRFMappedStringID name_single;
00041 GRFMappedStringID units_volume;
00042 GRFMappedStringID quantifier;
00043 GRFMappedStringID abbrev;
00044
00045 SpriteID sprite;
00046
00047 uint16 classes;
00048 const struct SpriteGroup *group;
00049
00050 bool IsValid() const;
00051 };
00052
00053
00054 extern uint32 _cargo_mask;
00055 extern CargoSpec _cargo[NUM_CARGO];
00056
00057
00058
00059 void SetupCargoForClimate(LandscapeID l);
00060
00061 const CargoSpec *GetCargo(CargoID c);
00062
00063 CargoID GetCargoIDByLabel(CargoLabel cl);
00064 CargoID GetCargoIDByBitnum(uint8 bitnum);
00065
00066 static inline bool IsCargoInClass(CargoID c, uint16 cc)
00067 {
00068 return (GetCargo(c)->classes & cc) != 0;
00069 }
00070
00071
00072 #endif