Files
@ r12291:690f4158878e
Branch filter:
Location: cpp/openttd-patchpack/source/src/cargotype.h - annotation
r12291:690f4158878e
1.6 KiB
text/x-c
(svn r16718) -Codechange: make IsFreeWagon() member of Train
r6091:2faa7d307565 r6091:2faa7d307565 r9111:983de9c5a848 r6123:049e9624d068 r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r8119:8fdb3a371896 r8123:dde0a9a84019 r8959:484dbfc31293 r9126:35955a7b9d9e r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r6311:78f38fcd68ca r6311:78f38fcd68ca r6311:78f38fcd68ca r6311:78f38fcd68ca r6311:78f38fcd68ca r6311:78f38fcd68ca r6311:78f38fcd68ca r6311:78f38fcd68ca r6311:78f38fcd68ca r6091:2faa7d307565 r12236:ae676539361d r12236:ae676539361d r6248:b940b09d7ab8 r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r6311:78f38fcd68ca r6091:2faa7d307565 r6359:99cac4de410b r6091:2faa7d307565 r8959:484dbfc31293 r8959:484dbfc31293 r8959:484dbfc31293 r8959:484dbfc31293 r8959:484dbfc31293 r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r6091:2faa7d307565 r9750:1e2535e15958 r6365:410001496130 r6122:508316e17f8e r12236:ae676539361d r12236:ae676539361d r12236:ae676539361d r12236:ae676539361d r6248:b940b09d7ab8 r6091:2faa7d307565 r6113:c77736e8b915 r6359:99cac4de410b r6113:c77736e8b915 r6113:c77736e8b915 r6091:2faa7d307565 r6091:2faa7d307565 r8762:2da4ffd55f31 r8762:2da4ffd55f31 r6143:9ed364174dfd r6143:9ed364174dfd r6460:74b53af67ae0 r6113:c77736e8b915 r12236:ae676539361d r12236:ae676539361d r12236:ae676539361d r12236:ae676539361d r12236:ae676539361d r12236:ae676539361d r12236:ae676539361d r12236:ae676539361d r6329:73b25d0f4ee2 r6329:73b25d0f4ee2 r6335:0f64aac189b1 r6329:73b25d0f4ee2 r6329:73b25d0f4ee2 r6091:2faa7d307565 r6091:2faa7d307565 | /* $Id$ */
/** @file cargotype.h Types/functions related to cargos. */
#ifndef CARGOTYPE_H
#define CARGOTYPE_H
#include "cargo_type.h"
#include "gfx_type.h"
#include "strings_type.h"
#include "landscape_type.h"
typedef uint32 CargoLabel;
enum TownEffect {
TE_NONE,
TE_PASSENGERS,
TE_MAIL,
TE_GOODS,
TE_WATER,
TE_FOOD,
};
static const byte INVALID_CARGO = 0xFF;
struct CargoSpec {
uint8 bitnum;
CargoLabel label;
uint8 legend_colour;
uint8 rating_colour;
uint8 weight;
uint16 initial_payment;
uint8 transit_days[2];
bool is_freight;
TownEffect town_effect; ///< The effect this cargo type has on towns
uint16 multipliertowngrowth;
uint8 callback_mask;
StringID name;
StringID name_single;
StringID units_volume;
StringID quantifier;
StringID abbrev;
SpriteID sprite;
uint16 classes;
const struct GRFFile *grffile; ///< NewGRF where 'group' belongs to
const struct SpriteGroup *group;
bool IsValid() const
{
return this->bitnum != INVALID_CARGO;
}
};
extern uint32 _cargo_mask;
extern CargoSpec _cargo[NUM_CARGO];
/* Set up the default cargo types for the given landscape type */
void SetupCargoForClimate(LandscapeID l);
/* Get the cargo icon for a given cargo ID */
SpriteID GetCargoSprite(CargoID i);
/* Get the cargo ID with the cargo label */
CargoID GetCargoIDByLabel(CargoLabel cl);
CargoID GetCargoIDByBitnum(uint8 bitnum);
/* Retrieve cargo details for the given cargo ID */
static inline const CargoSpec *GetCargo(CargoID c)
{
assert(c < lengthof(_cargo));
return &_cargo[c];
}
static inline bool IsCargoInClass(CargoID c, uint16 cc)
{
return (GetCargo(c)->classes & cc) != 0;
}
#endif /* CARGOTYPE_H */
|