X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsupertux%2Fsector.cpp;h=ba097a00200bb519fea7fc1deff657abc12f31ee;hb=1e30ee2923145eeda5aa36417adc2928b347d8f0;hp=8575297ae3ec749324afefa75ce3b9214da4c3cc;hpb=146cb5cf3c1ea9bd8f884e3c99a7789c42d598f1;p=supertux.git diff --git a/src/supertux/sector.cpp b/src/supertux/sector.cpp index 8575297ae..ba097a002 100644 --- a/src/supertux/sector.cpp +++ b/src/supertux/sector.cpp @@ -115,8 +115,15 @@ Sector::Sector(Level* parent) : Sector::~Sector() { using namespace scripting; + try + { + deactivate(); + } + catch(const std::exception& err) + { + log_warning << err.what() << std::endl; + } - deactivate(); for(auto i = scripts.begin(); i != scripts.end(); ++i) { HSQOBJECT& object = *i; @@ -1490,6 +1497,20 @@ Sector::play_music(MusicType type) } } +void +Sector::resume_music() +{ + if(SoundManager::current()->get_current_music() == music) + { + SoundManager::current()->resume_music(3.2f); + } + else + { + SoundManager::current()->stop_music(); + SoundManager::current()->play_music(music, true); + } +} + MusicType Sector::get_music_type() {