fixed critical telephone bug (thanks for noticing, Matze)
authorMarek Moeckel <wansti@gmx.de>
Mon, 23 May 2005 17:14:43 +0000 (17:14 +0000)
committerMarek Moeckel <wansti@gmx.de>
Mon, 23 May 2005 17:14:43 +0000 (17:14 +0000)
SVN-Revision: 2542

src/object/infoblock.cpp
src/object/infoblock.h

index 2eb7ca2..55e2e30 100644 (file)
@@ -39,8 +39,9 @@ InfoBlock::InfoBlock(const lisp::Lisp& lisp)
   if(!lisp.get("message", message)) {
     std::cerr << "No message in InfoBlock!\n";
   }
+  stopped = false;
   ringing = new AmbientSound(get_pos(), 0.5, 300, 1, "phone");
-  Sector::current()->add_object(ringing);
+  Sector::current()->add_object(ringing);  
 }
 
 InfoBlock::~InfoBlock()
@@ -52,7 +53,10 @@ InfoBlock::hit(Player& )
 {
   GameSession::current()->display_info_box(message);
   start_bounce();
-  ringing->remove_me();
+  if (!stopped) {
+    ringing->remove_me();
+    stopped = true;
+  }
 }
 
 IMPLEMENT_FACTORY(InfoBlock, "infoblock")
index 9f6a670..d67cb81 100644 (file)
@@ -34,6 +34,7 @@ protected:
   virtual void hit(Player& player);
   std::string message;
   AmbientSound* ringing;
+  bool stopped;
 };
 
 #endif