1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 08:52:40 +01:00

Codechange: remove manual param count; in all cases strlen(params) == nparams

This commit is contained in:
Rubidium
2025-04-26 21:10:08 +02:00
committed by rubidium42
parent 781187b8a6
commit c7056866a3
9 changed files with 47 additions and 49 deletions

View File

@@ -253,7 +253,7 @@ void Squirrel::PrintFunc(HSQUIRRELVM vm, const std::string &s)
}
}
void Squirrel::AddMethod(std::string_view method_name, SQFUNCTION proc, uint nparam, const char *params, void *userdata, int size)
void Squirrel::AddMethod(std::string_view method_name, SQFUNCTION proc, std::string_view params, void *userdata, int size)
{
ScriptAllocatorScope alloc_scope(this);
@@ -265,7 +265,7 @@ void Squirrel::AddMethod(std::string_view method_name, SQFUNCTION proc, uint npa
}
sq_newclosure(this->vm, proc, size != 0 ? 1 : 0);
if (nparam != 0) sq_setparamscheck(this->vm, nparam, params);
if (!params.empty()) sq_setparamscheck(this->vm, params.size(), params.data());
sq_setnativeclosurename(this->vm, -1, method_name);
sq_newslot(this->vm, -3, SQFalse);
}