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 solidcolor_background.cxx


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/backgrounds solidcolor_background.cxx,1.3,1.4 solidcolor_background.hxx,1.6,1.7 starfield_background.cxx,1.7,1.8 starfield_background.hxx,1.6,1.7 surface_background.cxx,1.4,1.5 surface_background.hxx,1.4,1.5 surface_background_data.cxx,1.3,1.4 surface_background_data.hxx,1.7,1.8 thunderstorm_background.hxx,1.3,1.4 thunderstorm_background_data.cxx,1.4,1.5 thunderstorm_background_data.hxx,1.6,1.7
Date: 23 Aug 2002 15:50:27 -0000

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

Modified Files:
        solidcolor_background.cxx solidcolor_background.hxx 
        starfield_background.cxx starfield_background.hxx 
        surface_background.cxx surface_background.hxx 
        surface_background_data.cxx surface_background_data.hxx 
        thunderstorm_background.hxx thunderstorm_background_data.cxx 
        thunderstorm_background_data.hxx 
Log Message:
- added copy constructor/operator= or private declarations
- some cleanup


Index: solidcolor_background.cxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/solidcolor_background.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- solidcolor_background.cxx   2 Jul 2002 10:42:38 -0000       1.3
+++ solidcolor_background.cxx   23 Aug 2002 15:49:54 -0000      1.4
@@ -51,6 +51,25 @@
     }
 }
 
+SolidColorBackgroundData::SolidColorBackgroundData (const 
SolidColorBackgroundData& old)
+                                                   : WorldObjData(old),
+                                                    color(old.color)
+{
+}
+
+SolidColorBackgroundData
+SolidColorBackgroundData::operator= (const SolidColorBackgroundData& old)
+{
+  if (this == &old)
+    return *this;
+    
+  WorldObjData::operator=(old);
+  
+  color = old.color;
+  
+  return *this;
+}
+
 WorldObj* 
 SolidColorBackgroundData::create_WorldObj()
 {

Index: solidcolor_background.hxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/solidcolor_background.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- solidcolor_background.hxx   2 Jul 2002 13:36:06 -0000       1.6
+++ solidcolor_background.hxx   23 Aug 2002 15:49:54 -0000      1.7
@@ -36,17 +36,20 @@
 
   // FIXME: Add z_pos handling here
 
-  SolidColorBackgroundData() {}
-  SolidColorBackgroundData(xmlDocPtr doc, xmlNodePtr cur);
+  SolidColorBackgroundData () {}
+  SolidColorBackgroundData (xmlDocPtr doc, xmlNodePtr cur);
+  SolidColorBackgroundData (const SolidColorBackgroundData& old);
+  SolidColorBackgroundData operator= (const SolidColorBackgroundData& old);
 
   virtual ~SolidColorBackgroundData() {}
 
   /** Writte the content of this object formated as xml to the given
       stream */
-  virtual void write_xml(std::ostream& xml);
+  virtual void write_xml (std::ostream& xml);
 
-  WorldObj* create_WorldObj();
-  EditorObjLst create_EditorObj();
+  WorldObj* create_WorldObj ();
+  EditorObjLst create_EditorObj ();
+  
 };
 
 class SolidColorBackground : public WorldObj,
@@ -60,6 +63,10 @@
   float get_z_pos() const { return -10; }  
   void update (float /*delta*/) {}
   void draw_offset (int x_of, int y_of, float s = 1.0);
+  
+private:
+  SolidColorBackground (const SolidColorBackground&);
+  SolidColorBackground operator= (const SolidColorBackground&);
 };
 
 
@@ -68,11 +75,13 @@
 {
 private:
   CL_Vector pos;
+  
 public:
   EditorSolidColorBackground (const SolidColorBackgroundData& data)
     : SolidColorBackgroundData (data),
       pos (0.0f, 0.0f)
   {}
+  
   void write_xml(std::ostream& xml) { 
this->SolidColorBackgroundData::write_xml (xml); }
 
   /// Return the object width
@@ -105,6 +114,10 @@
                                 + to_string (pos.x) + ", "
                                 + to_string (pos.y) + ", "
                                 + to_string (pos.z); }
+                                
+private:
+  EditorSolidColorBackground (const EditorSolidColorBackground&);
+  EditorSolidColorBackground operator= (const EditorSolidColorBackground&);
 };
 
 #endif

Index: starfield_background.cxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/starfield_background.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- starfield_background.cxx    22 Aug 2002 00:36:30 -0000      1.7
+++ starfield_background.cxx    23 Aug 2002 15:49:54 -0000      1.8
@@ -31,6 +31,29 @@
 {
 }
 
+StarfieldBackgroundData::StarfieldBackgroundData (const 
StarfieldBackgroundData& old)
+                                                : WorldObjData(old),
+                                                 
small_stars_count(old.small_stars_count),
+                                                 
middle_stars_count(old.middle_stars_count),
+                                                 
large_stars_count(old.large_stars_count)
+{
+}
+
+StarfieldBackgroundData
+StarfieldBackgroundData::operator= (const StarfieldBackgroundData& old)
+{
+  if (this == &old)
+    return *this;
+
+  WorldObjData::operator=(old);
+     
+   small_stars_count = old. small_stars_count;
+  middle_stars_count = old.middle_stars_count;
+   large_stars_count = old. large_stars_count;
+   
+  return *this;
+}
+
 void 
 StarfieldBackgroundData::write_xml(std::ostream& xml)
 {
@@ -42,7 +65,7 @@
       << std::endl;
 }
  
-StarfieldBackgroundData::StarfieldBackgroundData (xmlDocPtr /*doc*/, 
xmlNodePtr cur)
+StarfieldBackgroundData::StarfieldBackgroundData (xmlDocPtr doc, xmlNodePtr 
cur)
 {
   small_stars_count = 100;
   middle_stars_count = 50;
@@ -91,6 +114,8 @@
        } 
       cur = cur->next;
     }
+    
+  UNUSED_ARG(doc);
 }
 
 WorldObj* 
@@ -138,6 +163,33 @@
   
   x_add = rand () % 5 + 1.0;
   y_add = 0.0;
+}
+
+StarfieldBackgroundStars::StarfieldBackgroundStars (const 
StarfieldBackgroundStars& old)
+                                                  : WorldObj(old),
+                                                   sur(old.sur),
+                                                   x_pos(old.x_pos),
+                                                   y_pos(old.y_pos),
+                                                   x_add(old.x_add),
+                                                   y_add(old.y_add)
+{
+}
+
+StarfieldBackgroundStars
+StarfieldBackgroundStars::operator= (const StarfieldBackgroundStars& old)
+{
+  if (this == &old)
+    return *this;
+
+  WorldObj::operator=(old);
+
+  sur   = old.sur;
+  x_pos = old.x_pos;
+  y_pos = old.y_pos;
+  x_add = old.x_add;
+  y_add = old.y_add;
+ 
+  return *this;
 }
 
 void

Index: starfield_background.hxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/starfield_background.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- starfield_background.hxx    2 Jul 2002 13:36:06 -0000       1.6
+++ starfield_background.hxx    23 Aug 2002 15:49:54 -0000      1.7
@@ -34,13 +34,17 @@
   int large_stars_count;
 
   StarfieldBackgroundData ();
-  StarfieldBackgroundData (xmlDocPtr /*doc*/, xmlNodePtr cur);
+  StarfieldBackgroundData (xmlDocPtr doc, xmlNodePtr cur);
+  StarfieldBackgroundData (const StarfieldBackgroundData& old);
+  StarfieldBackgroundData operator= (const StarfieldBackgroundData& old);
+  
   virtual ~StarfieldBackgroundData () {}
 
   void write_xml(std::ostream& xml);
 
   WorldObj* create_WorldObj();
   EditorObjLst create_EditorObj();
+  
 };
 
 class StarfieldBackgroundStars : public WorldObj
@@ -65,6 +69,9 @@
   StarfieldBackgroundStars () {}
   StarfieldBackgroundStars (Type type);
   
+  StarfieldBackgroundStars (const StarfieldBackgroundStars& old);
+  StarfieldBackgroundStars operator= (const StarfieldBackgroundStars& old);
+  
   // Never used
   float get_z_pos() const { return -100; }
 
@@ -90,6 +97,10 @@
 
   void update(float delta);
   void draw_offset(int x_of, int y_of, float s = 1.0);
+  
+private:
+  StarfieldBackground (const StarfieldBackground&);
+  StarfieldBackground operator= (const StarfieldBackground&);
 };
 
 class EditorStarfieldBackground : public StarfieldBackgroundData,
@@ -97,6 +108,7 @@
 {
 private:
   CL_Vector pos;
+  
 public:
   EditorStarfieldBackground (const StarfieldBackgroundData& data)
     : StarfieldBackgroundData (data),
@@ -114,6 +126,10 @@
                                 + to_string (pos.x) + ", "
                                 + to_string (pos.y) + ", "
                                 + to_string (pos.z); }
+
+private:
+  EditorStarfieldBackground (const EditorStarfieldBackground&);
+  EditorStarfieldBackground operator= (const EditorStarfieldBackground&);
 };
 
 #endif

Index: surface_background.cxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/surface_background.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- surface_background.cxx      24 Jun 2002 09:40:59 -0000      1.4
+++ surface_background.cxx      23 Aug 2002 15:49:54 -0000      1.5
@@ -26,8 +26,12 @@
 #include "../blitter.hxx"
 #include "surface_background.hxx"
 
-SurfaceBackground::SurfaceBackground(const SurfaceBackgroundData& bg_data)
-  : SurfaceBackgroundData (bg_data)
+SurfaceBackground::SurfaceBackground (const SurfaceBackgroundData& bg_data)
+  : SurfaceBackgroundData(bg_data),
+    surface_need_deletion(false),
+    scroll_ox(0),
+    scroll_oy(0)
+
 {
   Timer timer;
 
@@ -35,8 +39,6 @@
     timer.start();
     std::cout << "Creating Background..." << std::flush;
   }
-  
-  surface_need_deletion = false;
 
   if (bg_data.color.alpha > 1.0) 
     std::cout << "Background: Warning dim larger than 1.0 are no longer 
supported" << std::endl;
@@ -88,9 +90,6 @@
   //bg_surface = CAImageManipulation::changeHSV(bg_surface, 150, 100, 0);
   counter.set_size(bg_surface.get_num_frames());
   counter.set_speed(1.0);
-
-  scroll_ox = 0;
-  scroll_oy = 0;
 
   if (verbose > 1)
     {

Index: surface_background.hxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/surface_background.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- surface_background.hxx      2 Jul 2002 13:36:06 -0000       1.4
+++ surface_background.hxx      23 Aug 2002 15:49:54 -0000      1.5
@@ -24,7 +24,6 @@
 #include "../game_counter.hxx"
 #include "surface_background_data.hxx"
 
-///
 class SurfaceBackground : public WorldObj, 
                          private SurfaceBackgroundData
 {
@@ -41,16 +40,17 @@
   float scroll_oy;
 
 public:
-  SurfaceBackground(const SurfaceBackgroundData&);
-  ///
-  virtual ~SurfaceBackground();
+  SurfaceBackground (const SurfaceBackgroundData&);
+  virtual ~SurfaceBackground ();
 
-  float get_z_pos() const { return pos.z; }
+  float get_z_pos () const { return pos.z; }
 
-  ///
-  void update(float delta);
-  ///
-  void draw_offset(int x_of, int y_of, float s = 1.0);
+  void update (float delta);
+  void draw_offset (int x_of, int y_of, float s = 1.0);
+  
+private:
+  SurfaceBackground (const SurfaceBackground&);
+  SurfaceBackground operator= (const SurfaceBackground&);
 };
 
 #endif

Index: surface_background_data.cxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/surface_background_data.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- surface_background_data.cxx 2 Jul 2002 10:42:38 -0000       1.3
+++ surface_background_data.cxx 23 Aug 2002 15:49:54 -0000      1.4
@@ -22,18 +22,53 @@
 #include "../string_converter.hxx"
 #include "surface_background.hxx"
 
-SurfaceBackgroundData::SurfaceBackgroundData()
+SurfaceBackgroundData::SurfaceBackgroundData () : para_x(0.5),
+                                                 para_y(0.5),
+                                                 pos(CL_Vector(0, 0, -150)),
+                                                 scroll_x(0.0),
+                                                  scroll_y(0.0),
+                                                 color(Color(0,0,0,0)),
+                                                 stretch_x(false),
+                                                 stretch_y(false)
+{
+}
+
+SurfaceBackgroundData::SurfaceBackgroundData (const SurfaceBackgroundData& 
old) 
+                                             : WorldObjData(old),
+                                              desc(old.desc),
+                                               para_x(old.para_x),
+                                              para_y(old.para_y),
+                                              pos(old.pos),
+                                              scroll_x(old.scroll_x),
+                                              scroll_y(old.scroll_y),
+                                              color(old.color),
+                                              stretch_x(old.stretch_x),
+                                              stretch_y(old.stretch_y)
 {
-  scroll_x = 0.0;
-  scroll_y = 0.0;
-  para_x = 0.5;
-  para_y = 0.5;
-  stretch_x = false;
-  stretch_y = false;
-  pos = CL_Vector (0, 0, -150);
-  color = Color (0,0,0,0);
 }
 
+SurfaceBackgroundData
+SurfaceBackgroundData::operator= (const SurfaceBackgroundData& old)
+{
+  if (this == &old)
+    return *this;
+
+  WorldObjData::operator=(old);
+        
+  desc      = old.desc;
+  para_x    = old.para_x;
+  para_y    = old.para_y;
+  pos       = old.pos;
+  scroll_x  = old.scroll_x;
+  scroll_y  = old.scroll_y;
+  color     = old.color;
+  stretch_x = old.stretch_x;
+  stretch_y = old.stretch_y;
+  
+  return *this;
+}
+
+
 SurfaceBackgroundData::~SurfaceBackgroundData()
 {
 }
@@ -135,4 +170,3 @@
 
 
 /* EOF */
-

Index: surface_background_data.hxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/surface_background_data.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- surface_background_data.hxx 2 Jul 2002 13:36:06 -0000       1.7
+++ surface_background_data.hxx 23 Aug 2002 15:49:54 -0000      1.8
@@ -59,27 +59,31 @@
   /// Stretch the background to the full screen size in x direction
   bool stretch_y;
 
+public:
   /// Init all fields with some usefull defaults values.
-  SurfaceBackgroundData();
+  SurfaceBackgroundData ();
   
   /** Parse the xml snip and return a newly allocated
       SurfaceBackgroundData*, the user is responsible to delete the
       object */
-  SurfaceBackgroundData(xmlDocPtr doc, xmlNodePtr cur);
+  SurfaceBackgroundData (xmlDocPtr doc, xmlNodePtr cur);
 
+  SurfaceBackgroundData (const SurfaceBackgroundData& old);
+  SurfaceBackgroundData operator= (const SurfaceBackgroundData& old);
+  
   /// Empty destructor
-  virtual ~SurfaceBackgroundData();
+  virtual ~SurfaceBackgroundData ();
 
   /** Write the content of this object formated as xml to the given
       stream */
-  void write_xml(std::ostream& xml);
+  void write_xml (std::ostream& xml);
+  
+  WorldObj* create_WorldObj ();
+  EditorObjLst create_EditorObj ();
   
-  WorldObj* create_WorldObj();
-  EditorObjLst create_EditorObj();
 };
 
 
-// FIXME: this should get into its own file
 class EditorSurfaceBackground : public SurfaceBackgroundData,
                                public SpriteEditorObj
 {
@@ -102,6 +106,10 @@
                                 + to_string (pos.x) + ", "
                                 + to_string (pos.y) + ", "
                                 + to_string (pos.z); }
+
+private:
+  EditorSurfaceBackground (const EditorSurfaceBackground&);
+  EditorSurfaceBackground operator= (const EditorSurfaceBackground&);
 };
 
 #endif

Index: thunderstorm_background.hxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/thunderstorm_background.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- thunderstorm_background.hxx 2 Jul 2002 13:36:06 -0000       1.3
+++ thunderstorm_background.hxx 23 Aug 2002 15:49:54 -0000      1.4
@@ -31,17 +31,19 @@
   CL_Surface clouds_sur;
   std::vector<CL_Surface> flash_sur;
   int x_pos;
+
 public:
-  ///
   ThunderstormBackground();
-  ///
   virtual ~ThunderstormBackground();
-  ///
 
   float get_z_pos() const { return pos.z; }
   
   void update(float delta);
   void draw_offset(int x_of, int y_of, float s = 1.0);
+  
+private:
+  ThunderstormBackground (const ThunderstormBackground&);
+  ThunderstormBackground operator= (const ThunderstormBackground&);
 };
 
 #endif

Index: thunderstorm_background_data.cxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/thunderstorm_background_data.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- thunderstorm_background_data.cxx    2 Jul 2002 10:42:38 -0000       1.4
+++ thunderstorm_background_data.cxx    23 Aug 2002 15:49:54 -0000      1.5
@@ -28,6 +28,12 @@
       << "</background>" << std::endl;
 }
 
+ThunderstormBackgroundData::ThunderstormBackgroundData (const 
ThunderstormBackgroundData& old) :
+                                                        WorldObjData(old),
+                                                       pos(old.pos)
+{
+}
+
 ThunderstormBackgroundData::ThunderstormBackgroundData (xmlDocPtr doc, 
xmlNodePtr cur)
 {
   cur = cur->children; 
@@ -44,6 +50,18 @@
        std::cout << "ThunderstormBackgroundData::create(xmlDocPtr doc, 
xmlNodePtr cur) error" << std::endl;
       }
     }
+}
+
+ThunderstormBackgroundData ThunderstormBackgroundData::operator= (const 
ThunderstormBackgroundData& old)
+{
+  if (this == &old)
+    return *this;
+
+  WorldObjData::operator=(old);
+      
+  pos = old.pos;
+  
+  return *this;
 }
 
 WorldObj* 

Index: thunderstorm_background_data.hxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/backgrounds/thunderstorm_background_data.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- thunderstorm_background_data.hxx    2 Jul 2002 13:36:06 -0000       1.6
+++ thunderstorm_background_data.hxx    23 Aug 2002 15:49:54 -0000      1.7
@@ -27,12 +27,18 @@
 
 class ThunderstormBackgroundData : public WorldObjData
 {
-public:
+protected:
   CL_Vector pos;
+  
+public:
 
   ThunderstormBackgroundData () {}
   ThunderstormBackgroundData (xmlDocPtr doc, xmlNodePtr cur);
 
+  ThunderstormBackgroundData (const ThunderstormBackgroundData& old);
+  
+  ThunderstormBackgroundData operator= (const ThunderstormBackgroundData& old);
+
   virtual ~ThunderstormBackgroundData() {}
 
   /** Writte the content of this object formated as xml to the given
@@ -41,6 +47,7 @@
   
   WorldObj* create_WorldObj();
   EditorObjLst create_EditorObj();
+  
 };
 
 class EditorThunderstormBackground : public ThunderstormBackgroundData,
@@ -62,9 +69,12 @@
   }
   
   std::string status_line () { return "ThunderstormBackground"; }
+  
+private:
+  EditorThunderstormBackground (const EditorThunderstormBackground&);
+  EditorThunderstormBackground operator= (const EditorThunderstormBackground&);
 };
 
 #endif
 
 /* EOF */
-





reply via email to

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