pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/worldmap dot_factory.cxx,NONE,1.1 dot


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldmap dot_factory.cxx,NONE,1.1 dot_factory.hxx,NONE,1.1 path_graph.cxx,NONE,1.1 path_graph.hxx,NONE,1.1 Makefile.am,1.4,1.5 graph.hxx,1.13,1.14 manager.cxx,1.14,1.15 manager.hxx,1.12,1.13 node.hxx,1.9,1.10 pingus.cxx,1.10,1.11 pingus.hxx,1.13,1.14 stat.cxx,1.13,1.14 stat.hxx,1.9,1.10 worldmap.cxx,1.15,1.16 worldmap.hxx,1.14,1.15
Date: 12 Oct 2002 23:34:45 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/worldmap
In directory dark:/tmp/cvs-serv15694

Modified Files:
        Makefile.am graph.hxx manager.cxx manager.hxx node.hxx 
        pingus.cxx pingus.hxx stat.cxx stat.hxx worldmap.cxx 
        worldmap.hxx 
Added Files:
        dot_factory.cxx dot_factory.hxx path_graph.cxx path_graph.hxx 
Log Message:
- started with the worldmap rewirte, worldmap is now broken and will not work 
for the next few days

--- NEW FILE: dot_factory.cxx ---
//  $Id: dot_factory.cxx,v 1.1 2002/10/12 23:34:43 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
//
//  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 distributed in the hope that it will be useful,
//  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  02111-1307, USA.

#include "../xml_helper.hxx"
#include "dot_factory.hxx"

Dot*
DotFactory::create(xmlDocPtr doc, xmlNodePtr cur)
{
  if (XMLhelper::equal_str(cur->name, "leveldot"))
    {
      
    }
  else if (XMLhelper::equal_str(cur->name, "tubedot"))
    {
      
    }
  else
    {
      PingusError::raise("DotFactory: unknown tag: " + cur->name);
    }
}

/* EOF */

--- NEW FILE: dot_factory.hxx ---
//  $Id: dot_factory.hxx,v 1.1 2002/10/12 23:34:43 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
//
//  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 distributed in the hope that it will be useful,
//  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  02111-1307, USA.

#ifndef HEADER_PINGUS_DOT_FACTORY_HXX
#define HEADER_PINGUS_DOT_FACTORY_HXX

namespace WorldMapNS {

class Dot;

/** */
class DotFactory
{
private:
public:
  /** Create a Dot from a given piece of XML */
  static Dot* create(xmlDocPtr doc, xmlNodePtr);
private:
  DotFactory (const DotFactory&);
  DotFactory& operator= (const DotFactory&);
};

} // namespace WorldMapNS

#endif

/* EOF */

--- NEW FILE: path_graph.cxx ---
//  $Id: path_graph.cxx,v 1.1 2002/10/12 23:34:43 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
//
//  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 distributed in the hope that it will be useful,
//  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  02111-1307, USA.

#include "../xml_helper.hxx"
#include "../pingus_error.hxx"
#include "dot_factory.hxx"
#include "path_graph.hxx"

namespace WorldMapNS {

PathGraph::PathGraph(WorldMap* worldmap, xmlDocPtr doc, xmlNodePtr cur)
{
  // cur is at <graph>...
  cur = cur->children;
  cur = XMLhelper::skip_blank(cur);
  
  while (cur)
    {
      if (XMLhelper::equal_str(cur->name, "nodes"))
        {

        }
      else if (XMLhelper::equal_str(cur->name, "edges"))
        {
          
        }
    }
}

void
PathGraph::parse_nodes(xmlDocPtr doc, xmlNodePtr cur)
{
  while (cur)
    {
      DotFactory::create(doc, cur);
    }  
}

void
PathGraph::parse_edges(xmlDocPtr doc, xmlNodePtr cur)
{
  while (cur)
    {
      if (XMLhelper::equal_str(cur->name, "edge"))
        {
          std::string name;
          std::string source;
          std::string destination;

          if (!XMLhelper::get_prop(cur, "id", name))
            {
              PingusError::raise("PathGraph: Missing Edge Name");
            }

          if (!XMLhelper::get_prop(cur, "source", source))
            {
              PingusError::raise("PathGraph: Missing Source Name");
            }

          if (!XMLhelper::get_prop(cur, "destination", destination))
            {
              PingusError::raise("PathGraph: Missing Destination Name");
            }

          // FIXME: add path-data parsing here

          // FIXME: No error checking
          graph.add_bi_edge((Path*)0, node_lookup[source], 
node_lookup[destination], 
                            0 /* costs */);
        }
      else
        {
          PingusError::raise("PathGraph: unhandled: ");
        }

      cur = cur->next;
      cur = XMLhelper::skip_blank(cur);
    }   
}

std::vector<Vector>
PathGraph::get_path(NodeId start, NodeId end)
{
  // insert pathfinding magic here...
  return std::vector<Vector>();
}

} // namespace WorldMapNS

/* EOF */

--- NEW FILE: path_graph.hxx ---
//  $Id: path_graph.hxx,v 1.1 2002/10/12 23:34:43 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
//
//  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 distributed in the hope that it will be useful,
//  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  02111-1307, USA.

#ifndef HEADER_PATH_GRAPH_HXX
#define HEADER_PATH_GRAPH_HXX

#include <map>
#include <vector>
#include "../vector.hxx"
#include "../libxmlfwd.hxx"
#include "graph.hxx"

class Dot;

namespace WorldMapNS {

class WorldMap;

typedef std::vector<Vector> Path;

/** This class represents the walkable path on the Worldmap */
class PathGraph
{
private:
  // FIXME: Memory leak? Where do we free stuff data inside the graph?
  Graph<Dot*, Path*> graph;

  // FIXME: This could/should probally be moved inside the graph (or not?!)
  /** Map to look up node names and get the coresponding id's */
  std::map<std::string, NodeId> node_lookup;

  /** Map to look up edge names and get the corresponding id's */
  std::map<std::string, EdgeId> edge_lookup;

public:
  /** @param worldmap is a pointer to the worldmap that holds this
      PathGraph, it is used so that the PathGraph can insert its
      drawables into the world */
  PathGraph(WorldMap* worldmap, xmlDocPtr doc, xmlNodePtr cur);

  /** @return a list of positions to walk to reach node \a end, by
      starting from \a start */
  std::vector<Vector> get_path(NodeId start, NodeId end);

private:
  void parse_nodes(xmlDocPtr doc, xmlNodePtr cur);
  void parse_edges(xmlDocPtr doc, xmlNodePtr cur);

  PathGraph (const PathGraph&);
  PathGraph& operator= (const PathGraph&);
};

} // namespace WorldMapNS

#endif

/* EOF */

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.am 12 Jun 2002 19:03:33 -0000      1.4
+++ Makefile.am 12 Oct 2002 23:34:43 -0000      1.5
@@ -20,9 +20,19 @@
 noinst_LIBRARIES = libpingus_worldmap.a
 
 libpingus_worldmap_a_SOURCES = \
-graph.hxx    node.hxx      pingus.hxx  worldmap.hxx \
-manager.hxx  node_data.hxx  stat.hxx \
-graph.cxx    node.cxx      pingus.cxx  worldmap.cxx \
-manager.cxx  node_data.cxx  stat.cxx
+graph.hxx          pingus.hxx  worldmap.hxx \
+manager.hxx    stat.hxx \
+pingus.cxx     worldmap.cxx \
+manager.cxx   stat.cxx \
+drawable.hxx drawable.cxx \
+sprite_drawable.hxx sprite_drawable.cxx \
+surface_drawable.hxx surface_drawable.cxx \
+drawable_factory.hxx drawable_factory.cxx \
+path_graph.hxx path_graph.cxx
+
+#node.cxx
+#node.hxx
+#node_data.hxx
+#node_data.cxx
 
 # EOF #

Index: graph.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/graph.hxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- graph.hxx   1 Oct 2002 19:53:45 -0000       1.13
+++ graph.hxx   12 Oct 2002 23:34:43 -0000      1.14
@@ -1,7 +1,7 @@
 //  $Id$
 // 
 //  Pingus - A free Lemmings clone
-//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
 //
 //  This program is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU General Public License
@@ -17,60 +17,139 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#ifndef HEADER_PINGUS_WORLDMAP_GRAPH_HXX
-#define HEADER_PINGUS_WORLDMAP_GRAPH_HXX
+#ifndef HEADER_GRAPH_HXX
+#define HEADER_GRAPH_HXX
 
-#include "../res_descriptor.hxx"
-#include "../boost/smart_ptr.hpp"
-#include "node.hxx"
+#include <algorithm>
+#include <vector>
 
 namespace WorldMapNS {
 
-//FIXME: #warring "Don't touch me, a rewritten version is somewhere around..."
+typedef int NodeId;
+typedef int EdgeId;
 
-/** The path on the WorldMap is a bidirectional graph, this class
-    managed it FIXME: needs a complete rewrite, EmptyNodes need to
-    be handled differently */
+extern const NodeId NoNode = -1;
+
+template<class NodeType>
+class Node 
+{
+public:
+  Node (const NodeType& d) 
+    : data (d)
+  {}
+
+  Node& operator= (const NodeType& d) 
+  {
+    data = d;
+  }
+
+  NodeType data;
+  std::vector<EdgeId> next;
+};
+
+template<class EdgeType>
+class Edge
+{
+public:
+  NodeId prev;
+  NodeId next;
+  int cost;
+
+  EdgeType data;
+
+  Edge (const EdgeType& arg_data, const NodeId& p, const NodeId& n, int c)
+    : prev (p), next (n), cost (c), data(arg_data)
+  {
+  }
+};
+
+template<class NodeType,
+         class EdgeType>
 class Graph
 {
 private:
-  //Graph<Node>* graph;
-  ResDescriptor bg_desc;
-  std::string music;
-  xmlDocPtr doc;
+  std::vector<Node<NodeType> > nodes;
+  std::vector<Edge<EdgeType> > edges;
   
 public:
-  std::list<boost::shared_ptr<Node> >   nodes;
-  typedef std::list<boost::shared_ptr<Node> >::iterator iterator;
+  Graph () 
+  {
+  }
 
-  Graph ();
-  ~Graph ();
- 
-  /** FIXME: We shouldn't have a background, but instead multiple
-      layers of images */
-  ResDescriptor              get_background ();
+  Graph (const Graph&)
+  {
+    assert (false);
+  }
 
-  /** @return The name of the music file which should be used for
-      @return this level, filename is relative to "data/music/"
-      @return Example: pingus1.it */
-  std::string get_music ();
+  Graph& operator= (const Graph&)
+  {
+    assert (false);
+  }
 
-  /** Draw the edges of the graph to the screen
-      @param offset FIXME: should be handled by GraphicContext instead */
-  void draw (const Vector& offset);
+  ~Graph () 
+  {
+  }
 
-  /** Some functions to parse the data out of an xml file.
-      For syntax description see doc/worldmap.xml
-      @{ */
-  void parse_file (std::string filename);
-private:
-  void parse_node_list (xmlNodePtr);
-  void parse_music (xmlNodePtr);
-  void parse_background (xmlNodePtr);
-  /** @} */
-      
-  Graph (const Graph&);
-  Graph& operator= (const Graph&);
+  NodeId add_node (NodeType d)
+  { 
+    nodes.push_back (Node<NodeType>(d));
+    return NodeId (nodes.size ()-1);
+  }
+  
+  void add_edge (const EdgeType& data, const NodeId& a, const NodeId& b, int 
cost)
+  {
+    Edge<EdgeType> new_edge (data, a, b, cost);
+    edges.push_back (new_edge);
+    resolve_node (a).next.push_back (edges.size ()-1);
+  }
+
+  void add_bi_edge (const EdgeType& data, const NodeId& a, const NodeId& b, 
int cost)
+  {
+    add_edge (data, a, b, cost);
+    add_edge (data, b, a, cost);
+  }
+
+  void remove_node (const NodeId& node)
+  {
+    assert (!"remove_node: not implemented");
+  }
+
+  void remove_edge (const NodeId& node1, const NodeId& node2)
+  {
+    assert (!"remove_edge: not implemented");
+  }
+
+  Edge<EdgeType>& resolve_edge (const EdgeId& node)
+  {
+    return edges[node];
+  }
+
+  /** Translates a NodeId into the corresponding Node */
+  Node<NodeType>& resolve_node (const NodeId& node)
+  {
+    return nodes[node];
+  }
+
+  /* FIXME: This might give problems under MSVC, so it could be better to not 
use it */
+  template<class Func>
+  void for_each_node (Func func) 
+  {
+    std::for_each (nodes.begin (), nodes.end (), func);
+  }
+
+  template<class Func>
+  void for_each_edge (Func func) 
+  {
+    std::for_each (edges.begin (), edges.end (), func);    
+  }
+
+  int nodes_size () {
+    return nodes.size ();
+  }
+  
+  int max_node_handler_value () {
+    return nodes.size ();
+  }
 };
 
 } // namespace WorldMapNS

Index: manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/manager.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- manager.cxx 28 Sep 2002 22:24:24 -0000      1.14
+++ manager.cxx 12 Oct 2002 23:34:43 -0000      1.15
@@ -34,9 +34,9 @@
 
   // FIXME: The default startup map should be configurable by some file
   worldmap = boost::shared_ptr<WorldMap>
-    (new WorldMap (path_manager.complete("worldmaps/volcano.xml")));
+    (new WorldMap (path_manager.complete("worldmaps/newvolcano.xml")));
 
-  worldmap->on_startup ();
+  //worldmap->on_startup ();
 
   // FIXME: a bit ugly because of the proteced member, but should work
   // FIXME: well enough. GUIScreen could also use multi-inheritage,
@@ -85,18 +85,19 @@
 void
 WorldMapManager::WorldMapComponent::update (float delta)
 {
-  WorldMapManager::instance ()->worldmap->update (delta);
+  WorldMapManager::instance ()->worldmap->update ();
 }
 
 void 
 WorldMapManager::WorldMapComponent::on_primary_button_press (int x, int y)
 {
   std::cout << "Buton press" << std::endl;
+  /** Fixme: insert Co. translation here */
   WorldMapManager::instance ()->worldmap->on_primary_button_press (x, y);
 }
 
 void 
-WorldMapManager::change_map (const std::string& filename, int node)
+WorldMapManager::change_map (const std::string& filename, NodeId node)
 {
   // Create the new worldmap and make it the current one
   new_worldmap = boost::shared_ptr<WorldMap>

Index: manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/manager.hxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- manager.hxx 27 Sep 2002 11:26:49 -0000      1.12
+++ manager.hxx 12 Oct 2002 23:34:43 -0000      1.13
@@ -32,6 +32,7 @@
 
 namespace WorldMapNS {
 
+typedef int NodeId;
 class WorldMap;
 
 /** The WorldMapManager manages the worldmaps and the translation
@@ -92,7 +93,7 @@
   @param filename the filename of the new map, filename must be
   @param filename relative to the worldmap directory
   @param filename Example: "volcano.xml" */
-  void change_map (const std::string& filename, int node);
+  void change_map (const std::string& filename, NodeId node);
 
   /** Singleton access function */
   static WorldMapManager* instance ();

Index: node.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/node.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- node.hxx    28 Sep 2002 11:52:26 -0000      1.9
+++ node.hxx    12 Oct 2002 23:34:43 -0000      1.10
@@ -21,6 +21,7 @@
 #define HEADER_PINGUS_WORLDMAP_NODE_HXX
 
 #include "../sprite.hxx"
+#include "graph.hxx"
 #include "node_data.hxx"
 
 class Vector;
@@ -105,8 +106,8 @@
   void draw (Vector offset);
   std::string get_string ();
 
-  int  get_id ()               { return NodeData::get_id(); }
-  Vector get_pos ()         { return NodeData::get_pos(); }
+  NodeId  get_id () { return NodeData::get_id(); }
+  Vector  get_pos () { return NodeData::get_pos(); }
   std::list<int>& get_links () { return NodeData::get_links(); }
       
 private:

Index: pingus.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/pingus.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pingus.cxx  28 Sep 2002 11:52:26 -0000      1.10
+++ pingus.cxx  12 Oct 2002 23:34:43 -0000      1.11
@@ -17,101 +17,132 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+#include "../graphic_context.hxx"
 #include "pingus.hxx"
 #include "../boost/smart_ptr.hpp"
 
 namespace WorldMapNS {
 
 Pingus::Pingus ()
-  : sprite ("Pingus/walker0", "pingus", 20.0f, Sprite::RIGHT)
+  : Drawable("pingus"),
+    sprite ("Pingus/walker0", "pingus", 20.0f, Sprite::RIGHT)
 {
   sprite.set_align (-sprite.get_width()/2,  4 - sprite.get_height());
-  is_left = false;
 }
 
 Pingus::~Pingus ()
 {
 }
 
-void 
-Pingus::set_position (boost::shared_ptr<Node> node)
+
+void
+Pingus::draw (GraphicContext& gc)
 {
-  pos = node->get_pos ();
-  current_node = node.get ();
+  gc.draw(sprite, pos);
 }
 
-void 
-Pingus::walk_to (Node* node)
+void
+Pingus::update (float delta)
 {
-  ///pos = node.pos;
-  targets.push (node);
+  sprite.update (delta);
 }
 
 void
-Pingus::draw (const Vector& offset)
+Pingus::update_walk (float delta)
 {
-  sprite.set_direction (is_left ? Sprite::LEFT : Sprite::RIGHT);
-  if (!targets.empty ())
-    sprite.put_screen (pos + offset);
-  else
+#if TODO
+  // Update the position
+  edge_path_position += velocity * delta;
+
+  if (edge_path_position > edge_path_length) // target reached
     {
-      //sprite.reset ();
-      sprite.put_screen (pos + offset);
+      if (node_path.empty ()) // final target reached
+        {
+          current_node = target_node;
+        }
+      else // edge is traveled, now go to the next node
+        {
+          source_node = target_node;
+          target_node = node_path.top ();
+          node_path.pop ();
+
+          edge_path_position = 0.0f;
+          edge_path = get_edge (source_node, target_node)->data;
+          edge_path_lenght   = calc_edge_path_length ();
+        }
     }
+
+  // Recalc pingu position on the screen
+  pos = calc_pos ();
+#endif
 }
 
 bool
-Pingus::is_walking ()
+Pingus::walk_to_node (NodeId target)
 {
+#if TODO
+  if (current_node) // pingu stands still
+    {
+      node_path = worldmap->find_path (current_node, target);
+    }
+  else // pingu between two nodes
+    {
+      node_path1 = worldmap->find_path (source_node, target);
+      node_path2 = worldmap->find_path (target_node, target);
+       
+      // Select the shorter path
+      if (length (node_path1) < length (node_path2))
+        { // walk to source node, which means to reverse the pingu
+          node_path = node_path1;
+
+          // Reverse the pingu
+          swap(target_node, source_node);
+          std::reverse(edge_path.begin (), edge_path.end ());
+          edge_path_position = edge_path_lenght - edge_path_position;
+        }
+      else
+        { // walk to target_node
+          node_path = node_path2;
+        }      
+    }
+#endif
   return false;
 }
 
-void
-Pingus::update (float delta)
+Vector
+Pingus::calc_pos ()
 {
-  //if (!targets.empty ())
-  sprite.update (delta);
-
-  if (!targets.empty ())
+#if TODO
+  if (current_node) // pingu stands still
     {
-      Vector t_pos = targets.front ()->get_pos ();
+      return current_node->get_pos ();
+    }
+  else // between two nodes
+    {
+      iterator current = edge_path.begin ();
+      iterator next    = edge_path.begin () + 1;
 
-      // Pingus found the target node
-      if (pos.x > t_pos.x - 3
-         && pos.x < t_pos.x + 3
-         && pos.y > t_pos.y - 3
-         && pos.y < t_pos.y + 3)
-       { 
-         pos = t_pos;
-         current_node = targets.front();
-         targets.pop ();
-       }
-      // Pingus needs to walk a bit to find the right node
-      else
-       {
-         float x_off = t_pos.x - pos.x;
-         float y_off = t_pos.y - pos.y;
+      float comp_length = 0.0f;
+      while (next != end)
+        {
+          float length = line_length (current, next);
 
-         float x_delta = x_off * 45.0 / sqrt(x_off * x_off  + y_off * y_off);
-         float y_delta = y_off * 45.0 / sqrt(x_off * x_off  + y_off * y_off);
-     
-         current_node = 0;
- 
-         if (x_delta > 0)
-           is_left = false;
-         else
-           is_left = true;
+          if (comp_length + length > edge_path_position) 
+            {
+              float perc = (edge_path_position - comp_length) // length to 
walk from current node
+                / length;
 
-         pos.x += x_delta * delta;
-         pos.y += y_delta * delta;
-       }  
-    }
-}
+              return interpol (current, next, perc);
+            }
 
-Node*
-Pingus::get_node ()
-{
-  return current_node;
+          ++current;
+          ++next;
+        }
+      assert (!"This shouldn't happen, traveled bejoint target node");
+      return target_node->get_pos ();
+    }
+#endif
+  return Vector();
 }
 
 } // namespace WorldMapNS

Index: pingus.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/pingus.hxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- pingus.hxx  28 Sep 2002 11:52:26 -0000      1.13
+++ pingus.hxx  12 Oct 2002 23:34:43 -0000      1.14
@@ -20,10 +20,14 @@
 #ifndef HEADER_PINGUS_WORLDMAP_PINGUS_HXX
 #define HEADER_PINGUS_WORLDMAP_PINGUS_HXX
 
-#include "../pingus.hxx"
 #include <math.h>
 #include <queue>
-#include "node.hxx"
+
+#include "../sprite.hxx"
+#include "../vector.hxx"
+#include "../pingus.hxx"
+#include "drawable.hxx"
+#include "graph.hxx"
 
 namespace boost {
   template <class T> class shared_ptr;
@@ -33,26 +37,27 @@
 
 /** This is the representation of the horde of Pingus which will walk
     on the worldmap */
-class Pingus
+class Pingus : public Drawable
 {
 private:
-#if TODO
+  Sprite sprite;
+
   /** The node on which the pingu currently stands, 0 if the pingu is
       currently on the move to another node */
-  Node* current_node;
+  NodeId current_node;
   
   /** The node from which the pingu as started its walk to the
       target_node, value is undefined when the pingu is currently
       standing on a node */
-  Node* source_node;
+  NodeId source_node;
  
   /** The node to which the pingu is currently walking, value is
       undefined when the pingu is currently standing on a node */
-  Node* target_node;
+  NodeId target_node;
 
   /** The node path to walk. The edge between two nodes is itself
       represented as a array of positions */
-  std::vector<Node*> node_path;
+  std::vector<NodeId> node_path;
 
   /** The path which represents an edge between two nodes */
   std::vector<Vector> edge_path;
@@ -69,150 +74,32 @@
   /** Current position of the pingu, only for caching purpose */
   Vector pos;
 
-  void draw (GraphicContext& gc);
-
-  void update_walk (float delta)
-  {
-    // Update the position
-    edge_path_position += velocity * delta;
-
-    if (edge_path_position > edge_path_length) // target reached
-      {
-       if (node_path.empty ()) // final target reached
-         {
-           current_node = target_node;
-         }
-       else // edge is traveled, now go to the next node
-         {
-           source_node = target_node;
-           target_node = node_path.top ();
-           node_path.pop ();
+  Vector velocity;
+public:
+  Pingus ();
+  ~Pingus ();
 
-           edge_path_position = 0.0f;
-           edge_path = get_edge (source_node, target_node)->data;
-           edge_path_lenght   = calc_edge_path_length ();
-         }
-      }
+  void draw (GraphicContext& gc);
 
-    // Recalc pingu position on the screen
-    pos = calc_pos ();
-  }
+  void update_walk (float delta);
   
   /** @return true if the node is reachable, false otherwise */
-  bool walk_to_node (Node* target)
-  {
-    if (current_node) // pingu stands still
-      {
-       node_path = worldmap->find_path (current_node, target);
-      }
-    else // pingu between two nodes
-      {
-       node_path1 = worldmap->find_path (source_node, target);
-       node_path2 = worldmap->find_path (target_node, target);
-       
-       // Select the shorter path
-       if (length (node_path1) < length (node_path2))
-         { // walk to source node, which means to reverse the pingu
-           node_path = node_path1;
-
-           // Reverse the pingu
-           swap(target_node, source_node);
-           std::reverse(edge_path.begin (), edge_path.end ());
-           edge_path_position = edge_path_lenght - edge_path_position;
-         }
-       else
-         { // walk to target_node
-           node_path = node_path2;
-         }     
-      }
-  }
+  bool walk_to_node (NodeId target);
   
   /** calculate the position of the pingu */
-  Vector calc_pos ()
-  {
-    if (current_node) // pingu stands still
-      {
-       return current_node->get_pos ();
-      }
-    else // between two nodes
-      {
-       iterator current = edge_path.begin ();
-       iterator next    = edge_path.begin () + 1;
-
-       float comp_length = 0.0f;
-       while (next != end)
-         {
-           float length = line_length (current, next);
-
-           if (comp_length + length > edge_path_position) 
-             {
-               float perc = (edge_path_position - comp_length) // length to 
walk from current node
-                 / length;
-
-               return interpol (current, next, perc);
-             }
-
-           ++current;
-           ++next;
-         }
-       assert (!"This shouldn't happen, traveled bejoint target node");
-       return target_node->get_pos ();
-      }
-  }
-
-  void update (float delta)
-  {
-    sprite.update (delta);
+  Vector calc_pos ();
 
-    if (current_node)
-      {
-       // do stuff when pingu is on a node
-      }
-    else // pingu walking
-      {
-       walk (delta);
-      }
-  }
+  void update (float delta);
   
   /** @return the node on which the pingu is currently standing, 0 is
       returned if the pingu is currently between two nodes */
-  Node* get_node () {
+  NodeId get_node () {
     return current_node;
   }
-#endif 
-
-  Sprite sprite;
-  Vector pos;
-  std::queue<Node*> targets;
-  bool is_left;
-  Node* current_node;
-
-public:
-  Pingus ();
-  ~Pingus ();
-
-  void draw (const Vector& offset);
-  void update (float delta);
 
-  /** Let the pingu walk to the given node
-      @param node The node to walk to */
-  void walk_to (Node* node);
-
-  /** @return If the pingu is currently between two nodes return
-      true */
-  bool is_walking ();
-
-  /** Set the pingu to the position of a node */
-  void set_position (boost::shared_ptr<Node> node);
-
-  /** @return Current position of the pingu on the screen */
-  Vector get_pos () { return pos; }
-
-  /** @return The node where the pingu is current on 
+  /** Set the pingu to the position of a given node */
+  void set_position (NodeId node);
 
-  FIXME: What should happen if the pingu is between two nodes? */
-  Node* get_node ();
-  
 private:
   Pingus (const Pingus&);
   Pingus& operator= (const Pingus&);

Index: stat.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/stat.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- stat.cxx    12 Oct 2002 13:30:51 -0000      1.13
+++ stat.cxx    12 Oct 2002 23:34:43 -0000      1.14
@@ -146,6 +146,7 @@
   return stats[id].accessible;
 }
 
+/*
 void
 PingusWorldMapStat::save (std::list<boost::shared_ptr<Node> >& nodes)
 {
@@ -173,6 +174,7 @@
       out << "</pingus-worldmap-stat>" << std::endl;
     }
 }
+*/
 
 } // namespace WorldMapNS
 

Index: stat.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/stat.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- stat.hxx    12 Oct 2002 13:30:51 -0000      1.9
+++ stat.hxx    12 Oct 2002 23:34:43 -0000      1.10
@@ -66,7 +66,7 @@
 
   /** Save the given nodes status to the file from which they are
       loaded */
-  void save (std::list<boost::shared_ptr<Node> >& nodes);
+  //void save (std::list<boost::shared_ptr<Node> >& nodes);
 
   /// @return true if the node is finished
   bool finished (int id);

Index: worldmap.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/worldmap.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- worldmap.cxx        1 Oct 2002 19:53:45 -0000       1.15
+++ worldmap.cxx        12 Oct 2002 23:34:43 -0000      1.16
@@ -28,16 +28,23 @@
 #include "../pingus_resource.hxx"
 #include "../globals.hxx"
 #include "../sound.hxx"
-#include "worldmap.hxx"
+#include "../xml_helper.hxx"
+#include "../pingus_error.hxx"
+#include "../my_gettext.hxx"
 #include "pingus.hxx"
+#include "../globals.hxx"
+#include "../debug.hxx"
+#include "worldmap.hxx"
+#include "drawable_factory.hxx"
+#include "drawable.hxx"
+#include "path_graph.hxx"
 
 namespace WorldMapNS {
 
-#if TODO
-
-WorldMap::WorldMap(const std::string& filename) 
+WorldMap::WorldMap(const std::string& arg_filename) 
+  : filename(arg_filename)
 {
-  doc = xmlParseFile(filename.c_str());
+  xmlDocPtr doc = xmlParseFile(filename.c_str());
   
   if (!doc) 
     {
@@ -47,11 +54,11 @@
   xmlNodePtr cur = doc->ROOT;
   cur = XMLhelper::skip_blank(cur);
 
-  parse_file(cur);
+  parse_file(doc, cur);
 }
 
 void 
-WorldMap::parse_file(xmlNodePtr cur)
+WorldMap::parse_file(xmlDocPtr doc, xmlNodePtr cur)
 {
   if (cur && XMLhelper::equal_str(cur->name, "pingus-worldmap"))
     {
@@ -62,15 +69,15 @@
        {
          if (XMLhelper::equal_str(cur->name, "graph"))
            {
-             parse_graph(cur);
+             parse_graph(doc, cur);
            }
          else if (XMLhelper::equal_str(cur->name, "objects"))
            {
-             parse_objects(cur);
+             parse_objects(doc, cur);
            }
          else if (XMLhelper::equal_str(cur->name, "properties"))
            {
-             parse_properties(cur);
+             parse_properties(doc, cur);
            }
          else
            {
@@ -83,30 +90,51 @@
     }
   else
     {
-      PingusError::raise ("WorldMap:" + filename + ": not a Worldmap file");
+      PingusError::raise("WorldMap:" + filename + ": not a Worldmap file");
+    }
+
+  if (!path_graph)
+    {
+      PingusError::raise("WorldMap: " + filename + " missed Graph");
     }
 }
 
 void
-WorldMap::parse_objects(xmlNodePtr cur)
+WorldMap::parse_objects(xmlDocPtr doc, xmlNodePtr cur)
 {
   cur = cur->children;
   cur = XMLhelper::skip_blank(cur);
 
+  while (cur)
+    {
+      Drawable* drawable = DrawableFactory::create(doc, cur);
 
+      if (drawable)
+        {
+          objects.push_back(drawable);
+          drawables.push_back(drawable);
+        }
+      else
+        {
+          std::cout << "Parse Error" << std::endl;
+        }
+      
+      cur = cur->next;
+      cur = XMLhelper::skip_blank(cur);
+    }      
 }
 
 void
-WorldMap::parse_graph(xmlNodePtr cur)
+WorldMap::parse_graph(xmlDocPtr doc, xmlNodePtr cur)
 {
   cur = cur->children;
   cur = XMLhelper::skip_blank(cur);
-
-
+  
+  path_graph = new PathGraph(this, doc, cur);
 }
 
 void
-WorldMap::parse_properties(xmlNodePtr cur)
+WorldMap::parse_properties(xmlDocPtr doc, xmlNodePtr cur)
 {
   cur = cur->children;
   cur = XMLhelper::skip_blank(cur);
@@ -117,283 +145,29 @@
 void
 WorldMap::draw (GraphicContext& gc)
 {
-  for (iterator drawables.begin (); i != drawables.end (); ++i)
+  for (DrawableLst::iterator i = drawables.begin (); i != drawables.end (); 
++i)
     {
-      i->draw (gc);
+      (*i)->draw (gc);
     }
 }
 
 void
-WorldMap::update (float delta)
-{
-  for (iterator drawables.begin (); i != drawables.end (); ++i)
-    {
-      i->update (delta);
-    }
-}
-
-#endif
-
-WorldMap::WorldMap (std::string filename) 
-  : green_dot ("worldmap/dot_green", "core"),
-    red_dot ("worldmap/dot_red", "core"),
-    dot_border ("Game/dot_border", "game"),
-    green_flag ("worldmap/flaggreen", "core"),
-    last_node (0)
-{
-  green_flag.set_align (-24, -36);
-  green_dot.set_align_center ();
-  red_dot.set_align_center ();
-  dot_border.set_align_center ();
-
-  graph_data.parse_file (filename);
-
-  background = PingusResource::load_surface (graph_data.get_background ());
-  
-  pingu = new Pingus ();
-
-  stat = boost::shared_ptr<PingusWorldMapStat>
-    (new PingusWorldMapStat (System::basename(filename)));
-  
-  if (!stat->empty ())
-    {
-      for (GraphIter i = graph_data.nodes.begin ();
-          i != graph_data.nodes.end ();
-          ++i)
-       {
-         (*i)->mark(stat->finished ((*i)->get_id ()));
-      
-         if (!(*i)->accessible)
-           (*i)->accessible = stat->accessible ((*i)->get_id ());
-       }
-      
-      pingu->set_position (*graph_data.nodes.begin ());
-    }
-  else
-    {
-      pingu->set_position (*graph_data.nodes.begin ());
-    }
-}
-
-WorldMap::~WorldMap ()
-{
-  //delete graph;
-  delete pingu;
-}
-
-void 
-WorldMap::save ()
-{
-  std::cout << "PingusWorldMap:save()" << std::endl;
-  stat->save (graph_data.nodes);
-}
-
-Vector 
-WorldMap::get_offset ()
+WorldMap::update ()
 {
-  // FIXME: Handling of background smaller than screen isn't handled
-  assert (pingu);
-
-  Vector offset = pingu->get_pos ();
-  offset *= -1.0;
-
-  if (CL_Display::get_width () <= int(background.get_width ()))
-    {
-      offset.x += float(CL_Display::get_width ())/2;
-      // When offset is larger then zero the background wouldn't fill the
-      // complet screen, so we reset.
-      if (offset.x > 0) offset.x = 0;
-      if (offset.x < float(CL_Display::get_width ()) - background.get_width ())
-       offset.x = float(CL_Display::get_width ()) - background.get_width ();
-    } 
-  else
-    {
-      offset.x = (float(CL_Display::get_width ()) - background.get_width ()) / 
2.0f;
-    }
-
-  if (CL_Display::get_height () <= int(background.get_height ()))
-    {
-      offset.y += float(CL_Display::get_height ())/2;
-      if (offset.y > 0) offset.y = 0;
-      if (offset.y < float(CL_Display::get_height ()) - background.get_height 
())
-       offset.y = float(CL_Display::get_height ()) - background.get_height ();
-    }
-  else
+  for (DrawableLst::iterator i = drawables.begin (); i != drawables.end (); 
++i)
     {
-      offset.y = (float(CL_Display::get_height ()) - background.get_height ()) 
/ 2.0f;
+      (*i)->update ();
     }
-  
-  return offset;
 }
 
 void
-WorldMap::on_startup ()
-{
-  std::cout << "PingusWorldMap::init" << std::endl;
-  if (!graph_data.get_music ().empty ())
-    PingusSound:: play_music (path_manager.complete("music/" + 
graph_data.get_music ()));
-}
-
-void 
-WorldMap::on_primary_button_press (int x, int y)
-{
-  Vector offset = get_offset ();
-
-  {      
-    NodePtr node
-      = get_node ((int) (x - offset.x), (int) (y - offset.y));
-
-    if (node.get() && !node->accessible)
-      {
-       PingusSound::play_sound("sounds/chink.wav");
-      }
-    else if (node.get() && node->accessible)
-      {
-       Node* pingus_node = pingu->get_node ();
-       if (maintainer_mode)
-         {
-           std::cout << "Click on: " << node->get_id () << std::endl;
-           std::cout << "Pingu at: " << pingus_node->get_id () << std::endl;
-         }
-
-       if (pingus_node && pingus_node->get_id () == node->get_id ())
-         {
-           node->on_click ();
-                   
-           // FIXME: Ugly marking code... should be rewritten
-           for (std::list<int>::iterator k = node->get_links ().begin();
-                k != node->get_links ().end();
-                ++k)
-             {
-               for (GraphIter i = graph_data.nodes.begin ();
-                    i != graph_data.nodes.end ();
-                    ++i)
-                 {
-                   if ((*i)->get_id () == *k)
-                     (*i)->accessible = true;
-                 }
-             }
-                   
-           // Save the changes
-           save ();
-         }
-       else
-         {
-           pingu->walk_to (node.get ());
-         }
-      }
-    else
-      {
-       if (maintainer_mode)
-         std::cout << "no id clicked" << std::endl;
-      }
-  }
-
-
-  /** 
-      case CL_MOUSE_MIDDLEBUTTON:
-      {
-      if (maintainer_mode)
-      {
-      std::cout << "<position>" << std::endl;
-      std::cout << "  <x-pos>" << key.x - offset.x << "</x-pos>" << std::endl;
-      std::cout << "  <y-pos>" << key.y - offset.y << "</y-pos>" << std::endl;
-      std::cout << "</position>" << std::endl;
-      }
-      }
-      break;*/
-}
- 
-void
-WorldMap::draw (GraphicContext& gc)
+WorldMap::set_pingus(NodeId id)
 {
-  Vector offset = get_offset ();
-  
-  if (offset.x > 0)
-    CL_Display::clear_display ();
-
-  background.put_screen ((int) offset.x, (int) offset.y);
-
-  if (last_node.get () && last_node->accessible)
-    {
-      dot_border.put_screen (last_node->get_pos () + offset);
-      
-      gc.print_center (Fonts::pingus_small, 
-                      CL_Display::get_width ()/2, CL_Display::get_height () - 
40,
-                      last_node->get_string().c_str ());
-    }
-
-  graph_data.draw(offset);
-
-  for (GraphIter i = graph_data.nodes.begin ();
-       i != graph_data.nodes.end ();
-       ++i)
-    {
-      (*i)->draw (get_offset ());
-    }
-
-  NodePtr node
-    = get_node (CL_Mouse::get_x () - (int) offset.x,
-               CL_Mouse::get_y () - (int) offset.y);
-
-  // The mouse is over a node
-  if (node.get ())
-    {
-      last_node = node;
-      last_node_time = CL_System::get_time ();
-    }
-  else
-    {
-      if (last_node_time + 300 < CL_System::get_time ())
-       {
-         last_node = NodePtr(0);
-       }
-    }
- 
-  pingu->draw (offset);
-  UNUSED_ARG(gc);
 }
 
 void
-WorldMap::update (float delta)
-{
-  pingu->update (delta);
-}
-
-boost::shared_ptr<Node>
-WorldMap::get_node (int x, int y)
-{
-  for (GraphIter i = graph_data.nodes.begin ();
-       i != graph_data.nodes.end ();
-       i++)
-    {
-      Vector pos = (*i)->get_pos ();
-
-      if (   pos.x - (int)(red_dot.get_width()/2) - 3 < x
-            && pos.x + (int)(red_dot.get_width()/2) + 3 > x
-            && pos.y - (int)(red_dot.get_width()/2) - 3 < y
-            && pos.y + (int)(red_dot.get_width()/2) + 3 > y)
-       {
-         if (!(*i)->get_string ().empty ())
-           return *i;
-       }
-    }
-  return NodePtr(0);
-}
-
-void 
-WorldMap::set_pingus (int node_id)
+WorldMap::on_primary_button_press(int x, int y)
 {
-  for (GraphIter i = graph_data.nodes.begin ();
-       i != graph_data.nodes.end ();
-       ++i)
-    {
-      if ((*i)->get_id () == node_id)
-       {
-         pingu->set_position (*i);
-         return;
-       }
-    }
 }
 
 } // namespace WorldMapNS

Index: worldmap.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/worldmap.hxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- worldmap.hxx        1 Oct 2002 19:53:45 -0000       1.14
+++ worldmap.hxx        12 Oct 2002 23:34:43 -0000      1.15
@@ -20,6 +20,8 @@
 #ifndef HEADER_PINGUS_WORLDMAP_WORLDMAP_HXX
 #define HEADER_PINGUS_WORLDMAP_WORLDMAP_HXX
 
+#include <vector>
+#include "../libxmlfwd.hxx"
 #include "stat.hxx"
 
 class GraphicContext;
@@ -29,6 +31,11 @@
 
 namespace WorldMapNS {
 
+typedef int EdgeId;
+typedef int NodeId;
+
+class PathGraph;
+class Drawable;
 class Pingus;
 
 /** A class for loading, displaying and managing the worldmap. The
@@ -38,117 +45,60 @@
     events (successfull level completions, etc.). */
 class WorldMap
 {
-#if TODO
+private:
+  /** name of the file to parse */
+  std::string filename;
+
+  typedef std::vector<Drawable*>   ObjectLst;
+  typedef std::vector<Drawable*> DrawableLst;
+
+  /** The graph that represents the path on the map */
+  PathGraph* path_graph;
+  
+  /** A collection of drawable things, allocation and deallocation
+      takes place elsewhere these are only references to other
+      objects */
+  DrawableLst drawables;
+
+  /** A collection of drawables loaded from the xml file, this list
+      gets deleted at the end */
+  ObjectLst objects;
 public:
   /** Load the given*/
   WorldMap (const std::string& filename);
   
   void draw (GraphicContext& gc);
-  void update (float delta)
+  void update ();
   
+  /** The the pingu to the given Node */
+  void set_pingus(NodeId id);
+
   /** @return the shortest path between node1 and node2  */
-  std::vector<Edge*> find_path (Node* node1, Node* node2);
-  
+  std::vector<EdgeId> find_path (NodeId node1, NodeId node2);
+
+  /** x,y are in WorldMap CO, not ScreenCO */
+  void on_primary_button_press(int x, int y);
+private:
+#if 0
   /** @return the node at the given position. x and y are in
       world-COs, not screen. */
-  Node* get_node (int x, int y);
-private:
+  NodeId get_node (int x, int y);
+#endif
+
   /** Parses a WorldMap XML file */
-  void parse_file(xmlNodePtr cur);
+  void parse_file(xmlDocPtr doc, xmlNodePtr cur);
   
   /** Parse the object section of the Worldmap XML file, it contains 
       Sprites, Backgrounds and other things */
-  void parse_objects(xmlNodePtr cur);
+  void parse_objects(xmlDocPtr doc, xmlNodePtr cur);
 
   /** Parse the graph section of the WorldMap XML file, it contains
       the path where the Pingu can walk on. */
-  void parse_graph(xmlNodePtr cur);
+  void parse_graph(xmlDocPtr doc, xmlNodePtr cur);
   
   /** Parse the propertie section of a WorldMap XML file, it contains
       meta data such as the author or the name of the Worldmap */
-  void parse_properties(xmlNodePtr cur);
-
-#endif
-private:
-  CL_Surface background;
-
-  Sprite green_dot;
-  Sprite red_dot;
-  Sprite dot_border;
-  Sprite green_flag; 
-
-  //Graph<PingusWorldMapNode>* graph;
-  Graph graph_data;
-  typedef Graph::iterator GraphIter;
-
-  /** FIXME: Should this be part of the worldmap manager? -> probally
-      FIXME: not, since pingu needs to be z-ordered */
-  Pingus* pingu;
-
-  /** FIXME: What is this? */
-  boost::shared_ptr<Node> last_node;
-  typedef boost::shared_ptr<Node> NodePtr;
-  unsigned int last_node_time;
-  
-  /** This should be the state saving object, which tells which
-      nodes are accessible and which are not. FIXME: might needs a
-      reimplementation. */
-  boost::shared_ptr<PingusWorldMapStat> stat;
-public:
-  /** Load a worldmap from a given worldmap description file
-      @param filename The fully qualified filename (as fopen()
-      @param and friends filename likes it) */
-  WorldMap (std::string filename);
-
-  /** Destruct the worldmap */
-  ~WorldMap ();
-
-  /** Start up the music and other things that need only to me run
-      once on startup of a new WorldMap */
-  void on_startup ();
-
-  /** Save the current status to a file */
-  void save ();
-  
-  /** React on button press:
-      - calculate which level was clicked
-      - calculate the shortest path
-      - let the pingu walk */
-  void on_primary_button_press (int x, int y);
-
-  /** Disable all event catching */
-  void disable_button_events ();
-  
-  /** Enable all event catching */
-  void enable_button_events ();
-  
-  /** Draw the world worldmap */
-  void draw (GraphicContext& gc);
-  
-  /** Let the woldmap do some stuff, like animating smoke, playing
-      sounds or reacting on special events */
-  void update (float delta);
-
-  /** Returns a pointer to the node under the given coordinates */
-  NodePtr get_node (int x, int y);
-  
-  /** Callculate the offset which is used for drawing and collision
-      detection. The offset will be used for scrolling when the
-      background is larger than the screen. 
-
-      FIXME: Do we need this one public? Other classes could
-      FIXME: handle the draw offset via the GraphicContext, 
-      FIXME: collision handling should be done in world-co's
-
-      @return the currently used draw offset */
-  Vector get_offset ();
-
-  /** Set the pingu to the given node with 'id' */
-  void set_pingus (int node_id);
-      
-private:
-  WorldMap (const WorldMap&);
-  WorldMap& operator= (const WorldMap&);
+  void parse_properties(xmlDocPtr doc, xmlNodePtr cur);
 };
 
 } // namespace WorldMapNS





reply via email to

[Prev in Thread] Current Thread [Next in Thread]