diff options
author | Stijn Buys <ingar@osirion.org> | 2008-11-08 12:58:05 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-11-08 12:58:05 +0000 |
commit | dbb28ef3422bf2442e15d75fd52180cfb9b40102 (patch) | |
tree | 16b9f8bb8b5bfa64f9676e4eed134dbe15299c90 /src/core/application.cc | |
parent | e3512a1b55e97b2eba62847e6e28065eec24c92f (diff) |
adds rcon, rconpassword and sv_password
Diffstat (limited to 'src/core/application.cc')
-rw-r--r-- | src/core/application.cc | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/core/application.cc b/src/core/application.cc index 300aaa6..7326383 100644 --- a/src/core/application.cc +++ b/src/core/application.cc @@ -127,6 +127,12 @@ void Application::init(int count, char **arguments) Cvar::sv_name = Cvar::get("sv_name", "osirion server", Cvar::Archive); Cvar::sv_name->set_info("[string] server name"); + Cvar::sv_description = Cvar::get("sv_description", "default server", Cvar::Archive); + Cvar::sv_description->set_info("[string] server description"); + + Cvar::sv_password = Cvar::get("sv_password", "", Cvar::Archive); + Cvar::sv_password->set_info("[string] server rcon password"); + // network settings Cvar::net_host = Cvar::get("net_host", "0.0.0.0", Cvar::Archive); Cvar::net_host->set_info("[ip] IP address the network server binds to"); @@ -143,10 +149,6 @@ void Application::init(int count, char **arguments) Cvar::net_framerate = Cvar::get("net_framerate", "25"); Cvar::net_framerate->set_info("[int] network framerate in frames/sec"); - // passwords - Cvar::rconpassword = Cvar::get("rconpassword", "", Cvar::Archive); - Cvar::rconpassword->set_info("[string] password for remote console access"); - #ifdef _WIN32 Cvar::con_ansi = Cvar::get("con_ansi", "0", Cvar::Archive); #else @@ -174,7 +176,7 @@ void Application::init(int count, char **arguments) func->set_info("exit the application"); func = Func::add("load", Application::func_load); - func->set_info("[str] load a game module"); + func->set_info("[string] load a game module"); func = Func::add("connect", Application::func_connect); func->set_info("[ip] without ip, create a game"); @@ -188,6 +190,9 @@ void Application::init(int count, char **arguments) func = Func::add("msg", Application::func_msg); func->set_info("msg [player] [text] send a private message to another player"); + func = Func::add("rcon", Application::func_rcon); + func->set_info("[string] send a console command to the server"); + func = 0; } @@ -546,6 +551,22 @@ void Application::func_msg(std::string const &args) } } +void Application::func_rcon(std::string const &args) +{ + if (connection()) { + core::Cvar *rconpassword = core::Cvar::find("rconpassword"); + if (rconpassword && rconpassword->str().size()) { + connection()->rcon(args); + } else { + con_warn << "rconpassword not set!" << std::endl; + } + } else if (server()) { + cmd() << args << "\n"; + } else { + con_print << "Not connected." << std::endl; + } +} + void Application::func_load(std::string const &args) { std::string name(args); |