[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldmap PingusWorldMap.cc,1.36,1.37
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldmap PingusWorldMap.cc,1.36,1.37 PingusWorldMap.hh,1.20,1.21 PingusWorldMapGraph.cc,1.30,1.31 PingusWorldMapGraph.hh,1.19,1.20 PingusWorldMapNode.cc,1.1,1.2 PingusWorldMapNode.hh,1.1,1.2 PingusWorldMapNodeData.cc,1.1,1.2 PingusWorldMapNodeData.hh,1.1,1.2 PingusWorldMapPingus.cc,1.14,1.15 PingusWorldMapPingus.hh,1.10,1.11 PingusWorldMapStat.cc,1.4,1.5 PingusWorldMapStat.hh,1.3,1.4 |
Date: |
6 Jun 2002 09:34:31 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldmap
In directory dark:/tmp/cvs-serv12510
Modified Files:
PingusWorldMap.cc PingusWorldMap.hh PingusWorldMapGraph.cc
PingusWorldMapGraph.hh PingusWorldMapNode.cc
PingusWorldMapNode.hh PingusWorldMapNodeData.cc
PingusWorldMapNodeData.hh PingusWorldMapPingus.cc
PingusWorldMapPingus.hh PingusWorldMapStat.cc
PingusWorldMapStat.hh
Log Message:
Some experiments with namespaces
Index: PingusWorldMap.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMap.cc,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- PingusWorldMap.cc 4 Jun 2002 21:23:42 -0000 1.36
+++ PingusWorldMap.cc 6 Jun 2002 09:34:28 -0000 1.37
@@ -32,6 +32,8 @@
#include "../Console.hh"
#include "PingusWorldMap.hh"
+using namespace Pingus::WorldMap;
+
PingusWorldMap::PingusWorldMap (std::string filename) :
font (PingusResource::load_font ("Fonts/pingus_small", "fonts")),
green_dot ("worldmap/dot_green", "core"),
@@ -173,7 +175,7 @@
{
case CL_MOUSE_LEFTBUTTON:
{
- boost::shared_ptr<PingusWorldMapNode> node
+ NodePtr node
= get_node ((int) (key.x - offset.x), (int) (key.y - offset.y));
if (node.get() && !node->accessible)
@@ -182,7 +184,7 @@
}
else if (node.get() && node->accessible)
{
- PingusWorldMapNode* pingus_node = pingus->get_node ();
+ Pingus::WorldMap::Node* pingus_node = pingus->get_node ();
if (maintainer_mode)
{
std::cout << "Click on: " << node->get_id () << std::endl;
@@ -238,7 +240,7 @@
break;
case CL_MOUSE_RIGHTBUTTON:
{
- //PingusWorldMapNode* node = get_node (key.x - offset.x, key.y -
offset.y);
+ //Node* node = get_node (key.x - offset.x, key.y - offset.y);
/*if (node) {
std::cout << "Node: " << node->id << std::endl;
@@ -258,7 +260,7 @@
}
void
-PingusWorldMap::start_level (PingusWorldMapNode* /*node*/)
+PingusWorldMap::start_level (Pingus::WorldMap::Node* /*node*/)
{
}
@@ -299,7 +301,7 @@
(*i)->draw (get_offset ());
}
- boost::shared_ptr<PingusWorldMapNode> node
+ NodePtr node
= get_node (CL_Mouse::get_x () - (int) offset.x,
CL_Mouse::get_y () - (int) offset.y);
// The mouse is over a node
@@ -312,7 +314,7 @@
{
if (last_node_time + 300 < CL_System::get_time ())
{
- last_node = boost::shared_ptr<PingusWorldMapNode>(0);
+ last_node = NodePtr(0);
}
}
@@ -325,7 +327,7 @@
pingus->update (delta);
}
-boost::shared_ptr<PingusWorldMapNode>
+boost::shared_ptr<Pingus::WorldMap::Node>
PingusWorldMap::get_node (int x, int y)
{
for (GraphIter i = graph_data.nodes.begin ();
@@ -343,7 +345,7 @@
return *i;
}
}
- return boost::shared_ptr<PingusWorldMapNode>(0);
+ return NodePtr(0);
}
void
Index: PingusWorldMap.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMap.hh,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- PingusWorldMap.hh 24 Jul 2001 09:10:12 -0000 1.20
+++ PingusWorldMap.hh 6 Jun 2002 09:34:28 -0000 1.21
@@ -49,7 +49,8 @@
bool catch_input;
bool do_quit;
- boost::shared_ptr<PingusWorldMapNode> last_node;
+ boost::shared_ptr<Pingus::WorldMap::Node> last_node;
+ typedef boost::shared_ptr<Pingus::WorldMap::Node> NodePtr;
unsigned int last_node_time;
boost::shared_ptr<PingusWorldMapStat> stat;
@@ -62,7 +63,7 @@
/** Launch the level at the given node
@param node The current node from which the level should be started */
- void start_level (PingusWorldMapNode* node);
+ void start_level (Pingus::WorldMap::Node* node);
/** Start up the music and other things that need only to me run
once on startup of a new WorldMap */
@@ -98,7 +99,7 @@
virtual void update (float delta);
/** Returns a pointer to the node under the given coordinates */
- boost::shared_ptr<PingusWorldMapNode> get_node (int x, int y);
+ 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
Index: PingusWorldMapGraph.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapGraph.cc,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- PingusWorldMapGraph.cc 4 Jun 2002 21:23:42 -0000 1.30
+++ PingusWorldMapGraph.cc 6 Jun 2002 09:34:28 -0000 1.31
@@ -35,6 +35,8 @@
#include "PingusWorldMapNode.hh"
#include "PingusWorldMapGraph.hh"
+using namespace Pingus::WorldMap;
+
PingusWorldMapGraph::PingusWorldMapGraph ()
{
music = "pingus-1.it";
@@ -106,22 +108,22 @@
if (strcmp((char*)cur->name, "empty") == 0)
{
- PingusWorldMapNodeData* data = PingusWorldMapEmptyNodeData::create
(doc, cur);
- nodes.push_back (boost::shared_ptr<class PingusWorldMapNode>
+ NodeData* data = EmptyNodeData::create (doc, cur);
+ nodes.push_back (boost::shared_ptr<class Node>
(data->create ()));
delete data;
}
else if (strcmp((char*)cur->name, "level") == 0)
{
- PingusWorldMapNodeData* data = PingusWorldMapLevelNodeData::create
(doc, cur);
- nodes.push_back (boost::shared_ptr<class PingusWorldMapNode>
+ NodeData* data = LevelNodeData::create (doc, cur);
+ nodes.push_back (boost::shared_ptr<class Node>
(data->create ()));
delete data;
}
else if (strcmp((char*)cur->name, "tube") == 0)
{
- PingusWorldMapNodeData* data = PingusWorldMapTubeNodeData::create
(doc, cur);
- nodes.push_back (boost::shared_ptr<class PingusWorldMapNode>
+ NodeData* data = TubeNodeData::create (doc, cur);
+ nodes.push_back (boost::shared_ptr<class Node>
(data->create ()));
delete data;
}
Index: PingusWorldMapGraph.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapGraph.hh,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- PingusWorldMapGraph.hh 4 Jun 2002 21:23:42 -0000 1.19
+++ PingusWorldMapGraph.hh 6 Jun 2002 09:34:28 -0000 1.20
@@ -32,20 +32,20 @@
class PingusWorldMapGraph
{
private:
- //Graph<PingusWorldMapNode>* graph;
+ //Graph<Node>* graph;
ResDescriptor bg_desc;
std::string music;
xmlDocPtr doc;
public:
- std::list<boost::shared_ptr<PingusWorldMapNode> > nodes;
- typedef std::list<boost::shared_ptr<PingusWorldMapNode> >::iterator iterator;
+ std::list<boost::shared_ptr<Pingus::WorldMap::Node> > nodes;
+ typedef std::list<boost::shared_ptr<Pingus::WorldMap::Node> >::iterator
iterator;
PingusWorldMapGraph ();
~PingusWorldMapGraph ();
ResDescriptor get_background ();
- //Graph<PingusWorldMapNode>* get_graph ();
+ //Graph<Node>* get_graph ();
std::string get_music ();
void draw (const CL_Vector&);
Index: PingusWorldMapNode.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapNode.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- PingusWorldMapNode.cc 4 Jun 2002 21:23:42 -0000 1.1
+++ PingusWorldMapNode.cc 6 Jun 2002 09:34:28 -0000 1.2
@@ -28,8 +28,10 @@
#include "../PingusError.hh"
#include "PingusWorldMapNode.hh"
-PingusWorldMapTubeNode::PingusWorldMapTubeNode (const
PingusWorldMapTubeNodeData& data)
- : PingusWorldMapTubeNodeData (data),
+using namespace Pingus::WorldMap;
+
+TubeNode::TubeNode (const TubeNodeData& data)
+ : TubeNodeData (data),
worldmap_name ("pacman.xml"),
tube ("worldmap/tube", "core")
{
@@ -38,26 +40,26 @@
void
-PingusWorldMapTubeNode::on_click ()
+TubeNode::on_click ()
{
std::cout << "Not Supported" << std::endl;
PingusWorldMapManager::get_current ()->change_map (worldmap_name, link_node);
}
void
-PingusWorldMapTubeNode::draw (CL_Vector offset)
+TubeNode::draw (CL_Vector offset)
{
tube.put_screen (pos + offset);
}
std::string
-PingusWorldMapTubeNode::get_string ()
+TubeNode::get_string ()
{
return _("Tube");
}
-PingusWorldMapLevelNode::PingusWorldMapLevelNode (const
PingusWorldMapLevelNodeData& data)
- : PingusWorldMapLevelNodeData (data),
+LevelNode::LevelNode (const LevelNodeData& data)
+ : LevelNodeData (data),
green_dot ("worldmap/dot_green", "core"),
red_dot ("worldmap/dot_red", "core"),
invalid_dot ("worldmap/dot_invalid", "core"),
@@ -76,7 +78,7 @@
}
void
-PingusWorldMapLevelNode::on_click ()
+LevelNode::on_click ()
{
if (!invalid)
{
@@ -100,18 +102,18 @@
}
else
{
- std::cout << "PingusWorldMapLevelNode::on_click (): Error: level is
invalid" << std::endl;
+ std::cout << "LevelNode::on_click (): Error: level is invalid" <<
std::endl;
}
}
void
-PingusWorldMapLevelNode::mark (bool value)
+LevelNode::mark (bool value)
{
finished = value;
}
void
-PingusWorldMapLevelNode::draw (CL_Vector offset)
+LevelNode::draw (CL_Vector offset)
{
if (!levelname.empty())
{
@@ -137,7 +139,7 @@
}
std::string
-PingusWorldMapLevelNode::get_string ()
+LevelNode::get_string ()
{
boost::shared_ptr<PLF> plf = get_plf ();
@@ -148,7 +150,7 @@
}
boost::shared_ptr<PLF>
-PingusWorldMapLevelNode::get_plf ()
+LevelNode::get_plf ()
{
if (plf.get () == 0)
{
Index: PingusWorldMapNode.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapNode.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- PingusWorldMapNode.hh 4 Jun 2002 21:23:42 -0000 1.1
+++ PingusWorldMapNode.hh 6 Jun 2002 09:34:28 -0000 1.2
@@ -28,85 +28,89 @@
#include "PingusWorldMapNodeData.hh"
//#include "../generic/Graph.hh"
-
-
-/** An object on the worldmap */
-class PingusWorldMapNode
+namespace Pingus
{
-public:
- /** should links or nodes be accessible? */
- bool accessible;
+ namespace WorldMap
+ {
+ /** An object on the worldmap */
+ class Node
+ {
+ public:
+ /** should links or nodes be accessible? */
+ bool accessible;
- PingusWorldMapNode () {}
- virtual ~PingusWorldMapNode () {}
+ 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 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;
+ };
-/** A wrap object which brings you to the next worldmap */
-class PingusWorldMapTubeNode
- : public PingusWorldMapNode,
- public PingusWorldMapTubeNodeData
-{
-public:
- std::string worldmap_name;
- Sprite tube;
- int link_node;
-public:
- PingusWorldMapTubeNode (const PingusWorldMapTubeNodeData&);
- void on_click ();
- void draw (CL_Vector offset);
- std::string get_string ();
+ /** A wrap object which brings you to the next worldmap */
+ 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 ();
- /** FIXME: this looks unnecesarry, could probally replaced by
- FIXME: templates or something like that */
- int get_id () { return PingusWorldMapNodeData::get_id (); }
- CL_Vector get_pos () { return PingusWorldMapNodeData::get_pos (); }
- std::list<int>& get_links () { return PingusWorldMapNodeData::get_links (); }
-};
+ /** FIXME: this looks unnecesarry, could probally replaced by
+ FIXME: templates or something like that */
+ int get_id () { return NodeData::get_id (); }
+ CL_Vector get_pos () { return NodeData::get_pos (); }
+ std::list<int>& get_links () { return NodeData::get_links (); }
+ };
-/** The entrance to a level */
-class PingusWorldMapLevelNode
- : public PingusWorldMapNode,
- public PingusWorldMapLevelNodeData
-{
-private:
- Sprite green_dot;
- Sprite red_dot;
- Sprite invalid_dot;
- Sprite dot_border;
- Sprite green_flag;
+ /** The entrance to a level */
+ 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;
- boost::shared_ptr<PLF> plf;
+ boost::shared_ptr<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;
- boost::shared_ptr<PLF> get_plf ();
+ public:
+ bool finished;
+ boost::shared_ptr<PLF> get_plf ();
- PingusWorldMapLevelNode (const PingusWorldMapLevelNodeData&);
- void on_click ();
- void mark (bool value);
- void draw (CL_Vector offset);
- std::string get_string ();
+ LevelNode (const LevelNodeData&);
+ void on_click ();
+ void mark (bool value);
+ void draw (CL_Vector offset);
+ std::string get_string ();
- /** FIXME: this looks unnecesarry, could probally replaced by
- FIXME: templates or something like that */
- int get_id () { return PingusWorldMapNodeData::get_id (); }
- CL_Vector get_pos () { return PingusWorldMapNodeData::get_pos (); }
- std::list<int>& get_links () { return PingusWorldMapNodeData::get_links (); }
-};
+ /** FIXME: this looks unnecesarry, could probally replaced by
+ FIXME: templates or something like that */
+ int get_id () { return NodeData::get_id (); }
+ CL_Vector get_pos () { return NodeData::get_pos (); }
+ std::list<int>& get_links () { return NodeData::get_links (); }
+ };
+ }
+}
#endif
Index: PingusWorldMapNodeData.cc
===================================================================
RCS file:
/usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapNodeData.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- PingusWorldMapNodeData.cc 4 Jun 2002 21:23:42 -0000 1.1
+++ PingusWorldMapNodeData.cc 6 Jun 2002 09:34:28 -0000 1.2
@@ -21,37 +21,39 @@
#include "PingusWorldMapNode.hh"
#include "PingusWorldMapNodeData.hh"
-PingusWorldMapNode*
-PingusWorldMapNodeData::create ()
+using namespace Pingus::WorldMap;
+
+Node*
+NodeData::create ()
{
/* FIXME: This looks clearly like a design bug. This class should
FIXME: probally be split of even more */
- assert (!"PingusWorldMapNode* create (): This should never be reached!");
+ assert (!"Node* create (): This should never be reached!");
return 0;
}
-PingusWorldMapNode*
-PingusWorldMapTubeNodeData::create ()
+Node*
+TubeNodeData::create ()
{
- return new PingusWorldMapTubeNode (*this);
+ return new TubeNode (*this);
}
-PingusWorldMapNode*
-PingusWorldMapLevelNodeData::create ()
+Node*
+LevelNodeData::create ()
{
- return new PingusWorldMapLevelNode (*this);
+ return new LevelNode (*this);
}
-PingusWorldMapNode*
-PingusWorldMapEmptyNodeData::create ()
+Node*
+EmptyNodeData::create ()
{
- return 0;//FIXME:new PingusWorldMapEmptyNode (*this);
+ return 0;//FIXME:new EmptyNode (*this);
}
-PingusWorldMapNodeData*
-PingusWorldMapNodeData::create(xmlDocPtr doc, xmlNodePtr cur)
+NodeData*
+NodeData::create(xmlDocPtr doc, xmlNodePtr cur)
{
- PingusWorldMapNodeData* node = new PingusWorldMapNodeData ();
+ NodeData* node = new NodeData ();
char* id = (char*)xmlGetProp(cur, (xmlChar*)"id");
if (id)
@@ -98,10 +100,10 @@
return node;
}
-PingusWorldMapTubeNodeData*
-PingusWorldMapTubeNodeData::create(xmlDocPtr doc, xmlNodePtr cur)
+TubeNodeData*
+TubeNodeData::create(xmlDocPtr doc, xmlNodePtr cur)
{
- PingusWorldMapTubeNodeData* node = new PingusWorldMapTubeNodeData ();
+ TubeNodeData* node = new TubeNodeData ();
cur = cur->children;
@@ -115,7 +117,7 @@
if (strcmp((char*)cur->name, "node") == 0)
{
- PingusWorldMapNodeData* node_data = PingusWorldMapNodeData::create
(doc, cur);
+ NodeData* node_data = NodeData::create (doc, cur);
node->assign(*node_data);
delete node_data;
}
@@ -148,10 +150,10 @@
}
-PingusWorldMapLevelNodeData*
-PingusWorldMapLevelNodeData::create(xmlDocPtr doc, xmlNodePtr cur)
+LevelNodeData*
+LevelNodeData::create(xmlDocPtr doc, xmlNodePtr cur)
{
- PingusWorldMapLevelNodeData* node = new PingusWorldMapLevelNodeData ();
+ LevelNodeData* node = new LevelNodeData ();
cur = cur->children;
@@ -165,7 +167,7 @@
if (strcmp((char*)cur->name, "node") == 0)
{
- PingusWorldMapNodeData* node_data = PingusWorldMapNodeData::create
(doc, cur);
+ NodeData* node_data = NodeData::create (doc, cur);
node->assign(*node_data);
delete node_data;
}
@@ -188,10 +190,10 @@
return node;
}
-PingusWorldMapNodeData*
-PingusWorldMapEmptyNodeData::create(xmlDocPtr doc, xmlNodePtr cur)
+NodeData*
+EmptyNodeData::create(xmlDocPtr doc, xmlNodePtr cur)
{
- return new PingusWorldMapEmptyNodeData ();
+ return new EmptyNodeData ();
}
/* EOF */
Index: PingusWorldMapNodeData.hh
===================================================================
RCS file:
/usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapNodeData.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- PingusWorldMapNodeData.hh 4 Jun 2002 21:23:42 -0000 1.1
+++ PingusWorldMapNodeData.hh 6 Jun 2002 09:34:28 -0000 1.2
@@ -28,108 +28,114 @@
/* Wannabe syntax of worldmaps:
----------------------------
- <level id="1" accessible="1">
- <node>
- <position>
- <x-pos>50</x-pos>
- <y-pos>377</y-pos>
- </position>
- <link id="2"/>
- </node>
+ <level id="1" accessible="1">
+ <node>
+ <position>
+ <x-pos>50</x-pos>
+ <y-pos>377</y-pos>
+ </position>
+ <link id="2"/>
+ </node>
- <level name="level1.xml"/>
- </level>
-
- <tube id="...">
- <node>
- ...
- */
+ <level name="level1.xml"/>
+ </level>
-class PingusWorldMapNode;
+ <tube id="...">
+ <node>
+ ...
+*/
-/** Node */
-class PingusWorldMapNodeData
+namespace Pingus
{
-protected:
- /** The id of this node, id's have to be uniq in a worldmap */
- int id;
+ namespace WorldMap
+ {
+ 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:
- virtual ~PingusWorldMapNodeData () {}
+ /** The position of the node in the worldmap, pos.z is used for
+ z-sorting */
+ CL_Vector pos;
- int get_id () { return id; }
- CL_Vector get_pos () { return pos; }
- std::list<int>& get_links () { return links; }
+ public:
+ virtual ~NodeData () {}
- void assign (const PingusWorldMapNodeData& data)
- {
- id = data.id;
- links = data.links;
- pos = data.pos;
- }
- virtual PingusWorldMapNode* create ();
+ int get_id () { return id; }
+ CL_Vector get_pos () { return pos; }
+ std::list<int>& get_links () { return links; }
- static PingusWorldMapNodeData* create(xmlDocPtr doc, xmlNodePtr cur);
-};
+ void assign (const NodeData& data)
+ {
+ id = data.id;
+ links = data.links;
+ pos = data.pos;
+ }
+ virtual Node* create ();
-/** EmptyNode */
-class PingusWorldMapEmptyNodeData
- : public PingusWorldMapNodeData
-{
-protected:
-public:
- virtual ~PingusWorldMapEmptyNodeData () {}
+ static NodeData* create(xmlDocPtr doc, xmlNodePtr cur);
+ };
- virtual PingusWorldMapNode* create ();
+ /** EmptyNode */
+ class EmptyNodeData
+ : public NodeData
+ {
+ protected:
+ public:
+ virtual ~EmptyNodeData () {}
- static PingusWorldMapNodeData* create(xmlDocPtr doc, xmlNodePtr cur);
-};
+ virtual Node* create ();
-/** Level */
-class PingusWorldMapLevelNodeData
- : public PingusWorldMapNodeData
-{
-protected:
- /** The filename of the level to start
+ static NodeData* create(xmlDocPtr doc, xmlNodePtr cur);
+ };
+
+ /** 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:
- virtual ~PingusWorldMapLevelNodeData () {}
+ */
+ std::string levelname;
+ public:
+ virtual ~LevelNodeData () {}
- virtual PingusWorldMapNode* create ();
+ virtual Node* create ();
- static PingusWorldMapLevelNodeData* create(xmlDocPtr doc, xmlNodePtr cur);
- void write_xml(std::ofstream* xml) {}
-};
+ static LevelNodeData* create(xmlDocPtr doc, xmlNodePtr cur);
+ void write_xml(std::ofstream* xml) {}
+ };
-/** Tube */
-class PingusWorldMapTubeNodeData
- : public PingusWorldMapNodeData
-{
-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;
-public:
- virtual ~PingusWorldMapTubeNodeData () {}
+ /** The node id in the worldmap to which this tube beams/links */
+ int link_node;
+ public:
+ virtual ~TubeNodeData () {}
- virtual PingusWorldMapNode* create ();
+ virtual Node* create ();
- static PingusWorldMapTubeNodeData* create(xmlDocPtr doc, xmlNodePtr cur);
-};
+ static TubeNodeData* create(xmlDocPtr doc, xmlNodePtr cur);
+ };
+ }
+}
#endif
Index: PingusWorldMapPingus.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapPingus.cc,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- PingusWorldMapPingus.cc 4 Jun 2002 21:23:42 -0000 1.14
+++ PingusWorldMapPingus.cc 6 Jun 2002 09:34:28 -0000 1.15
@@ -22,6 +22,8 @@
#include "../PingusResource.hh"
#include "PingusWorldMapPingus.hh"
+using namespace Pingus::WorldMap;
+
PingusWorldMapPingus::PingusWorldMapPingus ()
: sprite ("Pingus/walker0", "pingus", 20.0f, Sprite::RIGHT)
{
@@ -34,14 +36,14 @@
}
void
-PingusWorldMapPingus::set_position (boost::shared_ptr<PingusWorldMapNode> node)
+PingusWorldMapPingus::set_position (boost::shared_ptr<Node> node)
{
pos = node->get_pos ();
current_node = node.get ();
}
void
-PingusWorldMapPingus::walk_to (PingusWorldMapNode* node)
+PingusWorldMapPingus::walk_to (Node* node)
{
///pos = node.pos;
targets.push (node);
@@ -101,7 +103,7 @@
}
}
-PingusWorldMapNode*
+Node*
PingusWorldMapPingus::get_node ()
{
return current_node;
Index: PingusWorldMapPingus.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapPingus.hh,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- PingusWorldMapPingus.hh 23 Jul 2001 21:49:14 -0000 1.10
+++ PingusWorldMapPingus.hh 6 Jun 2002 09:34:28 -0000 1.11
@@ -31,9 +31,9 @@
private:
Sprite sprite;
CL_Vector pos;
- std::queue<PingusWorldMapNode*> targets;
+ std::queue<Pingus::WorldMap::Node*> targets;
bool is_left;
- PingusWorldMapNode* current_node;
+ Pingus::WorldMap::Node* current_node;
public:
PingusWorldMapPingus ();
@@ -41,11 +41,11 @@
void draw (const CL_Vector& offset);
void update (float delta);
- void walk_to (PingusWorldMapNode* node);
+ void walk_to (Pingus::WorldMap::Node* node);
bool is_walking ();
- void set_position (boost::shared_ptr<PingusWorldMapNode> node);
+ void set_position (boost::shared_ptr<Pingus::WorldMap::Node> node);
CL_Vector get_pos () { return pos; }
- PingusWorldMapNode* get_node ();
+ Pingus::WorldMap::Node* get_node ();
};
#endif
Index: PingusWorldMapStat.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapStat.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- PingusWorldMapStat.cc 4 Jun 2002 21:23:42 -0000 1.4
+++ PingusWorldMapStat.cc 6 Jun 2002 09:34:28 -0000 1.5
@@ -23,6 +23,8 @@
#include "../PingusError.hh"
#include "PingusWorldMapStat.hh"
+using namespace Pingus::WorldMap;
+
PingusWorldMapNodeStat::PingusWorldMapNodeStat ()
{
id = -1;
@@ -137,7 +139,7 @@
}
void
-PingusWorldMapStat::save (std::list<boost::shared_ptr<PingusWorldMapNode> >&
nodes)
+PingusWorldMapStat::save (std::list<boost::shared_ptr<Node> >& nodes)
{
std::ofstream out (filename.c_str ());
@@ -149,7 +151,7 @@
for (PingusWorldMapGraph::iterator i = nodes.begin ();
i != nodes.end (); ++i)
{
- PingusWorldMapLevelNode* node =
dynamic_cast<PingusWorldMapLevelNode*>((*i).get ());
+ LevelNode* node = dynamic_cast<LevelNode*>((*i).get ());
if (node)
{
Index: PingusWorldMapStat.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapStat.hh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- PingusWorldMapStat.hh 23 Jul 2001 21:49:14 -0000 1.3
+++ PingusWorldMapStat.hh 6 Jun 2002 09:34:28 -0000 1.4
@@ -61,7 +61,7 @@
/** Save the given nodes status to the file from which they are
loaded */
- void save (std::list<boost::shared_ptr<PingusWorldMapNode> >& nodes);
+ void save (std::list<boost::shared_ptr<Pingus::WorldMap::Node> >& nodes);
/// @return true if the node is finished
bool finished (int id);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldmap PingusWorldMap.cc,1.36,1.37 PingusWorldMap.hh,1.20,1.21 PingusWorldMapGraph.cc,1.30,1.31 PingusWorldMapGraph.hh,1.19,1.20 PingusWorldMapNode.cc,1.1,1.2 PingusWorldMapNode.hh,1.1,1.2 PingusWorldMapNodeData.cc,1.1,1.2 PingusWorldMapNodeData.hh,1.1,1.2 PingusWorldMapPingus.cc,1.14,1.15 PingusWorldMapPingus.hh,1.10,1.11 PingusWorldMapStat.cc,1.4,1.5 PingusWorldMapStat.hh,1.3,1.4,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src Debug.cc,NONE,1.1 Debug.hh,NONE,1.1 PingusStream.cc,NONE,1.1 PingusStream.hh,NONE,1.1 Console.cc,1.19,1.20 Makefile.am,1.73,1.74 PingusMain.cc,1.59,1.60 PingusMenu.cc,1.54,1.55
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src Debug.cc,1.1,1.2 Debug.hh,1.1,1.2 PingusStream.cc,1.1,1.2 PingusStream.hh,1.1,1.2
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src Debug.cc,NONE,1.1 Debug.hh,NONE,1.1 PingusStream.cc,NONE,1.1 PingusStream.hh,NONE,1.1 Console.cc,1.19,1.20 Makefile.am,1.73,1.74 PingusMain.cc,1.59,1.60 PingusMenu.cc,1.54,1.55
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src Debug.cc,1.1,1.2 Debug.hh,1.1,1.2 PingusStream.cc,1.1,1.2 PingusStream.hh,1.1,1.2
- Index(es):