You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/CCustomOpcodeSystem.cpp
+64-11
Original file line number
Diff line number
Diff line change
@@ -2075,7 +2075,7 @@ namespace CLEO
2075
2075
int label = 0;
2076
2076
2077
2077
char* moduleTxt = nullptr;
2078
-
auto paramType = CLEO_GetOperandType(thread);
2078
+
auto paramType = (eDataType)*thread->GetBytePointer();
2079
2079
switch (paramType)
2080
2080
{
2081
2081
// label of current script
@@ -2104,7 +2104,7 @@ namespace CLEO
2104
2104
break;
2105
2105
2106
2106
default:
2107
-
SHOW_ERROR("Invalid type (%s) of the first argument in opcode [0AB1] in script %s \nScript suspended.", ToKindStr(paramType), ((CCustomScript*)thread)->GetInfoStr().c_str());
2107
+
SHOW_ERROR("Invalid type (%s) of the 'input param count' argument in opcode [0AB1] in script %s \nScript suspended.", ToKindStr(paramType), ((CCustomScript*)thread)->GetInfoStr().c_str());
if (returnParamCount) GetScriptParams(thread, returnParamCount);
2234
2286
2235
2287
scmFunc->Return(thread); // jump back to cleo_call, right after last input param. Return slot var args starts here
2236
2288
if (scmFunc->moduleExportRef != nullptr) GetInstance().ModuleSystem.ReleaseModuleRef((char*)scmFunc->moduleExportRef); // export - release module
2237
2289
delete scmFunc;
2238
2290
2239
2291
DWORD returnSlotCount = GetVarArgCount(thread);
2240
-
if (returnSlotCount > returnParamCount)
2292
+
if(returnParamCount) returnParamCount--; // do not count the 'num args' argument itself
2293
+
if (returnSlotCount != returnParamCount)
2241
2294
{
2242
-
SHOW_ERROR("Opcode [0AB2] returned fewer params than expected by function caller in script %s\nScript suspended.", ((CCustomScript*)thread)->GetInfoStr().c_str());
2295
+
SHOW_ERROR("Opcode [0AB2] returned %d params, while function caller expected %d in script %s\nScript suspended.", returnParamCount, returnSlotCount, ((CCustomScript*)thread)->GetInfoStr().c_str());
0 commit comments