Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/commandbuffer.cc')
-rw-r--r--src/core/commandbuffer.cc33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc
index 21002bd..84b63be 100644
--- a/src/core/commandbuffer.cc
+++ b/src/core/commandbuffer.cc
@@ -16,6 +16,7 @@
#include "core/commandbuffer.h"
#include "core/gameconnection.h"
#include "core/func.h"
+#include "core/info.h"
#include "core/cvar.h"
#include "core/loader.h"
#include "core/zone.h"
@@ -23,6 +24,8 @@
namespace core
{
+std::stringstream CommandBuffer::cmdbuf(std::stringstream::in | std::stringstream::out);
+
void func_print(std::string const &args)
{
con_print << args << "\n";
@@ -38,6 +41,15 @@ void func_print_file(std::string const &args)
CommandBuffer::print_file(filename);
}
+void func_list_info(std::string const &args)
+{
+ Info *info = Info::find(args);
+ if (info)
+ info->print();
+ else
+ Info::list();
+}
+
void func_list_func(std::string const &args)
{
Func::list();
@@ -151,7 +163,19 @@ void func_exec(std::string const &args)
CommandBuffer::exec_file(filename);
}
-std::stringstream CommandBuffer::cmdbuf(std::stringstream::in | std::stringstream::out);
+void func_remote(std::string const &args)
+{
+ if (connection()) {
+ if ((args[0] == '\\') || (args[0] == '/')) {
+ connection()->forward(args.substr(1, args.size()-1));
+ } else {
+ connection()->forward(args);
+ }
+ } else {
+ cmd() << args;
+ CommandBuffer::exec();
+ }
+}
void CommandBuffer::init()
{
@@ -164,6 +188,9 @@ void CommandBuffer::init()
func = Func::add("list_func", (FuncPtr)func_list_func);
func->set_info("list functions");
+ func = Func::add("list_info", (FuncPtr)func_list_info);
+ func->set_info("list infos");
+
func = Func::add("list_var", (FuncPtr)func_list_var);
func->set_info("list variables");
@@ -190,6 +217,9 @@ void CommandBuffer::init()
func = Func::add("exec", (FuncPtr)func_exec);
func->set_info("[filename] execute commands from file");
+
+ func = Func::add("remote", (FuncPtr)func_remote);
+ func->set_info("[command] send a command to the game server");
}
void CommandBuffer::shutdown()
@@ -200,6 +230,7 @@ void CommandBuffer::shutdown()
Func::remove("toggle");
Func::remove("list_var");
Func::remove("list_func");
+ Func::remove("list_info");
Func::remove("list_ent");
Func::remove("list_model");
Func::remove("list_module");