pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src World.cc,1.76,1.77 World.hh,1.38,1.39


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src World.cc,1.76,1.77 World.hh,1.38,1.39
Date: 12 Jun 2002 10:40:08 -0000

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

Modified Files:
        World.cc World.hh 
Log Message:
changed list<WorlObj*> to list<WorldObj*> * and moved the iterator typedef
to the .cc - this should prevent a template instantiation through the .hh


Index: World.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/World.cc,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- World.cc    11 Jun 2002 18:28:34 -0000      1.76
+++ World.cc    12 Jun 2002 10:40:05 -0000      1.77
@@ -43,6 +43,9 @@
 using namespace std;
 using boost::shared_ptr;
 
+typedef std::list<WorldObj*>::iterator WorldObjIter;
+
+
 static 
 bool WorldObj_less (WorldObj* a, WorldObj* b) 
 {
@@ -62,7 +65,8 @@
 #endif
 
 World::World(PLF* arg_plf)
-  : particle_holder (new ParticleHolder()),
+  : world_obj (new std::list<WorldObj*>),
+    particle_holder (new ParticleHolder()),
     pingus (new PinguHolder()),
     plf (arg_plf),
     view (0)
@@ -88,9 +92,11 @@
 {
   delete particle_holder;
   
-  for (WorldObjIter it = world_obj.begin(); it != world_obj.end(); ++it) {
+  for (WorldObjIter it = world_obj->begin(); it != world_obj->end(); ++it) {
     delete *it;
   }
+  
+  delete world_obj;
 }
 
 // Merge the different layers on the screen together
@@ -102,7 +108,7 @@
   y_of += y1;
 
   //unsigned int time = CL_System::get_time (); 
-  for(WorldObjIter obj = world_obj.begin(); obj != world_obj.end(); ++obj)
+  for(WorldObjIter obj = world_obj->begin(); obj != world_obj->end(); ++obj)
     {
       //unsigned int time = CL_System::get_time (); 
       (*obj)->draw_offset(x_of, y_of, s);
@@ -154,7 +160,7 @@
   // Let the pingus catch each other and
   // Let the traps catch the pingus and
   // Let the exit catch the pingus
-  for(WorldObjIter obj = world_obj.begin(); obj != world_obj.end(); ++obj)
+  for(WorldObjIter obj = world_obj->begin(); obj != world_obj->end(); ++obj)
     {
       // catch_pingu() is now done in relevant update() if WorldObj
       // needs to catch pingus.
@@ -184,7 +190,7 @@
   gfx_map = new PingusSpotMap(plf);
   colmap = gfx_map->get_colmap();
 
-  world_obj.push_back (gfx_map);
+  world_obj->push_back (gfx_map);
 }
 
 void
@@ -197,7 +203,7 @@
       i != weather_d.end();
       i++)
     {
-      world_obj.push_back(WeatherGenerator::create(*i));
+      world_obj->push_back(WeatherGenerator::create(*i));
     }
 
   for (vector<WorldObjData*>::iterator i = worldobj_d.begin ();
@@ -206,25 +212,25 @@
     {
       WorldObj* obj = (*i)->create_WorldObj ();
       if (obj)
-       world_obj.push_back(obj);
+       world_obj->push_back(obj);
     }
 
-  world_obj.push_back(pingus);
+  world_obj->push_back(pingus);
 
   // After all objects are in world_obj, sort them to there z_pos
 #ifdef WIN32
   //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.
- world_obj.sort(std::greater<CWorldObjPtr>());
+ world_obj->sort(std::greater<CWorldObjPtr>());
 #else
-  world_obj.sort(WorldObj_less);
+  world_obj->sort(WorldObj_less);
 #endif
   // FIXME: If the above thing causes throuble under windows we could
   // use a vector instead of a list and use stable_sort() instead.
 
   // Drawing all world objs to the colmap
-  for(WorldObjIter obj = world_obj.begin(); obj != world_obj.end(); ++obj)
+  for(WorldObjIter obj = world_obj->begin(); obj != world_obj->end(); ++obj)
     (*obj)->draw_colmap();
 
   // Setup the gravity force

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




reply via email to

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