OpenTTD Source  20241108-master-g80f628063a
engine_cmd.h File Reference

Command definitions related to engines. More...

#include "command_type.h"

Go to the source code of this file.

Functions

CommandCost CmdWantEnginePreview (DoCommandFlag flags, EngineID engine_id)
 Accept an engine prototype. More...
 
CommandCost CmdEngineCtrl (DoCommandFlag flags, EngineID engine_id, CompanyID company_id, bool allow)
 Allow or forbid a specific company to use an engine. More...
 
CommandCost CmdRenameEngine (DoCommandFlag flags, EngineID engine_id, const std::string &text)
 Rename an engine. More...
 
CommandCost CmdSetVehicleVisibility (DoCommandFlag flags, EngineID engine_id, bool hide)
 Set the visibility of an engine. More...
 

Detailed Description

Command definitions related to engines.

Definition in file engine_cmd.h.

Function Documentation

◆ CmdEngineCtrl()

CommandCost CmdEngineCtrl ( DoCommandFlag  flags,
EngineID  engine_id,
CompanyID  company_id,
bool  allow 
)

Allow or forbid a specific company to use an engine.

Parameters
flagsoperation to perform
engine_idengine id
company_idCompany to allow/forbid the use of an engine.
allowfalse to forbid, true to allow.
Returns
the cost of this operation or an error

Definition at line 1022 of file engine.cpp.

References _current_company, CMD_ERROR, DC_EXEC, DisableEngineForCompany(), EnableEngineForCompany(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::IsValidID(), and OWNER_DEITY.

◆ CmdRenameEngine()

CommandCost CmdRenameEngine ( DoCommandFlag  flags,
EngineID  engine_id,
const std::string &  text 
)

Rename an engine.

Parameters
flagsoperation to perform
engine_idengine ID to rename
textthe new name or an empty string when resetting to the default
Returns
the cost of this operation or an error

Definition at line 1184 of file engine.cpp.

References CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::GetIfValid(), IsUniqueEngineName(), MarkWholeScreenDirty(), MAX_LENGTH_ENGINE_NAME_CHARS, Engine::name, return_cmd_error, and Utf8StringLength().

◆ CmdSetVehicleVisibility()

CommandCost CmdSetVehicleVisibility ( DoCommandFlag  flags,
EngineID  engine_id,
bool  hide 
)

◆ CmdWantEnginePreview()

CommandCost CmdWantEnginePreview ( DoCommandFlag  flags,
EngineID  engine_id 
)

Accept an engine prototype.

XXX - it is possible that the top-company changes while you are waiting to accept the offer? Then it becomes invalid

Parameters
flagsoperation to perform
engine_idengine-prototype offered
Returns
the cost of this operation or an error

Definition at line 1004 of file engine.cpp.

References _current_company, AcceptEnginePreview(), CMD_ERROR, DC_EXEC, ENGINE_EXCLUSIVE_PREVIEW, Engine::flags, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::GetIfValid(), and Engine::preview_company.