OpenTTD Source
20241121-master-g67a0fccfad
|
Command definitions related to autoreplace. More...
#include "command_type.h"
#include "vehicle_type.h"
#include "engine_type.h"
#include "group_type.h"
Go to the source code of this file.
Functions | |
CommandCost | CmdAutoreplaceVehicle (DoCommandFlag flags, VehicleID veh_id) |
Autoreplaces a vehicle Trains are replaced as a whole chain, free wagons in depot are replaced on their own. More... | |
CommandCost | CmdSetAutoReplace (DoCommandFlag flags, GroupID id_g, EngineID old_engine_type, EngineID new_engine_type, bool when_old) |
Change engine renewal parameters. More... | |
Command definitions related to autoreplace.
Definition in file autoreplace_cmd.h.
CommandCost CmdAutoreplaceVehicle | ( | DoCommandFlag | flags, |
VehicleID | veh_id | ||
) |
Autoreplaces a vehicle Trains are replaced as a whole chain, free wagons in depot are replaced on their own.
flags | type of operation |
veh_id | Index of vehicle |
Definition at line 732 of file autoreplace_cmd.cpp.
References _current_company, CommandCost::AddCost(), CheckOwnership(), CMD_ERROR, DC_EXEC, DoCmdStartStopVehicle(), EXPENSES_NEW_VEHICLES, CommandCost::Failed(), SpecializedVehicle< T, Type >::First(), Group::flags, SpecializedVehicle< T, Type >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), CommandCost::GetCost(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), GetNewEngineType(), GF_REPLACE_WAGON_REMOVAL, Vehicle::group_id, HasBit(), INVALID_ENGINE, Vehicle::IsArticulatedPart(), Vehicle::IsChainInDepot(), Vehicle::IsFrontEngine(), Vehicle::IsPrimaryVehicle(), GroundVehicle< T, Type >::IsRearDualheaded(), Vehicle::IsStoppedInDepot(), Vehicle::owner, CompanySettings::renew_keep_length, ReplaceChain(), ReplaceFreeUnit(), RestoreRandomSeeds(), SaveRandomSeeds(), CompanyProperties::settings, CommandCost::Succeeded(), BaseVehicle::type, VEH_TRAIN, Vehicle::vehstatus, VS_CRASHED, and VS_STOPPED.
CommandCost CmdSetAutoReplace | ( | DoCommandFlag | flags, |
GroupID | id_g, | ||
EngineID | old_engine_type, | ||
EngineID | new_engine_type, | ||
bool | when_old | ||
) |
Change engine renewal parameters.
flags | operation to perform |
id_g | engine group |
old_engine_type | old engine type |
new_engine_type | new engine type |
when_old | replace when engine gets old? |
Definition at line 820 of file autoreplace_cmd.cpp.
References _current_company, CMD_ERROR, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), IsAllGroupID(), and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::IsValidID().