author | hackykid |
Wed, 01 Jun 2005 11:34:37 +0000 | |
changeset 1883 | 3b02000cfbe0 |
parent 1802 | 448f187042d3 |
child 1895 | 398f156479c8 |
permissions | -rw-r--r-- |
0 | 1 |
#ifndef ENGINE_H |
2 |
#define ENGINE_H |
|
3 |
||
405
6830ae7a0d5d
(svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents:
389
diff
changeset
|
4 |
#include "sprite.h" |
6830ae7a0d5d
(svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents:
389
diff
changeset
|
5 |
|
0 | 6 |
typedef struct RailVehicleInfo { |
7 |
byte image_index; |
|
8 |
byte flags; /* 1=multihead engine, 2=wagon */ |
|
9 |
byte base_cost; |
|
10 |
uint16 max_speed; |
|
11 |
uint16 power; |
|
12 |
byte weight; |
|
13 |
byte running_cost_base; |
|
14 |
byte engclass; // 0: steam, 1: diesel, 2: electric |
|
15 |
byte capacity; |
|
16 |
byte cargo_type; |
|
17 |
} RailVehicleInfo; |
|
18 |
||
19 |
typedef struct ShipVehicleInfo { |
|
20 |
byte image_index; |
|
21 |
byte base_cost; |
|
22 |
uint16 max_speed; |
|
23 |
byte cargo_type; |
|
24 |
uint16 capacity; |
|
25 |
byte running_cost; |
|
26 |
byte sfx; |
|
27 |
byte refittable; |
|
28 |
} ShipVehicleInfo; |
|
29 |
||
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
|
30 |
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
|
31 |
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
|
32 |
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
|
33 |
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
|
34 |
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
|
35 |
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
|
36 |
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
|
37 |
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
|
38 |
byte mail_capacity; |
922
fc040662bd43
(svn r1410) Replaced all occurences of 'passanger' by 'passenger' in the code
celestar
parents:
842
diff
changeset
|
39 |
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
|
40 |
} 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
|
41 |
|
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
|
42 |
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
|
43 |
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
|
44 |
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
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
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
|
50 |
} RoadVehicleInfo; |
0 | 51 |
|
52 |
typedef struct EngineInfo { |
|
53 |
uint16 base_intro; |
|
54 |
byte unk2; |
|
55 |
byte lifelength; |
|
56 |
byte base_life; |
|
57 |
byte railtype_climates; |
|
58 |
} EngineInfo; |
|
59 |
||
60 |
typedef struct Engine { |
|
61 |
uint16 intro_date; |
|
62 |
uint16 age; |
|
63 |
uint16 reliability; |
|
64 |
uint16 reliability_spd_dec; |
|
65 |
uint16 reliability_start, reliability_max, reliability_final; |
|
66 |
uint16 duration_phase_1, duration_phase_2, duration_phase_3; |
|
67 |
byte lifelength; |
|
68 |
byte flags; |
|
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
|
69 |
PlayerID preview_player; |
0 | 70 |
byte preview_wait; |
71 |
byte railtype; |
|
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
|
72 |
PlayerID 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
|
73 |
byte type; // type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h |
0 | 74 |
} Engine; |
75 |
||
76 |
||
77 |
enum { |
|
78 |
RVI_MULTIHEAD = 1, |
|
79 |
RVI_WAGON = 2, |
|
80 |
}; |
|
81 |
||
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
|
82 |
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
|
83 |
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
|
84 |
}; |
0 | 85 |
|
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
|
86 |
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
|
87 |
void StartupEngines(void); |
0 | 88 |
|
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
|
89 |
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
|
90 |
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
|
91 |
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
|
92 |
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
|
93 |
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
|
94 |
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
|
95 |
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
|
96 |
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
|
97 |
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
|
98 |
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
|
99 |
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
|
100 |
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
|
101 |
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
|
102 |
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
|
103 |
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
|
104 |
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
|
105 |
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
|
106 |
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
|
107 |
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
|
108 |
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
|
109 |
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
|
110 |
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
|
111 |
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
|
112 |
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
|
113 |
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
|
114 |
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
|
115 |
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
|
116 |
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
|
117 |
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
|
118 |
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
|
119 |
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
|
120 |
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
|
121 |
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
|
122 |
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
|
123 |
}; |
0 | 124 |
|
1883
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
125 |
// This enum only lists implemented callbacks |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
126 |
enum CallbackID { |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
127 |
// 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
|
128 |
// the cargo we are refitting to, returns the new cargo capacity |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
129 |
CB_REFIT_CAP = 0x15, |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
130 |
}; |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
131 |
|
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
132 |
enum { |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
133 |
CALLBACK_FAILED = 0xFFFF |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
134 |
}; |
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
135 |
|
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
|
136 |
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
|
137 |
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
|
138 |
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
|
139 |
VARDEF const CargoID _local_cargo_id_ctype[NUM_GLOBAL_CID]; |
0 | 140 |
|
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
|
141 |
VARDEF uint32 _engine_refit_masks[256]; |
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 |
VARDEF byte _engine_original_sprites[256]; |
369
ab2266938fa8
(svn r557) -newgrf: Rename all 'superset' tokens to 'group' and some other small renamings (pasky and octo).
darkvater
parents:
358
diff
changeset
|
143 |
void SetWagonOverrideSprites(byte engine, struct SpriteGroup *group, byte *train_id, int trains); |
ab2266938fa8
(svn r557) -newgrf: Rename all 'superset' tokens to 'group' and some other small renamings (pasky and octo).
darkvater
parents:
358
diff
changeset
|
144 |
void SetCustomEngineSprites(byte engine, byte cargo, struct SpriteGroup *group); |
0 | 145 |
// loaded is in percents, overriding_engine 0xffff is none |
1475 | 146 |
int GetCustomEngineSprite(byte engine, const Vehicle *v, byte direction); |
1883
3b02000cfbe0
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
147 |
uint16 GetCallBackResult(uint16 callback_info, byte engine, 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
|
148 |
#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
|
149 |
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction) |
0 | 150 |
|
1477 | 151 |
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
|
152 |
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
|
153 |
// 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
|
154 |
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
|
155 |
// 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
|
156 |
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
|
157 |
// 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
|
158 |
VEHICLE_TRIGGER_ANY_NEW_CARGO = 8, |
1477 | 159 |
} VehicleTrigger; |
160 |
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
|
161 |
|
1329 | 162 |
void SetCustomEngineName(int engine, const char *name); |
0 | 163 |
StringID GetCustomEngineName(int engine); |
164 |
||
165 |
||
166 |
void DrawTrainEngine(int x, int y, int engine, uint32 image_ormod); |
|
167 |
void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod); |
|
168 |
void DrawShipEngine(int x, int y, int engine, uint32 image_ormod); |
|
169 |
void DrawAircraftEngine(int x, int y, int engine, uint32 image_ormod); |
|
170 |
||
171 |
void DrawTrainEngineInfo(int engine, int x, int y, int maxw); |
|
172 |
void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw); |
|
173 |
void DrawShipEngineInfo(int engine, int x, int y, int maxw); |
|
174 |
void DrawAircraftEngineInfo(int engine, int x, int y, int maxw); |
|
175 |
||
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
|
176 |
void AcceptEnginePreview(Engine *e, PlayerID player); |
0 | 177 |
|
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
|
178 |
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
|
179 |
void DeleteCustomEngineNames(void); |
0 | 180 |
|
1197 | 181 |
bool IsEngineBuildable(uint engine, byte type); |
1474
d83520edcda6
(svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Darkvater
parents:
1329
diff
changeset
|
182 |
void UnInitNewgrEngines(void); |
0 | 183 |
|
184 |
enum { |
|
185 |
NUM_NORMAL_RAIL_ENGINES = 54, |
|
186 |
NUM_MONORAIL_ENGINES = 30, |
|
187 |
NUM_MAGLEV_ENGINES = 32, |
|
188 |
NUM_TRAIN_ENGINES = NUM_NORMAL_RAIL_ENGINES + NUM_MONORAIL_ENGINES + NUM_MAGLEV_ENGINES, |
|
189 |
NUM_ROAD_ENGINES = 88, |
|
190 |
NUM_SHIP_ENGINES = 11, |
|
191 |
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
|
192 |
TOTAL_NUM_ENGINES = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES + NUM_AIRCRAFT_ENGINES, |
0 | 193 |
AIRCRAFT_ENGINES_INDEX = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES, |
194 |
SHIP_ENGINES_INDEX = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES, |
|
195 |
ROAD_ENGINES_INDEX = NUM_TRAIN_ENGINES, |
|
196 |
}; |
|
197 |
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
|
198 |
#define FOR_ALL_ENGINES(e) for (e = _engines; e != endof(_engines); e++) |
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
|
199 |
#define DEREF_ENGINE(i) (GetEngine(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
|
200 |
static inline Engine* GetEngine(uint 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
|
201 |
{ |
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
|
202 |
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
|
203 |
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
|
204 |
} |
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
|
205 |
|
0 | 206 |
VARDEF StringID _engine_name_strings[TOTAL_NUM_ENGINES]; |
207 |
||
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
|
208 |
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
|
209 |
{ |
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
|
210 |
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
|
211 |
} |
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
|
212 |
|
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
|
213 |
/* 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
|
214 |
//#include "table/engines.h" |
0 | 215 |
extern EngineInfo _engine_info[TOTAL_NUM_ENGINES]; |
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
|
216 |
extern RailVehicleInfo _rail_vehicle_info[NUM_TRAIN_ENGINES]; |
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
|
217 |
extern ShipVehicleInfo _ship_vehicle_info[NUM_SHIP_ENGINES]; |
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
|
218 |
extern AircraftVehicleInfo _aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES]; |
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
|
219 |
extern RoadVehicleInfo _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
|
220 |
|
539 | 221 |
static inline RailVehicleInfo *RailVehInfo(uint e) |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
222 |
{ |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
223 |
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
|
224 |
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
|
225 |
} |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
226 |
|
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
227 |
static inline ShipVehicleInfo *ShipVehInfo(uint e) |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
228 |
{ |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
229 |
assert(e - SHIP_ENGINES_INDEX < lengthof(_ship_vehicle_info)); |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
230 |
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
|
231 |
} |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
232 |
|
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
233 |
static inline AircraftVehicleInfo *AircraftVehInfo(uint e) |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
234 |
{ |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
235 |
assert(e - AIRCRAFT_ENGINES_INDEX < lengthof(_aircraft_vehicle_info)); |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
236 |
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
|
237 |
} |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
238 |
|
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
239 |
static inline RoadVehicleInfo *RoadVehInfo(uint e) |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
240 |
{ |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
241 |
assert(e - ROAD_ENGINES_INDEX < lengthof(_road_vehicle_info)); |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
445
diff
changeset
|
242 |
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
|
243 |
} |
405
6830ae7a0d5d
(svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents:
389
diff
changeset
|
244 |
|
0 | 245 |
#endif |