[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src game_session.cxx,1.22,1.23 game_sessi
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src game_session.cxx,1.22,1.23 game_session.hxx,1.13,1.14 |
Date: |
26 Oct 2002 17:27:54 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv1573
Modified Files:
game_session.cxx game_session.hxx
Log Message:
fixed timecode to use the provided delta_time and not do stuff with
CL_System::get_time()
Index: game_session.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_session.cxx,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- game_session.cxx 10 Oct 2002 12:25:53 -0000 1.22
+++ game_session.cxx 26 Oct 2002 17:27:52 -0000 1.23
@@ -43,9 +43,6 @@
client = new Client(server);
client_timer.stop();
- last_redraw = CL_System::get_time();
- last_update = CL_System::get_time();
-
number_of_redraws = 0;
number_of_updates = 0;
@@ -76,26 +73,18 @@
{
++number_of_redraws;
client->draw (gc);
- last_redraw = CL_System::get_time();
return true;
}
void
PingusGameSession::update (const GameDelta& delta)
{
- if (number_of_redraws == 1)
- {
- last_update = CL_System::get_time();
- }
-
if (server->is_finished())
{
ScreenManager::instance()->pop_screen();
}
- //std::cout << "Left Over Time: " << left_over_time << std::endl;
-
- int time_passed = (CL_System::get_time() - last_update) + left_over_time;
+ int time_passed = int(delta.get_time() * 1000) + left_over_time;
int update_time = game_speed;
left_over_time = 0;
@@ -117,10 +106,9 @@
// Time that got not used for updates
left_over_time = time_passed - (i * update_time);
- last_update = CL_System::get_time();
-
if (!max_cpu_usage && left_over_time < 0)
{
+ // FIXME: This doesn't really belong here
CL_System::sleep(-left_over_time);
}
Index: game_session.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_session.hxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- game_session.hxx 4 Oct 2002 16:54:04 -0000 1.13
+++ game_session.hxx 26 Oct 2002 17:27:52 -0000 1.14
@@ -46,9 +46,8 @@
/// The client
Client* client;
- unsigned int last_redraw;
- unsigned int last_update;
-
+ /** Time in 1/1000 second's that was not used in the last
+ update() */
int left_over_time;
/** Number of updates */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src game_session.cxx,1.22,1.23 game_session.hxx,1.13,1.14,
grumbel <=