Applied sound pre-loading patch from mathnerd314 (#331)
[supertux.git] / src / badguy / ghosttree.cpp
index 973afa8..e343621 100644 (file)
@@ -17,6 +17,7 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include <config.h>
+#include <algorithm>
 
 #include "ghosttree.hpp"
 #include "treewillowisp.hpp"
@@ -38,6 +39,9 @@ GhostTree::GhostTree(const lisp::Lisp& lisp)
     treecolor(0), suck_lantern(0)
 {
   glow_sprite.reset(sprite_manager->create("images/creatures/ghosttree/ghosttree-glow.sprite"));
+  set_colgroup_active(COLGROUP_TOUCHABLE);
+  sound_manager->preload("sounds/tree_howling.ogg");
+  sound_manager->preload("sounds/tree_suck.ogg");
 }
 
 GhostTree::~GhostTree()
@@ -64,7 +68,6 @@ GhostTree::activate()
   willowisp_timer.start(1.0f, true);
   colorchange_timer.start(13, true);
   root_timer.start(5, true);
-  set_group(COLGROUP_TOUCHABLE);
 }
 
 void