OpenTTD Source 20250312-master-gcdcc6b491d
|
Command definitions related to trains. More...
Go to the source code of this file.
Functions | |
CommandCost | CmdBuildRailVehicle (DoCommandFlags flags, TileIndex tile, const Engine *e, Vehicle **ret) |
Build a railroad vehicle. | |
CommandCost | CmdSellRailWagon (DoCommandFlags flags, Vehicle *t, bool sell_chain, bool backup_order, ClientID user) |
Sell a (single) train wagon/engine. | |
CommandCost | CmdMoveRailVehicle (DoCommandFlags flags, VehicleID src_veh, VehicleID dest_veh, bool move_chain) |
Move a rail vehicle around inside the depot. | |
CommandCost | CmdForceTrainProceed (DoCommandFlags flags, VehicleID veh_id) |
Force a train through a red signal. | |
CommandCost | CmdReverseTrainDirection (DoCommandFlags flags, VehicleID veh_id, bool reverse_single_veh) |
Reverse train. | |
void | CcBuildWagon (Commands cmd, const CommandCost &result, VehicleID new_veh_id, uint, uint16_t, CargoArray, TileIndex tile, EngineID, bool, CargoType, ClientID) |
Callback for building wagons. | |
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 | , | ||
CargoType | , | ||
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.
References CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, InvalidateWindowClassesData(), SpecializedVehicle< T, Type >::Iterate(), Vehicle::Last(), Vehicle::tile, and WC_TRAINS_LIST.
CommandCost CmdBuildRailVehicle | ( | DoCommandFlags | 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 749 of file train_cmd.cpp.
References _current_company, AddArticulatedParts(), Vehicle::build_year, RailVehicleInfo::capacity, Vehicle::cargo_cap, Vehicle::cargo_type, CCF_ARRANGE, CheckConsistencyOfArticulatedVehicle(), CMD_ERROR, CmdBuildRailWagon(), Train::ConsistChanged(), TimerGameCalendar::date, TimerGameEconomy::date, Vehicle::date_of_last_service, Vehicle::date_of_last_service_newgrf, DEFAULT_GROUP, DefaultPalette, DiagDirToDir(), Vehicle::direction, Vehicle::engine_type, ExclusivePreview, Execute, GroundVehicleCache::first_engine, Engine::flags, GroundVehicle< T, Type >::gcache, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), Engine::GetDefaultCargoType(), Engine::GetLifeLengthInDays(), GetRailDepotDirection(), GetRailType(), GetSlopePixelZ(), Vehicle::group_id, HasPowerOnRail(), Hidden, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, IsValidCargoType(), Vehicle::last_loading_station, Vehicle::last_station_visited, Vehicle::max_age, Vehicle::owner, RailVehicleInfo::railtype, RAILVEH_MULTIHEAD, RAILVEH_WAGON, Random, Vehicle::random_bits, Vehicle::refit_cap, Engine::reliability, Vehicle::reliability, Engine::reliability_spd_dec, Vehicle::reliability_spd_dec, VehicleSpriteSeq::Set(), SetBit(), GroundVehicle< T, Type >::SetEngine(), GroundVehicle< T, Type >::SetFrontEngine(), settings, Vehicle::sprite_cache, MutableSpriteCache::sprite_seq, Vehicle::spritenum, Stopped, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TestVehicleBuildProbability(), Vehicle::tile, TILE_SIZE, TileX(), TileY(), TRACK_BIT_DEPOT, Vehicle::UpdatePosition(), UpdateTrainGroupID(), BaseConsist::vehicle_flags, Vehicle::vehstatus, VF_BUILT_AS_PROTOTYPE, VRF_REVERSE_DIRECTION, Vehicle::x_pos, Vehicle::y_pos, TimerGameCalendar::year, and Vehicle::z_pos.
Referenced by CmdBuildVehicle().
CommandCost CmdForceTrainProceed | ( | DoCommandFlags | 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, Execute, CommandCost::Failed(), SpecializedVehicle< T, Type >::GetIfValid(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, GroundVehicle< T, Type >::IsChainInDepot(), Train::IsPrimaryVehicle(), Vehicle::owner, BaseConsist::ResetDepotUnbunching(), SetWindowDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TFP_NONE, TFP_SIGNAL, TFP_STUCK, VRF_TRAIN_STUCK, and WC_VEHICLE_VIEW.
CommandCost CmdMoveRailVehicle | ( | DoCommandFlags | flags, |
VehicleID | src_veh, | ||
VehicleID | dest_veh, | ||
bool | move_chain | ||
) |
Move a rail vehicle around inside the depot.
flags | type of operation Note: DoCommandFlag::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 - VehicleID::Invalid() to make a new line |
move_chain | move all vehicles following the source vehicle |
Definition at line 1192 of file train_cmd.cpp.
References _current_company, Vehicle::AddToShared(), ArrangeTrains(), AutoReplace, CheckCargoCapacity(), CheckOwnership(), CloseWindowById(), CMD_ERROR, Vehicle::CopyVehicleConfigAndStatistics(), GroupStatistics::CountVehicle(), Crashed, DEFAULT_GROUP, DeleteNewGRFInspectWindow(), DeleteVehicleOrders(), Execute, CommandCost::Failed(), SpecializedVehicle< T, Type >::First(), SpecializedVehicle< T, Type >::GetFirstEnginePart(), SpecializedVehicle< T, Type >::GetIfValid(), SpecializedVehicle< T, Type >::GetLastEnginePart(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, InvalidateWindowClassesData(), InvalidateWindowData(), GroundVehicle< T, Type >::IsEngine(), Vehicle::IsFrontEngine(), GroundVehicle< T, Type >::IsRearDualheaded(), Vehicle::IsStoppedInDepot(), MakeTrainBackup(), BaseConsist::name, NoCargoCapacityCheck, NormaliseSubtypes(), NormaliseTrainHead(), Vehicle::orders, Vehicle::owner, Vehicle::ReleaseUnitNumber(), RestoreTrainBackup(), SetTrainGroupID(), SetWindowDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Vehicle::tile, ValidateTrains(), Vehicle::vehstatus, WC_COMPANY, WC_TRAINS_LIST, WC_VEHICLE_DEPOT, WC_VEHICLE_DETAILS, WC_VEHICLE_ORDERS, WC_VEHICLE_REFIT, WC_VEHICLE_TIMETABLE, and WC_VEHICLE_VIEW.
CommandCost CmdReverseTrainDirection | ( | DoCommandFlags | 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 _settings_game, ArticEngine, Vehicle::breakdown_ctr, EngineInfo::callback_mask, CCF_ARRANGE, CheckOwnership(), CMD_ERROR, Train::ConsistChanged(), Crashed, Vehicle::cur_speed, Vehicle::current_order, Vehicle::engine_type, Execute, CommandCost::Failed(), Vehicle::fill_percent_te_id, SpecializedVehicle< T, Type >::First(), SpecializedVehicle< T, Type >::GetIfValid(), GetStationIndex(), HideFillingPercent(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, GroundVehicle< T, Type >::IsMultiheaded(), Train::IsPrimaryVehicle(), Vehicle::IsStoppedInDepot(), IsTileType(), Order::IsType(), Vehicle::LeaveStation(), MP_STATION, Vehicle::Next(), Vehicle::owner, BaseConsist::ResetDepotUnbunching(), ReverseTrainDirection(), GroundVehicle< T, Type >::SetLastSpeed(), SetWindowClassesDirty(), SetWindowDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TFP_NONE, Vehicle::tile, ToggleBit(), VehicleSettings::train_acceleration_model, GameSettings::vehicle, Vehicle::vehstatus, VRF_REVERSE_DIRECTION, WC_TRAINS_LIST, WC_VEHICLE_DEPOT, WC_VEHICLE_DETAILS, and WC_VEHICLE_VIEW.
CommandCost CmdSellRailWagon | ( | DoCommandFlags | 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 1390 of file train_cmd.cpp.
References CommandCost::AddCost(), Vehicle::AddToShared(), ArrangeTrains(), AutoReplace, OrderBackup::Backup(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_orderlist_pool >::CanAllocateItem(), Vehicle::CopyVehicleConfigAndStatistics(), GroupStatistics::CountVehicle(), DeleteVehicleOrders(), Execute, EXPENSES_NEW_VEHICLES, CommandCost::Failed(), SpecializedVehicle< T, Type >::First(), SpecializedVehicle< T, Type >::From(), SpecializedVehicle< T, Type >::GetFirstEnginePart(), InvalidateWindowClassesData(), InvalidateWindowData(), GroundVehicle< T, Type >::IsEngine(), Vehicle::IsFrontEngine(), Train::IsPrimaryVehicle(), GroundVehicle< T, Type >::IsRearDualheaded(), MakeTrainBackup(), SpecializedVehicle< T, Type >::Next(), NormaliseSubtypes(), NormaliseTrainHead(), Vehicle::orders, RestoreTrainBackup(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Vehicle::tile, ValidateTrains(), WC_TRAINS_LIST, and WC_VEHICLE_DEPOT.
Referenced by CmdSellVehicle().