pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/backgrounds SolidColorBackground.cc,1


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/backgrounds SolidColorBackground.cc,1.13,1.14 SolidColorBackground.hh,1.16,1.17 StarfieldBackground.cc,1.20,1.21 StarfieldBackground.hh,1.16,1.17 SurfaceBackgroundData.cc,1.18,1.19 SurfaceBackgroundData.hh,1.15,1.16 ThunderstormBackgroundData.cc,1.11,1.12 ThunderstormBackgroundData.hh,1.8,1.9
Date: 9 Jun 2002 13:03:13 -0000

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

Modified Files:
        SolidColorBackground.cc SolidColorBackground.hh 
        StarfieldBackground.cc StarfieldBackground.hh 
        SurfaceBackgroundData.cc SurfaceBackgroundData.hh 
        ThunderstormBackgroundData.cc ThunderstormBackgroundData.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: SolidColorBackground.cc
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/SolidColorBackground.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- SolidColorBackground.cc     8 Jun 2002 23:11:08 -0000       1.13
+++ SolidColorBackground.cc     9 Jun 2002 13:03:11 -0000       1.14
@@ -27,11 +27,8 @@
   (*xml) << "<worldobj type=\"solidcolor-background\"></worldobj>" << 
std::endl;
 }
 
-boost::shared_ptr<WorldObjData> 
-SolidColorBackgroundData::create (xmlDocPtr doc, xmlNodePtr cur)
+SolidColorBackgroundData::SolidColorBackgroundData(xmlDocPtr doc, xmlNodePtr 
cur)
 {
-  SolidColorBackgroundData* data = new SolidColorBackgroundData ();
-
   cur = cur->children;
   while (cur != NULL)
     {
@@ -43,7 +40,7 @@
 
       if (strcmp ((char*) cur->name, "color") == 0)
        {
-         data->color = XMLhelper::parse_color (doc, cur);
+         color = XMLhelper::parse_color (doc, cur);
        }
       else
        {
@@ -51,7 +48,6 @@
        }
       cur = cur->next;
     }
-  return boost::shared_ptr<WorldObjData>(data);
 }
 
 boost::shared_ptr<WorldObj> 

Index: SolidColorBackground.hh
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/SolidColorBackground.hh,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- SolidColorBackground.hh     8 Jun 2002 23:11:08 -0000       1.16
+++ SolidColorBackground.hh     9 Jun 2002 13:03:11 -0000       1.17
@@ -38,12 +38,13 @@
   // FIXME: Add z_pos handling here
 
   SolidColorBackgroundData() {}
+  SolidColorBackgroundData(xmlDocPtr doc, xmlNodePtr cur);
+
   virtual ~SolidColorBackgroundData() {}
 
   /** Writte the content of this object formated as xml to the given
       stream */
   virtual void write_xml(std::ofstream* xml);
-  static boost::shared_ptr<WorldObjData> create (xmlDocPtr doc, xmlNodePtr 
cur);
 
   boost::shared_ptr<WorldObj> create_WorldObj();
   EditorObjLst create_EditorObj();

Index: StarfieldBackground.cc
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/StarfieldBackground.cc,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- StarfieldBackground.cc      8 Jun 2002 20:19:54 -0000       1.20
+++ StarfieldBackground.cc      9 Jun 2002 13:03:11 -0000       1.21
@@ -43,14 +43,11 @@
         << std::endl;
 }
  
-boost::shared_ptr<WorldObjData>
-StarfieldBackgroundData::create(xmlDocPtr /*doc*/, xmlNodePtr cur)
+StarfieldBackgroundData::StarfieldBackgroundData (xmlDocPtr /*doc*/, 
xmlNodePtr cur)
 {
-  StarfieldBackgroundData* data = new StarfieldBackgroundData ();
-
-  data->small_stars_count = 100;
-  data->middle_stars_count = 50;
-  data->large_stars_count = 25;
+  small_stars_count = 100;
+  middle_stars_count = 50;
+  large_stars_count = 25;
 
   cur = cur->children;
 
@@ -67,7 +64,7 @@
          char* count = (char*)xmlGetProp(cur, (xmlChar*)"count");
          if (count)
            {
-             data->small_stars_count = StringConverter::to_int(count);
+             small_stars_count = StringConverter::to_int(count);
              free (count);
            }
        }
@@ -76,7 +73,7 @@
          char* count = (char*)xmlGetProp(cur, (xmlChar*)"count");
          if (count)
            {
-             data->middle_stars_count = StringConverter::to_int(count);
+             middle_stars_count = StringConverter::to_int(count);
              free (count);
            }     
        }
@@ -85,7 +82,7 @@
          char* count = (char*)xmlGetProp(cur, (xmlChar*)"count");
          if (count)
            {
-             data->large_stars_count = StringConverter::to_int(count);
+             large_stars_count = StringConverter::to_int(count);
              free (count);
            }     
        }
@@ -95,8 +92,6 @@
        } 
       cur = cur->next;
     }
-
-    return boost::shared_ptr<WorldObjData>(data);
 }
 
 boost::shared_ptr<WorldObj> 

Index: StarfieldBackground.hh
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/StarfieldBackground.hh,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- StarfieldBackground.hh      8 Jun 2002 23:11:08 -0000       1.16
+++ StarfieldBackground.hh      9 Jun 2002 13:03:11 -0000       1.17
@@ -35,6 +35,7 @@
   int large_stars_count;
 
   StarfieldBackgroundData ();
+  StarfieldBackgroundData (xmlDocPtr /*doc*/, xmlNodePtr cur);
   virtual ~StarfieldBackgroundData () {}
 
   void write_xml(std::ofstream* xml);

Index: SurfaceBackgroundData.cc
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/SurfaceBackgroundData.cc,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- SurfaceBackgroundData.cc    8 Jun 2002 23:11:08 -0000       1.18
+++ SurfaceBackgroundData.cc    9 Jun 2002 13:03:11 -0000       1.19
@@ -60,12 +60,9 @@
          << std::endl;
 }
 
-boost::shared_ptr<WorldObjData>
-SurfaceBackgroundData::create(xmlDocPtr doc, xmlNodePtr cur)
+SurfaceBackgroundData::SurfaceBackgroundData(xmlDocPtr doc, xmlNodePtr cur)
 {
-  SurfaceBackgroundData* background = new SurfaceBackgroundData ();
-
-  background->pos.z = -150;
+  pos.z = -150;
 
   cur = cur->children;  
   while (cur != NULL)
@@ -78,39 +75,39 @@
 
       if (strcmp((char*)cur->name, "surface") == 0)
        {
-         background->desc = XMLhelper::parse_surface(doc, cur);
+         desc = XMLhelper::parse_surface(doc, cur);
        }
       else if (strcmp((char*)cur->name, "color") == 0)
        {
-         background->color = XMLhelper::parse_color(doc, cur);
+         color = XMLhelper::parse_color(doc, cur);
        }
       else if (strcmp((char*)cur->name, "para-x") == 0)
        {
-         background->para_x = XMLhelper::parse_float(doc, cur);
+         para_x = XMLhelper::parse_float(doc, cur);
        }
       else if (strcmp((char*)cur->name, "para-y") == 0)
        {
-         background->para_y = XMLhelper::parse_float(doc, cur);
+         para_y = XMLhelper::parse_float(doc, cur);
        }
       else if (strcmp((char*)cur->name, "scroll-x") == 0)
        {
-         background->scroll_x = XMLhelper::parse_float(doc, cur);
+         scroll_x = XMLhelper::parse_float(doc, cur);
        }
       else if (strcmp((char*)cur->name, "scroll-y") == 0)
        {
-         background->scroll_y = XMLhelper::parse_float(doc, cur);
+         scroll_y = XMLhelper::parse_float(doc, cur);
        }
       else if (strcmp((char*)cur->name, "stretch-x") == 0)
        {
-         background->stretch_x = XMLhelper::parse_float(doc, cur);
+         stretch_x = XMLhelper::parse_float(doc, cur);
        }
       else if (strcmp((char*)cur->name, "stretch-y") == 0)
        {
-         background->stretch_y = XMLhelper::parse_float(doc, cur);
+         stretch_y = XMLhelper::parse_float(doc, cur);
        }
       else if (strcmp((char*)cur->name, "position") == 0)
        {
-         background->pos = XMLhelper::parse_vector(doc, cur);  
+         pos = XMLhelper::parse_vector(doc, cur);  
        }
       else
        {
@@ -118,7 +115,6 @@
        }
       cur = cur->next;
     }      
-  return boost::shared_ptr<WorldObjData>(background);
 }
 
 boost::shared_ptr<WorldObj> 

Index: SurfaceBackgroundData.hh
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/SurfaceBackgroundData.hh,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- SurfaceBackgroundData.hh    8 Jun 2002 21:48:49 -0000       1.15
+++ SurfaceBackgroundData.hh    9 Jun 2002 13:03:11 -0000       1.16
@@ -67,6 +67,11 @@
   /// Init all fields with some usefull defaults values.
   SurfaceBackgroundData();
   
+  /** Parse the xml snip and return a newly allocated
+      SurfaceBackgroundData*, the user is responsible to delete the
+      object */
+  SurfaceBackgroundData(xmlDocPtr doc, xmlNodePtr cur);
+
   /// Empty destructor
   virtual ~SurfaceBackgroundData();
 
@@ -74,11 +79,6 @@
       stream */
   void write_xml(std::ofstream* xml);
   
-  /** Parse the xml snip and return a newly allocated
-      SurfaceBackgroundData*, the user is responsible to delete the
-      object */
-  static boost::shared_ptr<WorldObjData> create(xmlDocPtr doc, xmlNodePtr cur);
-
   boost::shared_ptr<WorldObj> create_WorldObj();
   EditorObjLst create_EditorObj();
 };

Index: ThunderstormBackgroundData.cc
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/ThunderstormBackgroundData.cc,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ThunderstormBackgroundData.cc       8 Jun 2002 20:19:54 -0000       1.11
+++ ThunderstormBackgroundData.cc       9 Jun 2002 13:03:11 -0000       1.12
@@ -32,11 +32,8 @@
         << "</background>" << std::endl;
 }
 
-boost::shared_ptr<WorldObjData>
-ThunderstormBackgroundData::create(xmlDocPtr doc, xmlNodePtr cur)
+ThunderstormBackgroundData::ThunderstormBackgroundData (xmlDocPtr doc, 
xmlNodePtr cur)
 {
-  ThunderstormBackgroundData* data = new ThunderstormBackgroundData ();
-
   cur = cur->children; 
   while (cur != NULL)
     {
@@ -46,13 +43,11 @@
       }
 
       if (strcmp ((char*) cur->name, "position") == 0) {
-       data->pos = XMLhelper::parse_vector (doc, cur);
+       pos = XMLhelper::parse_vector (doc, cur);
       } else {
        std::cout << "ThunderstormBackgroundData::create(xmlDocPtr doc, 
xmlNodePtr cur) error" << std::endl;
       }
     }
-
-  return boost::shared_ptr<WorldObjData>(data);
 }
 
 boost::shared_ptr<WorldObj> 

Index: ThunderstormBackgroundData.hh
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/ThunderstormBackgroundData.hh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ThunderstormBackgroundData.hh       8 Jun 2002 20:19:54 -0000       1.8
+++ ThunderstormBackgroundData.hh       9 Jun 2002 13:03:11 -0000       1.9
@@ -31,15 +31,15 @@
 public:
   CL_Vector pos;
 
-  ThunderstormBackgroundData() {}
+  ThunderstormBackgroundData () {}
+  ThunderstormBackgroundData (xmlDocPtr doc, xmlNodePtr cur);
+
   virtual ~ThunderstormBackgroundData() {}
 
   /** Writte the content of this object formated as xml to the given
       stream */
   virtual void write_xml(std::ofstream* xml);
   
-  static boost::shared_ptr<WorldObjData> create(xmlDocPtr doc, xmlNodePtr cur);
-
   boost::shared_ptr<WorldObj> create_WorldObj();
   EditorObjLst create_EditorObj();
 };




reply via email to

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