Skip to content

Commit

Permalink
Added some comments to clarify intent
Browse files Browse the repository at this point in the history
  • Loading branch information
chendo committed Jan 2, 2021
1 parent feb4943 commit d6e171b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scripting/Scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ sol::object Scripting::Execute(const std::string& aFuncName, sol::variadic_args
static const auto hashGameInstance = RED4ext::FNV1a("ScriptGameInstance");
auto* pGIType = pRtti->GetType(RED4ext::FNV1a("ScriptGameInstance"));


auto* pPlayerSystem = pRtti->GetClass(hashcpPlayerSystem);
auto* gameInstanceType = pRtti->GetClass(hashGameInstance);

Expand Down Expand Up @@ -497,6 +496,7 @@ sol::object Scripting::Execute(const std::string& aFuncName, sol::variadic_args
if (pFunc->params.size > 0)
{
auto* pType = pFunc->params[0]->type;
// check if the first argument is expected to be ScriptGameInstance
if (pType == pGIType)
{
argOffset = 1;
Expand All @@ -505,7 +505,6 @@ sol::object Scripting::Execute(const std::string& aFuncName, sol::variadic_args

std::vector<CStackType> args(aArgs.size() + argOffset);


if (pFunc->params.size - argOffset != aArgs.size())
{
aReturnMessage = "Function '" + aFuncName + "' expects " +
Expand All @@ -517,6 +516,7 @@ sol::object Scripting::Execute(const std::string& aFuncName, sol::variadic_args

if (argOffset > 0)
{
// Inject the ScriptGameInstance into first argument
args[0].type = pFunc->params[0]->type;
args[0].value = &unk10;
}
Expand Down

0 comments on commit d6e171b

Please sign in to comment.