mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fix script command
Fixed problem where in certain cases input doesn't get compiled at all. Fixed problem where quote marks don't get passed correctly to the execute wrapper function. problems: passing non-string object as reference to constructor. using CCommand::Arg(index) seems to 'strip' quote marks from the actual buffer.
This commit is contained in:
parent
02cbb36474
commit
3ad668e37a
@ -33,11 +33,11 @@ struct SQBufState
|
||||
const SQChar* bufTail;
|
||||
const SQChar* bufCopy;
|
||||
|
||||
SQBufState(const std::string& code)
|
||||
SQBufState(const SQChar* code)
|
||||
{
|
||||
buf = code.c_str();
|
||||
bufTail = code.c_str() + code.size();
|
||||
bufCopy = code.c_str();
|
||||
buf = code;
|
||||
bufTail = code + strlen(code);
|
||||
bufCopy = code;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -451,17 +451,11 @@ void SQVM_Execute(const SQChar* code, SQCONTEXT context)
|
||||
HSQUIRRELVM v = SQVM_GetVM(context);
|
||||
if (!v)
|
||||
{
|
||||
Error(eDLL_T::ENGINE, "Attempted to execute %s script while VM isn't initialized\n", SQVM_GetContextName(context));
|
||||
Error(eDLL_T::ENGINE, "Attempted to run %s script while VM isn't initialized\n", SQVM_GetContextName(context));
|
||||
return;
|
||||
}
|
||||
|
||||
SQVM* vTable = v->GetVTable();
|
||||
if (!vTable)
|
||||
{
|
||||
Error(eDLL_T::ENGINE, "Attempted to execute %s script while VM isn't initialized\n", SQVM_GetContextName(context));
|
||||
return;
|
||||
}
|
||||
|
||||
SQRESULT compileResult{};
|
||||
SQBufState bufState = SQBufState(code);
|
||||
|
||||
|
@ -801,12 +801,7 @@ void _SQVM_ServerScript_f_CompletionFunc(const CCommand& args)
|
||||
{
|
||||
if (args.ArgC() >= 2)
|
||||
{
|
||||
string svBuf;
|
||||
for (int i = 1; i < args.ArgC(); i++)
|
||||
{
|
||||
svBuf.append(args.Arg(i));
|
||||
}
|
||||
SQVM_Execute(svBuf.c_str(), SQCONTEXT::SERVER);
|
||||
SQVM_Execute(args.ArgS(), SQCONTEXT::SERVER);
|
||||
}
|
||||
}
|
||||
|
||||
@ -823,12 +818,7 @@ void _SQVM_ClientScript_f_CompletionFunc(const CCommand& args)
|
||||
{
|
||||
if (args.ArgC() >= 2)
|
||||
{
|
||||
string svBuf;
|
||||
for (int i = 1; i < args.ArgC(); i++)
|
||||
{
|
||||
svBuf.append(args.Arg(i));
|
||||
}
|
||||
SQVM_Execute(svBuf.c_str(), SQCONTEXT::CLIENT);
|
||||
SQVM_Execute(args.ArgS(), SQCONTEXT::CLIENT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -844,12 +834,7 @@ void _SQVM_UIScript_f_CompletionFunc(const CCommand& args)
|
||||
{
|
||||
if (args.ArgC() >= 2)
|
||||
{
|
||||
string svBuf;
|
||||
for (int i = 1; i < args.ArgC(); i++)
|
||||
{
|
||||
svBuf.append(args.Arg(i));
|
||||
}
|
||||
SQVM_Execute(svBuf.c_str(), SQCONTEXT::UI);
|
||||
SQVM_Execute(args.ArgS(), SQCONTEXT::UI);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user