2007-02-20 22:09:21 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file cargotype.h Types/functions related to cargos. */
|
2007-02-23 11:50:43 +00:00
|
|
|
|
2007-02-20 22:09:21 +00:00
|
|
|
#ifndef CARGOTYPE_H
|
|
|
|
#define CARGOTYPE_H
|
|
|
|
|
2007-12-21 22:50:51 +00:00
|
|
|
#include "cargo_type.h"
|
2007-12-23 10:56:02 +00:00
|
|
|
#include "gfx_type.h"
|
2008-04-17 11:47:22 +00:00
|
|
|
#include "strings_type.h"
|
2008-05-07 09:07:19 +00:00
|
|
|
#include "landscape_type.h"
|
2007-02-20 22:09:21 +00:00
|
|
|
|
|
|
|
typedef uint32 CargoLabel;
|
|
|
|
|
2007-03-15 22:48:46 +00:00
|
|
|
enum TownEffect {
|
|
|
|
TE_NONE,
|
|
|
|
TE_PASSENGERS,
|
|
|
|
TE_MAIL,
|
|
|
|
TE_GOODS,
|
|
|
|
TE_WATER,
|
|
|
|
TE_FOOD,
|
|
|
|
};
|
|
|
|
|
2007-02-20 22:09:21 +00:00
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct CargoSpec {
|
2007-02-20 22:09:21 +00:00
|
|
|
uint8 bitnum;
|
|
|
|
CargoLabel label;
|
|
|
|
uint8 legend_colour;
|
|
|
|
uint8 rating_colour;
|
|
|
|
uint8 weight;
|
|
|
|
uint16 initial_payment;
|
|
|
|
uint8 transit_days[2];
|
|
|
|
|
|
|
|
bool is_freight;
|
2007-03-15 22:48:46 +00:00
|
|
|
TownEffect town_effect; ///< The effect this cargo type has on towns
|
2007-02-20 22:09:21 +00:00
|
|
|
uint16 multipliertowngrowth;
|
2007-03-22 23:19:40 +00:00
|
|
|
uint8 callback_mask;
|
2007-02-20 22:09:21 +00:00
|
|
|
|
2008-04-17 11:47:22 +00:00
|
|
|
StringID name;
|
|
|
|
StringID name_single;
|
|
|
|
StringID units_volume;
|
|
|
|
StringID quantifier;
|
|
|
|
StringID abbrev;
|
2007-02-20 22:09:21 +00:00
|
|
|
|
|
|
|
SpriteID sprite;
|
|
|
|
|
|
|
|
uint16 classes;
|
2008-07-30 18:23:12 +00:00
|
|
|
const struct GRFFile *grffile; ///< NewGRF where 'group' belongs to
|
2007-03-23 20:55:45 +00:00
|
|
|
const struct SpriteGroup *group;
|
2007-02-23 09:56:20 +00:00
|
|
|
|
|
|
|
bool IsValid() const;
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2007-02-20 22:09:21 +00:00
|
|
|
|
|
|
|
|
2007-02-22 22:09:51 +00:00
|
|
|
extern uint32 _cargo_mask;
|
2007-03-22 23:19:40 +00:00
|
|
|
extern CargoSpec _cargo[NUM_CARGO];
|
2007-02-22 22:09:51 +00:00
|
|
|
|
|
|
|
|
2007-02-20 22:09:21 +00:00
|
|
|
/* Set up the default cargo types for the given landscape type */
|
|
|
|
void SetupCargoForClimate(LandscapeID l);
|
|
|
|
/* Retrieve cargo details for the given cargo ID */
|
|
|
|
const CargoSpec *GetCargo(CargoID c);
|
2008-03-28 04:57:32 +00:00
|
|
|
/* Get the cargo icon for a given cargo ID */
|
|
|
|
SpriteID GetCargoSprite(CargoID i);
|
2007-02-24 19:36:47 +00:00
|
|
|
/* Get the cargo ID with the cargo label */
|
|
|
|
CargoID GetCargoIDByLabel(CargoLabel cl);
|
2007-04-13 19:32:18 +00:00
|
|
|
CargoID GetCargoIDByBitnum(uint8 bitnum);
|
2007-02-22 22:09:51 +00:00
|
|
|
|
2007-03-18 22:07:44 +00:00
|
|
|
static inline bool IsCargoInClass(CargoID c, uint16 cc)
|
|
|
|
{
|
2007-03-19 12:58:43 +00:00
|
|
|
return (GetCargo(c)->classes & cc) != 0;
|
2007-03-18 22:07:44 +00:00
|
|
|
}
|
|
|
|
|
2007-02-20 22:09:21 +00:00
|
|
|
|
|
|
|
#endif /* CARGOTYPE_H */
|