Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / object / pushbutton.cpp
index 3630cf6..5816607 100644 (file)
@@ -1,12 +1,10 @@
-//  $Id$
-//
 //  SuperTux - PushButton running a script
 //  Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
 //
-//  This program is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU General Public License
-//  as published by the Free Software Foundation; either version 2
-//  of the License, or (at your option) any later version.
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
 //
 //  This program is distributed in the hope that it will be useful,
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  GNU General Public License for more details.
 //
 //  You should have received a copy of the GNU General Public License
-//  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 <stdexcept>
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-#include "pushbutton.hpp"
-#include "object_factory.hpp"
-#include "player.hpp"
 #include "audio/sound_manager.hpp"
-#include "sprite/sprite_manager.hpp"
-#include "sector.hpp"
-#include "log.hpp"
+#include "object/player.hpp"
+#include "object/pushbutton.hpp"
 #include "sprite/sprite.hpp"
+#include "supertux/object_factory.hpp"
+#include "supertux/sector.hpp"
 
 namespace {
-  const std::string BUTTON_SOUND = "sounds/switch.ogg";
- //14 -> 8
+const std::string BUTTON_SOUND = "sounds/switch.ogg";
+//14 -> 8
 }
 
-PushButton::PushButton(const lisp::Lisp& lisp)
-        : MovingSprite(lisp, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING), state(OFF)
+PushButton::PushButton(const Reader& lisp)
+  : MovingSprite(lisp, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING), state(OFF)
 {
   sound_manager->preload(BUTTON_SOUND);
   set_action("off", -1);
@@ -54,10 +46,10 @@ PushButton::collision(GameObject& other, const CollisionHit& hit)
 {
   Player* player = dynamic_cast<Player*>(&other);
   if (!player) return FORCE_MOVE;
-  float vy = player->physic.get_velocity_y();
+  float vy = player->get_physic().get_velocity_y();
 
   //player->add_velocity(Vector(0, -150));
-  player->physic.set_velocity_y(-150);
+  player->get_physic().set_velocity_y(-150);
 
   if (state != OFF) return FORCE_MOVE;
   if (!hit.top) return FORCE_MOVE;
@@ -81,3 +73,5 @@ PushButton::collision(GameObject& other, const CollisionHit& hit)
 }
 
 IMPLEMENT_FACTORY(PushButton, "pushbutton");
+
+/* EOF */