| 487 | } |
| 488 | |
| 489 | static CommandCost ClearTile_Industry(TileIndex tile, DoCommandFlags flags) |
| 490 | { |
| 491 | Industry *i = Industry::GetByTile(tile); |
| 492 | const IndustrySpec *indspec = GetIndustrySpec(i->type); |
| 493 | |
| 494 | /* water can destroy industries |
| 495 | * in editor you can bulldoze industries |
| 496 | * with magic_bulldozer cheat you can destroy industries |
| 497 | * (area around OILRIG is water, so water shouldn't flood it |
| 498 | */ |
| 499 | if ((_current_company != OWNER_WATER && _game_mode != GM_EDITOR && |
| 500 | !_cheats.magic_bulldozer.value) || |
| 501 | flags.Test(DoCommandFlag::Auto) || |
| 502 | (_current_company == OWNER_WATER && |
| 503 | (indspec->behaviour.Test(IndustryBehaviour::BuiltOnWater) || |
| 504 | HasBit(GetIndustryTileSpec(GetIndustryGfx(tile))->slopes_refused, 5)))) { |
| 505 | |
| 506 | if (flags.Test(DoCommandFlag::Auto)) { |
| 507 | return CommandCostWithParam(STR_ERROR_GENERIC_OBJECT_IN_THE_WAY, indspec->name); |
| 508 | } |
| 509 | return CommandCost(INVALID_STRING_ID); |
| 510 | } |
| 511 | |
| 512 | if (flags.Test(DoCommandFlag::Execute)) { |
| 513 | AI::BroadcastNewEvent(new ScriptEventIndustryClose(i->index)); |
| 514 | Game::NewEvent(new ScriptEventIndustryClose(i->index)); |
| 515 | delete i; |
| 516 | } |
| 517 | return CommandCost(EXPENSES_CONSTRUCTION, indspec->GetRemovalCost()); |
| 518 | } |
| 519 | |
| 520 | /** |
| 521 | * Move produced cargo from industry to nearby stations. |
nothing calls this directly
no test coverage detected