14 RAILVEH_SINGLEHEAD, ///< indicates a "standalone" locomotive |
14 RAILVEH_SINGLEHEAD, ///< indicates a "standalone" locomotive |
15 RAILVEH_MULTIHEAD, ///< indicates a combination of two locomotives |
15 RAILVEH_MULTIHEAD, ///< indicates a combination of two locomotives |
16 RAILVEH_WAGON, ///< simple wagon, not motorized |
16 RAILVEH_WAGON, ///< simple wagon, not motorized |
17 }; |
17 }; |
18 |
18 |
19 typedef struct RailVehicleInfo { |
19 struct RailVehicleInfo { |
20 byte image_index; |
20 byte image_index; |
21 RailVehicleTypes railveh_type; |
21 RailVehicleTypes railveh_type; |
22 byte base_cost; |
22 byte base_cost; |
23 RailTypeByte railtype; |
23 RailTypeByte railtype; |
24 uint16 max_speed; |
24 uint16 max_speed; |
37 // kind of visual effect to generate for a vehicle (default, steam, diesel, electric). |
37 // kind of visual effect to generate for a vehicle (default, steam, diesel, electric). |
38 // Same goes for the callback result, which atm is only used to check if a wagon is powered. |
38 // Same goes for the callback result, which atm is only used to check if a wagon is powered. |
39 byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor |
39 byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor |
40 byte tractive_effort; ///< Tractive effort coefficient |
40 byte tractive_effort; ///< Tractive effort coefficient |
41 byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles |
41 byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles |
42 } RailVehicleInfo; |
42 }; |
43 |
43 |
44 typedef struct ShipVehicleInfo { |
44 struct ShipVehicleInfo { |
45 byte image_index; |
45 byte image_index; |
46 byte base_cost; |
46 byte base_cost; |
47 uint16 max_speed; |
47 uint16 max_speed; |
48 CargoID cargo_type; |
48 CargoID cargo_type; |
49 uint16 capacity; |
49 uint16 capacity; |
50 byte running_cost; |
50 byte running_cost; |
51 SoundFxByte sfx; |
51 SoundFxByte sfx; |
52 bool refittable; |
52 bool refittable; |
53 } ShipVehicleInfo; |
53 }; |
54 |
54 |
55 /* AircraftVehicleInfo subtypes, bitmask type. |
55 /* AircraftVehicleInfo subtypes, bitmask type. |
56 * If bit 0 is 0 then it is a helicopter, otherwise it is a plane |
56 * If bit 0 is 0 then it is a helicopter, otherwise it is a plane |
57 * in which case bit 1 tells us whether it's a big(fast) plane or not */ |
57 * in which case bit 1 tells us whether it's a big(fast) plane or not */ |
58 enum { |
58 enum { |
59 AIR_HELI = 0, |
59 AIR_HELI = 0, |
60 AIR_CTOL = 1, ///< Conventional Take Off and Landing, i.e. planes |
60 AIR_CTOL = 1, ///< Conventional Take Off and Landing, i.e. planes |
61 AIR_FAST = 2 |
61 AIR_FAST = 2 |
62 }; |
62 }; |
63 |
63 |
64 typedef struct AircraftVehicleInfo { |
64 struct AircraftVehicleInfo { |
65 byte image_index; |
65 byte image_index; |
66 byte base_cost; |
66 byte base_cost; |
67 byte running_cost; |
67 byte running_cost; |
68 byte subtype; |
68 byte subtype; |
69 SoundFxByte sfx; |
69 SoundFxByte sfx; |
70 byte acceleration; |
70 byte acceleration; |
71 uint16 max_speed; |
71 uint16 max_speed; |
72 byte mail_capacity; |
72 byte mail_capacity; |
73 uint16 passenger_capacity; |
73 uint16 passenger_capacity; |
74 } AircraftVehicleInfo; |
74 }; |
75 |
75 |
76 typedef struct RoadVehicleInfo { |
76 struct RoadVehicleInfo { |
77 byte image_index; |
77 byte image_index; |
78 byte base_cost; |
78 byte base_cost; |
79 byte running_cost; |
79 byte running_cost; |
80 SoundFxByte sfx; |
80 SoundFxByte sfx; |
81 byte max_speed; |
81 byte max_speed; |
82 byte capacity; |
82 byte capacity; |
83 CargoID cargo_type; |
83 CargoID cargo_type; |
84 } RoadVehicleInfo; |
84 }; |
85 |
85 |
86 /** Information about a vehicle |
86 /** Information about a vehicle |
87 * @see table/engines.h |
87 * @see table/engines.h |
88 */ |
88 */ |
89 typedef struct EngineInfo { |
89 struct EngineInfo { |
90 Date base_intro; |
90 Date base_intro; |
91 Year lifelength; |
91 Year lifelength; |
92 Year base_life; |
92 Year base_life; |
93 byte unk2; ///< Carriages have the highest bit set in this one |
93 byte unk2; ///< Carriages have the highest bit set in this one |
94 byte load_amount; |
94 byte load_amount; |
95 byte climates; |
95 byte climates; |
96 uint32 refit_mask; |
96 uint32 refit_mask; |
97 byte refit_cost; |
97 byte refit_cost; |
98 byte misc_flags; |
98 byte misc_flags; |
99 byte callbackmask; |
99 byte callbackmask; |
100 } EngineInfo; |
100 }; |
101 |
101 |
102 typedef struct Engine { |
102 struct Engine { |
103 Date intro_date; |
103 Date intro_date; |
104 Date age; |
104 Date age; |
105 uint16 reliability; |
105 uint16 reliability; |
106 uint16 reliability_spd_dec; |
106 uint16 reliability_spd_dec; |
107 uint16 reliability_start, reliability_max, reliability_final; |
107 uint16 reliability_start, reliability_max, reliability_final; |
138 }; |
138 }; |
139 |
139 |
140 static const EngineID INVALID_ENGINE = 0xFFFF; |
140 static const EngineID INVALID_ENGINE = 0xFFFF; |
141 |
141 |
142 |
142 |
143 void AddTypeToEngines(void); |
143 void AddTypeToEngines(); |
144 void StartupEngines(void); |
144 void StartupEngines(); |
145 |
145 |
146 |
146 |
147 void DrawTrainEngine(int x, int y, EngineID engine, SpriteID pal); |
147 void DrawTrainEngine(int x, int y, EngineID engine, SpriteID pal); |
148 void DrawRoadVehEngine(int x, int y, EngineID engine, SpriteID pal); |
148 void DrawRoadVehEngine(int x, int y, EngineID engine, SpriteID pal); |
149 void DrawShipEngine(int x, int y, EngineID engine, SpriteID pal); |
149 void DrawShipEngine(int x, int y, EngineID engine, SpriteID pal); |
150 void DrawAircraftEngine(int x, int y, EngineID engine, SpriteID pal); |
150 void DrawAircraftEngine(int x, int y, EngineID engine, SpriteID pal); |
151 |
151 |
152 void LoadCustomEngineNames(void); |
152 void LoadCustomEngineNames(); |
153 void DeleteCustomEngineNames(void); |
153 void DeleteCustomEngineNames(); |
154 |
154 |
155 bool IsEngineBuildable(EngineID engine, byte type, PlayerID player); |
155 bool IsEngineBuildable(EngineID engine, byte type, PlayerID player); |
156 |
156 |
157 enum { |
157 enum { |
158 NUM_NORMAL_RAIL_ENGINES = 54, |
158 NUM_NORMAL_RAIL_ENGINES = 54, |