pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/worldobjs conveyor_belt.cxx,1.6,1.7 c


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs conveyor_belt.cxx,1.6,1.7 conveyor_belt.hxx,1.5,1.6 ice_block.cxx,1.7,1.8 ice_block.hxx,1.6,1.7 info_box.cxx,1.4,1.5 info_box.hxx,1.6,1.7 switch_door.cxx,1.6,1.7 switch_door.hxx,1.6,1.7 teleporter.cxx,1.4,1.5 teleporter.hxx,1.7,1.8
Date: 23 Aug 2002 15:49:59 -0000

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

Modified Files:
        conveyor_belt.cxx conveyor_belt.hxx ice_block.cxx 
        ice_block.hxx info_box.cxx info_box.hxx switch_door.cxx 
        switch_door.hxx teleporter.cxx teleporter.hxx 
Log Message:
- added copy constructor/operator= or private declarations
- some cleanup


Index: conveyor_belt.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/conveyor_belt.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- conveyor_belt.cxx   17 Aug 2002 17:56:24 -0000      1.6
+++ conveyor_belt.cxx   23 Aug 2002 15:49:57 -0000      1.7
@@ -26,24 +26,11 @@
 #include "../xml_helper.hxx"
 #include "conveyor_belt.hxx"
 #include "../pingu.hxx"
-#include "../boost/smart_ptr.hpp"
 
 ConveyorBeltData::ConveyorBeltData () : width(5), speed(2)
 {
 }
 
-/** Writte the content of this object formated as xml to the given
-    stream */
-void 
-ConveyorBeltData::write_xml(std::ostream& xml)
-{
-  xml << "  <worldobj type=\"conveyorbelt\">";
-  XMLhelper::write_vector_xml (xml, pos);
-  xml << "    <width>" << width << "</width>\n"
-      << "    <speed>" << speed << "</speed>\n"
-      << "  </worldobj>\n" << std::endl;
-}
-
 ConveyorBeltData::ConveyorBeltData (xmlDocPtr doc, xmlNodePtr cur)
 {
   cur = cur->children;
@@ -71,6 +58,40 @@
        std::cout << "ConveyorBeltData::create (): Unhandled " << cur->name << 
std::endl;
       cur = cur->next;
     }
+}
+
+ConveyorBeltData::ConveyorBeltData (const ConveyorBeltData& old) : 
WorldObjData(old),
+                                                                   
pos(old.pos),
+                                                                  
width(old.width),
+                                                                  
speed(old.speed)
+{
+}
+
+ConveyorBeltData
+ConveyorBeltData::operator= (const ConveyorBeltData& old)
+{
+  if (this == &old)
+    return *this;
+    
+  WorldObjData::operator=(old);
+  
+  pos   = old.pos;
+  width = old.width;
+  speed = old.speed;
+  
+  return *this;
+}
+
+/** Writte the content of this object formated as xml to the given
+    stream */
+void 
+ConveyorBeltData::write_xml(std::ostream& xml)
+{
+  xml << "  <worldobj type=\"conveyorbelt\">";
+  XMLhelper::write_vector_xml (xml, pos);
+  xml << "    <width>" << width << "</width>\n"
+      << "    <speed>" << speed << "</speed>\n"
+      << "  </worldobj>\n" << std::endl;
 }
 
 WorldObj* 

Index: conveyor_belt.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/conveyor_belt.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- conveyor_belt.hxx   2 Jul 2002 10:42:39 -0000       1.5
+++ conveyor_belt.hxx   23 Aug 2002 15:49:57 -0000      1.6
@@ -33,6 +33,9 @@
 
   ConveyorBeltData ();
   ConveyorBeltData (xmlDocPtr doc, xmlNodePtr cur);
+  
+  ConveyorBeltData (const ConveyorBeltData& old);
+  ConveyorBeltData operator= (const ConveyorBeltData& old);
 
   /** Write the content of this object formatted as xml to the given
       stream */
@@ -62,6 +65,10 @@
   void draw_colmap();
   void update(float delta);
   float get_z_pos() const { return pos.z; }
+  
+private:
+  ConveyorBelt (const ConveyorBelt&);
+  ConveyorBelt operator= (const ConveyorBelt&);
 };
 
 class EditorConveyorBeltObj : public RectEditorObj,
@@ -100,11 +107,12 @@
 
   void make_larger ();
   void make_smaller ();
+  
+private:
+  EditorConveyorBeltObj (const EditorConveyorBeltObj&);
+  EditorConveyorBeltObj operator= (const EditorConveyorBeltObj&);
 };
 
 #endif
 
 /* EOF */
-
-
-

Index: ice_block.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/ice_block.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ice_block.cxx       2 Jul 2002 10:42:39 -0000       1.7
+++ ice_block.cxx       23 Aug 2002 15:49:57 -0000      1.8
@@ -27,7 +27,6 @@
 #include "../game_time.hxx"
 #include "ice_block.hxx"
 #include "../pingu.hxx"
-#include "../boost/smart_ptr.hpp"
 #include "../game_time.hxx"
 
 IceBlockData::IceBlockData () : width(1)

Index: ice_block.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/ice_block.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ice_block.hxx       16 Aug 2002 13:03:36 -0000      1.6
+++ ice_block.hxx       23 Aug 2002 15:49:57 -0000      1.7
@@ -47,6 +47,10 @@
 
   /** Create an EditorObj from the given data object */
   EditorObjLst create_EditorObj ();
+  
+private:
+  IceBlockData (const IceBlockData&);
+  IceBlockData operator= (const IceBlockData&);
 };
 
 class IceBlock : public IceBlockData, 
@@ -59,10 +63,14 @@
 public:
   IceBlock (const IceBlockData& data);
 
-  float get_z_pos() const { return 100; }
-  void draw_colmap();
-  void draw_offset(int x, int y, float s = 1.0);
-  void update(float delta);
+  float get_z_pos () const { return 100; }
+  void draw_colmap ();
+  void draw_offset (int x, int y, float s = 1.0);
+  void update (float delta);
+  
+private:
+  IceBlock (const IceBlock&);
+  IceBlock operator= (const IceBlock&);
 };
 
 
@@ -80,6 +88,10 @@
   void write_xml(std::ostream& xml) { IceBlockData::write_xml (xml); }
   EditorObj* duplicate();
   std::string status_line();
+  
+private:
+  EditorIceBlockObj (const EditorIceBlockObj&);
+  EditorIceBlockObj operator= (const EditorIceBlockObj&);
 };
 
 #endif

Index: info_box.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/info_box.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- info_box.cxx        2 Jul 2002 10:42:39 -0000       1.4
+++ info_box.cxx        23 Aug 2002 15:49:57 -0000      1.5
@@ -26,7 +26,6 @@
 #include "../xml_helper.hxx"
 #include "info_box.hxx"
 #include "../pingu.hxx"
-#include "../boost/smart_ptr.hpp"
 
 InfoBoxData::InfoBoxData ()
 {
@@ -75,6 +74,28 @@
     }
 }
 
+InfoBoxData::InfoBoxData (const InfoBoxData& old) : WorldObjData(old),
+                                                    info_text(old.info_text),
+                                                   pos(old.pos),
+                                                   text_pos(old.text_pos)
+{
+}
+
+InfoBoxData
+InfoBoxData::operator= (const InfoBoxData& old)
+{
+  if (this == &old)
+    return *this;
+  
+  WorldObjData::operator=(old);
+  
+  info_text = old.info_text;
+  pos       = old.pos;
+  text_pos  = old.text_pos;
+  
+  return *this;
+}
+
 void 
 InfoBoxData::write_xml(std::ostream& xml)
 {
@@ -138,6 +159,23 @@
     SpriteEditorObj ("infobox", "worldobjs", pos)
 {
   sprite.set_align_center_bottom ();
+}
+
+EditorInfoBox::EditorInfoBox (const EditorInfoBox& old) : InfoBoxData(old), 
+                                                          SpriteEditorObj(old)
+{
+}
+
+EditorInfoBox
+EditorInfoBox::operator= (const EditorInfoBox& old)
+{
+  if (this == &old)
+    return *this;
+    
+  InfoBoxData::operator=(old);
+  SpriteEditorObj::operator=(old);
+  
+  return *this;
 }
 
 EditorObjLst

Index: info_box.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/info_box.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- info_box.hxx        2 Jul 2002 10:42:39 -0000       1.6
+++ info_box.hxx        23 Aug 2002 15:49:57 -0000      1.7
@@ -32,14 +32,19 @@
 class InfoBoxData : public WorldObjData
 {
 public:
-  InfoBoxData ();
-  InfoBoxData (xmlDocPtr doc, xmlNodePtr cur);
-  ~InfoBoxData ();
-
   std::string info_text;
   CL_Vector pos;
   CL_Vector text_pos;
 
+public:
+  InfoBoxData ();
+  InfoBoxData (xmlDocPtr doc, xmlNodePtr cur);
+  
+  InfoBoxData (const InfoBoxData& old);
+  InfoBoxData operator= (const InfoBoxData& old);
+  
+  ~InfoBoxData ();
+
   void write_xml(std::ostream& xml);  
   WorldObj* create_WorldObj();
   EditorObjLst create_EditorObj();
@@ -59,6 +64,10 @@
   void draw_offset (int x, int y, float s = 1.0);
   void update (float delta);
   float get_z_pos() const { return pos.z; }
+  
+private:
+  InfoBox (const InfoBox&);
+  InfoBox operator= (const InfoBox&);
 };
 
 class EditorInfoBox : public InfoBoxData,
@@ -72,6 +81,10 @@
   void write_xml(std::ostream& xml) { InfoBoxData::write_xml (xml); }
   EditorObj* duplicate();
   std::string status_line ();
+  
+private:
+  EditorInfoBox (const EditorInfoBox& old);
+  EditorInfoBox operator= (const EditorInfoBox& old);
 };
 
 #endif

Index: switch_door.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/switch_door.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- switch_door.cxx     17 Aug 2002 17:56:24 -0000      1.6
+++ switch_door.cxx     23 Aug 2002 15:49:57 -0000      1.7
@@ -26,11 +26,9 @@
 #include "../xml_helper.hxx"
 #include "switch_door.hxx"
 #include "../pingu.hxx"
-#include "../boost/smart_ptr.hpp"
 
-SwitchDoorData::SwitchDoorData ()
+SwitchDoorData::SwitchDoorData () : door_height(10)
 {
-  door_height = 10;
 }
 
 SwitchDoorData::SwitchDoorData (xmlDocPtr doc, xmlNodePtr cur)
@@ -94,6 +92,28 @@
     }
 }
 
+SwitchDoorData::SwitchDoorData (const SwitchDoorData& old) : WorldObjData(old),
+                                                             
door_pos(old.door_pos),
+                                                            
switch_pos(old.switch_pos),
+                                                            
door_height(old.door_height)
+{
+}
+
+SwitchDoorData 
+SwitchDoorData::operator= (const SwitchDoorData& old)
+{
+  if (this == &old)
+    return *this;
+    
+  WorldObjData::operator=(old);
+  
+  door_pos    = old.door_pos;
+  switch_pos  = old.switch_pos;
+  door_height = old.door_height;
+  
+  return *this;
+}
+  
 void 
 SwitchDoorData::write_xml(std::ostream& xml)
 {

Index: switch_door.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/switch_door.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- switch_door.hxx     2 Jul 2002 10:42:39 -0000       1.6
+++ switch_door.hxx     23 Aug 2002 15:49:57 -0000      1.7
@@ -30,8 +30,6 @@
     opened by a switch */
 class SwitchDoorData : public WorldObjData
 {
-private:
-  
 public:
   /// The upper/middle pos of the door 
   CL_Vector door_pos;
@@ -44,6 +42,9 @@
 
   SwitchDoorData ();
   SwitchDoorData (xmlDocPtr doc, xmlNodePtr cur);
+  
+  SwitchDoorData (const SwitchDoorData& old);
+  SwitchDoorData operator= (const SwitchDoorData& old);
 
   /** Write the content of this object formatted as xml to the given
       stream */
@@ -82,6 +83,10 @@
   void update(float delta);
   /// The switch and the door should stay above the pingus
   float get_z_pos() const { return 100; }
+  
+private:
+  SwitchDoor (const SwitchDoor&);
+  SwitchDoor operator= (const SwitchDoor&);
 };
 
 class EditorSwitchDoorObj;
@@ -100,6 +105,10 @@
 
   void write_xml (std::ostream& /*xml*/) {}
   std::string status_line();
+  
+private:
+  EditorSwitchDoorSwitchObj (const EditorSwitchDoorSwitchObj&);
+  EditorSwitchDoorSwitchObj operator= (const EditorSwitchDoorSwitchObj&);
 };
 
 class EditorSwitchDoorObj : public SwitchDoorData,
@@ -134,6 +143,10 @@
   void draw (EditorView * view);
   void save_xml (std::ostream& xml);
   std::string status_line();
+  
+private:
+  EditorSwitchDoorObj (const EditorSwitchDoorObj&);
+  EditorSwitchDoorObj operator= (const EditorSwitchDoorObj&);
 };
 
 #endif

Index: teleporter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/teleporter.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- teleporter.cxx      2 Jul 2002 10:42:39 -0000       1.4
+++ teleporter.cxx      23 Aug 2002 15:49:57 -0000      1.5
@@ -26,10 +26,24 @@
 #include "teleporter.hxx"
 #include "../pingu.hxx"
 
-TeleporterData::TeleporterData (const TeleporterData& data) : 
WorldObjData(data)
+TeleporterData::TeleporterData (const TeleporterData& data) : 
WorldObjData(data),
+                                                              pos(data.pos),
+                                                             
target_pos(data.target_pos)
+{
+}
+
+TeleporterData
+TeleporterData::operator= (const TeleporterData& data)
 {
+  if (this == &data)
+    return *this;
+
+  WorldObjData::operator=(data);
+  
   pos = data.pos;
   target_pos = data.target_pos;
+
+  return *this;
 }
 
 void 

Index: teleporter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/teleporter.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- teleporter.hxx      16 Aug 2002 13:03:36 -0000      1.7
+++ teleporter.hxx      23 Aug 2002 15:49:57 -0000      1.8
@@ -37,6 +37,7 @@
   TeleporterData (xmlDocPtr doc, xmlNodePtr cur);
 
   TeleporterData (const TeleporterData& data);
+  TeleporterData operator= (const TeleporterData& data);
   
   /** Write the content of this object formatted as xml to the given
       stream */
@@ -63,6 +64,10 @@
   void draw_offset (int x, int y, float s = 1.0);
   void update(float delta);
   float get_z_pos() const { return (int) pos.z; }
+  
+private:
+  Teleporter (const Teleporter&);
+  Teleporter operator= (const Teleporter&);
 };
 
 class EditorTeleporterTargetObj;
@@ -90,6 +95,10 @@
   void draw (EditorView * view);
   void save_xml (std::ostream& xml);
   std::string status_line();
+  
+private:
+  EditorTeleporterObj (const EditorTeleporterObj&);
+  EditorTeleporterObj operator= (const EditorTeleporterObj&);
 };
 
 /** A pseudo object to represent the teleporter target; all the
@@ -109,8 +118,12 @@
   EditorObj* duplicate() { return teleporter->duplicate (); }
 
   /// The saving will be done in EditorTeleporterObj::save_xml
-  void write_xml (std::ostream& /*xml*/) {}
+  void write_xml (std::ostream& xml) { UNUSED_ARG(xml); }
   std::string status_line();
+  
+private:
+  EditorTeleporterTargetObj (const EditorTeleporterTargetObj&);
+  EditorTeleporterTargetObj operator= (const EditorTeleporterTargetObj&);
 };
 
 #endif





reply via email to

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