Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / worldmap / sprite_change.hpp
index 7bf2f8c..1e2eb89 100644 (file)
@@ -1,12 +1,10 @@
-//  $Id$
-//
 //  SuperTux
 //  Copyright (C) 2006 Matthias Braun <matze@braunis.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.
-#ifndef __WORLDMAP_SPRITE_CHANGE_HPP__
-#define __WORLDMAP_SPRITE_CHANGE_HPP__
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-#include <string>
+#ifndef HEADER_SUPERTUX_WORLDMAP_SPRITE_CHANGE_HPP
+#define HEADER_SUPERTUX_WORLDMAP_SPRITE_CHANGE_HPP
+
+#include <list>
 #include <memory>
-#include "game_object.hpp"
+#include <string>
+
 #include "lisp/lisp.hpp"
 #include "math/vector.hpp"
+#include "supertux/game_object.hpp"
 
 class Sprite;
 
-namespace WorldMapNS
-{
+namespace WorldMapNS {
 
 class SpriteChange : public GameObject
 {
@@ -50,16 +49,38 @@ public:
    * another SpriteChange object.
    */
   std::string stay_action;
+
   /**
-   * should the stayaction be displayed
+   * name of a group in which only one SpriteChange will ever have its stay_action displayed.
+   * Leave empty if you don't care.
    */
-  bool in_stay_action;
+  std::string stay_group;
 
   virtual void draw(DrawingContext& context);
   virtual void update(float elapsed_time);
+
+  /**
+   * Activates the SpriteChange's stay action, if applicable
+   */
+  void set_stay_action();
+
+  /**
+   * Deactivates the SpriteChange's stay action, if applicable
+   */
+  void clear_stay_action();
+
+private:
+  /**
+   * should the stayaction be displayed
+   */
+  bool in_stay_action;
+
+  static std::list<SpriteChange*> all_sprite_changes;
+
 };
 
 }
 
 #endif
 
+/* EOF */