OpenTTD Source 20250312-master-gcdcc6b491d
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 (DoCommandFlags flags, EngineID engine_id)
 Accept an engine prototype.
 
CommandCost CmdEngineCtrl (DoCommandFlags flags, EngineID engine_id, CompanyID company_id, bool allow)
 Allow or forbid a specific company to use an engine.
 
CommandCost CmdRenameEngine (DoCommandFlags flags, EngineID engine_id, const std::string &text)
 Rename an engine.
 
CommandCost CmdSetVehicleVisibility (DoCommandFlags flags, EngineID engine_id, bool hide)
 Set the visibility of an engine.
 

Detailed Description

Command definitions related to engines.

Definition in file engine_cmd.h.

Function Documentation

◆ CmdEngineCtrl()

CommandCost CmdEngineCtrl ( DoCommandFlags  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 1058 of file engine.cpp.

References _current_company, CMD_ERROR, DisableEngineForCompany(), EnableEngineForCompany(), Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID(), OWNER_DEITY, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

◆ CmdRenameEngine()

CommandCost CmdRenameEngine ( DoCommandFlags  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 1221 of file engine.cpp.

References CMD_ERROR, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::GetIfValid(), IsUniqueEngineName(), MarkWholeScreenDirty(), MAX_LENGTH_ENGINE_NAME_CHARS, Engine::name, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and Utf8StringLength().

◆ CmdSetVehicleVisibility()

◆ CmdWantEnginePreview()

CommandCost CmdWantEnginePreview ( DoCommandFlags  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 1040 of file engine.cpp.

References _current_company, AcceptEnginePreview(), CMD_ERROR, ExclusivePreview, Execute, Engine::flags, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::GetIfValid(), Engine::preview_company, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().