MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / CmdWantEnginePreview

Function CmdWantEnginePreview

src/engine.cpp:1039–1047  ·  view source on GitHub ↗

* 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 * @param flags operation to perform * @param engine_id engine-prototype offered * @return the cost of this operation or an error */

Source from the content-addressed store, hash-verified

1037 * @return the cost of this operation or an error
1038 */
1039CommandCost CmdWantEnginePreview(DoCommandFlags flags, EngineID engine_id)
1040{
1041 Engine *e = Engine::GetIfValid(engine_id);
1042 if (e == nullptr || !e->flags.Test(EngineFlag::ExclusivePreview) || e->preview_company != _current_company) return CMD_ERROR;
1043
1044 if (flags.Test(DoCommandFlag::Execute)) AcceptEnginePreview(engine_id, _current_company);
1045
1046 return CommandCost();
1047}
1048
1049/**
1050 * Allow or forbid a specific company to use an engine

Callers

nothing calls this directly

Calls 3

AcceptEnginePreviewFunction · 0.85
CommandCostClass · 0.85
TestMethod · 0.80

Tested by

no test coverage detected