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 ConveyorBelt.cc,1.33,1.34 C


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs ConveyorBelt.cc,1.33,1.34 ConveyorBelt.hh,1.20,1.21 IceBlock.cc,1.27,1.28 IceBlock.hh,1.21,1.22 InfoBox.cc,1.6,1.7 InfoBox.hh,1.5,1.6 SwitchDoor.cc,1.29,1.30 SwitchDoor.hh,1.22,1.23 Teleporter.cc,1.36,1.37 Teleporter.hh,1.27,1.28
Date: 9 Jun 2002 13:03:14 -0000

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

Modified Files:
        ConveyorBelt.cc ConveyorBelt.hh IceBlock.cc IceBlock.hh 
        InfoBox.cc InfoBox.hh SwitchDoor.cc SwitchDoor.hh 
        Teleporter.cc Teleporter.hh 
Log Message:
- replaced shared_ptr<WorldObjData> with WorldObjData*
- the changes trigger a bug in the owner_id, which causes it to be 
uninitialized, not sure if my new code causes this, or just triggers it (since 
I have seen that before)

Index: ConveyorBelt.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/ConveyorBelt.cc,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- ConveyorBelt.cc     8 Jun 2002 21:43:36 -0000       1.33
+++ ConveyorBelt.cc     9 Jun 2002 13:03:11 -0000       1.34
@@ -44,11 +44,8 @@
         << "  </worldobj>\n" << std::endl;
 }
 
-boost::shared_ptr<WorldObjData>
-ConveyorBeltData::create(xmlDocPtr doc, xmlNodePtr cur)
+ConveyorBeltData::ConveyorBeltData (xmlDocPtr doc, xmlNodePtr cur)
 {
-  ConveyorBeltData* data = new ConveyorBeltData ();
-
   cur = cur->children;
   
   while (cur != NULL)
@@ -60,22 +57,20 @@
        }
       else if (strcmp((char*)cur->name, "position") == 0)
        {
-         data->pos = XMLhelper::parse_vector (doc, cur);
+         pos = XMLhelper::parse_vector (doc, cur);
        }
       else if (strcmp((char*)cur->name, "width") == 0)
        {
-         data->width = XMLhelper::parse_int (doc, cur);
+         width = XMLhelper::parse_int (doc, cur);
        }
       else if (strcmp((char*)cur->name, "speed") == 0)
        {
-         data->speed = XMLhelper::parse_int (doc, cur);
+         speed = XMLhelper::parse_int (doc, cur);
        }
       else
        std::cout << "ConveyorBeltData::create (): Unhandled " << cur->name << 
std::endl;
       cur = cur->next;
     }
-  
-  return boost::shared_ptr<WorldObjData>(data); 
 }
 
 boost::shared_ptr<WorldObj> 

Index: ConveyorBelt.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/ConveyorBelt.hh,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- ConveyorBelt.hh     7 Jun 2002 14:50:35 -0000       1.20
+++ ConveyorBelt.hh     9 Jun 2002 13:03:11 -0000       1.21
@@ -33,12 +33,12 @@
   double speed;
 
   ConveyorBeltData ();
+  ConveyorBeltData (xmlDocPtr doc, xmlNodePtr cur);
 
   /** Write the content of this object formatted as xml to the given
       stream */
   void write_xml(std::ofstream* xml);
   ///
-  static boost::shared_ptr<WorldObjData> create(xmlDocPtr doc, xmlNodePtr cur);
 
   /** Create an WorldObj from the given data object */
   boost::shared_ptr<WorldObj> create_WorldObj ();

Index: IceBlock.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/IceBlock.cc,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- IceBlock.cc 8 Jun 2002 23:11:09 -0000       1.27
+++ IceBlock.cc 9 Jun 2002 13:03:11 -0000       1.28
@@ -41,11 +41,8 @@
 }
 
 ///
-boost::shared_ptr<WorldObjData>
-IceBlockData::create(xmlDocPtr doc, xmlNodePtr cur)
+IceBlockData::IceBlockData (xmlDocPtr doc, xmlNodePtr cur)
 {
-  IceBlockData* data = new IceBlockData ();
-
   cur = cur->children;
   
   while (cur != NULL)
@@ -57,18 +54,16 @@
        }
       else if (strcmp((char*)cur->name, "position") == 0)
        {
-         data->pos = XMLhelper::parse_vector (doc, cur);
+         pos = XMLhelper::parse_vector (doc, cur);
        }
       else if (strcmp((char*)cur->name, "width") == 0)
        {
-         data->width = XMLhelper::parse_int (doc, cur);
+         width = XMLhelper::parse_int (doc, cur);
        }
       else
        std::cout << "IceBlockData::creata (): Unhandled " << cur->name << 
std::endl;
       cur = cur->next;
     }
-  
-  return boost::shared_ptr<WorldObjData>(data);
 }
 
 boost::shared_ptr<WorldObj> 

Index: IceBlock.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/IceBlock.hh,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- IceBlock.hh 8 Jun 2002 23:11:09 -0000       1.21
+++ IceBlock.hh 9 Jun 2002 13:03:11 -0000       1.22
@@ -43,13 +43,12 @@
   int last_contact;
 
   IceBlockData ();
+  IceBlockData (xmlDocPtr doc, xmlNodePtr cur);
 
   /** Write the content of this object formatted as xml to the given
       stream */
   void write_xml(std::ofstream* xml);
-  ///
-  static boost::shared_ptr<WorldObjData> create(xmlDocPtr doc, xmlNodePtr cur);
-
+  
   /** Create an WorldObj from the given data object */
   boost::shared_ptr<WorldObj> create_WorldObj ();
 

Index: InfoBox.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/InfoBox.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- InfoBox.cc  8 Jun 2002 21:43:37 -0000       1.6
+++ InfoBox.cc  9 Jun 2002 13:03:11 -0000       1.7
@@ -45,11 +45,8 @@
   return lst;
 }
 
-boost::shared_ptr<WorldObjData>
-InfoBoxData::create(xmlDocPtr doc, xmlNodePtr cur)
+InfoBoxData::InfoBoxData (xmlDocPtr doc, xmlNodePtr cur)
 {
-  InfoBoxData* data = new InfoBoxData ();
-
   cur = cur->children;
   
   while (cur != NULL)
@@ -61,18 +58,16 @@
        }
       else if (strcmp((char*)cur->name, "position") == 0)
        {
-         data->pos = XMLhelper::parse_vector (doc, cur);
+         pos = XMLhelper::parse_vector (doc, cur);
        }
       else if (strcmp((char*)cur->name, "info-text") == 0)
        {
-         data->info_text = XMLhelper::parse_string (doc, cur);
+         info_text = XMLhelper::parse_string (doc, cur);
        }
       else
        std::cout << "InfoBox::creata (): Unhandled " << cur->name << std::endl;
       cur = cur->next;
     }
-
-  return boost::shared_ptr<WorldObjData>(data);
 }
 
 void 

Index: InfoBox.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/InfoBox.hh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- InfoBox.hh  8 Jun 2002 23:11:09 -0000       1.5
+++ InfoBox.hh  9 Jun 2002 13:03:11 -0000       1.6
@@ -31,6 +31,7 @@
 {
 public:
   InfoBoxData ();
+  InfoBoxData (xmlDocPtr doc, xmlNodePtr cur);
   ~InfoBoxData ();
 
   std::string info_text;
@@ -40,7 +41,6 @@
   void write_xml(std::ofstream* xml);  
   boost::shared_ptr<WorldObj> create_WorldObj();
   EditorObjLst create_EditorObj();
-  static boost::shared_ptr<WorldObjData> create(xmlDocPtr doc, xmlNodePtr cur);
 };
 
 class InfoBox : public InfoBoxData,

Index: SwitchDoor.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/SwitchDoor.cc,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- SwitchDoor.cc       8 Jun 2002 23:11:09 -0000       1.29
+++ SwitchDoor.cc       9 Jun 2002 13:03:11 -0000       1.30
@@ -30,25 +30,8 @@
   door_height = 10;
 }
 
-void 
-SwitchDoorData::write_xml(std::ofstream* xml)
-{
-  (*xml) << "  <worldobj type=\"switchdoor\">\n";
-  (*xml) << "    <switch>\n";
-  XMLhelper::write_vector_xml (xml, switch_pos);
-  (*xml) << "    </switch>\n"
-        << "    <door>\n"
-        << "    <height>\n" << door_height << "</height>\n";
-  XMLhelper::write_vector_xml (xml, door_pos);
-  (*xml) << "    </door>\n"
-        << "  </worldobj>\n" << std::endl;
-}
-
-boost::shared_ptr<WorldObjData>
-SwitchDoorData::create(xmlDocPtr doc, xmlNodePtr cur)
+SwitchDoorData::SwitchDoorData (xmlDocPtr doc, xmlNodePtr cur)
 {
-  SwitchDoorData* data = new SwitchDoorData ();
-
   cur = cur->children;
   
   while (cur != NULL)
@@ -71,7 +54,7 @@
              
              if (strcmp((char*)subcur->name, "position") == 0)
                {
-                 data->switch_pos = XMLhelper::parse_vector (doc, subcur);
+                 switch_pos = XMLhelper::parse_vector (doc, subcur);
                }
              else
                std::cout << "SwitchDoorData: switch: Unhandled " << 
subcur->name << std::endl;
@@ -92,11 +75,11 @@
              
              if (strcmp((char*)subcur->name, "position") == 0)
                {
-                 data->door_pos = XMLhelper::parse_vector (doc, subcur);
+                 door_pos = XMLhelper::parse_vector (doc, subcur);
                }
              else if (strcmp((char*)subcur->name, "height") == 0)
                {
-                 data->door_height = XMLhelper::parse_int (doc, subcur);
+                 door_height = XMLhelper::parse_int (doc, subcur);
                }
              else
                std::cout << "SwitchDoor::door: Unhandled " << subcur->name << 
std::endl;
@@ -106,8 +89,20 @@
        }
       cur = cur->next;
     }
-  
-  return   boost::shared_ptr<WorldObjData>(data);
+}
+
+void 
+SwitchDoorData::write_xml(std::ofstream* xml)
+{
+  (*xml) << "  <worldobj type=\"switchdoor\">\n";
+  (*xml) << "    <switch>\n";
+  XMLhelper::write_vector_xml (xml, switch_pos);
+  (*xml) << "    </switch>\n"
+        << "    <door>\n"
+        << "    <height>\n" << door_height << "</height>\n";
+  XMLhelper::write_vector_xml (xml, door_pos);
+  (*xml) << "    </door>\n"
+        << "  </worldobj>\n" << std::endl;
 }
 
 /** Create an WorldObj from the given data object */

Index: SwitchDoor.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/SwitchDoor.hh,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- SwitchDoor.hh       8 Jun 2002 23:11:09 -0000       1.22
+++ SwitchDoor.hh       9 Jun 2002 13:03:11 -0000       1.23
@@ -44,13 +44,12 @@
   int door_height;
 
   SwitchDoorData ();
+  SwitchDoorData (xmlDocPtr doc, xmlNodePtr cur);
 
   /** Write the content of this object formatted as xml to the given
       stream */
   void write_xml(std::ofstream* xml);
-  ///
-  static boost::shared_ptr<WorldObjData> create(xmlDocPtr doc, xmlNodePtr cur);
-
+  
   /** Create an WorldObj from the given data object */
   boost::shared_ptr<WorldObj> create_WorldObj ();
 

Index: Teleporter.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/Teleporter.cc,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- Teleporter.cc       8 Jun 2002 21:43:37 -0000       1.36
+++ Teleporter.cc       9 Jun 2002 13:03:11 -0000       1.37
@@ -41,11 +41,8 @@
   (*xml) << "  </worldobj>" << std::endl;
 }
 
-boost::shared_ptr<WorldObjData>
-TeleporterData::create(xmlDocPtr doc, xmlNodePtr cur)
+TeleporterData::TeleporterData (xmlDocPtr doc, xmlNodePtr cur)
 {
-  TeleporterData* data = new TeleporterData ();
-  
   cur = cur->children;
   
   while (cur != NULL)
@@ -58,7 +55,7 @@
 
       if (strcmp((char*)cur->name, "position") == 0)
        {
-         data->pos = XMLhelper::parse_vector (doc, cur);
+         pos = XMLhelper::parse_vector (doc, cur);
        }
       else if (strcmp((char*)cur->name, "target") == 0)
        {
@@ -67,7 +64,7 @@
          if (xmlIsBlankNode(ncur)) ncur = ncur->next;
            
          if (ncur != NULL)
-           data->target_pos = XMLhelper::parse_vector (doc, ncur);
+           target_pos = XMLhelper::parse_vector (doc, ncur);
          else
            std::cout << "TeleporterData::create (): <target> is empty" << 
std::endl;
        }
@@ -78,7 +75,6 @@
 
       cur = cur->next;
     }
-  return boost::shared_ptr<WorldObjData> (data);
 }
 
 boost::shared_ptr<WorldObj> 

Index: Teleporter.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/Teleporter.hh,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- Teleporter.hh       8 Jun 2002 20:19:55 -0000       1.27
+++ Teleporter.hh       9 Jun 2002 13:03:11 -0000       1.28
@@ -43,14 +43,14 @@
   CL_Vector target_pos;
   
   TeleporterData () {}
+  TeleporterData (xmlDocPtr doc, xmlNodePtr cur);
+
   TeleporterData (const TeleporterData& data);
   
   /** Write the content of this object formatted as xml to the given
       stream */
   void write_xml(std::ofstream* xml);
   
-  static boost::shared_ptr<WorldObjData> create(xmlDocPtr doc, xmlNodePtr cur);
-
   /** Create an WorldObj from the given data object */
   boost::shared_ptr<WorldObj> create_WorldObj ();
 




reply via email to

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