Renamed namespaces to all lowercase
[supertux.git] / src / worldmap / sprite_change.hpp
index a597f7a..0f7843e 100644 (file)
@@ -1,13 +1,10 @@
-//  $Id: worldmap.hpp 3327 2006-04-13 15:02:40Z ravu_al_hemio $
-//
 //  SuperTux
-//  Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
-//  Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
+//  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 "lisp/lisp.hpp"
+#include <string>
+
+#include "util/reader_fwd.hpp"
 #include "math/vector.hpp"
+#include "supertux/game_object.hpp"
 
 class Sprite;
 
-namespace WorldMapNS
-{
+namespace worldmap {
 
 class SpriteChange : public GameObject
 {
 public:
-  SpriteChange(const lisp::Lisp* lisp);
+  SpriteChange(const Reader& lisp);
   virtual ~SpriteChange();
 
-  Vector pos;
+  virtual void draw(DrawingContext& context);
+  virtual void update(float elapsed_time);
+
   /**
-   * should tuxs sprite change when the tile has been completely entered,
-   * or already when the tile was just touched
+   * Activates the SpriteChange's stay action, if applicable
    */
-  bool change_on_touch;
-  /// sprite to change tux image to
-  std::auto_ptr<Sprite> sprite;
+  void set_stay_action();
+
   /**
-   * stay action can be used for objects like boats or cars, if it is
-   * != "" then this sprite will be displayed when tux left the tile towards
-   * another SpriteChange object.
+   * Deactivates the SpriteChange's stay action, if applicable
    */
+  void clear_stay_action();
+
+public:
+  Vector pos;
+
+  /** should tuxs sprite change when the tile has been completely entered,
+      or already when the tile was just touched */
+  bool change_on_touch;
+
+  /** sprite to change tux image to */
+  std::auto_ptr<Sprite> sprite;
+
+  /** stay action can be used for objects like boats or cars, if it is
+      != "" then this sprite will be displayed when tux left the tile
+      towards 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. */
+  std::string stay_group;
+
+private:
+  /** should the stayaction be displayed */
   bool in_stay_action;
 
-  virtual void draw(DrawingContext& context);
-  virtual void update(float elapsed_time);
+private:
+  static std::list<SpriteChange*> all_sprite_changes;
 };
 
-}
+} // namespace worldmap
 
 #endif
 
+/* EOF */