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

Function CmdIndustrySetText

src/industry_cmd.cpp:2262–2276  ·  view source on GitHub ↗

* Change additional industry text. * @param flags Type of operation. * @param ind_id IndustryID * @param text - Additional industry text. * @return Empty cost or an error. */

Source from the content-addressed store, hash-verified

2260 * @return Empty cost or an error.
2261 */
2262CommandCost CmdIndustrySetText(DoCommandFlags flags, IndustryID ind_id, const EncodedString &text)
2263{
2264 if (_current_company != OWNER_DEITY) return CMD_ERROR;
2265
2266 Industry *ind = Industry::GetIfValid(ind_id);
2267 if (ind == nullptr) return CMD_ERROR;
2268
2269 if (flags.Test(DoCommandFlag::Execute)) {
2270 ind->text.clear();
2271 if (!text.empty()) ind->text = text;
2272 InvalidateWindowData(WC_INDUSTRY_VIEW, ind->index);
2273 }
2274
2275 return CommandCost();
2276}
2277
2278/**
2279 * Create a new industry of random layout.

Callers

nothing calls this directly

Calls 5

CommandCostClass · 0.85
TestMethod · 0.80
InvalidateWindowDataFunction · 0.70
clearMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected