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

Function CmdIndustrySetFlags

src/industry_cmd.cpp:2156–2167  ·  view source on GitHub ↗

* Set industry control flags. * @param flags Type of operation. * @param ind_id IndustryID * @param ctlflags IndustryControlFlags * @return Empty cost or an error. */

Source from the content-addressed store, hash-verified

2154 * @return Empty cost or an error.
2155 */
2156CommandCost CmdIndustrySetFlags(DoCommandFlags flags, IndustryID ind_id, IndustryControlFlags ctlflags)
2157{
2158 if (_current_company != OWNER_DEITY) return CMD_ERROR;
2159
2160 Industry *ind = Industry::GetIfValid(ind_id);
2161 if (ind == nullptr) return CMD_ERROR;
2162 if (!ctlflags.IsValid()) return CMD_ERROR;
2163
2164 if (flags.Test(DoCommandFlag::Execute)) ind->ctlflags = ctlflags;
2165
2166 return CommandCost();
2167}
2168
2169/**
2170 * Set industry production.

Callers

nothing calls this directly

Calls 3

CommandCostClass · 0.85
TestMethod · 0.80
IsValidMethod · 0.45

Tested by

no test coverage detected