diff --git a/src/C4Script.cpp b/src/C4Script.cpp index 569d9c4d..432f4de6 100644 --- a/src/C4Script.cpp +++ b/src/C4Script.cpp @@ -1779,7 +1779,7 @@ static C4Object *FnFindBase(C4ValueInt iOwner, C4ValueInt iIndex) return Game.FindBase(iOwner, iIndex); } -C4FindObject *CreateCriterionsFromPars(const C4Value *pPars, C4FindObject **pFOs, C4SortObject **pSOs) +C4FindObject *CreateCriterionsFromPars(std::span pPars, C4FindObject **pFOs, C4SortObject **pSOs) { int i, iCnt = 0, iSortCnt = 0; // Read all parameters @@ -1827,7 +1827,7 @@ C4FindObject *CreateCriterionsFromPars(const C4Value *pPars, C4FindObject **pFOs return pFO; } -static C4Value FnObjectCount2(C4AulContext *cthr, const C4Value *pPars) +static C4Value FnObjectCount2(C4AulContext *cthr, std::span pPars) { // Create FindObject-structure C4FindObject *pFOs[C4AUL_MAX_Par]; @@ -1843,7 +1843,7 @@ static C4Value FnObjectCount2(C4AulContext *cthr, const C4Value *pPars) return C4VInt(iCnt); } -static C4Value FnFindObject2(C4AulContext *cthr, const C4Value *pPars) +static C4Value FnFindObject2(C4AulContext *cthr, std::span pPars) { // Create FindObject-structure C4FindObject *pFOs[C4AUL_MAX_Par]; @@ -1860,7 +1860,7 @@ static C4Value FnFindObject2(C4AulContext *cthr, const C4Value *pPars) return C4VObj(pObj); } -static C4Value FnFindObjects(C4AulContext *cthr, const C4Value *pPars) +static C4Value FnFindObjects(C4AulContext *cthr, std::span pPars) { // Create FindObject-structure C4FindObject *pFOs[C4AUL_MAX_Par]; diff --git a/src/C4ScriptHelpers.h b/src/C4ScriptHelpers.h index 0994abc7..93f8dd2d 100644 --- a/src/C4ScriptHelpers.h +++ b/src/C4ScriptHelpers.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -250,7 +251,7 @@ namespace C4ScriptHelpers { template class C4AulEngineFuncParArray : public C4AulEngineFuncHelper { - using Func = C4Value(&)(C4AulContext *context, const C4Value *pars); + using Func = C4Value(&)(C4AulContext *context, std::span pars); Func func; public: @@ -259,7 +260,7 @@ namespace C4ScriptHelpers { C4V_Type GetRetType() noexcept override { return RetType; } C4Value Exec(C4AulContext *context, const C4Value pars[], bool = false) override { - return func(context, pars); + return func(context, std::span{pars, ParCount}); } }; }