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.cc36
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;