diff options
Diffstat (limited to 'src/core/commandbuffer.cc')
-rw-r--r-- | src/core/commandbuffer.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc index c111e17..5ed3787 100644 --- a/src/core/commandbuffer.cc +++ b/src/core/commandbuffer.cc @@ -64,6 +64,11 @@ void func_list_zone(std::string const &args) } } +void func_list_model(std::string const &args) +{ + model::Model::list(); +} + void func_set(std::string const &args) { std::istringstream argstream(args); @@ -160,6 +165,9 @@ void CommandBuffer::init() func = Func::add("list_zone", (FuncPtr)func_list_zone); func->set_info("list zones"); + Func::add("list_model", (FuncPtr) func_list_model); + func->set_info("list models"); + func = Func::add("set", (FuncPtr)func_set); func->set_info("[variable] [str] set variable value"); @@ -185,6 +193,7 @@ void CommandBuffer::shutdown() Func::remove("list_var"); Func::remove("list_func"); Func::remove("list_ent"); + Func::remove("list_model"); Func::remove("list_zone"); Func::remove("print"); Func::remove("print_file"); @@ -205,6 +214,10 @@ void CommandBuffer::exec(std::string const &cmdline) aux::to_lowercase(command); //con_debug << "Executing '" << cmdline << "'\n"; + if ((command[0] == '\\') || (command[0] == '/')) { + command.erase(0, 1); + } + // is it a function Func *f = Func::find(command); if (f) { @@ -248,10 +261,15 @@ void CommandBuffer::exec(std::string const &cmdline) } // this gets forwarded to the server - if (connection()) - connection()->forward(cmdline); - else + if (connection()) { + if ((cmdline[0] == '\\') || (cmdline[0] == '/')) { + connection()->forward(cmdline.substr(1, cmdline.size()-1)); + } else { + connection()->forward(cmdline); + } + } else { con_print << "Unknown command '" << command << "^N'\n"; + } } void CommandBuffer::exec() |