12 |
12 |
13 enum RailVehicleTypes { |
13 enum RailVehicleTypes { |
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 }; |
|
18 |
|
19 enum EngineClass { |
|
20 EC_STEAM, |
|
21 EC_DIESEL, |
|
22 EC_ELECTRIC, |
|
23 EC_MONORAIL, |
|
24 EC_MAGLEV, |
17 }; |
25 }; |
18 |
26 |
19 struct RailVehicleInfo { |
27 struct RailVehicleInfo { |
20 byte image_index; |
28 byte image_index; |
21 RailVehicleTypes railveh_type; |
29 RailVehicleTypes railveh_type; |
109 byte lifelength; |
118 byte lifelength; |
110 byte flags; |
119 byte flags; |
111 PlayerByte preview_player; |
120 PlayerByte preview_player; |
112 byte preview_wait; |
121 byte preview_wait; |
113 byte player_avail; |
122 byte player_avail; |
114 byte type; ///< type, ie VEH_ROAD, VEH_TRAIN, etc. Same as in vehicle.h |
123 VehicleType type; ///< type, ie VEH_ROAD, VEH_TRAIN, etc. Same as in vehicle.h |
115 }; |
124 }; |
116 |
125 |
117 /** |
126 /** |
118 * EngineInfo.misc_flags is a bitmask, with the following values |
127 * EngineInfo.misc_flags is a bitmask, with the following values |
119 */ |
128 */ |
120 enum { |
129 enum { |
121 EF_RAIL_TILTS = 0, ///< Rail vehicle tilts in curves (unsupported) |
130 EF_RAIL_TILTS = 0, ///< Rail vehicle tilts in curves |
122 EF_ROAD_TRAM = 0, ///< Road vehicle is a tram/light rail vehicle (unsup) |
131 EF_ROAD_TRAM = 0, ///< Road vehicle is a tram/light rail vehicle |
123 EF_USES_2CC = 1, ///< Vehicle uses two company colours |
132 EF_USES_2CC = 1, ///< Vehicle uses two company colours |
124 EF_RAIL_IS_MU = 2, ///< Rail vehicle is a multiple-unit (DMU/EMU) |
133 EF_RAIL_IS_MU = 2, ///< Rail vehicle is a multiple-unit (DMU/EMU) |
125 }; |
134 }; |
126 |
135 |
127 /** |
136 /** |
151 |
160 |
152 void LoadCustomEngineNames(); |
161 void LoadCustomEngineNames(); |
153 void DeleteCustomEngineNames(); |
162 void DeleteCustomEngineNames(); |
154 |
163 |
155 bool IsEngineBuildable(EngineID engine, byte type, PlayerID player); |
164 bool IsEngineBuildable(EngineID engine, byte type, PlayerID player); |
|
165 CargoID GetEngineCargoType(EngineID engine); |
156 |
166 |
157 enum { |
167 enum { |
158 NUM_NORMAL_RAIL_ENGINES = 54, |
168 NUM_NORMAL_RAIL_ENGINES = 54, |
159 NUM_MONORAIL_ENGINES = 30, |
169 NUM_MONORAIL_ENGINES = 30, |
160 NUM_MAGLEV_ENGINES = 32, |
170 NUM_MAGLEV_ENGINES = 32, |
305 * @param erl The renewlist to search in. |
316 * @param erl The renewlist to search in. |
306 * @param engine Engine type to be replaced. |
317 * @param engine Engine type to be replaced. |
307 * @return The engine type to replace with, or INVALID_ENGINE if no |
318 * @return The engine type to replace with, or INVALID_ENGINE if no |
308 * replacement is in the list. |
319 * replacement is in the list. |
309 */ |
320 */ |
310 EngineID EngineReplacement(EngineRenewList erl, EngineID engine); |
321 EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group); |
311 |
322 |
312 /** |
323 /** |
313 * Add an engine replacement to the given renewlist. |
324 * Add an engine replacement to the given renewlist. |
314 * @param erl The renewlist to add to. |
325 * @param erl The renewlist to add to. |
315 * @param old_engine The original engine type. |
326 * @param old_engine The original engine type. |
316 * @param new_engine The replacement engine type. |
327 * @param new_engine The replacement engine type. |
317 * @param flags The calling command flags. |
328 * @param flags The calling command flags. |
318 * @return 0 on success, CMD_ERROR on failure. |
329 * @return 0 on success, CMD_ERROR on failure. |
319 */ |
330 */ |
320 int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID new_engine, uint32 flags); |
331 int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags); |
321 |
332 |
322 /** |
333 /** |
323 * Remove an engine replacement from a given renewlist. |
334 * Remove an engine replacement from a given renewlist. |
324 * @param erl The renewlist from which to remove the replacement |
335 * @param erl The renewlist from which to remove the replacement |
325 * @param engine The original engine type. |
336 * @param engine The original engine type. |
326 * @param flags The calling command flags. |
337 * @param flags The calling command flags. |
327 * @return 0 on success, CMD_ERROR on failure. |
338 * @return 0 on success, CMD_ERROR on failure. |
328 */ |
339 */ |
329 int32 RemoveEngineReplacement(EngineRenewList* erl, EngineID engine, uint32 flags); |
340 int32 RemoveEngineReplacement(EngineRenewList* erl, EngineID engine, GroupID group, uint32 flags); |
330 |
341 |
331 /** When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists |
342 /** When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists |
332 * @param type The type of engine |
343 * @param type The type of engine |
333 */ |
344 */ |
334 void AddRemoveEngineFromAutoreplaceAndBuildWindows(byte type); |
345 void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type); |
335 |
346 |
336 /* Engine list manipulators - current implementation is only C wrapper of CBlobT<EngineID> class (helpers.cpp) */ |
347 /* Engine list manipulators - current implementation is only C wrapper of CBlobT<EngineID> class (helpers.cpp) */ |
337 void EngList_Create(EngineList *el); ///< Creates engine list |
348 void EngList_Create(EngineList *el); ///< Creates engine list |
338 void EngList_Destroy(EngineList *el); ///< Deallocate and destroy engine list |
349 void EngList_Destroy(EngineList *el); ///< Deallocate and destroy engine list |
339 uint EngList_Count(const EngineList *el); ///< Returns number of items in the engine list |
350 uint EngList_Count(const EngineList *el); ///< Returns number of items in the engine list |