OpenTTD Source: src/roadveh_cmd.h File Reference

OpenTTD Source 15.0-beta1

Functions
roadveh_cmd.h File Reference

Command definitions related to road vehicles. More...

`#include "command_type.h"`
`#include "engine_type.h"`
`#include "vehicle_type.h"`

Go to the source code of this file.

## Functions
bool | RoadVehLeaveDepot (RoadVehicle *v, bool first)
bool | IndividualRoadVehicleController (RoadVehicle *v, const RoadVehicle *prev)
bool | RoadVehiclesAreBuilt ()
| Verify whether a road vehicle is available.
CommandCost | CmdBuildRoadVehicle (DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **v)
| Build a road vehicle.
CommandCost | CmdTurnRoadVeh (DoCommandFlag flags, VehicleID veh_id)
| Turn a roadvehicle around.

## Detailed Description

Command definitions related to road vehicles.

Definition in file roadveh_cmd.h.

## Function Documentation

## ◆ CmdBuildRoadVehicle()

CommandCost CmdBuildRoadVehicle | ( | DoCommandFlag | flags,
|  | TileIndex | tile,
|  | const Engine * | e,
|  | Vehicle ** | ret
| ) |  |

Build a road vehicle.

Parameters

  | flags | type of operation.
  | tile | tile of the depot where road vehicle is built.
  | e | the engine to build.
  [out] | ret | the vehicle that has been built.

Returns
  the cost of this operation or an error.

Definition at line 261 of file roadveh_cmd.cpp.

References _current_company, _settings_game, AddArticulatedParts(), Vehicle::build_year, GroundVehicleCache::cached_veh_length, Vehicle::cargo_cap, Vehicle::cargo_type, GroundVehicle< T, Type >::CargoChanged(), CheckConsistencyOfArticulatedVehicle(), RoadVehicle::compatible_roadtypes, TimerGameCalendar::date, TimerGameEconomy::date, Vehicle::date_of_last_service, Vehicle::date_of_last_service_newgrf, DC_EXEC, DiagDirToDir(), Vehicle::direction, ENGINE_EXCLUSIVE_PREVIEW, Vehicle::engine_type, GroundVehicleCache::first_engine, Engine::flags, GroundVehicle< T, Type >::gcache, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Engine::GetDefaultCargoType(), Engine::GetLifeLengthInDays(), GetRoadDepotDirection(), GetRoadTypeInfo(), GetSlopePixelZ(), HasTileAnyRoadType(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_ENGINE, Vehicle::InvalidateNewGRFCache(), Vehicle::InvalidateNewGRFCacheOfChain(), IsValidCargoID(), Vehicle::last_loading_station, Vehicle::last_station_visited, Vehicle::max_age, SpecializedVehicle< T, Type >::Next(), Vehicle::owner, RoadTypeInfo::powered_roadtypes, Vehicle::random_bits, Vehicle::refit_cap, Engine::reliability, Vehicle::reliability, Engine::reliability_spd_dec, Vehicle::reliability_spd_dec, RoadVehicleInfo::roadtype, RoadVehicle::roadtype, VehicleSettings::roadveh_acceleration_model, RoadVehUpdateCache(), RVSB_IN_DEPOT, VehicleSpriteSeq::Set(), SetBit(), GroundVehicle< T, Type >::SetFrontEngine(), settings, Vehicle::sprite_cache, MutableSpriteCache::sprite_seq, Vehicle::spritenum, RoadVehicle::state, Vehicle::tile, TILE_SIZE, TileX(), TileY(), Vehicle::UpdatePosition(), GameSettings::vehicle, BaseConsist::vehicle_flags, VEHICLE_LENGTH, Vehicle::vehstatus, VF_BUILT_AS_PROTOTYPE, VS_DEFPAL, VS_HIDDEN, VS_STOPPED, Vehicle::x_pos, Vehicle::y_pos, TimerGameCalendar::year, and Vehicle::z_pos.

Referenced by CmdBuildVehicle().

## ◆ CmdTurnRoadVeh()

CommandCost CmdTurnRoadVeh | ( | DoCommandFlag | flags,
|  | VehicleID | veh_id
| ) |  |

Turn a roadvehicle around.

Parameters

  flags | operation to perform
  veh_id | vehicle ID to turn

Returns
  the cost of this operation or an error

Definition at line 361 of file roadveh_cmd.cpp.

References Vehicle::breakdown_ctr, CheckOwnership(), CMD_ERROR, Vehicle::current_order, DC_EXEC, Vehicle::direction, DirToDiagDir(), DRD_NONE, CommandCost::Failed(), GetDisallowedRoadDirections(), SpecializedVehicle< T, Type >::GetIfValid(), GetTunnelBridgeDirection(), RoadVehicle::IsInDepot(), IsNormalRoadTile(), RoadVehicle::IsPrimaryVehicle(), IsTileType(), Order::IsType(), MP_TUNNELBRIDGE, RoadVehicle::overtaking, Vehicle::owner, BaseConsist::ResetDepotUnbunching(), RVSB_WORMHOLE, RoadVehicle::state, Vehicle::tile, Vehicle::vehstatus, VS_CRASHED, and VS_STOPPED.

## ◆ IndividualRoadVehicleController()

bool IndividualRoadVehicleController | ( | RoadVehicle * | v,
|  | const RoadVehicle * | prev
| ) |  |

Definition at line 1135 of file roadveh_cmd.cpp.

## ◆ RoadVehiclesAreBuilt()

bool RoadVehiclesAreBuilt | ( |  | ) |

Verify whether a road vehicle is available.

Returns
  `true` if at least one road vehicle is available, `false` if not

Definition at line 179 of file road_cmd.cpp.

References SpecializedVehicle< T, Type >::Iterate().

Referenced by CheckRoadSide().

## ◆ RoadVehLeaveDepot()

bool RoadVehLeaveDepot | ( | RoadVehicle * | v,
|  | bool | first
| ) |  |

Definition at line 1002 of file roadveh_cmd.cpp.