Updated addon repository URL and improved debug output on download
[supertux.git] / src / worldmap / level.hpp
1 //  SuperTux
2 //  Copyright (C) 2004 Ingo Ruhnke <grumbel@gmail.com>
3 //  Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
4 //
5 //  This program is free software: you can redistribute it and/or modify
6 //  it under the terms of the GNU General Public License as published by
7 //  the Free Software Foundation, either version 3 of the License, or
8 //  (at your option) any later version.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 #ifndef HEADER_SUPERTUX_WORLDMAP_LEVEL_HPP
19 #define HEADER_SUPERTUX_WORLDMAP_LEVEL_HPP
20
21 #include <memory>
22 #include <string>
23
24 #include "math/vector.hpp"
25 #include "sprite/sprite_ptr.hpp"
26 #include "supertux/game_object.hpp"
27 #include "supertux/statistics.hpp"
28 #include "video/surface.hpp"
29
30 class Sprite;
31
32 namespace worldmap {
33
34 class LevelTile : public GameObject
35 {
36 public:
37   LevelTile(const std::string& basedir, const Reader& lisp);
38   virtual ~LevelTile();
39
40   virtual void draw(DrawingContext& context);
41   virtual void update(float elapsed_time);
42
43   void set_solved(bool v);
44   void set_perfect(bool v);
45
46 private:
47   void update_sprite_action();
48
49 public:
50   Vector pos;
51   std::string title;
52   bool solved;
53   bool perfect;
54   bool auto_play; /**< true if Tux should automatically enter this level if it's unfinished */
55
56   SpritePtr sprite;
57
58   /** Statistics for level tiles */
59   Statistics statistics;
60   float target_time;
61
62   /** Script that is run when the level is successfully finished */
63   std::string extro_script;
64
65 private:
66   std::string basedir;
67   bool picture_cached;
68   Surface* picture;
69
70 private:
71   LevelTile(const LevelTile&);
72   LevelTile& operator=(const LevelTile&);
73 };
74
75 } // namespace worldmap
76
77 #endif
78
79 /* EOF */