pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src game_session.cxx,1.27,1.28 smallmap.c


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src game_session.cxx,1.27,1.28 smallmap.cxx,1.31,1.32 world.cxx,1.38,1.39 world.hxx,1.24,1.25 worldobj_data.hxx,1.7,1.8
Date: 26 Feb 2003 17:08:31 -0000

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

Modified Files:
        game_session.cxx smallmap.cxx world.cxx world.hxx 
        worldobj_data.hxx 
Log Message:
changed the way world objects get inserted into the world


Index: game_session.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_session.cxx,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- game_session.cxx    19 Feb 2003 11:33:00 -0000      1.27
+++ game_session.cxx    26 Feb 2003 17:08:29 -0000      1.28
@@ -90,6 +90,8 @@
 void
 PingusGameSession::update (const GameDelta& delta)
 {
+#if 0
+  // FIXME: Timing code could need another rewrite...
   if (server->is_finished())
     {
       ScreenManager::instance()->pop_screen();
@@ -112,8 +114,6 @@
       ++number_of_updates;
     }
 
-  //std::cout << "Number of updates: " << i << std::endl;
-
   // Time that got not used for updates
   left_over_time = time_passed - (i * update_time);
 
@@ -124,6 +124,10 @@
     }
   
   // Client is independend of the update limit, well, not completly...
+  client->update (delta);
+#endif
+  // Move the game one loop further
+  server->update ();
   client->update (delta);
 }
 

Index: smallmap.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/smallmap.cxx,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- smallmap.cxx        19 Feb 2003 10:37:31 -0000      1.31
+++ smallmap.cxx        26 Feb 2003 17:08:29 -0000      1.32
@@ -134,6 +134,7 @@
              cbuffer[i + 3] =   0;
               break;
               
+            case Groundtype::GP_WATER:
             case Groundtype::GP_LAVA:
               cbuffer[i + 0] = 255;
              cbuffer[i + 1] = 100;

Index: world.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/world.cxx,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- world.cxx   19 Feb 2003 10:37:31 -0000      1.38
+++ world.cxx   26 Feb 2003 17:08:29 -0000      1.39
@@ -72,16 +72,25 @@
   WorldObj::set_world(this);
 
   world_obj.push_back(gfx_map);
+
   world_obj.push_back(pingu_particle_holder);
-  world_obj.push_back (rain_particle_holder);
+  world_obj.push_back(rain_particle_holder);
   world_obj.push_back(smoke_particle_holder);
-  world_obj.push_back (snow_particle_holder);
+  world_obj.push_back(snow_particle_holder);
 
   init_worldobjs(plf);
+
+  // FIXME: Ugly
   rain_particle_holder->set_world_width(get_width());
 }
 
 void
+World::add_object (WorldObj* obj)
+{
+  world_obj.push_back(obj);
+}
+
+void
 World::init_worldobjs(PLF* plf)
 {
   std::vector<WorldObjData*> worldobj_d = plf->get_worldobjs_data();
@@ -90,20 +99,11 @@
        i != worldobj_d.end ();
        ++i)
     {
-      WorldObj* obj = (*i)->create_WorldObj ();
-      if (obj)
-       {
-         world_obj.push_back(obj);
-       }
-      else
-       {
-         std::cout << "World: Couldn't create object from data" << std::endl;
-       }
+      (*i)->insert_WorldObjs (this);
     }
 
    world_obj.push_back(pingus);
 
-   //world_obj->sort(WorldObj_less);
    std::stable_sort (world_obj.begin (), world_obj.end (), WorldObj_less);
 
   // Drawing all world objs to the colmap, gfx, or what ever the

Index: world.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/world.hxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- world.hxx   19 Feb 2003 10:37:31 -0000      1.24
+++ world.hxx   26 Feb 2003 17:08:29 -0000      1.25
@@ -97,6 +97,10 @@
 public:
   World(PLF*);
   virtual ~World();
+  
+  /** Add an object to the world, obj needs to be new'ed the World
+      make sure that it will get deleted */
+  void add_object (WorldObj* obj);
 
   /** Draw the world onto the given GraphicContext */
   void    draw (GraphicContext& gc);

Index: worldobj_data.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobj_data.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- worldobj_data.hxx   27 Sep 2002 11:26:44 -0000      1.7
+++ worldobj_data.hxx   26 Feb 2003 17:08:29 -0000      1.8
@@ -23,7 +23,7 @@
 #include <iosfwd>
 #include <vector>
 
-class WorldObj;
+class World;
 class EditorObj;
 
 typedef std::vector<EditorObj*> EditorObjLst;
@@ -52,8 +52,8 @@
       stream */
   virtual void write_xml (std::ostream& xml) =0;
 
-  /** Create an WorldObj from the given data object */
-  virtual WorldObj* create_WorldObj () =0;
+  /** Insert all WorldObjs into the World */
+  virtual void insert_WorldObjs (World*) =0;
 
   /** Create an EditorObj from the given data object, caller is
       responible for deleting the pointers in the vector */





reply via email to

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