OpenTTD Source
20241120-master-g6d3adc6169
|
Command definitions related to trains. More...
Go to the source code of this file.
Functions | |
CommandCost | CmdBuildRailVehicle (DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret) |
Build a railroad vehicle. More... | |
CommandCost | CmdSellRailWagon (DoCommandFlag flags, Vehicle *t, bool sell_chain, bool backup_order, ClientID user) |
Sell a (single) train wagon/engine. More... | |
CommandCost | CmdMoveRailVehicle (DoCommandFlag flags, VehicleID src_veh, VehicleID dest_veh, bool move_chain) |
Move a rail vehicle around inside the depot. More... | |
CommandCost | CmdForceTrainProceed (DoCommandFlag flags, VehicleID veh_id) |
Force a train through a red signal. More... | |
CommandCost | CmdReverseTrainDirection (DoCommandFlag flags, VehicleID veh_id, bool reverse_single_veh) |
Reverse train. More... | |
void | CcBuildWagon (Commands cmd, const CommandCost &result, VehicleID new_veh_id, uint, uint16_t, CargoArray, TileIndex tile, EngineID, bool, CargoID, ClientID) |
Callback for building wagons. More... | |
Command definitions related to trains.
Definition in file train_cmd.h.
void CcBuildWagon | ( | Commands | cmd, |
const CommandCost & | result, | ||
VehicleID | new_veh_id, | ||
uint | , | ||
uint16_t | , | ||
CargoArray | , | ||
TileIndex | tile, | ||
EngineID | , | ||
bool | , | ||
CargoID | , | ||
ClientID | |||
) |
Callback for building wagons.
result | The result of the command. |
new_veh_id | ID of the ne vehicle. |
tile | The tile the command was executed on. |
Definition at line 29 of file train_gui.cpp.
CommandCost CmdBuildRailVehicle | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
const Engine * | e, | ||
Vehicle ** | ret | ||
) |
Build a railroad vehicle.
flags | type of operation. | |
tile | tile of the depot where rail-vehicle is built. | |
e | the engine to build. | |
[out] | ret | the vehicle that has been built. |
Definition at line 750 of file train_cmd.cpp.
References CMD_ERROR, CmdBuildRailWagon(), DC_EXEC, GetRailDepotDirection(), GetRailType(), HasPowerOnRail(), RailVehicleInfo::railtype, and RAILVEH_WAGON.
CommandCost CmdForceTrainProceed | ( | DoCommandFlag | flags, |
VehicleID | veh_id | ||
) |
Force a train through a red signal.
flags | type of operation |
veh_id | train to ignore the red signal |
Definition at line 2132 of file train_cmd.cpp.
References CheckOwnership(), CMD_ERROR, DC_EXEC, CommandCost::Failed(), SpecializedVehicle< T, Type >::GetIfValid(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, GroundVehicle< T, Type >::IsChainInDepot(), Train::IsPrimaryVehicle(), Vehicle::owner, BaseConsist::ResetDepotUnbunching(), SetWindowDirty(), TFP_NONE, TFP_SIGNAL, TFP_STUCK, VRF_TRAIN_STUCK, and WC_VEHICLE_VIEW.
CommandCost CmdMoveRailVehicle | ( | DoCommandFlag | flags, |
VehicleID | src_veh, | ||
VehicleID | dest_veh, | ||
bool | move_chain | ||
) |
Move a rail vehicle around inside the depot.
flags | type of operation Note: DC_AUTOREPLACE is set when autoreplace tries to undo its modifications or moves vehicles to temporary locations inside the depot. |
src_veh | source vehicle index |
dest_veh | what wagon to put the source wagon AFTER, XXX - INVALID_VEHICLE to make a new line |
move_chain | move all vehicles following the source vehicle |
Definition at line 1193 of file train_cmd.cpp.
References CheckOwnership(), CMD_ERROR, DC_AUTOREPLACE, CommandCost::Failed(), SpecializedVehicle< T, Type >::GetIfValid(), INVALID_VEHICLE, GroundVehicle< T, Type >::IsEngine(), Vehicle::owner, Vehicle::vehstatus, and VS_CRASHED.
CommandCost CmdReverseTrainDirection | ( | DoCommandFlag | flags, |
VehicleID | veh_id, | ||
bool | reverse_single_veh | ||
) |
Reverse train.
flags | type of operation |
veh_id | train to reverse |
reverse_single_veh | if true, reverse a unit in a train (needs to be in a depot) |
Definition at line 2059 of file train_cmd.cpp.
References CheckOwnership(), CMD_ERROR, CommandCost::Failed(), SpecializedVehicle< T, Type >::GetIfValid(), HasBit(), GroundVehicle< T, Type >::IsMultiheaded(), and Vehicle::owner.
CommandCost CmdSellRailWagon | ( | DoCommandFlag | flags, |
Vehicle * | t, | ||
bool | sell_chain, | ||
bool | backup_order, | ||
ClientID | user | ||
) |
Sell a (single) train wagon/engine.
flags | type of operation |
t | the train wagon to sell |
sell_chain | the selling mode
|
backup_order | make order backup? |
user | the user for the order backup. |
Definition at line 1391 of file train_cmd.cpp.
References CommandCost::AddCost(), Vehicle::AddToShared(), ArrangeTrains(), OrderBackup::Backup(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_orderlist_pool >::CanAllocateItem(), Vehicle::CopyVehicleConfigAndStatistics(), GroupStatistics::CountVehicle(), DC_AUTOREPLACE, DC_EXEC, DeleteVehicleOrders(), EXPENSES_NEW_VEHICLES, CommandCost::Failed(), SpecializedVehicle< T, Type >::First(), SpecializedVehicle< T, Type >::From(), InvalidateWindowClassesData(), InvalidateWindowData(), GroundVehicle< T, Type >::IsEngine(), Vehicle::IsFrontEngine(), Train::IsPrimaryVehicle(), GroundVehicle< T, Type >::IsRearDualheaded(), MakeTrainBackup(), SpecializedVehicle< T, Type >::Next(), NormaliseSubtypes(), NormaliseTrainHead(), Vehicle::orders, RestoreTrainBackup(), return_cmd_error, Vehicle::tile, ValidateTrains(), WC_TRAINS_LIST, and WC_VEHICLE_DEPOT.
Referenced by CmdSellVehicle().