engine.h
author tron
Wed, 07 Jun 2006 19:35:21 +0000
changeset 3977 edb5b94e2094
parent 3956 0f43adbc293a
child 3997 29c77eab14a4
permissions -rw-r--r--
(svn r5155) - Remove the bridge branch merge (revision r5070)
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2129
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2129
diff changeset
     2
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
#ifndef ENGINE_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     4
#define ENGINE_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
2129
9095824555e6 (svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents: 1998
diff changeset
     6
/** @file engine.h
9095824555e6 (svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents: 1998
diff changeset
     7
  */
9095824555e6 (svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents: 1998
diff changeset
     8
2848
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
     9
#include "pool.h"
405
6830ae7a0d5d (svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents: 389
diff changeset
    10
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
typedef struct RailVehicleInfo {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
	byte image_index;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
	byte flags; /* 1=multihead engine, 2=wagon */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
	byte base_cost;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
	uint16 max_speed;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
	uint16 power;
2542
fdea27216e48 (svn r3071) -NewGRF: Add support for rail vehicle weight greater than 255 tons.
peter1138
parents: 2530
diff changeset
    17
	uint16 weight;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
	byte running_cost_base;
2840
d68a605b2087 (svn r3388) - NewGRF: Allow train running cost class to differ from engine class. Also fix typo in r3384.
peter1138
parents: 2817
diff changeset
    19
	byte running_cost_class;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
	byte engclass; // 0: steam, 1: diesel, 2: electric
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
	byte capacity;
3344
d86c852715fa (svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents: 3113
diff changeset
    22
	CargoID cargo_type;
3022
236a3e5b3c69 (svn r3602) - Move _railveh_score data to _rail_vehicle_info->ai_rank and remove global variable to return data as we can now access this directly.
peter1138
parents: 3006
diff changeset
    23
	byte ai_rank;
1908
bc48a30aba72 (svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents: 1895
diff changeset
    24
	uint16 pow_wag_power;
bc48a30aba72 (svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents: 1895
diff changeset
    25
	byte pow_wag_weight;
bc48a30aba72 (svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents: 1895
diff changeset
    26
	byte visual_effect; // NOTE: this is not 100% implemented yet, at the moment it is only used as a 'fallback' value
bc48a30aba72 (svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents: 1895
diff changeset
    27
	                    //       for when the 'powered wagon' callback fails. But it should really also determine what
bc48a30aba72 (svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents: 1895
diff changeset
    28
	                    //       kind of visual effect to generate for a vehicle (default, steam, diesel, electric).
bc48a30aba72 (svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents: 1895
diff changeset
    29
	                    //       Same goes for the callback result, which atm is only used to check if a wagon is powered.
1922
797081e56d13 (svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents: 1909
diff changeset
    30
	byte shorten_factor;	// length on main map for this type is 8 - shorten_factor
3862
898c8212afa1 (svn r4896) - NewGRF: add support for vehicle property 0x25 (user defined data) used by variable 0x42.
peter1138
parents: 3750
diff changeset
    31
	byte user_def_data; ///! Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
} RailVehicleInfo;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
typedef struct ShipVehicleInfo {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
	byte image_index;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
	byte base_cost;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    37
	uint16 max_speed;
3344
d86c852715fa (svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents: 3113
diff changeset
    38
	CargoID cargo_type;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
	uint16 capacity;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
	byte running_cost;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
	byte sfx;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
	byte refittable;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    43
} ShipVehicleInfo;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    44
376
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    45
typedef struct AircraftVehicleInfo {
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    46
	byte image_index;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    47
	byte base_cost;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    48
	byte running_cost;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    49
	byte subtype;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    50
	byte sfx;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    51
	byte acceleration;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    52
	byte max_speed;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    53
	byte mail_capacity;
922
fc040662bd43 (svn r1410) Replaced all occurences of 'passanger' by 'passenger' in the code
celestar
parents: 842
diff changeset
    54
	uint16 passenger_capacity;
376
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    55
} AircraftVehicleInfo;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    56
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    57
typedef struct RoadVehicleInfo {
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    58
	byte image_index;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    59
	byte base_cost;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    60
	byte running_cost;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    61
	byte sfx;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    62
	byte max_speed;
1a4425a0a953 (svn r565) -newgrf: fixed double work of RoadVehicleInfo[]; added AircraftVehicleInfo[] as well. table/engines.h is now the same as in the _map branch.
darkvater
parents: 374
diff changeset
    63
	byte capacity;
3344
d86c852715fa (svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents: 3113
diff changeset
    64
	CargoID cargo_type;
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
    65
} RoadVehicleInfo;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
2129
9095824555e6 (svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents: 1998
diff changeset
    67
/** Information about a vehicle
9095824555e6 (svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents: 1998
diff changeset
    68
  * @see table/engines.h
9095824555e6 (svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents: 1998
diff changeset
    69
  */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
typedef struct EngineInfo {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    71
	uint16 base_intro;
2129
9095824555e6 (svn r2639) -Add: Added the vehicle names in table/engines.h so that you know what line represents what vehicle (I hope I didn't mess that up). Added some comments while I'm at it and include the table/ directory in the Doxygen generation
celestar
parents: 1998
diff changeset
    72
	byte unk2;              ///< Carriages have the highest bit set in this one
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    73
	byte lifelength;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
	byte base_life;
2530
b8d5a5284024 (svn r3059) Use bitfields to encode railtype and climates of engines instead of manual shifting/anding
tron
parents: 2491
diff changeset
    75
	byte railtype:4;
b8d5a5284024 (svn r3059) Use bitfields to encode railtype and climates of engines instead of manual shifting/anding
tron
parents: 2491
diff changeset
    76
	byte climates:4;
2611
65b5313bc525 (svn r3148) -NewGRF, Feature: Add support for cargo refitting specification by cargo classes.
peter1138
parents: 2602
diff changeset
    77
	uint32 refit_mask;
3095
2d4498efac3b (svn r3684) - NewGRF: Support loading of miscellaneous flags (not used yet)
peter1138
parents: 3022
diff changeset
    78
	byte misc_flags;
3956
0f43adbc293a (svn r5105) - NewGRF: Move callbackmask from *VehicleInfo to EngineInfo. This simplifies code that works with more than one vehicle type.
peter1138
parents: 3866
diff changeset
    79
	byte callbackmask;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    80
} EngineInfo;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
typedef struct Engine {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
	uint16 intro_date;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
	uint16 age;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    85
	uint16 reliability;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    86
	uint16 reliability_spd_dec;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    87
	uint16 reliability_start, reliability_max, reliability_final;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    88
	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
    89
	byte lifelength;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    90
	byte flags;
2331
72a9f9b31e4e (svn r2857) -Fix: PlayerID is not a valid type for a player-bit-field. Partly reverted r2290
truelight
parents: 2186
diff changeset
    91
	byte preview_player;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
	byte preview_wait;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
	byte railtype;
2331
72a9f9b31e4e (svn r2857) -Fix: PlayerID is not a valid type for a player-bit-field. Partly reverted r2290
truelight
parents: 2186
diff changeset
    94
	byte player_avail;
819
02e9296ccdca (svn r1290) Added type to typedef struct Engine and filled in the same data as in type in vehicle
bjarni
parents: 539
diff changeset
    95
	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
    96
} Engine;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    97
3113
c0f312f22238 (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 3095
diff changeset
    98
/**
c0f312f22238 (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 3095
diff changeset
    99
 * EngineInfo.misc_flags is a bitmask, with the following values
c0f312f22238 (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 3095
diff changeset
   100
 */
c0f312f22238 (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 3095
diff changeset
   101
enum {
c0f312f22238 (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 3095
diff changeset
   102
	EF_RAIL_TILTS = 0, ///< Rail vehicle tilts in curves (unsupported)
c0f312f22238 (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 3095
diff changeset
   103
	EF_ROAD_TRAM  = 0, ///< Road vehicle is a tram/light rail vehicle (unsup)
c0f312f22238 (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 3095
diff changeset
   104
	EF_USES_2CC   = 1, ///< Vehicle uses two company colours
c0f312f22238 (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 3095
diff changeset
   105
	EF_RAIL_IS_MU = 2, ///< Rail vehicle is a multiple-unit (DMU/EMU)
c0f312f22238 (svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
peter1138
parents: 3095
diff changeset
   106
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   107
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   108
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   109
	RVI_MULTIHEAD = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   110
	RVI_WAGON = 2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   111
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   112
1802
448f187042d3 (svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents: 1786
diff changeset
   113
enum {
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
	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
   115
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   116
2848
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   117
enum {
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   118
	INVALID_ENGINE = 0xFFFF,
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   119
};
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   120
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
   121
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
   122
void StartupEngines(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   123
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];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   126
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   127
void DrawTrainEngine(int x, int y, EngineID engine, uint32 image_ormod);
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   128
void DrawRoadVehEngine(int x, int y, EngineID engine, uint32 image_ormod);
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   129
void DrawShipEngine(int x, int y, EngineID engine, uint32 image_ormod);
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   130
void DrawAircraftEngine(int x, int y, EngineID engine, uint32 image_ormod);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
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
   132
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
   133
void DeleteCustomEngineNames(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   134
1197
4322cf8d6ae7 (svn r1701) Style police ^^
tron
parents: 1196
diff changeset
   135
bool IsEngineBuildable(uint engine, byte type);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   136
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   137
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   138
	NUM_NORMAL_RAIL_ENGINES = 54,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
	NUM_MONORAIL_ENGINES = 30,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   140
	NUM_MAGLEV_ENGINES = 32,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   141
	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
   142
	NUM_ROAD_ENGINES = 88,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   143
	NUM_SHIP_ENGINES = 11,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   144
	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
   145
	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
   146
	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
   147
	SHIP_ENGINES_INDEX = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
	ROAD_ENGINES_INDEX = NUM_TRAIN_ENGINES,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   149
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   150
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
   151
#define FOR_ALL_ENGINES(e) for (e = _engines; e != endof(_engines); e++)
1926
68d60188a22f (svn r2432) Use GetEngine() instead of DEREF_ENGINE() or even _engines[]
tron
parents: 1922
diff changeset
   152
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   153
static inline Engine* GetEngine(EngineID i)
1786
a54634efeb98 (svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents: 1477
diff changeset
   154
{
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
   155
  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
   156
  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
   157
}
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
   158
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
VARDEF StringID _engine_name_strings[TOTAL_NUM_ENGINES];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   160
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
   161
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
   162
{
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
   163
	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
   164
}
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
   165
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
   166
/* 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
   167
//#include "table/engines.h"
2463
de2605ed3758 (svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents: 2436
diff changeset
   168
extern const EngineInfo orig_engine_info[TOTAL_NUM_ENGINES];
de2605ed3758 (svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents: 2436
diff changeset
   169
extern const RailVehicleInfo orig_rail_vehicle_info[NUM_TRAIN_ENGINES];
de2605ed3758 (svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents: 2436
diff changeset
   170
extern const ShipVehicleInfo orig_ship_vehicle_info[NUM_SHIP_ENGINES];
de2605ed3758 (svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents: 2436
diff changeset
   171
extern const AircraftVehicleInfo orig_aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES];
de2605ed3758 (svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents: 2436
diff changeset
   172
extern const RoadVehicleInfo orig_road_vehicle_info[NUM_ROAD_ENGINES];
538
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   173
2763
d579caf58b59 (svn r3308) BAD
tron
parents: 2611
diff changeset
   174
extern EngineInfo _engine_info[TOTAL_NUM_ENGINES];
d579caf58b59 (svn r3308) BAD
tron
parents: 2611
diff changeset
   175
extern RailVehicleInfo _rail_vehicle_info[NUM_TRAIN_ENGINES];
d579caf58b59 (svn r3308) BAD
tron
parents: 2611
diff changeset
   176
extern ShipVehicleInfo _ship_vehicle_info[NUM_SHIP_ENGINES];
d579caf58b59 (svn r3308) BAD
tron
parents: 2611
diff changeset
   177
extern AircraftVehicleInfo _aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES];
d579caf58b59 (svn r3308) BAD
tron
parents: 2611
diff changeset
   178
extern RoadVehicleInfo _road_vehicle_info[NUM_ROAD_ENGINES];
2463
de2605ed3758 (svn r2989) - Make engine/vehicle information tables constant. Duplicate them so NewGRF data can be loaded without wiping out the default data.
peter1138
parents: 2436
diff changeset
   179
3393
48ce4c723a76 (svn r4201) - Codechange: Do for _engine_info[] what we do for _*_vehicle_info[]; create and use a function to retrieve data, and ensure constness.
peter1138
parents: 3344
diff changeset
   180
static inline const EngineInfo *EngInfo(EngineID e)
48ce4c723a76 (svn r4201) - Codechange: Do for _engine_info[] what we do for _*_vehicle_info[]; create and use a function to retrieve data, and ensure constness.
peter1138
parents: 3344
diff changeset
   181
{
48ce4c723a76 (svn r4201) - Codechange: Do for _engine_info[] what we do for _*_vehicle_info[]; create and use a function to retrieve data, and ensure constness.
peter1138
parents: 3344
diff changeset
   182
	assert(e < lengthof(_engine_info));
48ce4c723a76 (svn r4201) - Codechange: Do for _engine_info[] what we do for _*_vehicle_info[]; create and use a function to retrieve data, and ensure constness.
peter1138
parents: 3344
diff changeset
   183
	return &_engine_info[e];
48ce4c723a76 (svn r4201) - Codechange: Do for _engine_info[] what we do for _*_vehicle_info[]; create and use a function to retrieve data, and ensure constness.
peter1138
parents: 3344
diff changeset
   184
}
48ce4c723a76 (svn r4201) - Codechange: Do for _engine_info[] what we do for _*_vehicle_info[]; create and use a function to retrieve data, and ensure constness.
peter1138
parents: 3344
diff changeset
   185
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   186
static inline const RailVehicleInfo* RailVehInfo(EngineID e)
538
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   187
{
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   188
	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
   189
	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
   190
}
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   191
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   192
static inline const ShipVehicleInfo* ShipVehInfo(EngineID e)
538
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   193
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   194
	assert(e >= SHIP_ENGINES_INDEX && e < SHIP_ENGINES_INDEX + lengthof(_ship_vehicle_info));
538
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   195
	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
   196
}
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   197
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   198
static inline const AircraftVehicleInfo* AircraftVehInfo(EngineID e)
538
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   199
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   200
	assert(e >= AIRCRAFT_ENGINES_INDEX && e < AIRCRAFT_ENGINES_INDEX + lengthof(_aircraft_vehicle_info));
538
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   201
	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
   202
}
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   203
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   204
static inline const RoadVehicleInfo* RoadVehInfo(EngineID e)
538
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   205
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
   206
	assert(e >= ROAD_ENGINES_INDEX && e < ROAD_ENGINES_INDEX + lengthof(_road_vehicle_info));
538
5dd99f3b7eca (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents: 445
diff changeset
   207
	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
   208
}
405
6830ae7a0d5d (svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents: 389
diff changeset
   209
2848
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   210
/************************************************************************
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   211
 * Engine Replacement stuff
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   212
 ************************************************************************/
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   213
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   214
/**
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   215
 * Struct to store engine replacements. DO NOT USE outside of engine.c. Is
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   216
 * placed here so the only exception to this rule, the saveload code, can use
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   217
 * it.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   218
 */
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   219
struct EngineRenew {
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   220
	uint16 index;
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   221
	EngineID from;
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   222
	EngineID to;
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   223
	struct EngineRenew *next;
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   224
};
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   225
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   226
typedef struct EngineRenew EngineRenew;
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   227
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   228
/**
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   229
 * Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   230
 * placed here so the only exception to this rule, the saveload code, can use
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   231
 * it.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   232
 */
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   233
extern MemoryPool _engine_renew_pool;
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   234
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   235
/**
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   236
 * DO NOT USE outside of engine.c. Is
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   237
 * placed here so the only exception to this rule, the saveload code, can use
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   238
 * it.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   239
 */
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   240
static inline EngineRenew *GetEngineRenew(uint16 index)
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   241
{
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   242
	return (EngineRenew*)GetItemFromPool(&_engine_renew_pool, index);
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   243
}
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   244
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   245
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   246
/**
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   247
 * A list to group EngineRenew directives together (such as per-player).
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   248
 */
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   249
typedef EngineRenew* EngineRenewList;
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   250
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   251
/**
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   252
 * Remove all engine replacement settings for the player.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   253
 * @param  er The renewlist for a given player.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   254
 * @return The new renewlist for the player.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   255
 */
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   256
void RemoveAllEngineReplacement(EngineRenewList* erl);
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   257
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   258
/**
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   259
 * Retrieve the engine replacement in a given renewlist for an original engine type.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   260
 * @param  erl The renewlist to search in.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   261
 * @param  engine Engine type to be replaced.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   262
 * @return The engine type to replace with, or INVALID_ENGINE if no
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   263
 * replacement is in the list.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   264
 */
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   265
EngineID EngineReplacement(EngineRenewList erl, EngineID engine);
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   266
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   267
/**
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   268
 * Add an engine replacement to the given renewlist.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   269
 * @param erl The renewlist to add to.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   270
 * @param old_engine The original engine type.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   271
 * @param new_engine The replacement engine type.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   272
 * @param flags The calling command flags.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   273
 * @return 0 on success, CMD_ERROR on failure.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   274
 */
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   275
int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID new_engine, uint32 flags);
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   276
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   277
/**
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   278
 * Remove an engine replacement from a given renewlist.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   279
 * @param erl The renewlist from which to remove the replacement
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   280
 * @param engine The original engine type.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   281
 * @param flags The calling command flags.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   282
 * @return 0 on success, CMD_ERROR on failure.
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   283
 */
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   284
int32 RemoveEngineReplacement(EngineRenewList* erl, EngineID engine, uint32 flags);
cb4b1cc0bf65 (svn r3396) - Autoreplace changes:
peter1138
parents: 2840
diff changeset
   285
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2331
diff changeset
   286
#endif /* ENGINE_H */