engine.h
author Darkvater
Sat, 14 May 2005 12:36:16 +0000
changeset 1802 448f187042d3
parent 1786 a54634efeb98
child 1883 3b02000cfbe0
permissions -rw-r--r--
(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"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     1
#ifndef ENGINE_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     2
#define ENGINE_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
typedef struct RailVehicleInfo {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
	byte image_index;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
	byte flags; /* 1=multihead engine, 2=wagon */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
	byte base_cost;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
	uint16 max_speed;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
	uint16 power;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
	byte weight;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
	byte running_cost_base;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
	byte engclass; // 0: steam, 1: diesel, 2: electric
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
	byte capacity;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
	byte cargo_type;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    17
} RailVehicleInfo;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
typedef struct ShipVehicleInfo {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
	byte image_index;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
	byte base_cost;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
	uint16 max_speed;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    23
	byte cargo_type;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
	uint16 capacity;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
	byte running_cost;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    26
	byte sfx;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
	byte refittable;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
} ShipVehicleInfo;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    52
typedef struct EngineInfo {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    53
	uint16 base_intro;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    54
	byte unk2;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
	byte lifelength;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
	byte base_life;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
	byte railtype_climates;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
} EngineInfo;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
typedef struct Engine {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
	uint16 intro_date;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
	uint16 age;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
	uint16 reliability;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    64
	uint16 reliability_spd_dec;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
	uint16 reliability_start, reliability_max, reliability_final;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
	uint16 duration_phase_1, duration_phase_2, duration_phase_3;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    67
	byte lifelength;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
	byte preview_wait;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
} Engine;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    75
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    76
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    77
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
	RVI_MULTIHEAD = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    79
	RVI_WAGON = 2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    80
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   124
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
   125
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
   126
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
   127
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
   128
VARDEF const CargoID _local_cargo_id_ctype[NUM_GLOBAL_CID];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   129
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
   130
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
   131
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
   132
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
   133
void SetCustomEngineSprites(byte engine, byte cargo, struct SpriteGroup *group);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   134
// loaded is in percents, overriding_engine 0xffff is none
1475
b5cf1fc28304 (svn r1979) Const correctness
tron
parents: 1474
diff changeset
   135
int GetCustomEngineSprite(byte engine, const Vehicle *v, byte direction);
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
   136
#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
   137
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   138
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 1475
diff changeset
   139
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
   140
	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
   141
	// 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
   142
	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
   143
	// 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
   144
	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
   145
	// 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
   146
	VEHICLE_TRIGGER_ANY_NEW_CARGO = 8,
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 1475
diff changeset
   147
} VehicleTrigger;
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 1475
diff changeset
   148
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
   149
1329
a8a0d60b0a8e (svn r1833) byte -> char transition: the rest
tron
parents: 1197
diff changeset
   150
void SetCustomEngineName(int engine, const char *name);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   151
StringID GetCustomEngineName(int engine);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   152
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   153
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   154
void DrawTrainEngine(int x, int y, int engine, uint32 image_ormod);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   155
void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   156
void DrawShipEngine(int x, int y, int engine, uint32 image_ormod);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   157
void DrawAircraftEngine(int x, int y, int engine, uint32 image_ormod);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   158
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
void DrawTrainEngineInfo(int engine, int x, int y, int maxw);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   160
void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   161
void DrawShipEngineInfo(int engine, int x, int y, int maxw);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   162
void DrawAircraftEngineInfo(int engine, int x, int y, int maxw);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   163
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
   164
void AcceptEnginePreview(Engine *e, PlayerID player);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
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
   166
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
   167
void DeleteCustomEngineNames(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   168
1197
4322cf8d6ae7 (svn r1701) Style police ^^
tron
parents: 1196
diff changeset
   169
bool IsEngineBuildable(uint engine, byte type);
1474
d83520edcda6 (svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Darkvater
parents: 1329
diff changeset
   170
void UnInitNewgrEngines(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   172
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   173
	NUM_NORMAL_RAIL_ENGINES = 54,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
	NUM_MONORAIL_ENGINES = 30,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
	NUM_MAGLEV_ENGINES = 32,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
	NUM_TRAIN_ENGINES = NUM_NORMAL_RAIL_ENGINES + NUM_MONORAIL_ENGINES + NUM_MAGLEV_ENGINES,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
	NUM_ROAD_ENGINES = 88,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
	NUM_SHIP_ENGINES = 11,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
	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
   180
	TOTAL_NUM_ENGINES = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES + NUM_AIRCRAFT_ENGINES,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
	AIRCRAFT_ENGINES_INDEX = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   182
	SHIP_ENGINES_INDEX = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   183
	ROAD_ENGINES_INDEX = NUM_TRAIN_ENGINES,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   184
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
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
   186
#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
   187
#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
   188
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
   189
{
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
   190
  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
   191
  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
   192
}
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
   193
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
VARDEF StringID _engine_name_strings[TOTAL_NUM_ENGINES];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   195
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
   196
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
   197
{
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
	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
   199
}
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
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
   201
/* 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
   202
//#include "table/engines.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
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
   204
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
   205
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
   206
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
   207
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
   208
539
ccf9518e6cfd (svn r923) Forgot s/rail_vehinfo/RailVehInfo/
tron
parents: 538
diff changeset
   209
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
   210
{
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   211
	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
   212
	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
   213
}
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   214
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   215
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
   216
{
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   217
	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
   218
	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
   219
}
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   220
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   221
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
   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 - 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
   224
	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
   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 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
   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 - 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
   230
	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
   231
}
405
6830ae7a0d5d (svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents: 389
diff changeset
   232
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
#endif