#include "stdafx.h"#include "core/bitmath_func.hpp"#include "vehicle_base.h"Go to the source code of this file.
Data Structures | |
| struct | Train |
| This class 'wraps' Vehicle; you do not actually instantiate this class. More... | |
Enumerations | |
| enum | TrainSubtype { TS_FRONT = 0, TS_ARTICULATED_PART = 1, TS_WAGON = 2, TS_ENGINE = 3, TS_FREE_WAGON = 4, TS_MULTIHEADED = 5 } |
Functions | |
| static bool | IsFrontEngine (const Vehicle *v) |
| Check if a vehicle is front engine. | |
| static void | SetFrontEngine (Vehicle *v) |
| Set front engine state. | |
| static void | ClearFrontEngine (Vehicle *v) |
| Remove the front engine state. | |
| static bool | IsArticulatedPart (const Vehicle *v) |
| Check if a vehicle is an articulated part of an engine. | |
| static void | SetArticulatedPart (Vehicle *v) |
| Set a vehicle to be an articulated part. | |
| static void | ClearArticulatedPart (Vehicle *v) |
| Clear a vehicle from being an articulated part. | |
| static bool | IsTrainWagon (const Vehicle *v) |
| Check if a vehicle is a wagon. | |
| static void | SetTrainWagon (Vehicle *v) |
| Set a vehicle to be a wagon. | |
| static void | ClearTrainWagon (Vehicle *v) |
| Clear wagon property. | |
| static bool | IsTrainEngine (const Vehicle *v) |
| Check if a vehicle is an engine (can be first in a train). | |
| static void | SetTrainEngine (Vehicle *v) |
| Set engine status. | |
| static void | ClearTrainEngine (Vehicle *v) |
| Clear engine status. | |
| static bool | IsFreeWagon (const Vehicle *v) |
| Check if a vehicle is a free wagon (got no engine in front of it). | |
| static void | SetFreeWagon (Vehicle *v) |
| Set if a vehicle is a free wagon. | |
| static void | ClearFreeWagon (Vehicle *v) |
| Clear a vehicle from being a free wagon. | |
| static bool | IsMultiheaded (const Vehicle *v) |
| Check if a vehicle is a multiheaded engine. | |
| static void | SetMultiheaded (Vehicle *v) |
| Set if a vehicle is a multiheaded engine. | |
| static void | ClearMultiheaded (Vehicle *v) |
| Clear multiheaded engine property. | |
| static bool | EngineHasArticPart (const Vehicle *v) |
| Check if an engine has an articulated part. | |
| static Vehicle * | GetNextArticPart (const Vehicle *v) |
| Get the next part of a multi-part engine. | |
| static Vehicle * | GetLastEnginePart (Vehicle *v) |
| Get the last part of a multi-part engine. | |
| static bool | IsRearDualheaded (const Vehicle *v) |
| Tell if we are dealing with the rear end of a multiheaded engine. | |
| static Vehicle * | GetNextVehicle (const Vehicle *v) |
| Get the next real (non-articulated part) vehicle in the consist. | |
| static Vehicle * | GetNextUnit (Vehicle *v) |
| Get the next real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist. | |
| void | ConvertOldMultiheadToNew () |
| Converts all trains to the new subtype format introduced in savegame 16.2 It also links multiheaded engines or make them forget they are multiheaded if no suitable partner is found. | |
| void | ConnectMultiheadedTrains () |
| uint | CountArticulatedParts (EngineID engine_type) |
| int | CheckTrainInDepot (const Vehicle *v, bool needs_to_be_stopped) |
| void | CcBuildLoco (bool success, TileIndex tile, uint32 p1, uint32 p2) |
| void | CcBuildWagon (bool success, TileIndex tile, uint32 p1, uint32 p2) |
| byte | FreightWagonMult (CargoID cargo) |
| Return the cargo weight multiplier to use for a rail vehicle. | |
| int | CheckTrainStoppedInDepot (const Vehicle *v) |
| void | UpdateTrainAcceleration (Vehicle *v) |
| void | CheckTrainsLengths () |
| Checks if lengths of all rail vehicles are valid. | |
Definition in file train.h.
| enum TrainSubtype |
| void CheckTrainsLengths | ( | ) |
Checks if lengths of all rail vehicles are valid.
If not, shows an error message.
Definition at line 214 of file train_cmd.cpp.
References _networking, abs(), max(), TicksToLeaveDepot(), and TRACK_BIT_DEPOT.
Referenced by InitializeWindowsAndCaches(), and ReloadNewGRFData().
| static void ClearArticulatedPart | ( | Vehicle * | v | ) | [inline, static] |
Clear a vehicle from being an articulated part.
| v | vehicle to change |
Definition at line 79 of file train.h.
References ClrBit(), and TS_ARTICULATED_PART.
| static void ClearFreeWagon | ( | Vehicle * | v | ) | [inline, static] |
Clear a vehicle from being a free wagon.
| v | vehicle to change |
Definition at line 163 of file train.h.
References ClrBit(), and TS_FREE_WAGON.
Referenced by CmdMoveRailVehicle().
| static void ClearFrontEngine | ( | Vehicle * | v | ) | [inline, static] |
Remove the front engine state.
| v | vehicle to change |
Definition at line 51 of file train.h.
References ClrBit(), and TS_FRONT.
Referenced by CmdMoveRailVehicle().
| static void ClearMultiheaded | ( | Vehicle * | v | ) | [inline, static] |
Clear multiheaded engine property.
| v | vehicle to change |
Definition at line 191 of file train.h.
References ClrBit(), and TS_MULTIHEADED.
| static void ClearTrainEngine | ( | Vehicle * | v | ) | [inline, static] |
| static void ClearTrainWagon | ( | Vehicle * | v | ) | [inline, static] |
| static bool EngineHasArticPart | ( | const Vehicle * | v | ) | [inline, static] |
Check if an engine has an articulated part.
| v | Vehicle. |
Definition at line 201 of file train.h.
References IsArticulatedPart().
Referenced by CmdCloneVehicle(), GetLastEnginePart(), GetNextArticPart(), and GetNextVehicle().
| byte FreightWagonMult | ( | CargoID | cargo | ) |
Return the cargo weight multiplier to use for a rail vehicle.
| cargo | Cargo type to get multiplier for |
Definition at line 89 of file train_cmd.cpp.
Referenced by TrainCargoChanged().
| static Vehicle* GetLastEnginePart | ( | Vehicle * | v | ) | [inline, static] |
Get the last part of a multi-part engine.
| v | Vehicle. |
Definition at line 222 of file train.h.
References EngineHasArticPart(), and GetNextArticPart().
Referenced by CmdMoveRailVehicle(), and UnlinkWagon().
| static Vehicle* GetNextArticPart | ( | const Vehicle * | v | ) | [inline, static] |
Get the next part of a multi-part engine.
Will only work on a multi-part engine (EngineHasArticPart(v) == true), Result is undefined for normal engine.
Definition at line 212 of file train.h.
References EngineHasArticPart().
Referenced by CmdCloneVehicle(), GetLastEnginePart(), and GetNextVehicle().
| static Vehicle* GetNextUnit | ( | Vehicle * | v | ) | [inline, static] |
Get the next real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist.
| v | Vehicle. |
Definition at line 256 of file train.h.
References GetNextVehicle(), and IsRearDualheaded().
Referenced by CmdMoveRailVehicle().
| static Vehicle* GetNextVehicle | ( | const Vehicle * | v | ) | [inline, static] |
Get the next real (non-articulated part) vehicle in the consist.
| v | Vehicle. |
Definition at line 243 of file train.h.
References EngineHasArticPart(), and GetNextArticPart().
Referenced by CmdCloneVehicle(), CmdMoveRailVehicle(), CmdSellRailWagon(), GetNextUnit(), and UnlinkWagon().
| static bool IsArticulatedPart | ( | const Vehicle * | v | ) | [inline, static] |
Check if a vehicle is an articulated part of an engine.
| v | vehicle to check |
Definition at line 61 of file train.h.
References HasBit(), and TS_ARTICULATED_PART.
Referenced by CmdMoveRailVehicle(), CmdSellRailWagon(), EngineHasArticPart(), GetVehiclePalette(), IsEngineCountable(), TrainCargoChanged(), TrainConsistChanged(), TrainPowerChanged(), and UpdateTrainPowerProc().
| static bool IsFreeWagon | ( | const Vehicle * | v | ) | [inline, static] |
Check if a vehicle is a free wagon (got no engine in front of it).
| v | vehicle to check |
Definition at line 145 of file train.h.
References HasBit(), and TS_FREE_WAGON.
Referenced by AfterLoadVehicles(), BuildDepotVehicleList(), CmdBuildRailWagon(), CmdMoveRailVehicle(), NormalizeTrainVehInDepot(), TrainConsistChanged(), and UpdateTrainGroupID().
| static bool IsFrontEngine | ( | const Vehicle * | v | ) | [inline, static] |
Check if a vehicle is front engine.
| v | vehicle to check |
Definition at line 33 of file train.h.
References HasBit(), and TS_FRONT.
Referenced by AfterLoadVehicles(), BuildDepotVehicleList(), CmdCloneVehicle(), CmdMoveRailVehicle(), CmdSellRailWagon(), DrawPlayerVehiclesAmount(), GetTrainAcceleration(), HandleCloneVehClick(), SettingsDisableElrail(), SetTrainGroupID(), TrainApproachingCrossingEnum(), TrainApproachingCrossingTile(), TrainConsistChanged(), UpdateTrainGroupID(), and WhoCanServiceIndustry().
| static bool IsMultiheaded | ( | const Vehicle * | v | ) | [inline, static] |
Check if a vehicle is a multiheaded engine.
| v | vehicle to check |
Definition at line 173 of file train.h.
References HasBit(), and TS_MULTIHEADED.
Referenced by CmdReverseTrainDirection(), CmdSellRailWagon(), IsRearDualheaded(), and TrainPowerChanged().
| static bool IsRearDualheaded | ( | const Vehicle * | v | ) | [inline, static] |
Tell if we are dealing with the rear end of a multiheaded engine.
| v | Vehicle. |
Definition at line 233 of file train.h.
References IsMultiheaded(), and IsTrainEngine().
Referenced by CmdCloneVehicle(), CmdMoveRailVehicle(), CmdSellRailWagon(), GetNextUnit(), and IsEngineCountable().
| static bool IsTrainEngine | ( | const Vehicle * | v | ) | [inline, static] |
Check if a vehicle is an engine (can be first in a train).
| v | vehicle to check |
Definition at line 117 of file train.h.
References HasBit(), and TS_ENGINE.
Referenced by CmdMoveRailVehicle(), CmdSellRailWagon(), IsRearDualheaded(), and TrainConsistChanged().
| static bool IsTrainWagon | ( | const Vehicle * | v | ) | [inline, static] |
Check if a vehicle is a wagon.
| v | vehicle to check |
Definition at line 89 of file train.h.
References HasBit(), and TS_WAGON.
Referenced by TrainConsistChanged(), and UnlinkWagon().
| static void SetArticulatedPart | ( | Vehicle * | v | ) | [inline, static] |
Set a vehicle to be an articulated part.
| v | vehicle to change |
Definition at line 70 of file train.h.
References SetBit(), and TS_ARTICULATED_PART.
Referenced by ConvertOldMultiheadToNew().
| static void SetFreeWagon | ( | Vehicle * | v | ) | [inline, static] |
Set if a vehicle is a free wagon.
| v | vehicle to change |
Definition at line 154 of file train.h.
References SetBit(), and TS_FREE_WAGON.
Referenced by CmdBuildRailWagon(), CmdMoveRailVehicle(), ConvertOldMultiheadToNew(), and UnlinkWagon().
| static void SetFrontEngine | ( | Vehicle * | v | ) | [inline, static] |
Set front engine state.
| v | vehicle to change |
Definition at line 42 of file train.h.
References SetBit(), and TS_FRONT.
Referenced by CmdBuildRailVehicle(), CmdMoveRailVehicle(), CmdSellRailWagon(), and ConvertOldMultiheadToNew().
| static void SetMultiheaded | ( | Vehicle * | v | ) | [inline, static] |
Set if a vehicle is a multiheaded engine.
| v | vehicle to change |
Definition at line 182 of file train.h.
References SetBit(), and TS_MULTIHEADED.
Referenced by CmdBuildRailVehicle(), and ConvertOldMultiheadToNew().
| static void SetTrainEngine | ( | Vehicle * | v | ) | [inline, static] |
Set engine status.
| v | vehicle to change |
Definition at line 126 of file train.h.
References SetBit(), and TS_ENGINE.
Referenced by CmdBuildRailVehicle(), and ConvertOldMultiheadToNew().
| static void SetTrainWagon | ( | Vehicle * | v | ) | [inline, static] |
Set a vehicle to be a wagon.
| v | vehicle to change |
Definition at line 98 of file train.h.
References SetBit(), and TS_WAGON.
Referenced by CmdBuildRailWagon(), and ConvertOldMultiheadToNew().
1.5.6