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 graph.cxx,1.4,1.5 graph.hxx,


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldmap graph.cxx,1.4,1.5 graph.hxx,1.6,1.7 manager.cxx,1.9,1.10 manager.hxx,1.9,1.10 node.cxx,1.6,1.7 node.hxx,1.5,1.6 node_data.cxx,1.2,1.3 node_data.hxx,1.6,1.7 pingus.cxx,1.7,1.8 pingus.hxx,1.8,1.9 stat.cxx,1.6,1.7 stat.hxx,1.5,1.6 worldmap.cxx,1.9,1.10 worldmap.hxx,1.8,1.9
Date: 7 Sep 2002 23:33:49 -0000

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

Modified Files:
        graph.cxx graph.hxx manager.cxx manager.hxx node.cxx node.hxx 
        node_data.cxx node_data.hxx pingus.cxx pingus.hxx stat.cxx 
        stat.hxx worldmap.cxx worldmap.hxx 
Log Message:
- some fun with namespaces and a bit of cleanup
- we probally need to change to something like NS_blabla, everything else just 
leads easily to conflicts (at least in the worldmap/)

Index: graph.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/graph.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- graph.cxx   7 Sep 2002 19:29:04 -0000       1.4
+++ graph.cxx   7 Sep 2002 23:33:47 -0000       1.5
@@ -23,7 +23,8 @@
 #include "../xml_helper.hxx"
 #include "graph.hxx"
 
-using namespace Pingus::WorldMap;
+namespace pingus {
+namespace worldmap {
 
 Graph::Graph ()
 {
@@ -201,5 +202,8 @@
    delete sur;
    delete provider;
 */
+
+} // namespace worldmap
+} // namespace pingus
 
 /* EOF */

Index: graph.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/graph.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- graph.hxx   7 Sep 2002 19:29:04 -0000       1.6
+++ graph.hxx   7 Sep 2002 23:33:47 -0000       1.7
@@ -24,67 +24,66 @@
 #include "../boost/smart_ptr.hpp"
 #include "node.hxx"
 
-namespace Pingus
-{
-  namespace WorldMap
-  {
-#if 0
-    /** */
-    class Graph
-    {
-    public:
-      /** Load a graph from file */
-      Graph (const std::string& filename);
-      ~Graph ();
-
-      /** Draw the graph to the given GC 
-         @param gc The GraphicContext to draw on */
-      void draw (GraphicContext& gc);
+namespace pingus {
+namespace worldmap {
 
-      /** @return a reference to the nodes of this graph */
-      const std::vector<>& get_nodes ();
+#if 0
+/** */
+class Graph
+{
+public:
+  /** Load a graph from file */
+  Graph (const std::string& filename);
+  ~Graph ();
+    
+  /** Draw the graph to the given GC 
+      @param gc The GraphicContext to draw on */
+  void draw (GraphicContext& gc);
+    
+  /** @return a reference to the nodes of this graph */
+  const std::vector<>& get_nodes ();
 
-      /** @return a reference to the edges of this graph */
-      const std::vector<>& get_edges ();
-    };
+  /** @return a reference to the edges of this graph */
+  const std::vector<>& get_edges ();
+};
 #endif 
 
-    /** The path on the WorldMap is a bidirectional graph, this class
-       managed it FIXME: needs a complete rewrite, EmptyNodes need to
-       be handled differently */
-    class Graph
-    {
-    private:
-      //Graph<Node>* graph;
-      ResDescriptor bg_desc;
-      std::string music;
-      xmlDocPtr doc;
+/** The path on the WorldMap is a bidirectional graph, this class
+    managed it FIXME: needs a complete rewrite, EmptyNodes need to
+    be handled differently */
+class Graph
+{
+private:
+  //Graph<Node>* graph;
+  ResDescriptor bg_desc;
+  std::string music;
+  xmlDocPtr doc;
   
-    public:
-      std::list<boost::shared_ptr<Pingus::WorldMap::Node> >   nodes;
-      typedef std::list<boost::shared_ptr<Pingus::WorldMap::Node> >::iterator 
iterator;
+public:
+  std::list<boost::shared_ptr<Node> >   nodes;
+  typedef std::list<boost::shared_ptr<Node> >::iterator iterator;
 
-      Graph ();
-      ~Graph ();
+  Graph ();
+  ~Graph ();
  
-      /** FIXME: We shouldn't have a background, but instead multiple
-         layers of images */
-      ResDescriptor              get_background ();
+  /** FIXME: We shouldn't have a background, but instead multiple
+      layers of images */
+  ResDescriptor              get_background ();
 
-      /** @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 ();
+  /** @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 ();
 
-      /** Draw the edges of the graph to the screen
-         @param offset FIXME: should be handled by GraphicContext instead */
-      void draw (const CL_Vector& offset);
+  /** Draw the edges of the graph to the screen
+      @param offset FIXME: should be handled by GraphicContext instead */
+  void draw (const CL_Vector& offset);
 
-      /** Some functions to parse the data out of an xml file
+  /** Some functions to parse the data out of an xml file
 
-      File Syntax (FIXME: the current implementation is different):
+  File Syntax (FIXME: the current implementation is different):
       
-      <pingus-worldmap>
+  <pingus-worldmap>
         <graph>
          <nodes>
            <node id="node_1">
@@ -110,18 +109,19 @@
       </pingus-worldmap>      
       
       @{ */
-      void parse_file (std::string filename);
-    private:
-      void parse_node_list (xmlNodePtr);
-      void parse_music (xmlNodePtr);
-      void parse_background (xmlNodePtr);
-      /** @} */
+  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&);
-    };
-  }
-}
+  Graph (const Graph&);
+  Graph operator= (const Graph&);
+};
+
+} // namespace worldmap
+} // namespace pingus
 
 #endif
 

Index: manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/manager.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- manager.cxx 7 Sep 2002 19:29:04 -0000       1.9
+++ manager.cxx 7 Sep 2002 23:33:47 -0000       1.10
@@ -25,8 +25,8 @@
 #include "worldmap.hxx"
 #include "manager.hxx"
 
-using namespace Pingus;
-using namespace Pingus::WorldMap;
+namespace pingus {
+namespace worldmap {
 
 WorldMapManager* WorldMapManager::instance_ = 0;
 
@@ -115,5 +115,8 @@
   else
     return instance_ = new WorldMapManager ();
 }
+
+} // namespace worldmap
+} // namespace pingus
 
 /* EOF */

Index: manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/manager.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- manager.hxx 7 Sep 2002 19:29:04 -0000       1.9
+++ manager.hxx 7 Sep 2002 23:33:47 -0000       1.10
@@ -30,85 +30,84 @@
 class CL_Key;
 class GameDelta;
 
-namespace Pingus
-{
-  namespace WorldMap
-  {
-    class WorldMap;
-  }
+namespace pingus {
+namespace worldmap {
 
-  /** The WorldMapManager manages the worldmaps and the translation
-      between two worldmaps */
-  class WorldMapManager : public GUIScreen
+class WorldMap;
+
+/** The WorldMapManager manages the worldmaps and the translation
+    between two worldmaps */
+class WorldMapManager : public GUIScreen
+{
+  /** FIXME: Workaround class to let the worldmap play with well
+      FIXME: with the Screen, should be deleted at a later point. */
+  class WorldMapComponent : public GUI::Component
   {
-    /** FIXME: Workaround class to let the worldmap play with well
-       FIXME: with the Screen, should be deleted at a later point. */
-    class WorldMapComponent : public GUI::Component
-    {
-    public:
-      WorldMapComponent () { }
+  public:
+    WorldMapComponent () { }
       
-      void on_primary_button_press (int x, int y);
+    void on_primary_button_press (int x, int y);
  
-      void draw (GraphicContext& gc);
-      void update (float delta);
+    void draw (GraphicContext& gc);
+    void update (float delta);
       
-      bool is_at (int, int) { return true; }
+    bool is_at (int, int) { return true; }
       
-    private:
-      WorldMapComponent (const WorldMapComponent&);
-      WorldMapComponent operator= (const WorldMapComponent&);
+  private:
+    WorldMapComponent (const WorldMapComponent&);
+    WorldMapComponent operator= (const WorldMapComponent&);
 
-    } worldmap_component;
+  } worldmap_component;
 
     
-    friend class WorldMapComponent;
-  private:
-    static WorldMapManager* instance_;
+  friend class WorldMapComponent;
+private:
+  static WorldMapManager* instance_;
 
-    bool is_init;
-    bool exit_worldmap;
-    boost::shared_ptr<WorldMap::WorldMap> worldmap;
-    boost::shared_ptr<WorldMap::WorldMap> new_worldmap;
+  bool is_init;
+  bool exit_worldmap;
+  boost::shared_ptr<WorldMap> worldmap;
+  boost::shared_ptr<WorldMap> new_worldmap;
 
-    WorldMapManager ();
-  public:
-    ~WorldMapManager ();
+  WorldMapManager ();
+public:
+  ~WorldMapManager ();
   
-    /** Check if WorldMap manager still needs to run and exit if if
-       not */
-    void update (float);
+  /** Check if WorldMap manager still needs to run and exit if if
+      not */
+  void update (float);
 
-    /** @defgroup WorldMapManagerBindings Controller bindings of the 
WorldMapManager
-       @{*/
-    /** Calculate the node that was clicked and set the pingu to walk
-       to that node. If a node is double-cliked, the pingu should go
-       faster. */
-    void on_primary_button_press (int x, int y);
+  /** @defgroup WorldMapManagerBindings Controller bindings of the 
WorldMapManager
+      @{*/
+  /** Calculate the node that was clicked and set the pingu to walk
+      to that node. If a node is double-cliked, the pingu should go
+      faster. */
+  void on_primary_button_press (int x, int y);
 
-    /** Exit the WorldMapManager and return to the previous screen */
-    void on_escape_press ();
-    /** @}*/
+  /** Exit the WorldMapManager and return to the previous screen */
+  void on_escape_press ();
+  /** @}*/
 
-    /** Change the current map to the given map 
+  /** Change the current map to the given map 
 
-       @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);
+  @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);
 
-    /** Singleton access function */
-    static WorldMapManager* instance ();
+  /** Singleton access function */
+  static WorldMapManager* instance ();
     
-  private:
-    /** Startup Hook of the Screen */
-    void on_startup ();
+private:
+  /** Startup Hook of the Screen */
+  void on_startup ();
 
-    WorldMapManager (const WorldMapManager&);
-    WorldMapManager operator= (const WorldMapManager&);
-  };
+  WorldMapManager (const WorldMapManager&);
+  WorldMapManager operator= (const WorldMapManager&);
+};
 
-}
+} // namespace worldmap
+} // namespace pingus
 
 #endif
 

Index: node.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/node.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- node.cxx    2 Aug 2002 11:25:47 -0000       1.6
+++ node.cxx    7 Sep 2002 23:33:47 -0000       1.7
@@ -32,7 +32,8 @@
 #include "../screen_manager.hxx"
 #include "node.hxx"
 
-using namespace Pingus::WorldMap;
+namespace pingus {
+namespace worldmap {
 
 TubeNode::TubeNode (const TubeNodeData& data)
   : TubeNodeData (data),
@@ -176,5 +177,8 @@
 {
   return plf;
 }
+
+} // namespace worldmap
+} // namespace pingus
 
 /* EOF */

Index: node.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/node.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- node.hxx    7 Sep 2002 19:29:04 -0000       1.5
+++ node.hxx    7 Sep 2002 23:33:47 -0000       1.6
@@ -26,97 +26,97 @@
 class CL_Vector;
 class PLF;
 
-namespace Pingus
+namespace pingus {
+namespace worldmap {
+
+/** An node in the WorldmapGraph on which the Pingu walks */
+class Node 
 {
-  namespace WorldMap
-  {
-    /** An node in the WorldmapGraph on which the Pingu walks */
-    class Node 
-    {
-    public:
-      /** should links or nodes be accessible? */
-      bool accessible;
+public:
+  /** should links or nodes be accessible? */
+  bool accessible;
   
-      Node () {}
-      virtual ~Node () {}
-
-      virtual void on_click () =0;
-      virtual void mark (bool /*value*/) {}
-      virtual void draw (CL_Vector /*offset*/) {}
-      virtual std::string get_string () =0;
+  Node () {}
+  virtual ~Node () {}
+  
+  virtual void on_click () =0;
+  virtual void mark (bool /*value*/) {}
+  virtual void draw (CL_Vector /*offset*/) {}
+  virtual std::string get_string () =0;
 
-      virtual int  get_id () =0;
-      virtual CL_Vector get_pos () =0;
-      virtual std::list<int>& get_links () =0;
+  virtual int  get_id () =0;
+  virtual CL_Vector get_pos () =0;
+  virtual std::list<int>& get_links () =0;
       
-    private:
-      Node (const Node&);
-      Node operator= (const Node&);
-    };
+private:
+  Node (const Node&);
+  Node operator= (const Node&);
+};
 
-    /** A wrap/beam object which brings you to the next worldmap 
-       FIXME: Multi-Inheritage is evil */
-    class TubeNode : public Node, 
-                    public TubeNodeData
-    {
-    public:
-      std::string worldmap_name;
-      Sprite tube;
-      int link_node;
-    public:  
-      TubeNode (const TubeNodeData&);
-      void on_click ();
-      void draw (CL_Vector offset);
-      std::string get_string ();
+/** A wrap/beam object which brings you to the next worldmap 
+    FIXME: Multi-Inheritage is evil */
+class TubeNode : public Node, 
+                public TubeNodeData
+{
+public:
+  std::string worldmap_name;
+  Sprite tube;
+  int link_node;
+public:  
+  TubeNode (const TubeNodeData&);
+  void on_click ();
+  void draw (CL_Vector offset);
+  std::string get_string ();
 
-      int  get_id ()               { return NodeData::get_id();    }
-      CL_Vector get_pos ()         { return NodeData::get_pos();   }
-      std::list<int>& get_links () { return NodeData::get_links(); }
+  int  get_id ()               { return NodeData::get_id();    }
+  CL_Vector get_pos ()         { return NodeData::get_pos();   }
+  std::list<int>& get_links () { return NodeData::get_links(); }
 
-    private:
-      TubeNode (const TubeNode&);
-      TubeNode operator= (const TubeNode&);
-    };
+private:
+  TubeNode (const TubeNode&);
+  TubeNode operator= (const TubeNode&);
+};
 
-    /** The entrance to a level 
-       FIXME: Multi-Inheritage is evil */
-    class LevelNode :  public Pingus::WorldMap::Node,
-                       public Pingus::WorldMap::LevelNodeData
-    {
-    private:
-      Sprite green_dot;
-      Sprite red_dot;
-      Sprite invalid_dot;
-      Sprite dot_border;
-      Sprite green_flag;
+/** The entrance to a level 
+    FIXME: Multi-Inheritage is evil */
+class LevelNode :  public Node,
+                  public LevelNodeData
+{
+private:
+  Sprite green_dot;
+  Sprite red_dot;
+  Sprite invalid_dot;
+  Sprite dot_border;
+  Sprite green_flag;
 
-      PLF* plf;
+  PLF* plf;
   
-      /** true if the level is invalid, which means that the levelfile
-         could not be loaded or had errors. false is the default */
-      bool invalid;
+  /** true if the level is invalid, which means that the levelfile
+      could not be loaded or had errors. false is the default */
+  bool invalid;
 
-    public:
-      bool finished;
-      PLF* get_plf ();
+public:
+  bool finished;
+  PLF* get_plf ();
 
-      LevelNode (const LevelNodeData&);
-      virtual ~LevelNode ();
-      void on_click ();
-      void mark (bool value);
-      void draw (CL_Vector offset);
-      std::string get_string ();
+  LevelNode (const LevelNodeData&);
+  virtual ~LevelNode ();
+  void on_click ();
+  void mark (bool value);
+  void draw (CL_Vector offset);
+  std::string get_string ();
 
-      int  get_id ()               { return NodeData::get_id(); }
-      CL_Vector get_pos ()         { return NodeData::get_pos(); }
-      std::list<int>& get_links () { return NodeData::get_links(); }
+  int  get_id ()               { return NodeData::get_id(); }
+  CL_Vector get_pos ()         { return NodeData::get_pos(); }
+  std::list<int>& get_links () { return NodeData::get_links(); }
       
-    private:
-      LevelNode (const LevelNode&);
-      LevelNode operator= (const LevelNode&);
-    };
-  }
-}
+private:
+  LevelNode (const LevelNode&);
+  LevelNode operator= (const LevelNode&);
+};
+
+} // namespace worldmap
+} // namespace pingus
 
 #endif
 

Index: node_data.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/node_data.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- node_data.cxx       23 Aug 2002 15:49:57 -0000      1.2
+++ node_data.cxx       7 Sep 2002 23:33:47 -0000       1.3
@@ -21,7 +21,8 @@
 #include "../xml_helper.hxx"
 #include "node.hxx"
 
-using namespace Pingus::WorldMap;
+namespace pingus {
+namespace worldmap {
 
 NodeData::NodeData (const NodeData& old) : id(old.id),
                                            links(old.links),
@@ -251,5 +252,8 @@
 {
   return new EmptyNodeData ();
 }
+
+} // namespace worldmap
+} // namespace pingus
 
 /* EOF */

Index: node_data.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/node_data.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- node_data.hxx       23 Aug 2002 15:49:57 -0000      1.6
+++ node_data.hxx       7 Sep 2002 23:33:47 -0000       1.7
@@ -47,114 +47,114 @@
    ...
 */
 
-namespace Pingus 
-{
-  namespace WorldMap 
-  {
-    class Node;
+namespace pingus {
+namespace worldmap {
 
-    /** Node */
-    class NodeData
-    {
-    protected:
-      /** The id of this node, id's have to be uniq in a worldmap */
-      int id;
+class Node;
 
-      /** List of connections to other node, the int values are the id's
-         of other nodes */
-      std::list<int> links;  
+/** Node */
+class NodeData
+{
+protected:
+  /** The id of this node, id's have to be uniq in a worldmap */
+  int id;
 
-      /** The position of the node in the worldmap, pos.z is used for
-         z-sorting */
-      CL_Vector pos;
+  /** List of connections to other node, the int values are the id's
+      of other nodes */
+  std::list<int> links;  
 
-    public:
-      NodeData () { }
+  /** The position of the node in the worldmap, pos.z is used for
+      z-sorting */
+  CL_Vector pos;
+
+public:
+  NodeData () { }
       
-      NodeData (const NodeData& old);
-      NodeData operator= (const NodeData& old);
+  NodeData (const NodeData& old);
+  NodeData operator= (const NodeData& old);
       
-      virtual ~NodeData () { }
+  virtual ~NodeData () { }
 
-      int       get_id () { return id; } 
-      CL_Vector get_pos () { return pos; } 
-      std::list<int>& get_links () { return links; } 
+  int       get_id () { return id; } 
+  CL_Vector get_pos () { return pos; } 
+  std::list<int>& get_links () { return links; } 
 
-      void assign (const NodeData& data) 
-      {
-       id    = data.id;
-       links = data.links;
-       pos   = data.pos;
-      }
-      virtual Node* create ();
+  void assign (const NodeData& data) 
+  {
+    id    = data.id;
+    links = data.links;
+    pos   = data.pos;
+  }
+  virtual Node* create ();
 
-      static NodeData* create(xmlDocPtr doc, xmlNodePtr cur);
-    };
+  static NodeData* create(xmlDocPtr doc, xmlNodePtr cur);
+};
 
-    /** EmptyNode */ 
-    class EmptyNodeData : public NodeData
-    {
-    public:
-      EmptyNodeData () { }
-      virtual ~EmptyNodeData () { }
+/** EmptyNode */ 
+class EmptyNodeData : public NodeData
+{
+public:
+  EmptyNodeData () { }
+  virtual ~EmptyNodeData () { }
 
-      virtual Node* create ();
+  virtual Node* create ();
 
-      static NodeData* create(xmlDocPtr doc, xmlNodePtr cur);
+  static NodeData* create(xmlDocPtr doc, xmlNodePtr cur);
       
-    private:
-      EmptyNodeData (const EmptyNodeData&);
-      EmptyNodeData operator= (const EmptyNodeData&);
-    };
+private:
+  EmptyNodeData (const EmptyNodeData&);
+  EmptyNodeData operator= (const EmptyNodeData&);
+};
 
-    /** Level */
-    class LevelNodeData : public NodeData
-    {
-    protected:
-      /** The filename of the level to start 
+/** Level */
+class LevelNodeData : public NodeData
+{
+protected:
+  /** The filename of the level to start 
 
-      FIXME: Is the filename relative to the worldmap directory,
-      FIXME: relative to the ~/.pingus/ directory or what?
-      */
-      std::string levelname;
-    public:
-      LevelNodeData () { }
+  FIXME: Is the filename relative to the worldmap directory,
+  FIXME: relative to the ~/.pingus/ directory or what?
+  */
+  std::string levelname;
+public:
+  LevelNodeData () { }
       
-      LevelNodeData (const LevelNodeData& old);
-      LevelNodeData operator= (const LevelNodeData& old);
+  LevelNodeData (const LevelNodeData& old);
+  LevelNodeData operator= (const LevelNodeData& old);
       
-      virtual ~LevelNodeData () {}
+  virtual ~LevelNodeData () {}
 
-      virtual Node* create ();
+  virtual Node* create ();
 
-      static LevelNodeData* create(xmlDocPtr doc, xmlNodePtr cur);
-      void write_xml(std::ofstream* xml) { UNUSED_ARG(xml); }
-    };
+  static LevelNodeData* create(xmlDocPtr doc, xmlNodePtr cur);
+  void write_xml(std::ofstream* xml) { UNUSED_ARG(xml); }
+};
 
-    /** Tube */
-    class TubeNodeData : public NodeData
-    {
-    protected:
-      /** The world to which this tupe 'beams' */
-      std::string worldmap;
+/** Tube */
+class TubeNodeData : public NodeData
+{
+protected:
+  /** The world to which this tupe 'beams' */
+  std::string worldmap;
   
-      /** The node id in the worldmap to which this tube beams/links */
-      int link_node;
+  /** The node id in the worldmap to which this tube beams/links */
+  int link_node;
 
-    public:
-      TubeNodeData () { }
+public:
+  TubeNodeData () { }
       
-      TubeNodeData (const TubeNodeData& old);
-      TubeNodeData operator= (const TubeNodeData& old);
+  TubeNodeData (const TubeNodeData& old);
+  TubeNodeData operator= (const TubeNodeData& old);
   
-      virtual ~TubeNodeData () { }
+  virtual ~TubeNodeData () { }
 
-      virtual Node* create ();
+  virtual Node* create ();
 
-      static TubeNodeData* create(xmlDocPtr doc, xmlNodePtr cur);
-    };
-  }
-}
+  static TubeNodeData* create(xmlDocPtr doc, xmlNodePtr cur);
+};
+
+} // namespace worldmap
+} // namespace pingus
 
 #endif
 

Index: pingus.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/pingus.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- pingus.cxx  4 Sep 2002 17:49:48 -0000       1.7
+++ pingus.cxx  7 Sep 2002 23:33:47 -0000       1.8
@@ -20,35 +20,36 @@
 #include "pingus.hxx"
 #include "../boost/smart_ptr.hpp"
 
-using namespace Pingus::WorldMap;
+namespace pingus {
+namespace worldmap {
 
-PingusWorldMapPingus::PingusWorldMapPingus ()
+Pingus::Pingus ()
   : sprite ("Pingus/walker0", "pingus", 20.0f, Sprite::RIGHT)
 {
   sprite.set_align (-sprite.get_width()/2,  4 - sprite.get_height());
   is_left = false;
 }
 
-PingusWorldMapPingus::~PingusWorldMapPingus ()
+Pingus::~Pingus ()
 {
 }
 
 void 
-PingusWorldMapPingus::set_position (boost::shared_ptr<Pingus::WorldMap::Node> 
node)
+Pingus::set_position (boost::shared_ptr<Node> node)
 {
   pos = node->get_pos ();
   current_node = node.get ();
 }
 
 void 
-PingusWorldMapPingus::walk_to (Node* node)
+Pingus::walk_to (Node* node)
 {
   ///pos = node.pos;
   targets.push (node);
 }
 
 void
-PingusWorldMapPingus::draw (const CL_Vector& offset)
+Pingus::draw (const CL_Vector& offset)
 {
   sprite.set_direction (is_left ? Sprite::LEFT : Sprite::RIGHT);
   if (!targets.empty ())
@@ -61,13 +62,13 @@
 }
 
 bool
-PingusWorldMapPingus::is_walking ()
+Pingus::is_walking ()
 {
   return false;
 }
 
 void
-PingusWorldMapPingus::update (float delta)
+Pingus::update (float delta)
 {
   //if (!targets.empty ())
   sprite.update (delta);
@@ -109,9 +110,12 @@
 }
 
 Node*
-PingusWorldMapPingus::get_node ()
+Pingus::get_node ()
 {
   return current_node;
 }
+
+} // namespace worldmap
+} // namespace pingus
 
 /* EOF */

Index: pingus.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/pingus.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- pingus.hxx  7 Sep 2002 19:29:04 -0000       1.8
+++ pingus.hxx  7 Sep 2002 23:33:47 -0000       1.9
@@ -29,47 +29,53 @@
   template <class T> class shared_ptr;
 }
 
+namespace pingus {
+namespace worldmap {
+
 /** This is the representation of the horde of Pingus which will walk
     on the worldmap */
-class PingusWorldMapPingus
+class Pingus
 {
 private:
   Sprite sprite;
   CL_Vector pos;
-  std::queue<Pingus::WorldMap::Node*> targets;
+  std::queue<Node*> targets;
   bool is_left;
-  Pingus::WorldMap::Node* current_node;
+  Node* current_node;
 
 public:
-  PingusWorldMapPingus ();
-  ~PingusWorldMapPingus ();
+  Pingus ();
+  ~Pingus ();
 
   void draw (const CL_Vector& offset);
   void update (float delta);
 
   /** Let the pingu walk to the given node
       @param node The node to walk to */
-  void walk_to (Pingus::WorldMap::Node* node);
+  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<Pingus::WorldMap::Node> node);
+  void set_position (boost::shared_ptr<Node> node);
 
   /** @return Current position of the pingu on the screen */
   CL_Vector get_pos () { return pos; }
 
   /** @return The node where the pingu is current on 
 
-      FIXME: What should happen if the pingu is between two nodes? */
-  Pingus::WorldMap::Node* get_node ();
+  FIXME: What should happen if the pingu is between two nodes? */
+  Node* get_node ();
   
 private:
-  PingusWorldMapPingus (const PingusWorldMapPingus&);
-  PingusWorldMapPingus operator= (const PingusWorldMapPingus&);
+  Pingus (const Pingus&);
+  Pingus operator= (const Pingus&);
 };
+
+} // namespace worldmap
+} // namespace pingus
 
 #endif
 

Index: stat.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/stat.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- stat.cxx    23 Aug 2002 15:49:57 -0000      1.6
+++ stat.cxx    7 Sep 2002 23:33:47 -0000       1.7
@@ -25,22 +25,24 @@
 #include "../xml_helper.hxx"
 #include "stat.hxx"
 
-using namespace Pingus::WorldMap;
+namespace pingus {
+namespace worldmap {
 
-PingusWorldMapNodeStat::PingusWorldMapNodeStat () : finished(false),
-                                                    accessible(false),
-                                                   id(-1),
-                                                   percentage(25)
+PingusWorldMapNodeStat::PingusWorldMapNodeStat () 
+  : finished(false),
+    accessible(false),
+    id(-1),
+    percentage(25)
 {
 }
 
 PingusWorldMapNodeStat::PingusWorldMapNodeStat (const PingusWorldMapNodeStat& 
old)
-                                              : finished(old.finished),
-                                               accessible(old.accessible),
-                                               id(old.id),
-                                               percentage(old.percentage),
-                                               levelfile(old.levelfile),
-                                               checksum(old.checksum)
+  : finished(old.finished),
+    accessible(old.accessible),
+    id(old.id),
+    percentage(old.percentage),
+    levelfile(old.levelfile),
+    checksum(old.checksum)
 {
 }
 
@@ -166,7 +168,7 @@
 }
 
 void
-PingusWorldMapStat::save (std::list<boost::shared_ptr<Pingus::WorldMap::Node> 
>& nodes)
+PingusWorldMapStat::save (std::list<boost::shared_ptr<Node> >& nodes)
 {
   std::ofstream out (filename.c_str ());
   
@@ -192,5 +194,8 @@
       out << "</pingus-worldmap-stat>" << std::endl;
     }
 }
+
+} // namespace worldmap
+} // namespace pingus
 
 /* EOF */

Index: stat.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/stat.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- stat.hxx    23 Aug 2002 15:49:57 -0000      1.5
+++ stat.hxx    7 Sep 2002 23:33:47 -0000       1.6
@@ -23,6 +23,9 @@
 #include <map>
 #include "graph.hxx"
 
+namespace pingus {
+namespace worldmap {
+
 /** This class holds the information on a level's completeness, etc.
     It's only here for internal use by PingusWorldMapStat. */
 class PingusWorldMapNodeStat
@@ -64,7 +67,7 @@
 
   /** Save the given nodes status to the file from which they are
       loaded */
-  void save (std::list<boost::shared_ptr<Pingus::WorldMap::Node> >& nodes);
+  void save (std::list<boost::shared_ptr<Node> >& nodes);
 
   /// @return true if the node is finished
   bool finished (int id);
@@ -78,6 +81,9 @@
   PingusWorldMapStat (const PingusWorldMapStat&);
   PingusWorldMapStat operator= (const PingusWorldMapStat&);
 };
+
+} // namespace worldmap
+} // namespace pingus
 
 #endif
 

Index: worldmap.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/worldmap.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- worldmap.cxx        7 Sep 2002 19:29:04 -0000       1.9
+++ worldmap.cxx        7 Sep 2002 23:33:47 -0000       1.10
@@ -33,7 +33,8 @@
 #include "worldmap.hxx"
 #include "pingus.hxx"
 
-using namespace Pingus::WorldMap;
+namespace pingus {
+namespace worldmap {
 
 WorldMap::WorldMap (std::string filename) 
   : green_dot ("worldmap/dot_green", "core"),
@@ -51,7 +52,7 @@
 
   background = PingusResource::load_surface (graph_data.get_background ());
   
-  pingus = new PingusWorldMapPingus;
+  pingu = new Pingus ();
 
   stat = boost::shared_ptr<PingusWorldMapStat>
     (new PingusWorldMapStat (System::basename(filename)));
@@ -68,18 +69,18 @@
            (*i)->accessible = stat->accessible ((*i)->get_id ());
        }
       
-      pingus->set_position (*graph_data.nodes.begin ());
+      pingu->set_position (*graph_data.nodes.begin ());
     }
   else
     {
-      pingus->set_position (*graph_data.nodes.begin ());
+      pingu->set_position (*graph_data.nodes.begin ());
     }
 }
 
 WorldMap::~WorldMap ()
 {
   //delete graph;
-  delete pingus;
+  delete pingu;
 }
 
 void 
@@ -93,9 +94,9 @@
 WorldMap::get_offset ()
 {
   // FIXME: Handling of background smaller than screen isn't handled
-  assert (pingus);
+  assert (pingu);
 
-  CL_Vector offset = pingus->get_pos ();
+  CL_Vector offset = pingu->get_pos ();
   offset *= -1.0;
 
   if (CL_Display::get_width () <= int(background.get_width ()))
@@ -150,7 +151,7 @@
       }
     else if (node.get() && node->accessible)
       {
-       Pingus::WorldMap::Node* pingus_node = pingus->get_node ();
+       Node* pingus_node = pingu->get_node ();
        if (maintainer_mode)
          {
            std::cout << "Click on: " << node->get_id () << std::endl;
@@ -180,7 +181,7 @@
          }
        else
          {
-           pingus->walk_to (node.get ());
+           pingu->walk_to (node.get ());
          }
       }
     else
@@ -260,17 +261,17 @@
        }
     }
  
-  pingus->draw (offset);
+  pingu->draw (offset);
   UNUSED_ARG(gc);
 }
 
 void
 WorldMap::update (float delta)
 {
-  pingus->update (delta);
+  pingu->update (delta);
 }
 
-boost::shared_ptr<Pingus::WorldMap::Node>
+boost::shared_ptr<Node>
 WorldMap::get_node (int x, int y)
 {
   for (GraphIter i = graph_data.nodes.begin ();
@@ -300,10 +301,13 @@
     {
       if ((*i)->get_id () == node_id)
        {
-         pingus->set_position (*i);
+         pingu->set_position (*i);
          return;
        }
     }
 }
+
+} // namespace worldmap
+} // namespace pingus
 
 /* EOF */

Index: worldmap.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/worldmap.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- worldmap.hxx        7 Sep 2002 19:29:04 -0000       1.8
+++ worldmap.hxx        7 Sep 2002 23:33:47 -0000       1.9
@@ -26,103 +26,103 @@
 class CL_Key;
 class CL_Font;
 class CL_InputDevice;
-class PingusWorldMapPingus;
 
-namespace Pingus
-{
-  namespace WorldMap
-  {
+namespace pingus {
+namespace worldmap {
 
-    /** A class for loading, displaying and managing the worldmap. The
-       worldmap is basically a multi-layered image and a path
-       (bidirectional graph) where a pingu can walk on. Parts of the
-       worldmap are hidable and will only get displayed at specific
-       events (successfull level completions). */
-    class WorldMap
-    {
-    private:
-      CL_Surface background;
+class Pingus;
 
-      Sprite green_dot;
-      Sprite red_dot;
-      Sprite dot_border;
-      Sprite green_flag; 
+/** A class for loading, displaying and managing the worldmap. The
+    worldmap is basically a multi-layered image and a path
+    (bidirectional graph) where a pingu can walk on. Parts of the
+    worldmap are hidable and will only get displayed at specific
+    events (successfull level completions). */
+class WorldMap
+{
+private:
+  CL_Surface background;
 
-      //Graph<PingusWorldMapNode>* graph;
-      Graph graph_data;
-      typedef Graph::iterator GraphIter;
+  Sprite green_dot;
+  Sprite red_dot;
+  Sprite dot_border;
+  Sprite green_flag; 
 
-      /** FIXME: Should this be part of the worldmap manager? */
-      PingusWorldMapPingus* pingus;
+  //Graph<PingusWorldMapNode>* graph;
+  Graph graph_data;
+  typedef Graph::iterator GraphIter;
 
-      /** FIXME: What is this? */
-      boost::shared_ptr<Pingus::WorldMap::Node> last_node;
-      typedef boost::shared_ptr<Pingus::WorldMap::Node> NodePtr;
-      unsigned int last_node_time;
+  /** 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);
+  /** 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 ();
+  /** 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 ();
+  /** 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 ();
+  /** 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);
+  /** 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 ();
+  /** Disable all event catching */
+  void disable_button_events ();
   
-      /** Enable all event catching */
-      void enable_button_events ();
+  /** Enable all event catching */
+  void enable_button_events ();
   
-      /** Draw the world worldmap */
-      void draw (GraphicContext& gc);
+  /** 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);
+  /** 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);
+  /** 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. 
+  /** 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
+      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 */
-      CL_Vector get_offset ();
+      @return the currently used draw offset */
+  CL_Vector get_offset ();
 
-      /** Set the pingu to the given node with 'id' */
-      void set_pingus (int node_id);
+  /** Set the pingu to the given node with 'id' */
+  void set_pingus (int node_id);
       
-    private:
-      WorldMap (const WorldMap&);
-      WorldMap operator= (const WorldMap&);
-    };
+private:
+  WorldMap (const WorldMap&);
+  WorldMap operator= (const WorldMap&);
+};
 
-  }
-}
+} // namespace worldmap
+} // namespace pingus
 
 #endif
 





reply via email to

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