OpenTTD Source
1.11.0-beta2
|
#include "stdafx.h"
#include "roadveh.h"
#include "news_func.h"
#include "airport.h"
#include "cmd_helper.h"
#include "command_func.h"
#include "company_func.h"
#include "train.h"
#include "aircraft.h"
#include "newgrf_text.h"
#include "vehicle_func.h"
#include "string_func.h"
#include "depot_map.h"
#include "vehiclelist.h"
#include "engine_func.h"
#include "articulated_vehicles.h"
#include "autoreplace_gui.h"
#include "group.h"
#include "order_backup.h"
#include "ship.h"
#include "newgrf.h"
#include "company_base.h"
#include "core/random_func.hpp"
#include <sstream>
#include <iomanip>
#include "table/strings.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | RefitResult |
Helper structure for RefitVehicle() More... | |
Functions | |
CommandCost | CmdBuildRailVehicle (TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **v) |
Build a railroad vehicle. More... | |
CommandCost | CmdBuildRoadVehicle (TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **v) |
Build a road vehicle. More... | |
CommandCost | CmdBuildShip (TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **v) |
Build a ship. More... | |
CommandCost | CmdBuildAircraft (TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **v) |
Build an aircraft. More... | |
CommandCost | CmdRefitVehicle (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Refits a vehicle to the specified cargo type. More... | |
CommandCost | CmdBuildVehicle (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Build a vehicle. More... | |
CommandCost | CmdSellRailWagon (DoCommandFlag flags, Vehicle *v, uint16 data, uint32 user) |
Sell a (single) train wagon/engine. More... | |
CommandCost | CmdSellVehicle (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Sell a vehicle. More... | |
static int | GetRefitCostFactor (const Vehicle *v, EngineID engine_type, CargoID new_cid, byte new_subtype, bool *auto_refit_allowed) |
Helper to run the refit cost callback. More... | |
static CommandCost | GetRefitCost (const Vehicle *v, EngineID engine_type, CargoID new_cid, byte new_subtype, bool *auto_refit_allowed) |
Learn the price of refitting a certain engine. More... | |
static CommandCost | RefitVehicle (Vehicle *v, bool only_this, uint8 num_vehicles, CargoID new_cid, byte new_subtype, DoCommandFlag flags, bool auto_refit) |
Refits a vehicle (chain). More... | |
CommandCost | CmdStartStopVehicle (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Start/Stop a vehicle. More... | |
CommandCost | CmdMassStartStopVehicle (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Starts or stops a lot of vehicles. More... | |
CommandCost | CmdDepotSellAllVehicles (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Sells all vehicles in a depot. More... | |
CommandCost | CmdDepotMassAutoReplace (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Autoreplace all vehicles in the depot. More... | |
static bool | IsUniqueVehicleName (const char *name) |
Test if a name is unique among vehicle names. More... | |
static void | CloneVehicleName (const Vehicle *src, Vehicle *dst) |
Clone the custom name of a vehicle, adding or incrementing a number. More... | |
CommandCost | CmdCloneVehicle (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Clone a vehicle. More... | |
static CommandCost | SendAllVehiclesToDepot (DoCommandFlag flags, bool service, const VehicleListIdentifier &vli) |
Send all vehicles of type to depots. More... | |
CommandCost | CmdSendVehicleToDepot (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Send a vehicle to the depot. More... | |
CommandCost | CmdRenameVehicle (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Give a custom name to your vehicle. More... | |
CommandCost | CmdChangeServiceInt (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Change the service interval of a vehicle. More... | |
Variables | |
const uint32 | _veh_build_proc_table [] |
const uint32 | _veh_sell_proc_table [] |
const uint32 | _veh_refit_proc_table [] |
const uint32 | _send_to_depot_proc_table [] |
Commands for vehicles.
Definition in file vehicle_cmd.cpp.
Clone the custom name of a vehicle, adding or incrementing a number.
src | Source vehicle, with a custom name. |
dst | Destination vehicle. |
Definition at line 765 of file vehicle_cmd.cpp.
References BaseConsist::name.
CommandCost CmdBuildAircraft | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
const Engine * | e, | ||
uint16 | data, | ||
Vehicle ** | ret | ||
) |
Build an aircraft.
tile | tile of the depot where aircraft is built. | |
flags | type of operation. | |
e | the engine to build. | |
data | unused. | |
[out] | ret | the vehicle that has been built. |
Definition at line 268 of file aircraft_cmd.cpp.
References _current_company, Station::airport, CanVehicleUseStation(), CMD_ERROR, DC_EXEC, DIR_SE, Vehicle::direction, SpecializedStation< Station, false >::GetByTile(), Airport::GetHangarNum(), Airport::GetHangarTile(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Vehicle::owner, and Vehicle::tile.
CommandCost CmdBuildRailVehicle | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
const Engine * | e, | ||
uint16 | data, | ||
Vehicle ** | ret | ||
) |
Build a railroad vehicle.
tile | tile of the depot where rail-vehicle is built. | |
flags | type of operation. | |
e | the engine to build. | |
data | bit 0 prevents any free cars from being added to the train. | |
[out] | ret | the vehicle that has been built. |
Definition at line 715 of file train_cmd.cpp.
References CMD_ERROR, CmdBuildRailWagon(), DC_EXEC, GetRailDepotDirection(), GetRailType(), HasPowerOnRail(), RAILVEH_WAGON, and Vehicle::tile.
CommandCost CmdBuildRoadVehicle | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
const Engine * | e, | ||
uint16 | data, | ||
Vehicle ** | ret | ||
) |
Build a road vehicle.
tile | tile of the depot where road vehicle is built. | |
flags | type of operation. | |
e | the engine to build. | |
data | unused. | |
[out] | ret | the vehicle that has been built. |
Definition at line 259 of file roadveh_cmd.cpp.
References _current_company, DC_EXEC, DiagDirToDir(), Vehicle::direction, GetRoadDepotDirection(), GetRoadTypeInfo(), HasTileAnyRoadType(), Vehicle::owner, RoadTypeInfo::powered_roadtypes, return_cmd_error, RoadVehicleInfo::roadtype, and Vehicle::tile.
CommandCost CmdBuildShip | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
const Engine * | e, | ||
uint16 | data, | ||
Vehicle ** | ret | ||
) |
Build a ship.
tile | tile of the depot where ship is built. | |
flags | type of operation. | |
e | the engine to build. | |
data | unused. | |
[out] | ret | the vehicle that has been built. |
Definition at line 827 of file ship_cmd.cpp.
References DC_EXEC, and GetShipDepotNorthTile().
CommandCost CmdBuildVehicle | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Build a vehicle.
tile | tile of depot where the vehicle is built |
flags | for command |
p1 | various bitstuffed data bits 0-15: vehicle type being built. bits 16-23: vehicle type specific bits passed on to the vehicle build functions. bits 24-31: refit cargo type. |
p2 | User |
text | unused |
Definition at line 89 of file vehicle_cmd.cpp.
References _current_company, AIR_CTOL, CMD_ERROR, CountArticulatedParts(), CT_INVALID, EXPENSES_NEW_VEHICLES, GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), Engine::GetCost(), Engine::GetDefaultCargoType(), GetDepotVehicleType(), IsDepotTile(), IsEngineBuildable(), IsTileOwner(), NUM_CARGO, RAILVEH_MULTIHEAD, return_cmd_error, AircraftVehicleInfo::subtype, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
CommandCost CmdChangeServiceInt | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Change the service interval of a vehicle.
tile | unused |
flags | type of operation |
p1 | vehicle ID that is being service-interval-changed |
p2 | bitmask
|
text | unused |
Definition at line 1113 of file vehicle_cmd.cpp.
References CheckOwnership(), CMD_ERROR, CompanyServiceInterval(), DC_EXEC, CommandCost::Failed(), GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), GetServiceIntervalClamped(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Vehicle::IsPrimaryVehicle(), Vehicle::owner, VehicleDefaultSettings::servint_ispercent, Company::settings, SetWindowDirty(), BaseVehicle::type, CompanySettings::vehicle, and WC_VEHICLE_DETAILS.
CommandCost CmdCloneVehicle | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Clone a vehicle.
If it is a train, it will clone all the cars too
tile | tile of the depot where the cloned vehicle is build |
flags | type of operation |
p1 | the original vehicle's index |
p2 | 1 = shared orders, else copied orders |
text | unused |
Definition at line 825 of file vehicle_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::CanAllocateItem(), CheckOwnership(), CMD_ERROR, Train::crash_anim_pos, CT_INVALID, DC_AUTOREPLACE, DC_EXEC, DoCommand(), Vehicle::engine_type, EXPENSES_NEW_VEHICLES, CommandCost::Failed(), SpecializedVehicle< Train, Type >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), Vehicle::IsFrontEngine(), Vehicle::IsPrimaryVehicle(), GroundVehicle< T, Type >::IsRearDualheaded(), Vehicle::Next(), Vehicle::owner, return_cmd_error, BaseVehicle::type, and VEH_TRAIN.
CommandCost CmdDepotMassAutoReplace | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Autoreplace all vehicles in the depot.
tile | Tile of the depot where the vehicles are |
flags | type of operation |
p1 | Type of vehicle |
p2 | unused |
text | unused |
Definition at line 721 of file vehicle_cmd.cpp.
References _current_company, CommandCost::AddCost(), BuildDepotVehicleList(), CMD_AUTOREPLACE_VEHICLE, CMD_ERROR, DoCommand(), EXPENSES_NEW_VEHICLES, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Vehicle::IsChainInDepot(), IsCompanyBuildableVehicleType(), IsDepotTile(), IsTileOwner(), and CommandCost::Succeeded().
CommandCost CmdDepotSellAllVehicles | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Sells all vehicles in a depot.
tile | Tile of the depot where the depot is |
flags | type of operation |
p1 | Vehicle type |
p2 | unused |
text | unused |
Definition at line 683 of file vehicle_cmd.cpp.
References CMD_ERROR, EXPENSES_NEW_VEHICLES, and IsCompanyBuildableVehicleType().
CommandCost CmdMassStartStopVehicle | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Starts or stops a lot of vehicles.
tile | Tile of the depot where the vehicles are started/stopped (only used for depots) |
flags | type of operation |
p1 | bitmask
|
p2 | packed VehicleListIdentifier |
text | unused |
Definition at line 643 of file vehicle_cmd.cpp.
References BuildDepotVehicleList(), CMD_ERROR, CMD_START_STOP_VEHICLE, do_start, DoCommand(), GenerateVehicleSortList(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Vehicle::IsChainInDepot(), IsCompanyBuildableVehicleType(), VehicleListIdentifier::UnpackIfValid(), Vehicle::vehstatus, VS_STOPPED, and VehicleListIdentifier::vtype.
CommandCost CmdRefitVehicle | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Refits a vehicle to the specified cargo type.
tile | unused |
flags | type of operation |
p1 | vehicle ID to refit |
p2 | various bitstuffed elements
|
text | unused |
Definition at line 471 of file vehicle_cmd.cpp.
References CheckOwnership(), CMD_ERROR, Vehicle::current_order, DC_QUERY_COST, CommandCost::Failed(), Vehicle::First(), SpecializedVehicle< Train, Type >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), HasBit(), IsCompanyBuildableVehicleType(), GroundVehicle< T, Type >::IsFreeWagon(), Order::IsType(), Vehicle::owner, BaseVehicle::type, VEH_AIRCRAFT, VEH_SHIP, and VEH_TRAIN.
CommandCost CmdRenameVehicle | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Give a custom name to your vehicle.
tile | unused |
flags | type of operation |
p1 | vehicle ID to name |
p2 | unused |
text | the new name or an empty string when resetting to the default |
Definition at line 1072 of file vehicle_cmd.cpp.
References CheckOwnership(), CMD_ERROR, DC_AUTOREPLACE, DC_EXEC, CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), GetWindowClassForVehicleType(), InvalidateWindowClassesData(), Vehicle::IsPrimaryVehicle(), IsUniqueVehicleName(), MarkWholeScreenDirty(), MAX_LENGTH_VEHICLE_NAME_CHARS, BaseConsist::name, Vehicle::owner, return_cmd_error, StrEmpty(), BaseVehicle::type, and Utf8StringLength().
CommandCost CmdSellRailWagon | ( | DoCommandFlag | flags, |
Vehicle * | t, | ||
uint16 | data, | ||
uint32 | user | ||
) |
Sell a (single) train wagon/engine.
flags | type of operation |
t | the train wagon to sell |
data | the selling mode
|
user | the user for the order backup. |
Definition at line 1357 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(), Vehicle::first, SpecializedVehicle< T, Type >::First(), SpecializedVehicle< Train, Type >::From(), SpecializedVehicle< T, Type >::GetFirstEnginePart(), HasBit(), InvalidateWindowClassesData(), InvalidateWindowData(), GroundVehicle< T, Type >::IsEngine(), Vehicle::IsFrontEngine(), Train::IsPrimaryVehicle(), GroundVehicle< T, Type >::IsRearDualheaded(), Vehicle::list, MAKE_ORDER_BACKUP_FLAG, MakeTrainBackup(), Vehicle::Next(), NormaliseSubtypes(), NormaliseTrainHead(), Vehicle::orders, RestoreTrainBackup(), return_cmd_error, Vehicle::tile, ValidateTrains(), Vehicle::value, WC_TRAINS_LIST, and WC_VEHICLE_DEPOT.
Referenced by CmdSellVehicle().
CommandCost CmdSellVehicle | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Sell a vehicle.
tile | unused. |
flags | for command. |
p1 | various bitstuffed data. bits 0-19: vehicle ID being sold. bits 20-30: vehicle type specific bits passed on to the vehicle build functions. bit 31: make a backup of the vehicle's order (if an engine). |
p2 | User. |
text | unused. |
Definition at line 209 of file vehicle_cmd.cpp.
References OrderBackup::Backup(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_order_pool >::CanAllocateItem(), CheckOwnership(), CMD_ERROR, CmdSellRailWagon(), DC_EXEC, EXPENSES_NEW_VEHICLES, CommandCost::Failed(), Vehicle::First(), GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), OrderList::GetNumOrders(), Vehicle::IsPrimaryVehicle(), OrderList::IsShared(), Vehicle::IsStoppedInDepot(), Vehicle::list, MAKE_ORDER_BACKUP_FLAG, Vehicle::orders, Vehicle::owner, return_cmd_error, BaseVehicle::type, Vehicle::value, VEH_TRAIN, Vehicle::vehstatus, and VS_CRASHED.
CommandCost CmdSendVehicleToDepot | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Send a vehicle to the depot.
tile | unused |
flags | for command type |
p1 | bitmask
|
p2 | packed VehicleListIdentifier. |
text | unused |
Definition at line 1047 of file vehicle_cmd.cpp.
References CMD_ERROR, DEPOT_MASS_SEND, DEPOT_SERVICE, GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), Vehicle::IsPrimaryVehicle(), SendAllVehiclesToDepot(), Vehicle::SendToDepot(), and VehicleListIdentifier::UnpackIfValid().
CommandCost CmdStartStopVehicle | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Start/Stop a vehicle.
tile | unused |
flags | type of operation |
p1 | vehicle to start/stop, don't forget to change CcStartStopVehicle if you modify this! |
p2 | bit 0: Shall the start/stop newgrf callback be evaluated (only valid with DC_AUTOREPLACE for network safety) |
text | unused |
Definition at line 559 of file vehicle_cmd.cpp.
References GroundVehicleCache::cached_power, CALLBACK_FAILED, CBID_VEHICLE_START_STOP_CHECK, CheckOwnership(), CMD_ERROR, Vehicle::cur_speed, DC_AUTOREPLACE, DC_EXEC, DeleteVehicleNews(), Vehicle::engine_type, error(), CommandCost::Failed(), Aircraft::flags, SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::From(), SpecializedVehicle< Train, Type >::From(), GB(), GroundVehicle< T, Type >::gcache, Vehicle::GetGRF(), Vehicle::GetGRFID(), GetGRFStringID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), GetVehicleCallback(), GetWindowClassForVehicleType(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, InvalidateWindowData(), Vehicle::IsPrimaryVehicle(), Vehicle::IsStoppedInDepot(), Vehicle::MarkDirty(), Vehicle::owner, return_cmd_error, SetBit(), SetWindowClassesDirty(), SetWindowDirty(), SetWindowWidgetDirty(), STARTTAKEOFF, Aircraft::state, TERM7, Vehicle::tile, BaseVehicle::type, VAF_HELI_DIRECT_DESCENT, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, Vehicle::vehstatus, VS_CRASHED, VS_STOPPED, WC_VEHICLE_DEPOT, WC_VEHICLE_VIEW, and WID_VV_START_STOP.
|
static |
Learn the price of refitting a certain engine.
v | The vehicle we are refitting, can be nullptr. | |
engine_type | Which engine to refit | |
new_cid | Cargo type we are refitting to. | |
new_subtype | New cargo subtype. | |
[out] | auto_refit_allowed | The refit is allowed as an auto-refit. |
Definition at line 288 of file vehicle_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), GetRefitCostFactor(), Engine::type, and VEH_SHIP.
|
static |
Helper to run the refit cost callback.
v | The vehicle we are refitting, can be nullptr. | |
engine_type | Which engine to refit | |
new_cid | Cargo type we are refitting to. | |
new_subtype | New cargo subtype. | |
[out] | auto_refit_allowed | The refit is allowed as an auto-refit. |
Definition at line 256 of file vehicle_cmd.cpp.
References CALLBACK_FAILED, GRFFile::cargo_map, Vehicle::cargo_type, CBID_VEHICLE_REFIT_COST, CargoSpec::classes, GB(), CargoSpec::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), Engine::GetGRF(), GetVehicleCallback(), and HasBit().
Referenced by GetRefitCost().
|
static |
Test if a name is unique among vehicle names.
name | Name to test. |
Definition at line 751 of file vehicle_cmd.cpp.
Referenced by CmdRenameVehicle().
|
static |
Refits a vehicle (chain).
This is the vehicle-type independent part of the CmdRefitXXX functions.
v | The vehicle to refit. |
only_this | Whether to only refit this vehicle, or to check the rest of them. |
num_vehicles | Number of vehicles to refit (not counting articulated parts). Zero means the whole chain. |
new_cid | Cargotype to refit to |
new_subtype | Cargo subtype to refit to. 0xFF means to try keeping the same subtype according to GetBestFittingSubType(). |
flags | Command flags |
auto_refit | Refitting is done as automatic refitting outside a depot. |
Definition at line 345 of file vehicle_cmd.cpp.
References Vehicle::GetExpenseType().
|
static |
Send all vehicles of type to depots.
flags | the flags used for DoCommand() |
service | should the vehicles only get service in the depots |
vli | identifier of the vehicle list |
Definition at line 1010 of file vehicle_cmd.cpp.
References CMD_ERROR, DEPOT_DONT_CANCEL, DEPOT_SERVICE, DoCommand(), GenerateVehicleSortList(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, and Vehicle::tile.
Referenced by CmdSendVehicleToDepot().
const uint32 _send_to_depot_proc_table[] |
Definition at line 62 of file vehicle_cmd.cpp.
const uint32 _veh_build_proc_table[] |
Definition at line 41 of file vehicle_cmd.cpp.
const uint32 _veh_refit_proc_table[] |
Definition at line 55 of file vehicle_cmd.cpp.
const uint32 _veh_sell_proc_table[] |
Definition at line 48 of file vehicle_cmd.cpp.