OpenTTD Source  20241121-master-g67a0fccfad
autoreplace_cmd.h File Reference

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...
 

Detailed Description

Command definitions related to autoreplace.

Definition in file autoreplace_cmd.h.

Function Documentation

◆ CmdAutoreplaceVehicle()

CommandCost CmdAutoreplaceVehicle ( DoCommandFlag  flags,
VehicleID  veh_id 
)

◆ CmdSetAutoReplace()

CommandCost CmdSetAutoReplace ( DoCommandFlag  flags,
GroupID  id_g,
EngineID  old_engine_type,
EngineID  new_engine_type,
bool  when_old 
)

Change engine renewal parameters.

Parameters
flagsoperation to perform
id_gengine group
old_engine_typeold engine type
new_engine_typenew engine type
when_oldreplace when engine gets old?
Returns
the cost of this operation or an error

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().