author | Tero Marttila <terom@fixme.fi> |
Fri, 18 Jul 2008 21:28:42 +0300 | |
changeset 11175 | 020c61e39c94 |
parent 10444 | 3876060cdef7 |
permissions | -rw-r--r-- |
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
1 |
/* $Id$ */ |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
2 |
|
10429
1b99254f9607
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
10219
diff
changeset
|
3 |
/** @file cargotype.h Types/functions related to cargos. */ |
6449
e520244dc71e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6448
diff
changeset
|
4 |
|
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
5 |
#ifndef CARGOTYPE_H |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
6 |
#define CARGOTYPE_H |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
7 |
|
8615
6b91ca653bad
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents:
7783
diff
changeset
|
8 |
#include "cargo_type.h" |
8619
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8615
diff
changeset
|
9 |
#include "gfx_type.h" |
10219
2ff2b0f7643e
(svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium
parents:
9258
diff
changeset
|
10 |
#include "strings_type.h" |
10444
3876060cdef7
(svn r12986) -Codechange: move the landscape and transport related types from openttd.h to their own headers.
rubidium
parents:
10429
diff
changeset
|
11 |
#include "landscape_type.h" |
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
12 |
|
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
13 |
typedef uint32 CargoLabel; |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
14 |
|
6637
9ed3a7f4ecbc
(svn r9236) -Codechange: Add 'town effect' attribute to cargo types. This will be used to specify how the cargo behaves wrt towns, instead of relying on fixed cargo IDs.
peter1138
parents:
6574
diff
changeset
|
15 |
enum TownEffect { |
9ed3a7f4ecbc
(svn r9236) -Codechange: Add 'town effect' attribute to cargo types. This will be used to specify how the cargo behaves wrt towns, instead of relying on fixed cargo IDs.
peter1138
parents:
6574
diff
changeset
|
16 |
TE_NONE, |
9ed3a7f4ecbc
(svn r9236) -Codechange: Add 'town effect' attribute to cargo types. This will be used to specify how the cargo behaves wrt towns, instead of relying on fixed cargo IDs.
peter1138
parents:
6574
diff
changeset
|
17 |
TE_PASSENGERS, |
9ed3a7f4ecbc
(svn r9236) -Codechange: Add 'town effect' attribute to cargo types. This will be used to specify how the cargo behaves wrt towns, instead of relying on fixed cargo IDs.
peter1138
parents:
6574
diff
changeset
|
18 |
TE_MAIL, |
9ed3a7f4ecbc
(svn r9236) -Codechange: Add 'town effect' attribute to cargo types. This will be used to specify how the cargo behaves wrt towns, instead of relying on fixed cargo IDs.
peter1138
parents:
6574
diff
changeset
|
19 |
TE_GOODS, |
9ed3a7f4ecbc
(svn r9236) -Codechange: Add 'town effect' attribute to cargo types. This will be used to specify how the cargo behaves wrt towns, instead of relying on fixed cargo IDs.
peter1138
parents:
6574
diff
changeset
|
20 |
TE_WATER, |
9ed3a7f4ecbc
(svn r9236) -Codechange: Add 'town effect' attribute to cargo types. This will be used to specify how the cargo behaves wrt towns, instead of relying on fixed cargo IDs.
peter1138
parents:
6574
diff
changeset
|
21 |
TE_FOOD, |
9ed3a7f4ecbc
(svn r9236) -Codechange: Add 'town effect' attribute to cargo types. This will be used to specify how the cargo behaves wrt towns, instead of relying on fixed cargo IDs.
peter1138
parents:
6574
diff
changeset
|
22 |
}; |
9ed3a7f4ecbc
(svn r9236) -Codechange: Add 'town effect' attribute to cargo types. This will be used to specify how the cargo behaves wrt towns, instead of relying on fixed cargo IDs.
peter1138
parents:
6574
diff
changeset
|
23 |
|
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
24 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6474
diff
changeset
|
25 |
struct CargoSpec { |
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
26 |
uint8 bitnum; |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
27 |
CargoLabel label; |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
28 |
uint32 grfid; |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
29 |
uint8 legend_colour; |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
30 |
uint8 rating_colour; |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
31 |
uint8 weight; |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
32 |
uint16 initial_payment; |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
33 |
uint8 transit_days[2]; |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
34 |
|
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
35 |
bool is_freight; |
6637
9ed3a7f4ecbc
(svn r9236) -Codechange: Add 'town effect' attribute to cargo types. This will be used to specify how the cargo behaves wrt towns, instead of relying on fixed cargo IDs.
peter1138
parents:
6574
diff
changeset
|
36 |
TownEffect town_effect; ///< The effect this cargo type has on towns |
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
37 |
uint16 multipliertowngrowth; |
6685
410bba0abb67
(svn r9411) -Codechange: Add support for loading of newcargo data.
peter1138
parents:
6661
diff
changeset
|
38 |
uint8 callback_mask; |
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
39 |
|
10219
2ff2b0f7643e
(svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium
parents:
9258
diff
changeset
|
40 |
StringID name; |
2ff2b0f7643e
(svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium
parents:
9258
diff
changeset
|
41 |
StringID name_single; |
2ff2b0f7643e
(svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium
parents:
9258
diff
changeset
|
42 |
StringID units_volume; |
2ff2b0f7643e
(svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium
parents:
9258
diff
changeset
|
43 |
StringID quantifier; |
2ff2b0f7643e
(svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium
parents:
9258
diff
changeset
|
44 |
StringID abbrev; |
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
45 |
|
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
46 |
SpriteID sprite; |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
47 |
|
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
48 |
uint16 classes; |
6691
e8c27a509894
(svn r9418) -Codechange: Implement actions 1/2/3 for cargos, callback handler and custom icon sprites
peter1138
parents:
6685
diff
changeset
|
49 |
const struct SpriteGroup *group; |
6448
a749c78812a7
(svn r8858) -Codechange: Replace magic number test with class method for determining if a cargo is valid/active.
peter1138
parents:
6439
diff
changeset
|
50 |
|
a749c78812a7
(svn r8858) -Codechange: Replace magic number test with class method for determining if a cargo is valid/active.
peter1138
parents:
6439
diff
changeset
|
51 |
bool IsValid() const; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6474
diff
changeset
|
52 |
}; |
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
53 |
|
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
54 |
|
6439
99a5807852b1
(svn r8849) -Codechange: Replace hardcoded global/climate cargo mapping tables with dynamically generated data. Change associated code to use new functions.
peter1138
parents:
6417
diff
changeset
|
55 |
extern uint32 _cargo_mask; |
6685
410bba0abb67
(svn r9411) -Codechange: Add support for loading of newcargo data.
peter1138
parents:
6661
diff
changeset
|
56 |
extern CargoSpec _cargo[NUM_CARGO]; |
6439
99a5807852b1
(svn r8849) -Codechange: Replace hardcoded global/climate cargo mapping tables with dynamically generated data. Change associated code to use new functions.
peter1138
parents:
6417
diff
changeset
|
57 |
|
99a5807852b1
(svn r8849) -Codechange: Replace hardcoded global/climate cargo mapping tables with dynamically generated data. Change associated code to use new functions.
peter1138
parents:
6417
diff
changeset
|
58 |
|
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
59 |
/* Set up the default cargo types for the given landscape type */ |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
60 |
void SetupCargoForClimate(LandscapeID l); |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
61 |
/* Retrieve cargo details for the given cargo ID */ |
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
62 |
const CargoSpec *GetCargo(CargoID c); |
9258
c00ebaa5bf90
(svn r12458) -Codechange: split acquiring the sprite ID for cargos from the actual drawing of them.
rubidium
parents:
8794
diff
changeset
|
63 |
/* Get the cargo icon for a given cargo ID */ |
c00ebaa5bf90
(svn r12458) -Codechange: split acquiring the sprite ID for cargos from the actual drawing of them.
rubidium
parents:
8794
diff
changeset
|
64 |
SpriteID GetCargoSprite(CargoID i); |
6469
05a2e97144ec
(svn r8886) -Codechange: (NewGRF) Add (partial) cargo translation table support, applied to action 3s only.
peter1138
parents:
6449
diff
changeset
|
65 |
/* Get the cargo ID with the cargo label */ |
05a2e97144ec
(svn r8886) -Codechange: (NewGRF) Add (partial) cargo translation table support, applied to action 3s only.
peter1138
parents:
6449
diff
changeset
|
66 |
CargoID GetCargoIDByLabel(CargoLabel cl); |
6956
0d884da2fd1c
(svn r9620) -Codechange: apply cargo translation table to newstation variables 0x60..0x65
peter1138
parents:
6691
diff
changeset
|
67 |
CargoID GetCargoIDByBitnum(uint8 bitnum); |
6439
99a5807852b1
(svn r8849) -Codechange: Replace hardcoded global/climate cargo mapping tables with dynamically generated data. Change associated code to use new functions.
peter1138
parents:
6417
diff
changeset
|
68 |
|
6655
951b0ba32eb1
(svn r9301) -Codechange: Use cargo class to determine if a road vehicle can stop in bus or truck stops.
peter1138
parents:
6637
diff
changeset
|
69 |
static inline bool IsCargoInClass(CargoID c, uint16 cc) |
951b0ba32eb1
(svn r9301) -Codechange: Use cargo class to determine if a road vehicle can stop in bus or truck stops.
peter1138
parents:
6637
diff
changeset
|
70 |
{ |
6661 | 71 |
return (GetCargo(c)->classes & cc) != 0; |
6655
951b0ba32eb1
(svn r9301) -Codechange: Use cargo class to determine if a road vehicle can stop in bus or truck stops.
peter1138
parents:
6637
diff
changeset
|
72 |
} |
951b0ba32eb1
(svn r9301) -Codechange: Use cargo class to determine if a road vehicle can stop in bus or truck stops.
peter1138
parents:
6637
diff
changeset
|
73 |
|
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
74 |
|
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
diff
changeset
|
75 |
#endif /* CARGOTYPE_H */ |