diff options
author | Stijn Buys <ingar@osirion.org> | 2008-11-01 13:33:18 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-11-01 13:33:18 +0000 |
commit | 83d6c17799c4d448a67ab5cdad02954282fa5c94 (patch) | |
tree | 2d76abb9bb501491f78e07822ed52e8302fdd247 /src/core/commandbuffer.cc | |
parent | a6bceed80f1b4315f23656efeceb6fe02cc7641c (diff) |
server-side model loading, initial @dock function
Diffstat (limited to 'src/core/commandbuffer.cc')
-rw-r--r-- | src/core/commandbuffer.cc | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc index 8c3c8a1..d3cb4f2 100644 --- a/src/core/commandbuffer.cc +++ b/src/core/commandbuffer.cc @@ -231,19 +231,39 @@ void CommandBuffer::exec(std::string const &cmdline) // is it a function Func *f = Func::find(command); if (f) { - std::string args; - char c; - if (cmdstream >> args) { - while (cmdstream.get(c)) - args += c; - } - // console can not execute game functions, and neither should rcon if ((f->flags() & Func::Game) && (Cvar::sv_dedicated->value() == 0)) { + if (application()->connected()) { - f->exec(game()->localplayer(), args); + + if ((f->flags() & Func::Target)) { + // target function + unsigned int id = 0; + if ((cmdstream >> id)) { + con_debug << "target function " << command << " " << id << std::endl; + Entity *entity = Entity::find(id); + if (entity) + f->exec(game()->localplayer(), entity); + } + } else { + // game function + std::string args; + char c; + if (cmdstream >> args) { + while (cmdstream.get(c)) + args += c; + } + f->exec(game()->localplayer(), args); + } } } else { + // regular function + std::string args; + char c; + if (cmdstream >> args) { + while (cmdstream.get(c)) + args += c; + } f->exec(args); } return; |