std::exception(const char*) seems to be an msvc extension...
[supertux.git] / src / level.hpp
index 18d1803..1ab7448 100644 (file)
@@ -1,7 +1,7 @@
 //  $Id$
-// 
+//
 //  SuperTux
-//  Copyright (C) 2004 SuperTux Development Team, see AUTHORS for details
+//  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
@@ -12,7 +12,7 @@
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 //  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
@@ -23,8 +23,8 @@
 
 #include <vector>
 #include <string>
-
-class Sector;
+#include "statistics.hpp"
+#include "sector.hpp"
 
 namespace lisp {
 class Lisp;
@@ -35,8 +35,10 @@ class Level
 public:
   std::string name;
   std::string author;
+  std::string on_menukey_script;
   typedef std::vector<Sector*> Sectors;
   Sectors sectors;
+  Statistics stats;
 
 public:
   Level();
@@ -59,8 +61,18 @@ public:
   size_t get_sector_count();
   Sector* get_sector(size_t num);
 
-  int get_total_badguys();
   int get_total_coins();
+  int get_total_badguys();
+
+  /** Get total number of GameObjects of given type */
+  template<class T> int get_total_count()
+  {
+    int total = 0;
+    for(Sectors::iterator i = sectors.begin(); i != sectors.end(); ++i) {
+      total += (*i)->get_total_count<T>();
+    }
+    return total;
+  }
 
 private:
   void load_old_format(const lisp::Lisp& reader);