OpenTTD Source 20241224-master-gf74b0cf984
|
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. | |
CommandCost | CmdSetAutoReplace (DoCommandFlag flags, GroupID id_g, EngineID old_engine_type, EngineID new_engine_type, bool when_old) |
Change engine renewal parameters. | |
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, AddEngineReplacementForCompany(), CheckAutoreplaceValidity(), CMD_ERROR, DC_EXEC, 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<&_engine_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), GetWindowClassForVehicleType(), INVALID_ENGINE, InvalidateAutoreplaceWindow(), IsAllGroupID(), IsLocalCompany(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::IsValidID(), RemoveEngineReplacementForCompany(), SetWindowDirty(), GroupStatistics::UpdateAutoreplace(), and WC_REPLACE_VEHICLE.