Updated addon repository URL and improved debug output on download
[supertux.git] / src / worldmap / worldmap.hpp
index db0749c..c42e551 100644 (file)
 #include <vector>
 
 #include "control/controller.hpp"
-#include "util/reader_fwd.hpp"
 #include "math/vector.hpp"
 #include "supertux/console.hpp"
 #include "supertux/game_object.hpp"
+#include "supertux/game_object_ptr.hpp"
 #include "supertux/level.hpp"
 #include "supertux/screen.hpp"
 #include "supertux/statistics.hpp"
 #include "supertux/tile_manager.hpp"
 #include "supertux/timer.hpp"
+#include "util/reader_fwd.hpp"
 #include "worldmap/direction.hpp"
 #include "worldmap/spawn_point.hpp"
 #include "worldmap/special_tile.hpp"
@@ -41,7 +42,7 @@ class GameObject;
 class PlayerStatus;
 class Sprite;
 class TileMap;
-class WorldState;
+class Savegame;
 
 namespace worldmap {
 
@@ -73,12 +74,12 @@ private:
   typedef std::vector<SpriteChange*> SpriteChanges;
   typedef std::vector<SpawnPoint*> SpawnPoints;
   typedef std::vector<LevelTile*> LevelTiles;
-  typedef std::vector<GameObject*> GameObjects;
+  typedef std::vector<GameObjectPtr> GameObjects;
   typedef std::vector<HSQOBJECT> ScriptList;
 
-  Tux* tux;
+  std::shared_ptr<Tux> tux;
 
-  WorldState& m_world_state;
+  Savegame& m_savegame;
 
   TileSet *tileset;
   bool     free_tileset;
@@ -124,13 +125,13 @@ private:
   bool panning;
 
 public:
-  WorldMap(const std::string& filename, WorldState& world_state, const std::string& force_spawnpoint = "");
+  WorldMap(const std::string& filename, Savegame& savegame, const std::string& force_spawnpoint = "");
   ~WorldMap();
 
-  void add_object(GameObject* object);
+  void add_object(GameObjectPtr object);
 
-  void try_expose(GameObject* object);
-  void try_unexpose(GameObject* object);
+  void try_expose(const GameObjectPtr& object);
+  void try_unexpose(const GameObjectPtr& object);
 
   static WorldMap* current()
   { return current_; }
@@ -167,9 +168,9 @@ public:
   void finished_level(Level* level);
 
   /** returns current Tux incarnation */
-  Tux* get_tux() { return tux; }
+  Tux* get_tux() { return tux.get(); }
 
-  WorldState& get_world_state() { return m_world_state; }
+  Savegame& get_savegame() { return m_savegame; }
 
   LevelTile* at_level();
   SpecialTile* at_special_tile();
@@ -220,6 +221,11 @@ public:
    */
   float get_height() const;
 
+  /**
+   * Mark all levels as solved or unsolved
+   */
+  void set_levels_solved(bool solved, bool perfect);
+
 private:
   void get_level_title(LevelTile& level);
   void get_level_target_time(LevelTile& level);