| 129 | } |
| 130 | |
| 131 | CLevel::~CLevel() |
| 132 | { |
| 133 | xr_delete(g_player_hud); |
| 134 | // g_pGameLevel = NULL; |
| 135 | Msg("- Destroying level"); |
| 136 | |
| 137 | Engine.Event.Handler_Detach(eEntitySpawn, this); |
| 138 | |
| 139 | Engine.Event.Handler_Detach(eEnvironment, this); |
| 140 | Engine.Event.Handler_Detach(eChangeTrack, this); |
| 141 | Engine.Event.Handler_Detach(eDemoPlay, this); |
| 142 | Engine.Event.Handler_Detach(eChangeRP, this); |
| 143 | |
| 144 | if (ph_world) |
| 145 | { |
| 146 | ph_world->Destroy(); |
| 147 | xr_delete(ph_world); |
| 148 | } |
| 149 | |
| 150 | // destroy PSs |
| 151 | for (POIt p_it = m_StaticParticles.begin(); m_StaticParticles.end() != p_it; ++p_it) |
| 152 | CParticlesObject::Destroy(*p_it); |
| 153 | m_StaticParticles.clear(); |
| 154 | |
| 155 | // Unload sounds |
| 156 | // unload prefetched sounds |
| 157 | sound_registry.clear(); |
| 158 | sound_registry_defer.clear(); |
| 159 | |
| 160 | // unload static sounds |
| 161 | for (u32 i = 0; i < static_Sounds.size(); ++i) |
| 162 | { |
| 163 | static_Sounds[i]->destroy(); |
| 164 | xr_delete(static_Sounds[i]); |
| 165 | } |
| 166 | static_Sounds.clear(); |
| 167 | |
| 168 | xr_delete(m_level_sound_manager); |
| 169 | |
| 170 | xr_delete(m_space_restriction_manager); |
| 171 | |
| 172 | xr_delete(m_seniority_hierarchy_holder); |
| 173 | |
| 174 | xr_delete(m_client_spawn_manager); |
| 175 | |
| 176 | xr_delete(m_debug_renderer); |
| 177 | |
| 178 | xr_delete(game); |
| 179 | xr_delete(game_events); |
| 180 | |
| 181 | // by Dandy |
| 182 | // destroy fog of war |
| 183 | // xr_delete (m_pFogOfWar); |
| 184 | // destroy bullet manager |
| 185 | xr_delete(m_pBulletManager); |
| 186 | |
| 187 | //----------------------------------------------------------- |
| 188 | xr_delete(m_ph_commander); |