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 "strings_type.h"
00011 #include "landscape_type.h"
00012
00013 typedef uint32 CargoLabel;
00014
00015 enum TownEffect {
00016 TE_NONE,
00017 TE_PASSENGERS,
00018 TE_MAIL,
00019 TE_GOODS,
00020 TE_WATER,
00021 TE_FOOD,
00022 };
00023
00024
00025 struct CargoSpec {
00026 uint8 bitnum;
00027 CargoLabel label;
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 StringID name;
00040 StringID name_single;
00041 StringID units_volume;
00042 StringID quantifier;
00043 StringID abbrev;
00044
00045 SpriteID sprite;
00046
00047 uint16 classes;
00048 const struct GRFFile *grffile;
00049 const struct SpriteGroup *group;
00050
00051 bool IsValid() const;
00052 };
00053
00054
00055 extern uint32 _cargo_mask;
00056 extern CargoSpec _cargo[NUM_CARGO];
00057
00058
00059
00060 void SetupCargoForClimate(LandscapeID l);
00061
00062 const CargoSpec *GetCargo(CargoID c);
00063
00064 SpriteID GetCargoSprite(CargoID i);
00065
00066 CargoID GetCargoIDByLabel(CargoLabel cl);
00067 CargoID GetCargoIDByBitnum(uint8 bitnum);
00068
00069 static inline bool IsCargoInClass(CargoID c, uint16 cc)
00070 {
00071 return (GetCargo(c)->classes & cc) != 0;
00072 }
00073
00074
00075 #endif