author | bjarni |
Mon, 30 Jan 2006 19:31:02 +0000 | |
changeset 2937 | c6b63d147210 |
parent 2848 | cb4b1cc0bf65 |
child 2962 | dbd168a4703a |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#ifndef ENGINE_H |
4 |
#define ENGINE_H |
|
5 |
||
2129
9095824555e6
(svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents:
1998
diff
changeset
|
6 |
/** @file engine.h |
9095824555e6
(svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents:
1998
diff
changeset
|
7 |
*/ |
9095824555e6
(svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents:
1998
diff
changeset
|
8 |
|
405
6830ae7a0d5d
(svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents:
389
diff
changeset
|
9 |
#include "sprite.h" |
2848 | 10 |
#include "pool.h" |
405
6830ae7a0d5d
(svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents:
389
diff
changeset
|
11 |
|
0 | 12 |
typedef struct RailVehicleInfo { |
13 |
byte image_index; |
|
14 |
byte flags; /* 1=multihead engine, 2=wagon */ |
|
15 |
byte base_cost; |
|
16 |
uint16 max_speed; |
|
17 |
uint16 power; |
|
2542
fdea27216e48
(svn r3071) -NewGRF: Add support for rail vehicle weight greater than 255 tons.
peter1138
parents:
2530
diff
changeset
|
18 |
uint16 weight; |
0 | 19 |
byte running_cost_base; |
2840
d68a605b2087
(svn r3388) - NewGRF: Allow train running cost class to differ from engine class. Also fix typo in r3384.
peter1138
parents:
2817
diff
changeset
|
20 |
byte running_cost_class; |
0 | 21 |
byte engclass; // 0: steam, 1: diesel, 2: electric |
22 |
byte capacity; |
|
23 |
byte cargo_type; |
|
1895
398f156479c8
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
24 |
byte callbackmask; // see CallbackMask enum |
1908
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
25 |
uint16 pow_wag_power; |
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
26 |
byte pow_wag_weight; |
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
27 |
byte visual_effect; // NOTE: this is not 100% implemented yet, at the moment it is only used as a 'fallback' value |
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
28 |
// for when the 'powered wagon' callback fails. But it should really also determine what |
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
29 |
// kind of visual effect to generate for a vehicle (default, steam, diesel, electric). |
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
30 |
// Same goes for the callback result, which atm is only used to check if a wagon is powered. |
1922
797081e56d13
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1909
diff
changeset
|
31 |
byte shorten_factor; // length on main map for this type is 8 - shorten_factor |
0 | 32 |
} RailVehicleInfo; |
33 |
||
34 |
typedef struct ShipVehicleInfo { |
|
35 |
byte image_index; |
|
36 |
byte base_cost; |
|
37 |
uint16 max_speed; |
|
38 |
byte cargo_type; |
|
39 |
uint16 capacity; |
|
40 |
byte running_cost; |
|
41 |
byte sfx; |
|
42 |
byte refittable; |
|
43 |
} ShipVehicleInfo; |
|
44 |
||
376
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
45 |
typedef struct AircraftVehicleInfo { |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
46 |
byte image_index; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
47 |
byte base_cost; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
48 |
byte running_cost; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
49 |
byte subtype; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
50 |
byte sfx; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
51 |
byte acceleration; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
52 |
byte max_speed; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
53 |
byte mail_capacity; |
922
fc040662bd43
(svn r1410) Replaced all occurences of 'passanger' by 'passenger' in the code
celestar
parents:
842
diff
changeset
|
54 |
uint16 passenger_capacity; |
376
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
55 |
} AircraftVehicleInfo; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
56 |
|
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
57 |
typedef struct RoadVehicleInfo { |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
58 |
byte image_index; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
59 |
byte base_cost; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
60 |
byte running_cost; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
61 |
byte sfx; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
62 |
byte max_speed; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
63 |
byte capacity; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
64 |
byte cargo_type; |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
65 |
} RoadVehicleInfo; |
0 | 66 |
|
2129
9095824555e6
(svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents:
1998
diff
changeset
|
67 |
/** Information about a vehicle |
9095824555e6
(svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents:
1998
diff
changeset
|
68 |
* @see table/engines.h |
9095824555e6
(svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents:
1998
diff
changeset
|
69 |
*/ |
0 | 70 |
typedef struct EngineInfo { |
71 |
uint16 base_intro; |
|
2129
9095824555e6
(svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents:
1998
diff
changeset
|
72 |
byte unk2; ///< Carriages have the highest bit set in this one |
0 | 73 |
byte lifelength; |
74 |
byte base_life; |
|
2530
b8d5a5284024
(svn r3059) Use bitfields to encode railtype and climates of engines instead of manual shifting/anding
tron
parents:
2491
diff
changeset
|
75 |
byte railtype:4; |
b8d5a5284024
(svn r3059) Use bitfields to encode railtype and climates of engines instead of manual shifting/anding
tron
parents:
2491
diff
changeset
|
76 |
byte climates:4; |
2611
65b5313bc525
(svn r3148) -NewGRF, Feature: Add support for cargo refitting specification by cargo classes.
peter1138
parents:
2602
diff
changeset
|
77 |
uint32 refit_mask; |
0 | 78 |
} EngineInfo; |
79 |
||
80 |
typedef struct Engine { |
|
81 |
uint16 intro_date; |
|
82 |
uint16 age; |
|
83 |
uint16 reliability; |
|
84 |
uint16 reliability_spd_dec; |
|
85 |
uint16 reliability_start, reliability_max, reliability_final; |
|
86 |
uint16 duration_phase_1, duration_phase_2, duration_phase_3; |
|
87 |
byte lifelength; |
|
88 |
byte flags; |
|
2331
72a9f9b31e4e
(svn r2857) -Fix: PlayerID is not a valid type for a player-bit-field. Partly reverted r2290
truelight
parents:
2186
diff
changeset
|
89 |
byte preview_player; |
0 | 90 |
byte preview_wait; |
91 |
byte railtype; |
|
2331
72a9f9b31e4e
(svn r2857) -Fix: PlayerID is not a valid type for a player-bit-field. Partly reverted r2290
truelight
parents:
2186
diff
changeset
|
92 |
byte player_avail; |
819
02e9296ccdca
(svn r1290) Added type to typedef struct Engine and filled in the same data as in type in vehicle
bjarni
parents:
539
diff
changeset
|
93 |
byte type; // type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h |
0 | 94 |
} Engine; |
95 |
||
96 |
||
97 |
enum { |
|
98 |
RVI_MULTIHEAD = 1, |
|
99 |
RVI_WAGON = 2, |
|
100 |
}; |
|
101 |
||
1802
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
102 |
enum { |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
103 |
NUM_VEHICLE_TYPES = 6 |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
104 |
}; |
0 | 105 |
|
2848 | 106 |
enum { |
107 |
INVALID_ENGINE = 0xFFFF, |
|
108 |
}; |
|
109 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
922
diff
changeset
|
110 |
void AddTypeToEngines(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
922
diff
changeset
|
111 |
void StartupEngines(void); |
0 | 112 |
|
1802
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
113 |
enum GlobalCargo { |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
114 |
GC_PASSENGERS = 0, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
115 |
GC_COAL = 1, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
116 |
GC_MAIL = 2, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
117 |
GC_OIL = 3, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
118 |
GC_LIVESTOCK = 4, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
119 |
GC_GOODS = 5, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
120 |
GC_GRAIN = 6, // GC_WHEAT / GC_MAIZE |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
121 |
GC_WOOD = 7, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
122 |
GC_IRON_ORE = 8, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
123 |
GC_STEEL = 9, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
124 |
GC_VALUABLES = 10, // GC_GOLD / GC_DIAMONDS |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
125 |
GC_PAPER = 11, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
126 |
GC_FOOD = 12, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
127 |
GC_FRUIT = 13, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
128 |
GC_COPPER_ORE = 14, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
129 |
GC_WATER = 15, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
130 |
GC_RUBBER = 16, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
131 |
GC_SUGAR = 17, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
132 |
GC_TOYS = 18, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
133 |
GC_BATTERIES = 19, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
134 |
GC_CANDY = 20, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
135 |
GC_TOFFEE = 21, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
136 |
GC_COLA = 22, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
137 |
GC_COTTON_CANDY = 23, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
138 |
GC_BUBBLES = 24, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
139 |
GC_PLASTIC = 25, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
140 |
GC_FIZZY_DRINKS = 26, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
141 |
GC_PAPER_TEMP = 27, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
142 |
GC_UNDEFINED = 28, // undefined; unused slot in arctic climate |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
143 |
GC_DEFAULT = 29, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
144 |
GC_PURCHASE = 30, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
145 |
GC_INVALID = 255, |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
146 |
NUM_GLOBAL_CID = 31 |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
147 |
}; |
0 | 148 |
|
1895
398f156479c8
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
149 |
// This enum lists the implemented callbacks |
398f156479c8
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
150 |
// Use as argument for the GetCallBackResult function (see comments there) |
1883
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
151 |
enum CallbackID { |
1908
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
152 |
// Powered wagons, if the result is lower as 0x40 then the wagon is powered |
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
153 |
// TODO: interpret the rest of the result, aka "visual effects" |
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
154 |
CBID_WAGON_POWER = 0x10, |
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
155 |
|
1922
797081e56d13
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1909
diff
changeset
|
156 |
// Vehicle length, returns the amount of 1/8's the vehicle is shorter |
797081e56d13
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1909
diff
changeset
|
157 |
// only for train vehicles |
797081e56d13
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1909
diff
changeset
|
158 |
CBID_VEH_LENGTH = 0x11, |
797081e56d13
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1909
diff
changeset
|
159 |
|
1883
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
160 |
// Refit capacity, the passed vehicle needs to have its ->cargo_type set to |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
161 |
// the cargo we are refitting to, returns the new cargo capacity |
1895
398f156479c8
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
162 |
CBID_REFIT_CAP = 0x15, |
2602
f0e2dcce3695
(svn r3139) -NewGRF, Feature: support for articulated rail vehicles. This is used, for example, by coal tenders.
peter1138
parents:
2542
diff
changeset
|
163 |
|
f0e2dcce3695
(svn r3139) -NewGRF, Feature: support for articulated rail vehicles. This is used, for example, by coal tenders.
peter1138
parents:
2542
diff
changeset
|
164 |
CBID_ARTIC_ENGINE = 0x16, |
1895
398f156479c8
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
165 |
}; |
398f156479c8
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
166 |
|
398f156479c8
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
167 |
// bit positions for rvi->callbackmask, indicates which callbacks are used by an engine |
398f156479c8
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
168 |
// (some callbacks are always used, and dont appear here) |
398f156479c8
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
169 |
enum CallbackMask { |
1909
8ef1a310dd39
(svn r2415) - Fix: [newgrf] Powered Wagons - Don't assume an undefined callback will fail.
hackykid
parents:
1908
diff
changeset
|
170 |
CBM_WAGON_POWER = 0, |
1922
797081e56d13
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1909
diff
changeset
|
171 |
CBM_VEH_LENGTH = 1, |
1895
398f156479c8
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
172 |
CBM_REFIT_CAP = 3, |
2602
f0e2dcce3695
(svn r3139) -NewGRF, Feature: support for articulated rail vehicles. This is used, for example, by coal tenders.
peter1138
parents:
2542
diff
changeset
|
173 |
CBM_ARTIC_ENGINE = 4, |
1883
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
174 |
}; |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
175 |
|
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
176 |
enum { |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
177 |
CALLBACK_FAILED = 0xFFFF |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
178 |
}; |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
179 |
|
1802
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
180 |
VARDEF const uint32 _default_refitmasks[NUM_VEHICLE_TYPES]; |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
181 |
VARDEF const CargoID _global_cargo_id[NUM_LANDSCAPE][NUM_CARGO]; |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
182 |
VARDEF const uint32 _landscape_global_cargo_mask[NUM_LANDSCAPE]; |
448f187042d3
(svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents:
1786
diff
changeset
|
183 |
VARDEF const CargoID _local_cargo_id_ctype[NUM_GLOBAL_CID]; |
2611
65b5313bc525
(svn r3148) -NewGRF, Feature: Add support for cargo refitting specification by cargo classes.
peter1138
parents:
2602
diff
changeset
|
184 |
VARDEF const uint32 cargo_classes[16]; |
0 | 185 |
|
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
186 |
void SetWagonOverrideSprites(EngineID engine, struct SpriteGroup *group, byte *train_id, int trains); |
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
187 |
void SetCustomEngineSprites(EngineID engine, byte cargo, struct SpriteGroup *group); |
0 | 188 |
// loaded is in percents, overriding_engine 0xffff is none |
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
189 |
int GetCustomEngineSprite(EngineID engine, const Vehicle *v, byte direction); |
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
190 |
uint16 GetCallBackResult(uint16 callback_info, EngineID engine, const Vehicle *v); |
1908
bc48a30aba72
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
191 |
bool UsesWagonOverride(const Vehicle *v); |
414
e18cc252e2ea
(svn r611) -newgrf: Change GetCustomEngineSprite() calling convention (invisible to users of GetCustomVehicle*() wrappers). Needed for deterministic spritegroups support (pasky).
darkvater
parents:
405
diff
changeset
|
192 |
#define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction) |
e18cc252e2ea
(svn r611) -newgrf: Change GetCustomEngineSprite() calling convention (invisible to users of GetCustomVehicle*() wrappers). Needed for deterministic spritegroups support (pasky).
darkvater
parents:
405
diff
changeset
|
193 |
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction) |
0 | 194 |
|
1477 | 195 |
typedef enum VehicleTrigger { |
445
0e3fa3da3899
(svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents:
414
diff
changeset
|
196 |
VEHICLE_TRIGGER_NEW_CARGO = 1, |
0e3fa3da3899
(svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents:
414
diff
changeset
|
197 |
// Externally triggered only for the first vehicle in chain |
0e3fa3da3899
(svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents:
414
diff
changeset
|
198 |
VEHICLE_TRIGGER_DEPOT = 2, |
0e3fa3da3899
(svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents:
414
diff
changeset
|
199 |
// Externally triggered only for the first vehicle in chain, only if whole chain is empty |
0e3fa3da3899
(svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents:
414
diff
changeset
|
200 |
VEHICLE_TRIGGER_EMPTY = 4, |
0e3fa3da3899
(svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents:
414
diff
changeset
|
201 |
// Not triggered externally (called for the whole chain if we got NEW_CARGO) |
0e3fa3da3899
(svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents:
414
diff
changeset
|
202 |
VEHICLE_TRIGGER_ANY_NEW_CARGO = 8, |
1477 | 203 |
} VehicleTrigger; |
204 |
void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger); |
|
445
0e3fa3da3899
(svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents:
414
diff
changeset
|
205 |
|
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
206 |
void SetCustomEngineName(EngineID engine, const char *name); |
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
207 |
StringID GetCustomEngineName(EngineID engine); |
0 | 208 |
|
209 |
||
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
210 |
void DrawTrainEngine(int x, int y, EngineID engine, uint32 image_ormod); |
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
211 |
void DrawRoadVehEngine(int x, int y, EngineID engine, uint32 image_ormod); |
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
212 |
void DrawShipEngine(int x, int y, EngineID engine, uint32 image_ormod); |
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
213 |
void DrawAircraftEngine(int x, int y, EngineID engine, uint32 image_ormod); |
0 | 214 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
922
diff
changeset
|
215 |
void LoadCustomEngineNames(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
922
diff
changeset
|
216 |
void DeleteCustomEngineNames(void); |
0 | 217 |
|
1197 | 218 |
bool IsEngineBuildable(uint engine, byte type); |
0 | 219 |
|
220 |
enum { |
|
221 |
NUM_NORMAL_RAIL_ENGINES = 54, |
|
222 |
NUM_MONORAIL_ENGINES = 30, |
|
223 |
NUM_MAGLEV_ENGINES = 32, |
|
224 |
NUM_TRAIN_ENGINES = NUM_NORMAL_RAIL_ENGINES + NUM_MONORAIL_ENGINES + NUM_MAGLEV_ENGINES, |
|
225 |
NUM_ROAD_ENGINES = 88, |
|
226 |
NUM_SHIP_ENGINES = 11, |
|
227 |
NUM_AIRCRAFT_ENGINES = 41, |
|
376
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
228 |
TOTAL_NUM_ENGINES = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES + NUM_AIRCRAFT_ENGINES, |
0 | 229 |
AIRCRAFT_ENGINES_INDEX = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES, |
230 |
SHIP_ENGINES_INDEX = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES, |
|
231 |
ROAD_ENGINES_INDEX = NUM_TRAIN_ENGINES, |
|
232 |
}; |
|
233 |
VARDEF Engine _engines[TOTAL_NUM_ENGINES]; |
|
1786
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
234 |
#define FOR_ALL_ENGINES(e) for (e = _engines; e != endof(_engines); e++) |
1926
68d60188a22f
(svn r2432) Use GetEngine() instead of DEREF_ENGINE() or even _engines[]
tron
parents:
1922
diff
changeset
|
235 |
|
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
236 |
static inline Engine* GetEngine(EngineID i) |
1786
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
237 |
{ |
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
238 |
assert(i < lengthof(_engines)); |
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
239 |
return &_engines[i]; |
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
240 |
} |
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
241 |
|
0 | 242 |
VARDEF StringID _engine_name_strings[TOTAL_NUM_ENGINES]; |
243 |
||
1786
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
244 |
static inline bool IsEngineIndex(uint index) |
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
245 |
{ |
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
246 |
return index < TOTAL_NUM_ENGINES; |
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
247 |
} |
a54634efeb98
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1477
diff
changeset
|
248 |
|
376
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
249 |
/* Access Vehicle Data */ |
1a4425a0a953
(svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents:
374
diff
changeset
|
250 |
//#include "table/engines.h" |
2463
de2605ed3758
(svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents:
2436
diff
changeset
|
251 |
extern const EngineInfo orig_engine_info[TOTAL_NUM_ENGINES]; |
de2605ed3758
(svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents:
2436
diff
changeset
|
252 |
extern const RailVehicleInfo orig_rail_vehicle_info[NUM_TRAIN_ENGINES]; |
de2605ed3758
(svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents:
2436
diff
changeset
|
253 |
extern const ShipVehicleInfo orig_ship_vehicle_info[NUM_SHIP_ENGINES]; |
de2605ed3758
(svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents:
2436
diff
changeset
|
254 |
extern const AircraftVehicleInfo orig_aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES]; |
de2605ed3758
(svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents:
2436
diff
changeset
|
255 |
extern const RoadVehicleInfo orig_road_vehicle_info[NUM_ROAD_ENGINES]; |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
256 |
|
2763 | 257 |
extern EngineInfo _engine_info[TOTAL_NUM_ENGINES]; |
258 |
extern RailVehicleInfo _rail_vehicle_info[NUM_TRAIN_ENGINES]; |
|
259 |
extern ShipVehicleInfo _ship_vehicle_info[NUM_SHIP_ENGINES]; |
|
260 |
extern AircraftVehicleInfo _aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES]; |
|
261 |
extern RoadVehicleInfo _road_vehicle_info[NUM_ROAD_ENGINES]; |
|
2463
de2605ed3758
(svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents:
2436
diff
changeset
|
262 |
|
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
263 |
static inline const RailVehicleInfo* RailVehInfo(EngineID e) |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
264 |
{ |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
265 |
assert(e < lengthof(_rail_vehicle_info)); |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
266 |
return &_rail_vehicle_info[e]; |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
267 |
} |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
268 |
|
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
269 |
static inline const ShipVehicleInfo* ShipVehInfo(EngineID e) |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
270 |
{ |
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
271 |
assert(e >= SHIP_ENGINES_INDEX && e < SHIP_ENGINES_INDEX + lengthof(_ship_vehicle_info)); |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
272 |
return &_ship_vehicle_info[e - SHIP_ENGINES_INDEX]; |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
273 |
} |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
274 |
|
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
275 |
static inline const AircraftVehicleInfo* AircraftVehInfo(EngineID e) |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
276 |
{ |
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
277 |
assert(e >= AIRCRAFT_ENGINES_INDEX && e < AIRCRAFT_ENGINES_INDEX + lengthof(_aircraft_vehicle_info)); |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
278 |
return &_aircraft_vehicle_info[e - AIRCRAFT_ENGINES_INDEX]; |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
279 |
} |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
280 |
|
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
281 |
static inline const RoadVehicleInfo* RoadVehInfo(EngineID e) |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
282 |
{ |
2477
d454d5152386
(svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents:
2464
diff
changeset
|
283 |
assert(e >= ROAD_ENGINES_INDEX && e < ROAD_ENGINES_INDEX + lengthof(_road_vehicle_info)); |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
284 |
return &_road_vehicle_info[e - ROAD_ENGINES_INDEX]; |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
285 |
} |
405
6830ae7a0d5d
(svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents:
389
diff
changeset
|
286 |
|
2491
dfe9542f783e
(svn r3017) -NewGRF: Implement sprite group unreferencing and unloading.
peter1138
parents:
2477
diff
changeset
|
287 |
void UnloadWagonOverrides(void); |
dfe9542f783e
(svn r3017) -NewGRF: Implement sprite group unreferencing and unloading.
peter1138
parents:
2477
diff
changeset
|
288 |
void UnloadCustomEngineSprites(void); |
2769
acea0abd2195
(svn r3316) - NewGRF: Unload engine names before loading grf files. This fixes names in climates where the engines don't get loaded. Renamed function to reflect its purpose.
peter1138
parents:
2763
diff
changeset
|
289 |
void UnloadCustomEngineNames(void); |
2491
dfe9542f783e
(svn r3017) -NewGRF: Implement sprite group unreferencing and unloading.
peter1138
parents:
2477
diff
changeset
|
290 |
|
2848 | 291 |
/************************************************************************ |
292 |
* Engine Replacement stuff |
|
293 |
************************************************************************/ |
|
294 |
||
295 |
/** |
|
296 |
* Struct to store engine replacements. DO NOT USE outside of engine.c. Is |
|
297 |
* placed here so the only exception to this rule, the saveload code, can use |
|
298 |
* it. |
|
299 |
*/ |
|
300 |
struct EngineRenew { |
|
301 |
uint16 index; |
|
302 |
EngineID from; |
|
303 |
EngineID to; |
|
304 |
struct EngineRenew *next; |
|
305 |
}; |
|
306 |
||
307 |
typedef struct EngineRenew EngineRenew; |
|
308 |
||
309 |
/** |
|
310 |
* Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is |
|
311 |
* placed here so the only exception to this rule, the saveload code, can use |
|
312 |
* it. |
|
313 |
*/ |
|
314 |
extern MemoryPool _engine_renew_pool; |
|
315 |
||
316 |
/** |
|
317 |
* DO NOT USE outside of engine.c. Is |
|
318 |
* placed here so the only exception to this rule, the saveload code, can use |
|
319 |
* it. |
|
320 |
*/ |
|
321 |
static inline EngineRenew *GetEngineRenew(uint16 index) |
|
322 |
{ |
|
323 |
return (EngineRenew*)GetItemFromPool(&_engine_renew_pool, index); |
|
324 |
} |
|
325 |
||
326 |
||
327 |
/** |
|
328 |
* A list to group EngineRenew directives together (such as per-player). |
|
329 |
*/ |
|
330 |
typedef EngineRenew* EngineRenewList; |
|
331 |
||
332 |
/** |
|
333 |
* Remove all engine replacement settings for the player. |
|
334 |
* @param er The renewlist for a given player. |
|
335 |
* @return The new renewlist for the player. |
|
336 |
*/ |
|
337 |
void RemoveAllEngineReplacement(EngineRenewList* erl); |
|
338 |
||
339 |
/** |
|
340 |
* Retrieve the engine replacement in a given renewlist for an original engine type. |
|
341 |
* @param erl The renewlist to search in. |
|
342 |
* @param engine Engine type to be replaced. |
|
343 |
* @return The engine type to replace with, or INVALID_ENGINE if no |
|
344 |
* replacement is in the list. |
|
345 |
*/ |
|
346 |
EngineID EngineReplacement(EngineRenewList erl, EngineID engine); |
|
347 |
||
348 |
/** |
|
349 |
* Add an engine replacement to the given renewlist. |
|
350 |
* @param erl The renewlist to add to. |
|
351 |
* @param old_engine The original engine type. |
|
352 |
* @param new_engine The replacement engine type. |
|
353 |
* @param flags The calling command flags. |
|
354 |
* @return 0 on success, CMD_ERROR on failure. |
|
355 |
*/ |
|
356 |
int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID new_engine, uint32 flags); |
|
357 |
||
358 |
/** |
|
359 |
* Remove an engine replacement from a given renewlist. |
|
360 |
* @param erl The renewlist from which to remove the replacement |
|
361 |
* @param engine The original engine type. |
|
362 |
* @param flags The calling command flags. |
|
363 |
* @return 0 on success, CMD_ERROR on failure. |
|
364 |
*/ |
|
365 |
int32 RemoveEngineReplacement(EngineRenewList* erl, EngineID engine, uint32 flags); |
|
366 |
||
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2331
diff
changeset
|
367 |
#endif /* ENGINE_H */ |