diff options
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/console.cc | 75 | ||||
-rw-r--r-- | src/server/console.h | 13 | ||||
-rw-r--r-- | src/server/server.cc | 5 |
3 files changed, 15 insertions, 78 deletions
diff --git a/src/server/console.cc b/src/server/console.cc index b5d0aaf..4b7992e 100644 --- a/src/server/console.cc +++ b/src/server/console.cc @@ -11,86 +11,21 @@ namespace server { -namespace console { +Console server_console; -//--- private definition ------------------------------------------ - -/// server console implementation -class Console : public sys::ConsoleInterface { -public: - /// stream to send normal messages too - virtual std::ostream & messagestream(); - - /// stream to send warning messages too - virtual std::ostream & warningstream(); - - /// stream to send warning messages too - virtual std::ostream & errorstream(); - - /// stream to send debug messages too - virtual std::ostream & debugstream(); - - /// flush does nothing in this implementation - virtual void flush(); - - unsigned long ping; - -}; - -// private console object -Console console; - -//--- engine functions -------------------------------------------- - -extern "C" void func_con_ping(std::stringstream &args) +Console *console() { - con_print << "Ping!" << std::endl; - console.ping++; + return (&server_console); } - -//--- public ------------------------------------------------------ - -void init() +void Console::init() { con_print << "Initializing console..." << std::endl; - - // register our engine functions - core::Func::add("con_ping", (core::FuncPtr) func_con_ping); } -void shutdown() +void Console::shutdown() { con_print << "Shutting down console..." << std::endl; - - // unregister our engine functions - core::Func::remove("con_ping"); -} - -//--- private ----------------------------------------------------- - -void Console::flush() -{ } -std::ostream & Console::messagestream() -{ - return std::cout; -} - -std::ostream & Console::warningstream() -{ - return std::cerr; } -std::ostream & Console::errorstream() -{ - return std::cerr; -} - -std::ostream & Console::debugstream() -{ - return std::cout; -} - -} // namespace console -} // namespace server diff --git a/src/server/console.h b/src/server/console.h index 1d94ba6..d894bf1 100644 --- a/src/server/console.h +++ b/src/server/console.h @@ -11,15 +11,16 @@ namespace server { -namespace console { +class Console : public sys::ConsoleInterface { +public: + static void init(); -void init(); + static void shutdown(); +}; -void shutdown(); +Console *console(); -} // namespace console - -} // namespace server +} #endif // __INCLUDED_SERVER_CONSOLE_H__ diff --git a/src/server/server.cc b/src/server/server.cc index 1c95ee8..ee54352 100644 --- a/src/server/server.cc +++ b/src/server/server.cc @@ -33,6 +33,7 @@ public: virtual void quit(int status); }; + Server app; //--- public ------------------------------------------------------ @@ -60,7 +61,7 @@ void Server::init(int count, char **arguments) core::Cvar::sv_private = core::Cvar::set("sv_dedicated", "1", core::Cvar::ReadOnly); core::Application::init(count, arguments); - console::init(); + Console::init(); // the command line is in the buffer, execute it core::CommandBuffer::exec(); @@ -103,7 +104,7 @@ void Server::shutdown() con_debug << " bytes sent " << std::setw(6) << core::Stats::network_bytes_sent / 1024 << " Kb" << std::endl; con_debug << " bytes received " << std::setw(6) << core::Stats::network_bytes_received / 1024 << " Kb" << std::endl; - console::shutdown(); + Console::shutdown(); core::Application::shutdown(); |