From 840f9b8678f607aecc15d47bc77248c4ac8b8574 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 4 Feb 2008 00:54:30 +0000 Subject: tweaked console client status with timer and fps core connect/disconnect --- src/server/application.cc | 9 ++++++--- src/server/timer.cc | 8 ++------ src/server/timer.h | 5 ----- 3 files changed, 8 insertions(+), 14 deletions(-) (limited to 'src/server') diff --git a/src/server/application.cc b/src/server/application.cc index ee5f32f..8ea0808 100644 --- a/src/server/application.cc +++ b/src/server/application.cc @@ -19,10 +19,13 @@ void Application::init() // force initialization of the game object server::game = new game::Game(); + con_print << "Initializing server..." << std::endl; + // initialize core - core::ApplicationInterface::init(); + core::ApplicationInterface::init(); - con_debug << "Initializing server..." << std::endl; + // connect to the game module + core::ApplicationInterface::connect(); } void Application::run() @@ -37,7 +40,7 @@ void Application::run() frame(elapsed); - timer.sleep(server_framerate - elapsed); + sys::sleep(server_framerate - elapsed); timer.mark(); } diff --git a/src/server/timer.cc b/src/server/timer.cc index c184659..946da2c 100644 --- a/src/server/timer.cc +++ b/src/server/timer.cc @@ -25,7 +25,8 @@ void Timer::mark() } float Timer::elapsed() -{ timeval tick; +{ + timeval tick; gettimeofday(&tick, &timer_tz); @@ -34,9 +35,4 @@ float Timer::elapsed() return( (float) delta / 1000000); } -void Timer::sleep(float seconds) -{ - usleep((useconds_t) seconds * (useconds_t) 1000000.0 ); -} - } diff --git a/src/server/timer.h b/src/server/timer.h index a96fa0e..496d698 100644 --- a/src/server/timer.h +++ b/src/server/timer.h @@ -27,11 +27,6 @@ public: */ float elapsed(); - /// suspend calling process for a number of seconds - void sleep(float seconds); - - /// TODO add inspectors for current timestamp and last mark - private: float timer_elapsed; struct timezone timer_tz; -- cgit v1.2.3