[cppcheck] Part 2: Some further style fixes etc.
[supertux.git] / src / object / pushbutton.cpp
index 5488de3..e5b7175 100644 (file)
 #include "sprite/sprite.hpp"
 #include "supertux/object_factory.hpp"
 #include "supertux/sector.hpp"
+#include "util/reader.hpp"
+
+#include <sstream>
+#include <stdexcept>
 
 namespace {
 const std::string BUTTON_SOUND = "sounds/switch.ogg";
@@ -27,11 +31,11 @@ const std::string BUTTON_SOUND = "sounds/switch.ogg";
 }
 
 PushButton::PushButton(const Reader& lisp) :
-  MovingSprite(lisp, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING), 
+  MovingSprite(lisp, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING),
   script(),
   state(OFF)
 {
-  sound_manager->preload(BUTTON_SOUND);
+  SoundManager::current()->preload(BUTTON_SOUND);
   set_action("off", -1);
   bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
 
@@ -65,7 +69,7 @@ PushButton::collision(GameObject& other, const CollisionHit& hit)
   set_pos(get_pos() + Vector(0, old_bbox_height - new_bbox_height));
 
   // play sound
-  sound_manager->play(BUTTON_SOUND);
+  SoundManager::current()->play(BUTTON_SOUND);
 
   // run script
   std::istringstream stream(script);
@@ -74,6 +78,4 @@ PushButton::collision(GameObject& other, const CollisionHit& hit)
   return FORCE_MOVE;
 }
 
-IMPLEMENT_FACTORY(PushButton, "pushbutton");
-
 /* EOF */