Split command buffer peeking hacks out of the "sm" command.

This commit is contained in:
David Anderson 2015-09-11 01:48:25 -07:00
parent 168b779786
commit 1a7b708df8
2 changed files with 19 additions and 26 deletions

View File

@ -538,7 +538,7 @@ void SM_ExecuteForPlugin(IPluginContext *ctx)
can_create = SM_ExecuteConfig(plugin, plugin->GetConfig(i), can_create);
}
char cmd[255];
ke::SafeSprintf(cmd, sizeof(cmd), "sm internal 2 %d\n", plugin->GetSerial());
ke::SafeSprintf(cmd, sizeof(cmd), "sm_internal 2 %d\n", plugin->GetSerial());
engine->ServerCommand(cmd);
}
}
@ -585,7 +585,24 @@ void SM_InternalCmdTrigger()
{
/* Order is important here. We need to buffer things before we send the command out. */
g_pOnAutoConfigsBuffered->Execute(NULL);
engine->ServerCommand("sm internal 1\n");
engine->ServerCommand("sm_internal 1\n");
g_PendingInternalPush = false;
}
CON_COMMAND(sm_internal, "")
{
#if SOURCE_ENGINE <= SE_DARKMESSIAH
CCommand args;
#endif
if (args.ArgC() < 1)
return;
const char *arg = args.Arg(1);
if (strcmp(arg, "1") == 0) {
SM_ConfigsExecuted_Global();
} else if (strcmp(arg, "2") == 0) {
if (args.ArgC() >= 3)
SM_ConfigsExecuted_Plugin(atoi(args.Arg(2)));
}
}

View File

@ -44,29 +44,5 @@ CON_COMMAND(sm, "SourceMod Menu")
#endif
EngineArgs cargs(args);
if (cargs.ArgC() >= 2) {
const char *cmdname = cargs.Arg(1);
if (strcmp(cmdname, "internal") == 0)
{
if (cargs.ArgC() >= 3)
{
const char *arg = cargs.Arg(2);
if (strcmp(arg, "1") == 0)
{
SM_ConfigsExecuted_Global();
}
else if (strcmp(arg, "2") == 0)
{
if (cargs.ArgC() >= 4)
{
SM_ConfigsExecuted_Plugin(atoi(cargs.Arg(3)));
}
}
}
return;
}
}
logicore.OnRootCommand(&cargs);
}