pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3654 - in trunk/pingus/src: . components worldobjs


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3654 - in trunk/pingus/src: . components worldobjs
Date: Fri, 4 Jul 2008 04:38:35 +0200

Author: grumbel
Date: 2008-07-04 04:38:34 +0200 (Fri, 04 Jul 2008)
New Revision: 3654

Modified:
   trunk/pingus/src/components/time_display.cpp
   trunk/pingus/src/game_time.cpp
   trunk/pingus/src/game_time.hpp
   trunk/pingus/src/server.cpp
   trunk/pingus/src/world.cpp
   trunk/pingus/src/world.hpp
   trunk/pingus/src/worldobjs/entrance.cpp
   trunk/pingus/src/worldobjs/ice_block.cpp
Log:
Removed some junk from GameTime

Modified: trunk/pingus/src/components/time_display.cpp
===================================================================
--- trunk/pingus/src/components/time_display.cpp        2008-07-04 02:07:25 UTC 
(rev 3653)
+++ trunk/pingus/src/components/time_display.cpp        2008-07-04 02:38:34 UTC 
(rev 3654)
@@ -40,7 +40,7 @@
 void
 TimeDisplay::draw (DrawingContext& gc)
 {
-  int  time_value = server->get_plf().get_time() - 
server->get_world()->get_time_passed();
+  int  time_value = server->get_plf().get_time() - 
server->get_world()->get_time();
   std::string time_string;
 
   if (server->get_plf().get_time() == -1 && !(pingus_debug_flags & 
PINGUS_DEBUG_GAMETIME))
@@ -55,7 +55,7 @@
         time_string = GameTime::ticks_to_realtime_string(time_value);
       else
         {
-          time_value = server->get_world()->get_time_passed();
+          time_value = server->get_world()->get_time();
           time_string = StringUtil::to_string(time_value);
         }
 

Modified: trunk/pingus/src/game_time.cpp
===================================================================
--- trunk/pingus/src/game_time.cpp      2008-07-04 02:07:25 UTC (rev 3653)
+++ trunk/pingus/src/game_time.cpp      2008-07-04 02:38:34 UTC (rev 3654)
@@ -21,41 +21,23 @@
 #include "game_time.hpp"
 
 
-GameTime::GameTime (int arg_tick_time)
-  : count (0), tick_time (arg_tick_time)
+GameTime::GameTime()
+  : count (0)
 {
 }
 
 int
-GameTime::get_time ()
-{
-  return count * game_speed;
-}
-
-int
 GameTime::get_ticks(void)
 {
   return count;
 }
 
-int
-GameTime::get_tick_time ()
-{
-  return game_speed;
-}
-
 void
 GameTime::update(void)
 {
   count += 1;
 }
 
-void
-GameTime::reset(void)
-{
-  count = 0;
-}
-
 std::string
 GameTime::ticks_to_realtime_string(int ticks)
 {

Modified: trunk/pingus/src/game_time.hpp
===================================================================
--- trunk/pingus/src/game_time.hpp      2008-07-04 02:07:25 UTC (rev 3653)
+++ trunk/pingus/src/game_time.hpp      2008-07-04 02:38:34 UTC (rev 3654)
@@ -31,28 +31,16 @@
   /** Tick counter */
   int count;
 
-  /** How long does a tick take in msec */
-  int tick_time;
-
 public:
-  GameTime (int arg_tick_time);
+  GameTime();
 
   /** Number of ticks since the time starts, a tick is one basically
       update call to the world */
   int  get_ticks(void);
 
-  /** Return the passed time in miliseconds (1000msec = 1sec) */
-  int get_time ();
-
-  /** Return in realtime (milisecondons ) how long a tick normally takes */
-  int get_tick_time ();
-
   /** Increase the tick count */
   void update(void);
 
-  /** Start from zero */
-  void reset(void);
-
   /** Convert time given in ticks, into a string of Minutes:Seconds */
   static std::string ticks_to_realtime_string(int ticks);
 

Modified: trunk/pingus/src/server.cpp
===================================================================
--- trunk/pingus/src/server.cpp 2008-07-04 02:07:25 UTC (rev 3653)
+++ trunk/pingus/src/server.cpp 2008-07-04 02:38:34 UTC (rev 3654)
@@ -144,7 +144,7 @@
 int
 Server::get_time ()
 {
-  return get_world()->get_game_time()->get_ticks();
+  return get_world()->get_time();
 }
 
 void

Modified: trunk/pingus/src/world.cpp
===================================================================
--- trunk/pingus/src/world.cpp  2008-07-04 02:07:25 UTC (rev 3653)
+++ trunk/pingus/src/world.cpp  2008-07-04 02:38:34 UTC (rev 3654)
@@ -48,7 +48,7 @@
 World::World(const PingusLevel& plf)
   : ambient_light(Color(plf.get_ambient_light())),
     gfx_map(new GroundMap(plf)),
-    game_time(new GameTime (game_speed)),
+    game_time(new GameTime()),
     do_armageddon(false),
     pingus(new PinguHolder(plf)),
     colmap(gfx_map->get_colmap()),
@@ -199,7 +199,7 @@
 }
 
 int
-World::get_time_passed()
+World::get_time()
 {
   return game_time->get_ticks();
 }
@@ -264,12 +264,6 @@
   return current_pingu;
 }
 
-GameTime*
-World::get_game_time ()
-{
-  return game_time;
-}
-
 float World::get_gravity()
 {
   return gravitational_acceleration;

Modified: trunk/pingus/src/world.hpp
===================================================================
--- trunk/pingus/src/world.hpp  2008-07-04 02:07:25 UTC (rev 3653)
+++ trunk/pingus/src/world.hpp  2008-07-04 02:38:34 UTC (rev 3654)
@@ -120,7 +120,7 @@
   int     get_width();
 
   /** Returns the time passed since the level was started */
-  int get_time_passed();
+  int get_time();
 
   /** @return A pointer to the collision map used in this world */
   ColMap* get_colmap();
@@ -166,9 +166,6 @@
   /** @return the pingu at the given word coordinates, 0 if none is there */
   Pingu* get_pingu (const Vector3f& pos);
 
-  /** Return a pointer to the GameTime object of this World */
-  GameTime* get_game_time ();
-
   /** Get the acceleration due to gravity in the world */
   float get_gravity();
 

Modified: trunk/pingus/src/worldobjs/entrance.cpp
===================================================================
--- trunk/pingus/src/worldobjs/entrance.cpp     2008-07-04 02:07:25 UTC (rev 
3653)
+++ trunk/pingus/src/worldobjs/entrance.cpp     2008-07-04 02:38:34 UTC (rev 
3654)
@@ -21,7 +21,6 @@
 #include "../pingu_holder.hpp"
 #include "../globals.hpp"
 #include "../pingu.hpp"
-#include "../game_time.hpp"
 #include "../resource.hpp"
 #include "../components/smallmap.hpp"
 #include "entrance.hpp"
@@ -74,8 +73,8 @@
 bool
 Entrance::pingu_ready ()
 {
-  if (last_release + release_rate < (world->get_game_time()->get_ticks())) {
-    last_release = world->get_game_time()->get_ticks();
+  if (last_release + release_rate < (world->get_time())) {
+    last_release = world->get_time();
     return true;
   } else {
     return false;

Modified: trunk/pingus/src/worldobjs/ice_block.cpp
===================================================================
--- trunk/pingus/src/worldobjs/ice_block.cpp    2008-07-04 02:07:25 UTC (rev 
3653)
+++ trunk/pingus/src/worldobjs/ice_block.cpp    2008-07-04 02:38:34 UTC (rev 
3654)
@@ -16,7 +16,6 @@
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "../col_map.hpp"
-#include "../game_time.hpp"
 #include "../display/scene_context.hpp"
 #include "../pingu.hpp"
 #include "../pingu_holder.hpp"
@@ -71,11 +70,11 @@
       if (   (*pingu)->get_x() > pos.x     && (*pingu)->get_x() < pos.x + 
block_sur.get_width()
          && (*pingu)->get_y() > pos.y - 4 && (*pingu)->get_y() < pos.y + 
block_sur.get_height())
        {
-         last_contact = world->get_game_time()->get_ticks();
+         last_contact = world->get_time();
        }
     }
 
-  if (last_contact && last_contact + 1000 > 
world->get_game_time()->get_ticks())
+  if (last_contact && last_contact + 1000 > world->get_time())
     {
       //std::cout << "IceBlock: Catched Pingu: " << thickness  << std::endl;
       thickness -= 0.01f;





reply via email to

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