diff options
Diffstat (limited to 'src/dedicated')
-rw-r--r-- | src/dedicated/Makefile.am | 10 | ||||
-rw-r--r-- | src/dedicated/console.cc | 6 | ||||
-rw-r--r-- | src/dedicated/console.h | 10 | ||||
-rw-r--r-- | src/dedicated/dedicated.cc | 45 | ||||
-rw-r--r-- | src/dedicated/dedicated.h | 36 |
5 files changed, 51 insertions, 56 deletions
diff --git a/src/dedicated/Makefile.am b/src/dedicated/Makefile.am index bc2f741..879829e 100644 --- a/src/dedicated/Makefile.am +++ b/src/dedicated/Makefile.am @@ -1,7 +1,7 @@ METASOURCES = AUTO -libserver_la_SOURCES = console.cc server.cc -noinst_HEADERS = console.h server.h -noinst_LTLIBRARIES = libserver.la +libdedicated_la_SOURCES = console.cc dedicated.cc +noinst_HEADERS = console.h dedicated.h +noinst_LTLIBRARIES = libdedicated.la INCLUDES = -I$(top_srcdir)/src -libserver_la_LDFLAGS = -avoid-version -no-undefined -libserver_la_LIBADD = $(top_builddir)/src/core/libcore.la +libdedicated_la_LDFLAGS = -avoid-version -no-undefined +libdedicated_la_LIBADD = $(top_builddir)/src/core/libcore.la diff --git a/src/dedicated/console.cc b/src/dedicated/console.cc index 9fdad4f..74b1101 100644 --- a/src/dedicated/console.cc +++ b/src/dedicated/console.cc @@ -11,16 +11,16 @@ #include <iomanip> #include <cmath> -#include "server/console.h" +#include "auxiliary/functions.h" #include "core/core.h" +#include "dedicated/console.h" #include "sys/consoleinterface.h" -#include "auxiliary/functions.h" #ifdef HAVE_CURSES #include <ncurses.h> #endif -namespace server { +namespace dedicated { bool console_initialized = false; bool console_updated = false; diff --git a/src/dedicated/console.h b/src/dedicated/console.h index 13db3fc..6ab26ba 100644 --- a/src/dedicated/console.h +++ b/src/dedicated/console.h @@ -1,15 +1,15 @@ /* - server/console.h + dedicated/console.h This file is part of the Osirion project and is distributed under the terms of the GNU General Public License version 2 */ -#ifndef __INCLUDED_SERVER_CONSOLE_H__ -#define __INCLUDED_SERVER_CONSOLE_H__ +#ifndef __INCLUDED_DEDICATED_CONSOLE_H__ +#define __INCLUDED_DEDICATED_CONSOLE_H__ #include "sys/consoleinterface.h" -namespace server { +namespace dedicated { class Console : public sys::ConsoleInterface { public: @@ -62,5 +62,5 @@ Console *console(); } -#endif // __INCLUDED_SERVER_CONSOLE_H__ +#endif // __INCLUDED_DEDICATED_CONSOLE_H__ diff --git a/src/dedicated/dedicated.cc b/src/dedicated/dedicated.cc index a4424a0..387fcbe 100644 --- a/src/dedicated/dedicated.cc +++ b/src/dedicated/dedicated.cc @@ -1,5 +1,5 @@ /* - server/server.cc + dedicated/dedicated.cc This file is part of the Osirion project and is distributed under the terms and conditions of the GNU General Public License version 2 */ @@ -10,36 +10,12 @@ #include "core/core.h" #include "core/stats.h" #include "core/timer.h" -#include "server/console.h" -#include "server/server.h" +#include "dedicated/console.h" +#include "dedicated/dedicated.h" -namespace server { +namespace dedicated { -//--- private definition ------------------------------------------ - -/// server Application implementation -class Server : public core::Application { -public: - /// initialize the server Application - virtual void init(int count, char **arguments); - - /// run the server Application - virtual void run(); - - /// shutdown the server Application - virtual void shutdown(); - - /// quit the server Application - virtual void quit(int status); -}; - - -Server app; - -//--- public ------------------------------------------------------ - -/// the server main loop -void main(int count, char **arguments) +void run(int count, char **arguments) { std::cout << core::name() << " " << core::version() << std::endl; @@ -47,14 +23,15 @@ void main(int count, char **arguments) std::cout << arguments[i] << " "; std::cout << std::endl; + Dedicated app; app.init(count, arguments); app.run(); app.shutdown(); } -//--- private ----------------------------------------------------- +/* ---- class Dedicated -------------------------------------------- */ -void Server::init(int count, char **arguments) +void Dedicated::init(int count, char **arguments) { con_print << "^BInitializing server..." << std::endl; @@ -71,7 +48,7 @@ void Server::init(int count, char **arguments) core::Application::connect(empty); } -void Server::run() +void Dedicated::run() { float server_framerate = 1.0f / 25.0f; @@ -89,7 +66,7 @@ void Server::run() } } -void Server::shutdown() +void Dedicated::shutdown() { con_print << "^BShutting down server..." << std::endl; @@ -114,7 +91,7 @@ void Server::shutdown() quit(0); } -void Server::quit(int status) +void Dedicated::quit(int status) { core::Application::quit(status); } diff --git a/src/dedicated/dedicated.h b/src/dedicated/dedicated.h index 4691e91..4b1f584 100644 --- a/src/dedicated/dedicated.h +++ b/src/dedicated/dedicated.h @@ -1,19 +1,37 @@ /* - server/server.h + dedicated/dedicated.h This file is part of the Osirion project and is distributed under the terms and conditions of the GNU General Public License version 2 */ -#ifndef __INCLUDED_SERVER_H__ -#define __INCLUDED_SERVER_H__ +#ifndef __INCLUDED_DEDICATED_H__ +#define __INCLUDED_DEDICATED_H__ -/// contains classes and functions to run a dedicated server -namespace server { +#include "core/application.h" -/// the server main loop -void main(int count, char **arguments); +/// contains classes and functions to run the dedicated server +namespace dedicated { + +/// run the dedicated server +void run(int count, char **arguments); -} // namespace server +/// server application implementation +class Dedicated : public core::Application { +public: + /// initialize the server Application + virtual void init(int count, char **arguments); + + /// run the server Application + virtual void run(); + + /// shutdown the server Application + virtual void shutdown(); + + /// quit the server Application + virtual void quit(int status); +}; + +} // namespace dedicated -#endif // __INCLUDED_SERVER_H__ +#endif // __INCLUDED_DEDICATED_H__ |