fix cr/lfs and remove trailing whitespaces...
[supertux.git] / src / object / infoblock.cpp
1 //  $Id$
2 //
3 //  SuperTux
4 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
5 //
6 //  This program is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU General Public License
8 //  as published by the Free Software Foundation; either version 2
9 //  of the License, or (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU General Public License for more details.
15 //
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20 #include <config.h>
21
22 #include "infoblock.hpp"
23 #include "game_session.hpp"
24 #include "resources.hpp"
25 #include "sprite/sprite_manager.hpp"
26 #include "object_factory.hpp"
27 #include "lisp/lisp.hpp"
28 #include "sector.hpp"
29 #include "log.hpp"
30
31 InfoBlock::InfoBlock(const lisp::Lisp& lisp)
32   : Block(sprite_manager->create("images/objects/bonus_block/infoblock.sprite"))
33 {
34   Vector pos;
35   lisp.get("x", pos.x);
36   lisp.get("y", pos.y);
37   bbox.set_pos(pos);
38
39   if(!lisp.get("message", message)) {
40     log_warning << "No message in InfoBlock" << std::endl;
41   }
42   //stopped = false;
43   //ringing = new AmbientSound(get_pos(), 0.5, 300, 1, "sounds/phone.wav");
44   //Sector::current()->add_object(ringing);
45 }
46
47 InfoBlock::~InfoBlock()
48 {
49 }
50
51 void
52 InfoBlock::hit(Player& )
53 {
54   start_bounce();
55   //if (!stopped) {
56   //  ringing->remove_me();
57   //  stopped = true;
58   //}
59   GameSession::current()->display_info_box(message);
60 }
61
62 IMPLEMENT_FACTORY(InfoBlock, "infoblock")