* Change additional industry text. * @param flags Type of operation. * @param ind_id IndustryID * @param text - Additional industry text. * @return Empty cost or an error. */
| 2260 | * @return Empty cost or an error. |
| 2261 | */ |
| 2262 | CommandCost 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. |
nothing calls this directly
no test coverage detected