[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldmap graph.hxx,1.4,1.5 manager.hx
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldmap graph.hxx,1.4,1.5 manager.hxx,1.6,1.7 node.hxx,1.3,1.4 node_data.cxx,1.1,1.2 node_data.hxx,1.5,1.6 pingus.hxx,1.6,1.7 stat.cxx,1.5,1.6 stat.hxx,1.4,1.5 worldmap.hxx,1.5,1.6 |
Date: |
23 Aug 2002 15:49:59 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldmap
In directory dark:/tmp/cvs-serv21141/worldmap
Modified Files:
graph.hxx manager.hxx node.hxx node_data.cxx node_data.hxx
pingus.hxx stat.cxx stat.hxx worldmap.hxx
Log Message:
- added copy constructor/operator= or private declarations
- some cleanup
Index: graph.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/graph.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- graph.hxx 2 Jul 2002 13:36:07 -0000 1.4
+++ graph.hxx 23 Aug 2002 15:49:56 -0000 1.5
@@ -58,6 +58,9 @@
void parse_music (xmlNodePtr);
void parse_background (xmlNodePtr);
//@}
+
+ Graph (const Graph&);
+ Graph operator= (const Graph&);
};
}
}
Index: manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/manager.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- manager.hxx 3 Aug 2002 09:59:23 -0000 1.6
+++ manager.hxx 23 Aug 2002 15:49:57 -0000 1.7
@@ -43,13 +43,21 @@
class WorldMapComponent : public GUI::Component
{
public:
+ WorldMapComponent () { }
+
void on_primary_button_press (int x, int y);
void draw ();
void update (float delta);
bool is_at (int, int) { return true; }
+
+ private:
+ WorldMapComponent (const WorldMapComponent&);
+ WorldMapComponent operator= (const WorldMapComponent&);
+
} worldmap_component;
+
friend class WorldMapComponent;
private:
@@ -74,6 +82,10 @@
public:
void change_map (const std::string& filename, int node);
static WorldMapManager* instance ();
+
+ private:
+ WorldMapManager (const WorldMapManager&);
+ WorldMapManager operator= (const WorldMapManager&);
};
}
Index: node.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/node.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- node.hxx 2 Jul 2002 13:36:07 -0000 1.3
+++ node.hxx 23 Aug 2002 15:49:57 -0000 1.4
@@ -48,12 +48,14 @@
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&);
};
/** A wrap object which brings you to the next worldmap */
- class TubeNode
- : public Node,
- public TubeNodeData
+ class TubeNode : public Node, public TubeNodeData
{
public:
std::string worldmap_name;
@@ -65,17 +67,18 @@
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 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&);
};
/** The entrance to a level */
- class LevelNode
- : public Pingus::WorldMap::Node,
- public Pingus::WorldMap::LevelNodeData
+ class LevelNode : public Pingus::WorldMap::Node,
+ public Pingus::WorldMap::LevelNodeData
{
private:
Sprite green_dot;
@@ -101,12 +104,13 @@
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 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&);
};
}
}
Index: node_data.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/node_data.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- node_data.cxx 12 Jun 2002 19:03:33 -0000 1.1
+++ node_data.cxx 23 Aug 2002 15:49:57 -0000 1.2
@@ -23,6 +23,25 @@
using namespace Pingus::WorldMap;
+NodeData::NodeData (const NodeData& old) : id(old.id),
+ links(old.links),
+ pos(old.pos)
+{
+}
+
+NodeData
+NodeData::operator= (const NodeData& old)
+{
+ if (this == &old)
+ return *this;
+
+ id = old.id;
+ links = old.links;
+ pos = old.pos;
+
+ return *this;
+}
+
Node*
NodeData::create ()
{
@@ -33,15 +52,93 @@
}
Node*
-TubeNodeData::create ()
+LevelNodeData::create ()
{
- return new TubeNode (*this);
+ return new LevelNode (*this);
+}
+
+LevelNodeData::LevelNodeData (const LevelNodeData& old) : NodeData(old),
+
levelname(old.levelname)
+{
+}
+
+LevelNodeData
+LevelNodeData::operator= (const LevelNodeData& old)
+{
+ if (this == &old)
+ return *this;
+
+ NodeData::operator=(old);
+
+ levelname = old.levelname;
+
+ return *this;
+}
+
+LevelNodeData*
+LevelNodeData::create(xmlDocPtr doc, xmlNodePtr cur)
+{
+ LevelNodeData* node = new LevelNodeData ();
+
+ cur = cur->children;
+
+ while (cur != NULL)
+ {
+ if (xmlIsBlankNode(cur))
+ {
+ cur = cur->next;
+ continue;
+ }
+
+ if (strcmp((char*)cur->name, "node") == 0)
+ {
+ NodeData* node_data = NodeData::create (doc, cur);
+ node->assign(*node_data);
+ delete node_data;
+ }
+ else if (strcmp((char*)cur->name, "level") == 0)
+ {
+ char* level = (char*)xmlGetProp(cur, (xmlChar*)"name");
+ if (level)
+ node->levelname = std::string("levels/") + level;
+ else
+ std::cout << "PingusWorldMapGraph::parse_node: no levelname given"
<< std::endl;
+ }
+ else
+ {
+ std::cout << "PingusWorldMapLevelNodeData::create: unhandled" <<
std::endl;
+ }
+
+ cur = cur->next;
+ }
+
+ return node;
}
+TubeNodeData::TubeNodeData (const TubeNodeData& old) : NodeData(old),
+ worldmap(old.worldmap),
+ link_node(old.link_node)
+{
+}
+
+TubeNodeData
+TubeNodeData::operator= (const TubeNodeData& old)
+{
+ if (this == &old)
+ return *this;
+
+ NodeData::operator=(old);
+
+ worldmap = old.worldmap;
+ link_node = old.link_node;
+
+ return *this;
+}
+
Node*
-LevelNodeData::create ()
+TubeNodeData::create ()
{
- return new LevelNode (*this);
+ return new TubeNode (*this);
}
Node*
@@ -147,47 +244,6 @@
cur = cur->next;
}
return node;
-}
-
-
-LevelNodeData*
-LevelNodeData::create(xmlDocPtr doc, xmlNodePtr cur)
-{
- LevelNodeData* node = new LevelNodeData ();
-
- cur = cur->children;
-
- while (cur != NULL)
- {
- if (xmlIsBlankNode(cur))
- {
- cur = cur->next;
- continue;
- }
-
- if (strcmp((char*)cur->name, "node") == 0)
- {
- NodeData* node_data = NodeData::create (doc, cur);
- node->assign(*node_data);
- delete node_data;
- }
- else if (strcmp((char*)cur->name, "level") == 0)
- {
- char* level = (char*)xmlGetProp(cur, (xmlChar*)"name");
- if (level)
- node->levelname = std::string("levels/") + level;
- else
- std::cout << "PingusWorldMapGraph::parse_node: no levelname given"
<< std::endl;
- }
- else
- {
- std::cout << "PingusWorldMapLevelNodeData::create: unhandled" <<
std::endl;
- }
-
- cur = cur->next;
- }
-
- return node;
}
NodeData*
Index: node_data.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/node_data.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- node_data.hxx 17 Aug 2002 17:21:25 -0000 1.5
+++ node_data.hxx 23 Aug 2002 15:49:57 -0000 1.6
@@ -69,7 +69,12 @@
CL_Vector pos;
public:
- virtual ~NodeData () {}
+ NodeData () { }
+
+ NodeData (const NodeData& old);
+ NodeData operator= (const NodeData& old);
+
+ virtual ~NodeData () { }
int get_id () { return id; }
CL_Vector get_pos () { return pos; }
@@ -87,21 +92,23 @@
};
/** EmptyNode */
- class EmptyNodeData
- : public NodeData
+ class EmptyNodeData : public NodeData
{
- protected:
public:
- virtual ~EmptyNodeData () {}
+ EmptyNodeData () { }
+ virtual ~EmptyNodeData () { }
virtual Node* create ();
static NodeData* create(xmlDocPtr doc, xmlNodePtr cur);
+
+ private:
+ EmptyNodeData (const EmptyNodeData&);
+ EmptyNodeData operator= (const EmptyNodeData&);
};
/** Level */
- class LevelNodeData
- : public NodeData
+ class LevelNodeData : public NodeData
{
protected:
/** The filename of the level to start
@@ -111,6 +118,11 @@
*/
std::string levelname;
public:
+ LevelNodeData () { }
+
+ LevelNodeData (const LevelNodeData& old);
+ LevelNodeData operator= (const LevelNodeData& old);
+
virtual ~LevelNodeData () {}
virtual Node* create ();
@@ -120,8 +132,7 @@
};
/** Tube */
- class TubeNodeData
- : public NodeData
+ class TubeNodeData : public NodeData
{
protected:
/** The world to which this tupe 'beams' */
@@ -129,8 +140,14 @@
/** The node id in the worldmap to which this tube beams/links */
int link_node;
+
public:
- virtual ~TubeNodeData () {}
+ TubeNodeData () { }
+
+ TubeNodeData (const TubeNodeData& old);
+ TubeNodeData operator= (const TubeNodeData& old);
+
+ virtual ~TubeNodeData () { }
virtual Node* create ();
@@ -142,6 +159,5 @@
#endif
/* EOF */
-
Index: pingus.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/pingus.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pingus.hxx 22 Aug 2002 09:24:18 -0000 1.6
+++ pingus.hxx 23 Aug 2002 15:49:57 -0000 1.7
@@ -25,7 +25,6 @@
#include <queue>
#include "node.hxx"
-
namespace boost {
template <class T> class shared_ptr;
}
@@ -52,6 +51,10 @@
void set_position (boost::shared_ptr<Pingus::WorldMap::Node> node);
CL_Vector get_pos () { return pos; }
Pingus::WorldMap::Node* get_node ();
+
+private:
+ PingusWorldMapPingus (const PingusWorldMapPingus&);
+ PingusWorldMapPingus operator= (const PingusWorldMapPingus&);
};
#endif
Index: stat.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/stat.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- stat.cxx 22 Aug 2002 02:24:59 -0000 1.5
+++ stat.cxx 23 Aug 2002 15:49:57 -0000 1.6
@@ -17,7 +17,6 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#include "pingus.hxx"
#include <fstream>
#include <iostream>
#include "../system.hxx"
@@ -28,12 +27,37 @@
using namespace Pingus::WorldMap;
-PingusWorldMapNodeStat::PingusWorldMapNodeStat ()
+PingusWorldMapNodeStat::PingusWorldMapNodeStat () : finished(false),
+ accessible(false),
+ id(-1),
+ percentage(25)
{
- id = -1;
- finished = false;
- accessible = false;
- 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)
+{
+}
+
+PingusWorldMapNodeStat
+PingusWorldMapNodeStat::operator= (const PingusWorldMapNodeStat& old)
+{
+ if (this == &old)
+ return *this;
+
+ finished = old.finished;
+ accessible = old.accessible;
+ id = old.id;
+ percentage = old.percentage;
+ levelfile = old.levelfile;
+ checksum = old.checksum;
+
+ return *this;
}
PingusWorldMapStat::PingusWorldMapStat (std::string worldmap_name)
Index: stat.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/stat.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- stat.hxx 2 Jul 2002 13:36:07 -0000 1.4
+++ stat.hxx 23 Aug 2002 15:49:57 -0000 1.5
@@ -28,14 +28,18 @@
class PingusWorldMapNodeStat
{
public:
- PingusWorldMapNodeStat ();
-
- int id;
- std::string levelfile;
- std::string checksum;
bool finished;
bool accessible;
+ int id;
int percentage;
+ std::string levelfile;
+ std::string checksum;
+
+public:
+ PingusWorldMapNodeStat ();
+
+ PingusWorldMapNodeStat (const PingusWorldMapNodeStat& old);
+ PingusWorldMapNodeStat operator= (const PingusWorldMapNodeStat& old);
};
/** Loads a status file and gives you access to the information, which
@@ -68,8 +72,11 @@
/// @return true if the node with the given id is accessible, false otherwise
bool accessible (int id);
- ///
bool empty () { return is_empty; }
+
+private:
+ PingusWorldMapStat (const PingusWorldMapStat&);
+ PingusWorldMapStat operator= (const PingusWorldMapStat&);
};
#endif
Index: worldmap.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/worldmap.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- worldmap.hxx 3 Aug 2002 09:59:23 -0000 1.5
+++ worldmap.hxx 23 Aug 2002 15:49:57 -0000 1.6
@@ -110,6 +110,10 @@
/** Set the pingu to the given node with 'id' */
void set_pingus (int node_id);
+
+ private:
+ WorldMap (const WorldMap&);
+ WorldMap operator= (const WorldMap&);
};
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldmap graph.hxx,1.4,1.5 manager.hxx,1.6,1.7 node.hxx,1.3,1.4 node_data.cxx,1.1,1.2 node_data.hxx,1.5,1.6 pingus.hxx,1.6,1.7 stat.cxx,1.5,1.6 stat.hxx,1.4,1.5 worldmap.hxx,1.5,1.6,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/particles explosive_particle.hxx,1.2,1.3 ground_particle.hxx,1.2,1.3 particle.hxx,1.2,1.3 particle_cache.hxx,1.3,1.4 particle_holder.hxx,1.2,1.3 pingu_particle.hxx,1.3,1.4 rain_generator.hxx,1.2,1.3 rain_particle.hxx,1.2,1.3 smoke_particle.hxx,1.3,1.4 snow_generator.hxx,1.2,1.3 snow_particle.hxx,1.2,1.3 weather_generator.hxx,1.2,1.3
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/input axis.hxx,1.5,1.6 axis_event.hxx,1.2,1.3 axis_factory.hxx,1.3,1.4 axis_pointer.hxx,1.6,1.7 axis_scroller.hxx,1.2,1.3 button.hxx,1.5,1.6 button_axis.hxx,1.4,1.5 button_event.hxx,1.2,1.3 button_factory.hxx,1.3,1.4 controller.cxx,1.19,1.20 controller.hxx,1.10,1.11 double_button.hxx,1.2,1.3 dummy_axis.hxx,1.2,1.3 dummy_button.hxx,1.2,1.3 dummy_pointer.hxx,1.2,1.3 dummy_scroller.hxx,1.2,1.3 event.hxx,1.4,1.5 inverted_axis.hxx,1.5,1.6 inverted_scroller.hxx,1.2,1.3 joystick_axis.hxx,1.4,1.5 joystick_button.hxx,1.3,1.4 joystick_scroller.hxx,1.2,1.3 key_button.hxx,1.3,1.4 key_helper.hxx,1.1,1.2 mouse_axis.hxx,1.5,1.6 mouse_button.hxx,1.3,1.4 mouse_pointer.cxx,1.3,1.4 mouse_pointer.hxx,1.4,1.5 mouse_scroller.cxx,1.2,1.3 mouse_scroller.hxx,1.2,1.3 multiple_axis.hxx,1.3,1.4 multiple_button.hxx,1.5,1.6 multiple_pointer.hxx,1.4,1.5 multiple_scroller.hxx,1.2,1.3 pointer.hxx,1.6,1.7 pointer_event.hxx,1.2,1.3 pointer_factory.hxx,1.1,1.2 pointer_scroller.hxx,1.2,1.3 scroll_event.hxx,1.1,1.2 scroller.hxx,1.3,1.4 scroller_factory.hxx,1.2,1.3 triple_button.hxx,1.2,1.3
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/particles explosive_particle.hxx,1.2,1.3 ground_particle.hxx,1.2,1.3 particle.hxx,1.2,1.3 particle_cache.hxx,1.3,1.4 particle_holder.hxx,1.2,1.3 pingu_particle.hxx,1.3,1.4 rain_generator.hxx,1.2,1.3 rain_particle.hxx,1.2,1.3 smoke_particle.hxx,1.3,1.4 snow_generator.hxx,1.2,1.3 snow_particle.hxx,1.2,1.3 weather_generator.hxx,1.2,1.3
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/input axis.hxx,1.5,1.6 axis_event.hxx,1.2,1.3 axis_factory.hxx,1.3,1.4 axis_pointer.hxx,1.6,1.7 axis_scroller.hxx,1.2,1.3 button.hxx,1.5,1.6 button_axis.hxx,1.4,1.5 button_event.hxx,1.2,1.3 button_factory.hxx,1.3,1.4 controller.cxx,1.19,1.20 controller.hxx,1.10,1.11 double_button.hxx,1.2,1.3 dummy_axis.hxx,1.2,1.3 dummy_button.hxx,1.2,1.3 dummy_pointer.hxx,1.2,1.3 dummy_scroller.hxx,1.2,1.3 event.hxx,1.4,1.5 inverted_axis.hxx,1.5,1.6 inverted_scroller.hxx,1.2,1.3 joystick_axis.hxx,1.4,1.5 joystick_button.hxx,1.3,1.4 joystick_scroller.hxx,1.2,1.3 key_button.hxx,1.3,1.4 key_helper.hxx,1.1,1.2 mouse_axis.hxx,1.5,1.6 mouse_button.hxx,1.3,1.4 mouse_pointer.cxx,1.3,1.4 mouse_pointer.hxx,1.4,1.5 mouse_scroller.cxx,1.2,1.3 mouse_scroller.hxx,1.2,1.3 multiple_axis.hxx,1.3,1.4 multiple_button.hxx,1.5,1.6 multiple_pointer.hxx,1.4,1.5 multiple_scroller.hxx,1.2,1.3 pointer.hxx,1.6,1.7 pointer_event.hxx,1.2,1.3 pointer_factory.hxx,1.1,1.2 pointer_scroller.hxx,1.2,1.3 scroll_event.hxx,1.1,1.2 scroller.hxx,1.3,1.4 scroller_factory.hxx,1.2,1.3 triple_button.hxx,1.2,1.3
- Index(es):