Con_Printf("No commands are pending.\n");
else
{
- List_For_Each_Entry(current, &cbuf->deferred, list)
+ List_For_Each_Entry(current, &cbuf->deferred, cmd_input_t, list)
Con_Printf("-> In %9.2f: %s\n", current->delay, current->text);
}
}
Con_Print("Cbuf_InsertText: overflow\n");
else
{
- Cbuf_LinkCreate(cmd, &llist, List_Entry(cbuf->start.next, cmd_input_t, list), text);
+ Cbuf_LinkCreate(cmd, &llist, (List_Is_Empty(&cbuf->start) ? NULL : List_Entry(cbuf->start.next, cmd_input_t, list)), text);
if(!List_Is_Empty(&llist))
List_Splice(&llist, &cbuf->start);
}
return;
cbuf->deferred_oldtime = host.realtime;
- List_For_Each_Entry(current, &cbuf->deferred, list)
+ List_For_Each_Entry(current, &cbuf->deferred, cmd_input_t, list)
{
current->delay -= eat;
if(current->delay <= 0)
}
}
-
func = (cmd_function_t *)Mem_Alloc(cmd->mempool, sizeof(cmd_function_t));
func->flags = flags;
func->name = cmd_name;
func->qcfunc = true; //[515]: csqc
func->next = cmd->userdefined->qc_functions;
+ // bones_was_here: if this QC command overrides an engine command, store its pointer
+ // to avoid doing this search at invocation if QC declines to handle this command.
+ for (cmd_function_t *f = cmd->engine_functions; f; f = f->next)
+ {
+ if (!strcmp(cmd_name, f->name))
+ {
+ Con_DPrintf("Adding QC override of engine command %s\n", cmd_name);
+ func->overridden = f;
+ break;
+ }
+ }
+
// insert it at the right alphanumeric position
for (prev = NULL, current = cmd->userdefined->qc_functions; current && strcmp(current->name, func->name) < 0; prev = current, current = current->next)
;
if(((func->flags & CF_CLIENT) && CL_VM_ConsoleCommand(text)) ||
((func->flags & CF_SERVER) && SV_VM_ConsoleCommand(text)))
return true;
+
+ if (func->overridden) // If this QC command overrides an engine command,
+ func = func->overridden; // fall back to that command.
}
if (func->flags & CF_SERVER_FROM_CLIENT)
{