| 892 | } |
| 893 | |
| 894 | void World::destroy_level(Level &level) |
| 895 | { |
| 896 | script_world::unspawned(*_script_world, level._unit_lookup, level._resource->num_units); |
| 897 | |
| 898 | for (u32 i = 0; i < level._resource->num_units; ++i) { |
| 899 | const UnitId unit = level._unit_lookup[i]; |
| 900 | |
| 901 | post_unit_destroyed_event(unit); |
| 902 | _unit_manager->destroy(unit); |
| 903 | } |
| 904 | |
| 905 | remove_dead_units(); |
| 906 | |
| 907 | list::remove(level._node); |
| 908 | level::destroy(*_allocator, &level); |
| 909 | } |
| 910 | |
| 911 | void World::remove_dead_units() |
| 912 | { |