pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src EntranceData.cc,1.10,1.11 EntranceDat


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src EntranceData.cc,1.10,1.11 EntranceData.hh,1.12,1.13 ExitData.cc,1.13,1.14 ExitData.hh,1.10,1.11 HotspotData.cc,1.10,1.11 HotspotData.hh,1.10,1.11 LiquidData.cc,1.11,1.12 LiquidData.hh,1.13,1.14 TrapData.cc,1.13,1.14 TrapData.hh,1.16,1.17 World.cc,1.75,1.76 World.hh,1.37,1.38 WorldObj.hh,1.23,1.24 WorldObjData.hh,1.13,1.14 WorldObjGroupData.cc,1.6,1.7 WorldObjGroupData.hh,1.7,1.8
Date: 11 Jun 2002 18:28:39 -0000

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

Modified Files:
        EntranceData.cc EntranceData.hh ExitData.cc ExitData.hh 
        HotspotData.cc HotspotData.hh LiquidData.cc LiquidData.hh 
        TrapData.cc TrapData.hh World.cc World.hh WorldObj.hh 
        WorldObjData.hh WorldObjGroupData.cc WorldObjGroupData.hh 
Log Message:
replaced shared_ptr<WorldObj> with WorldObj*


Index: EntranceData.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/EntranceData.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- EntranceData.cc     10 Jun 2002 11:00:25 -0000      1.10
+++ EntranceData.cc     11 Jun 2002 18:28:31 -0000      1.11
@@ -109,15 +109,15 @@
 }
 
 
-boost::shared_ptr<WorldObj> 
+WorldObj* 
 EntranceData::create_WorldObj()
 {
   if (type == "generic") {
-    return boost::shared_ptr<WorldObj>(new Entrance(*this));
+    return new Entrance(*this);
   } else if (type == "woodthing") {
-    return boost::shared_ptr<WorldObj>(new WoodThing(*this));
+    return new WoodThing(*this);
   } else if (type == "cloud") {
-    return boost::shared_ptr<WorldObj>(new Cloud(*this));
+    return new Cloud(*this);
   } else {
     throw PingusError("Entrance: Entrance type in PLF file is unknown: " + 
type);
   }
@@ -132,3 +132,4 @@
 }
 
 /* EOF */
+

Index: EntranceData.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/EntranceData.hh,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- EntranceData.hh     10 Jun 2002 11:00:25 -0000      1.12
+++ EntranceData.hh     11 Jun 2002 18:28:31 -0000      1.13
@@ -59,11 +59,12 @@
   void write_xml(std::ofstream *);
 
   EditorObjLst create_EditorObj();
-  boost::shared_ptr<WorldObj> create_WorldObj();
+  WorldObj* create_WorldObj();
 };
 
 #endif
 
 /* EOF */
+
 
 

Index: ExitData.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/ExitData.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- ExitData.cc 10 Jun 2002 11:00:25 -0000      1.13
+++ ExitData.cc 11 Jun 2002 18:28:31 -0000      1.14
@@ -84,10 +84,10 @@
         << std::endl;
 }
 
-boost::shared_ptr<WorldObj> 
+WorldObj* 
 ExitData::create_WorldObj()
 {
-  return boost::shared_ptr<WorldObj> (new Exit (*this));
+  return new Exit (*this);
 }
 
 EditorObjLst 
@@ -99,3 +99,4 @@
 }
 
 /* EOF */
+

Index: ExitData.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/ExitData.hh,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ExitData.hh 10 Jun 2002 11:00:25 -0000      1.10
+++ ExitData.hh 11 Jun 2002 18:28:31 -0000      1.11
@@ -55,13 +55,14 @@
 
   void write_xml(std::ofstream *);
   
-  boost::shared_ptr<WorldObj> create_WorldObj();
+  WorldObj* create_WorldObj();
   EditorObjLst create_EditorObj();
 };
 
 #endif
 
 /* EOF */
+
 
 
 

Index: HotspotData.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/HotspotData.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- HotspotData.cc      10 Jun 2002 15:01:23 -0000      1.10
+++ HotspotData.cc      11 Jun 2002 18:28:32 -0000      1.11
@@ -69,10 +69,10 @@
     }
 }
 
-boost::shared_ptr<WorldObj> 
+WorldObj* 
 HotspotData::create_WorldObj()
 {
-  return boost::shared_ptr<WorldObj> (new Hotspot (*this));
+  return new Hotspot (*this);
 }
 
 EditorObjLst 
@@ -84,3 +84,4 @@
 }
 
 /* EOF */
+

Index: HotspotData.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/HotspotData.hh,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- HotspotData.hh      10 Jun 2002 11:00:25 -0000      1.10
+++ HotspotData.hh      11 Jun 2002 18:28:32 -0000      1.11
@@ -52,13 +52,14 @@
 
   void write_xml(std::ofstream *);
 
-  boost::shared_ptr<WorldObj> create_WorldObj();
+  WorldObj* create_WorldObj();
   EditorObjLst create_EditorObj();
 };
 
 #endif
 
 /* EOF */
+
 
 
 

Index: LiquidData.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/LiquidData.cc,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- LiquidData.cc       10 Jun 2002 15:01:23 -0000      1.11
+++ LiquidData.cc       11 Jun 2002 18:28:32 -0000      1.12
@@ -79,11 +79,11 @@
     }
 }
 
-boost::shared_ptr<WorldObj> 
+WorldObj* 
 LiquidData::create_WorldObj ()
 {
   std::cout << "LiquidData::create_WorldObj ()" << std::endl;
-  return boost::shared_ptr<WorldObj>(new Liquid (*this));
+  return new Liquid (*this);
 }
 
 EditorObjLst
@@ -96,3 +96,4 @@
 }
 
 /* EOF */
+

Index: LiquidData.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/LiquidData.hh,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- LiquidData.hh       10 Jun 2002 11:00:26 -0000      1.13
+++ LiquidData.hh       11 Jun 2002 18:28:33 -0000      1.14
@@ -62,7 +62,7 @@
   void write_xml(std::ofstream*);
 
   /** Create an WorldObj from the given data object */
-  boost::shared_ptr<WorldObj> create_WorldObj ();
+  WorldObj* create_WorldObj ();
 
   /** Create an EditorObj from the given data object */
   std::list<boost::shared_ptr<EditorObj> > create_EditorObj ();
@@ -71,5 +71,6 @@
 #endif
 
 /* EOF */
+
 
 

Index: TrapData.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/TrapData.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- TrapData.cc 10 Jun 2002 11:00:27 -0000      1.13
+++ TrapData.cc 11 Jun 2002 18:28:33 -0000      1.14
@@ -70,23 +70,23 @@
         << std::endl;
 }
 
-boost::shared_ptr<WorldObj> 
+WorldObj* 
 TrapData::create_WorldObj ()
 {
   if (type == "smasher") {
-    return boost::shared_ptr<WorldObj>(new Smasher(*this));
+    return new Smasher(*this);
   } else if (type == "hammer") {
-    return boost::shared_ptr<WorldObj>(new Hammer(*this));
+    return new Hammer(*this);
   } else if (type == "fake_exit") {
-    return boost::shared_ptr<WorldObj>(new FakeExit(*this));
+    return new FakeExit(*this);
   } else if (type == "spike") {
-    return boost::shared_ptr<WorldObj>(new Spike(*this));
+    return new Spike(*this);
   } else if (type == "guillotine") {
-    return boost::shared_ptr<WorldObj>(new Guillotine(*this));
+    return new Guillotine(*this);
   } else if (type == "laser_exit") {
-    return boost::shared_ptr<WorldObj>(new LaserExit(*this));
+    return new LaserExit(*this);
   } else if (type == "bumper") {
-    return boost::shared_ptr<WorldObj>(new Bumper(*this));
+    return new Bumper(*this);
   }
   throw PingusError("Trap: `" + type + "' is unknown");
 }
@@ -100,3 +100,4 @@
 }
 
 /* EOF */
+

Index: TrapData.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/TrapData.hh,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- TrapData.hh 10 Jun 2002 11:00:27 -0000      1.16
+++ TrapData.hh 11 Jun 2002 18:28:33 -0000      1.17
@@ -52,7 +52,7 @@
   void write_xml(std::ofstream* xml);
 
   /** Create an WorldObj from the given data object */
-  boost::shared_ptr<WorldObj> create_WorldObj ();
+  WorldObj* create_WorldObj ();
 
   /** Create an EditorObj from the given data object */
   std::list<boost::shared_ptr<EditorObj> > create_EditorObj ();
@@ -61,6 +61,7 @@
 #endif
 
 /* EOF */
+
 
 
 

Index: World.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/World.cc,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- World.cc    10 Jun 2002 15:01:23 -0000      1.75
+++ World.cc    11 Jun 2002 18:28:34 -0000      1.76
@@ -44,7 +44,7 @@
 using boost::shared_ptr;
 
 static 
-bool WorldObj_less (shared_ptr<WorldObj>& a, shared_ptr<WorldObj>& b) 
+bool WorldObj_less (WorldObj* a, WorldObj* b) 
 {
   return a->get_z_pos () < b->get_z_pos ();
 }
@@ -53,9 +53,9 @@
 //FIXME: ingo: This is a workaround around the std::list::sort()
 //FIXME: problem under MSVC6. This is copy&paste from an usenet
 //FIXME: article, so it might work or not, never tested it.
-typedef shared_ptr<WorldObj>& CWorldObjPtr;
+typedef WorldObj* CWorldObjPtr;
 template<>
-bool std::greater<CWorldObjPtr>::operator()(shared_ptr<WorldObj>& a, 
shared_ptr<WorldObj>& b) const
+bool std::greater<CWorldObjPtr>::operator()(WorldObj* a, WorldObj* b) const
 {
   return WorldObj_less (a, b);
 } 
@@ -87,6 +87,10 @@
 World::~World()
 {
   delete particle_holder;
+  
+  for (WorldObjIter it = world_obj.begin(); it != world_obj.end(); ++it) {
+    delete *it;
+  }
 }
 
 // Merge the different layers on the screen together
@@ -177,11 +181,10 @@
 void
 World::init_map()
 {
-  // FIXME: Warning! Weird memory handling, could cause crash or memleak!11
   gfx_map = new PingusSpotMap(plf);
   colmap = gfx_map->get_colmap();
 
-  world_obj.push_back (boost::shared_ptr<WorldObj>(gfx_map));
+  world_obj.push_back (gfx_map);
 }
 
 void
@@ -201,13 +204,12 @@
        i != worldobj_d.end ();
        i++)
     {
-      shared_ptr<WorldObj> obj = (*i)->create_WorldObj ();
-      if (obj.get ())
-       world_obj.push_back(obj);
+      WorldObj* obj = (*i)->create_WorldObj ();
+      if (obj)
+       world_obj.push_back(obj);
     }
 
-  // FIXME: Weird memory handling, shared_ptr<> are evil!
-  world_obj.push_back(boost::shared_ptr<WorldObj>(pingus));
+  world_obj.push_back(pingus);
 
   // After all objects are in world_obj, sort them to there z_pos
 #ifdef WIN32
@@ -393,3 +395,4 @@
 }
 
 /* EOF */
+

Index: World.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/World.hh,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- World.hh    9 Jun 2002 14:28:03 -0000       1.37
+++ World.hh    11 Jun 2002 18:28:34 -0000      1.38
@@ -68,8 +68,8 @@
   /// The time you have to finish a level
   int exit_time;
 
-  typedef std::list<boost::shared_ptr<WorldObj> >::iterator WorldObjIter;
-  std::list<boost::shared_ptr<WorldObj> > world_obj;
+  typedef std::list<WorldObj*>::iterator WorldObjIter;
+  std::list<WorldObj*> world_obj;
 
   // These pointers hold objects and must be deleted
   ParticleHolder* particle_holder;

Index: WorldObj.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/WorldObj.hh,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- WorldObj.hh 8 Jun 2002 16:08:16 -0000       1.23
+++ WorldObj.hh 11 Jun 2002 18:28:35 -0000      1.24
@@ -42,7 +42,7 @@
   static World* get_world () { return world; }
 
 public:
-  /** Creates a new WorldObj */
+  /** Creates a new WorldObj*/
   WorldObj();
 
   /** Destroys a world object */
@@ -73,3 +73,4 @@
 #endif
 
 /* EOF */
+

Index: WorldObjData.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/WorldObjData.hh,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- WorldObjData.hh     8 Jun 2002 20:19:54 -0000       1.13
+++ WorldObjData.hh     11 Jun 2002 18:28:35 -0000      1.14
@@ -49,7 +49,7 @@
   virtual void write_xml (std::ofstream* xml) =0;
 
   /** Create an WorldObj from the given data object */
-  virtual boost::shared_ptr<WorldObj> create_WorldObj () =0;
+  virtual WorldObj* create_WorldObj () =0;
 
   /** Create an EditorObj from the given data object */
   virtual EditorObjLst create_EditorObj () =0;

Index: WorldObjGroupData.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/WorldObjGroupData.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- WorldObjGroupData.cc        9 Jun 2002 14:04:10 -0000       1.6
+++ WorldObjGroupData.cc        11 Jun 2002 18:28:35 -0000      1.7
@@ -49,11 +49,11 @@
 }
 
 /** Create an WorldObj from the given data object */
-boost::shared_ptr<WorldObj> 
+WorldObj* 
 WorldObjGroupData::create_WorldObj ()
 {
   std::cout << "WorldObjGroupData::create_WorldObj (): not implemented" << 
std::endl;
-  return boost::shared_ptr<WorldObj> ();
+  return NULL;
 }
 
 /** Create an EditorObj from the given data object */

Index: WorldObjGroupData.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/WorldObjGroupData.hh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- WorldObjGroupData.hh        10 Jun 2002 15:01:23 -0000      1.7
+++ WorldObjGroupData.hh        11 Jun 2002 18:28:35 -0000      1.8
@@ -39,7 +39,7 @@
   void write_xml (std::ofstream* xml);
 
   /** Create an WorldObj from the given data object */
-  boost::shared_ptr<WorldObj> create_WorldObj ();
+  WorldObj* create_WorldObj ();
 
   /** Create an EditorObj from the given data object */
   EditorObjLst create_EditorObj ();




reply via email to

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