Author: silene
Date: Sat Feb 13 13:18:45 2010
New Revision: 41184

URL: http://svn.gna.org/viewcvs/wesnoth?rev=41184&view=rev
Log:
Removed redundant class ntime::source.

Removed:
    trunk/src/time.cpp
    trunk/src/time.hpp
Modified:
    trunk/src/CMakeLists.txt
    trunk/src/Makefile.am
    trunk/src/SConscript
    trunk/src/server/server.cpp

Modified: trunk/src/CMakeLists.txt
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/CMakeLists.txt?rev=41184&r1=41183&r2=41184&view=diff
==============================================================================
--- trunk/src/CMakeLists.txt (original)
+++ trunk/src/CMakeLists.txt Sat Feb 13 13:18:45 2010
@@ -560,7 +560,6 @@
     server/forum_user_handler.cpp
     server/sample_user_handler.cpp
     network.cpp
-       time.cpp
     network_worker.cpp
     loadscreen_empty.cpp 
 )

Modified: trunk/src/Makefile.am
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/Makefile.am?rev=41184&r1=41183&r2=41184&view=diff
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Sat Feb 13 13:18:45 2010
@@ -346,8 +346,7 @@
        server/sample_user_handler.cpp \
        network.cpp \
        network_worker.cpp \
-       time.cpp \
-       loadscreen_empty.cpp 
+       loadscreen_empty.cpp
 
 
 wesnothd_LDADD = -L. -lwesnoth-core $(BOOST_IOSTREAMS_LIBS) @SDL_NET_LIBS@ 
@SDL_LIBS@ $(LIBINTL)

Modified: trunk/src/SConscript
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/SConscript?rev=41184&r1=41183&r2=41184&view=diff
==============================================================================
--- trunk/src/SConscript (original)
+++ trunk/src/SConscript Sat Feb 13 13:18:45 2010
@@ -451,7 +451,6 @@
     server/sample_user_handler.cpp
     server/simple_wml.cpp
     server/user_handler.cpp
-    time.cpp
     """)
 wesnothd_sources.extend(env.Object("server/server.cpp", EXTRA_DEFINE = 
env['fifodir'] and "FIFODIR='\"$fifodir\"'" or None))
 

Modified: trunk/src/server/server.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/server.cpp?rev=41184&r1=41183&r2=41184&view=diff
==============================================================================
--- trunk/src/server/server.cpp (original)
+++ trunk/src/server/server.cpp Sat Feb 13 13:18:45 2010
@@ -29,7 +29,6 @@
 #include "../network.hpp"
 #include "../filesystem.hpp"
 #include "../multiplayer_error_codes.hpp"
-#include "../time.hpp"
 #include "../serialization/parser.hpp"
 #include "../serialization/preprocessor.hpp"
 #include "../serialization/string_utils.hpp"
@@ -300,7 +299,7 @@
        }
 };
 
-
+static fps_limiter fps_limit_;
 
 server::server(int port, const std::string& config_file, size_t min_threads,
                size_t max_threads) :
@@ -481,7 +480,7 @@
        // remember to make new one as a daemon or it will block old one
        restart_command = cfg_["restart_command"];
 
-       
ntime::source::get_source().set_frame_time(lexical_cast_default<size_t>(cfg_["ms_per_frame"],20));
+       
fps_limit_.set_ms_per_frame(lexical_cast_default<size_t>(cfg_["ms_per_frame"], 
20));
 
        accepted_versions_.clear();
        const std::string& versions = cfg_["versions_accepted"];
@@ -574,7 +573,7 @@
        for (int loop = 0;; ++loop) {
                // Try to run with 50 FPS all the time
                // Server will respond a bit faster under heavy load
-               ntime::source::get_source().start_frame();
+               fps_limit_.limit();
                try {
                        // We are going to waith 10 seconds before shutting 
down so users can get out of game.
                        if (graceful_restart && games_.empty() && 
++graceful_counter > 500 )

Removed: trunk/src/time.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/time.cpp?rev=41183&view=auto
==============================================================================
--- trunk/src/time.cpp (original)
+++ trunk/src/time.cpp (removed)
@@ -1,67 +1,0 @@
-/* $Id$ */
-/*
-   Copyright (C) 2008 - 2010 by Pauli Nieminen <[email protected]>
-   Part of the Battle for Wesnoth Project http://www.wesnoth.org/
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License version 2
-   or at your option any later version.
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY.
-
-   See the COPYING file for more details.
-*/
-
-#include "time.hpp"
-#include "global.hpp"
-#include "SDL.h"
-
-namespace ntime {
-
-       source source::time_source_;
-
-       source::source() : frame_time_(20),
-                       current_time_(SDL_GetTicks())
-       {
-       }
-
-       size_t source::start_frame(const bool limit)
-       {
-               size_t previus_time = current_time_;
-               size_t current_time = SDL_GetTicks();
-               size_t frame_used = current_time - previus_time;
-               if (limit && frame_time_ > frame_used)
-               {
-                       // use delay to wait so we don't take all cpu
-                       size_t wait_time = frame_time_ - frame_used;
-                       SDL_Delay(wait_time);
-                       current_time += wait_time;
-               }
-               current_time_ = current_time;
-               return frame_used;
-       }
-
-       void source::set_frame_rate(const size_t fps)
-       {
-               frame_time_ = 1000/fps;
-       }
-
-       void source::set_frame_time(const size_t ms)
-       {
-               frame_time_ = ms;
-       }
-
-       size_t source::get_time() const
-       {
-               return current_time_;
-       }
-
-       source& source::get_source()
-       {
-               return source::time_source_;
-       }
-
-
-
-}
-

Removed: trunk/src/time.hpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/time.hpp?rev=41183&view=auto
==============================================================================
--- trunk/src/time.hpp (original)
+++ trunk/src/time.hpp (removed)
@@ -1,46 +1,0 @@
-/* $Id$ */
-/*
-   Copyright (C) 2008 - 2010 by Pauli Nieminen <[email protected]>
-   Part of the Battle for Wesnoth Project http://www.wesnoth.org/
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License version 2
-   or at your option any later version.
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY.
-
-   See the COPYING file for more details.
-*/
-
-#ifndef TIME_HPP_INCLUDED
-#define TIME_HPP_INCLUDED
-#include <cstdlib>
-
-namespace ntime {
-
-       class source
-       {
-               size_t frame_time_;
-               size_t current_time_;
-               static source time_source_;
-               source();
-               source(const source&);
-               void operator=(const source&);
-
-       public:
-               /**
-                * Called in begin of each frame
-                * @return How many milliseconds this frame took?
-                */
-               size_t start_frame(const bool limit = true);
-               void set_frame_rate(const size_t fps);
-               void set_frame_time(const size_t ms);
-
-               size_t get_time() const;
-
-               static source& get_source();
-
-       };
-}
-
-#endif


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to