diff options
-rw-r--r-- | cmake/scripts/SquirrelExport.cmake | 8 | ||||
-rw-r--r-- | src/ai/ai_info.cpp | 4 | ||||
-rw-r--r-- | src/game/game_info.cpp | 2 | ||||
-rw-r--r-- | src/script/api/script_text.cpp | 2 | ||||
-rw-r--r-- | src/script/squirrel.cpp | 2 | ||||
-rw-r--r-- | src/script/squirrel.hpp | 2 | ||||
-rw-r--r-- | src/script/squirrel_helper.hpp | 12 |
7 files changed, 16 insertions, 16 deletions
diff --git a/cmake/scripts/SquirrelExport.cmake b/cmake/scripts/SquirrelExport.cmake index 3b230de00..d0c228355 100644 --- a/cmake/scripts/SquirrelExport.cmake +++ b/cmake/scripts/SquirrelExport.cmake @@ -28,10 +28,10 @@ endmacro() macro(dump_class_templates NAME) string(REGEX REPLACE "^Script" "" REALNAME ${NAME}) - string(APPEND SQUIRREL_EXPORT "\n template <> inline ${NAME} *GetParam(ForceType<${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (${NAME} *)instance; }") - string(APPEND SQUIRREL_EXPORT "\n template <> inline ${NAME} &GetParam(ForceType<${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(${NAME} *)instance; }") - string(APPEND SQUIRREL_EXPORT "\n template <> inline const ${NAME} *GetParam(ForceType<const ${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (${NAME} *)instance; }") - string(APPEND SQUIRREL_EXPORT "\n template <> inline const ${NAME} &GetParam(ForceType<const ${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(${NAME} *)instance; }") + string(APPEND SQUIRREL_EXPORT "\n template <> inline ${NAME} *GetParam(ForceType<${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return (${NAME} *)instance; }") + string(APPEND SQUIRREL_EXPORT "\n template <> inline ${NAME} &GetParam(ForceType<${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return *(${NAME} *)instance; }") + string(APPEND SQUIRREL_EXPORT "\n template <> inline const ${NAME} *GetParam(ForceType<const ${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return (${NAME} *)instance; }") + string(APPEND SQUIRREL_EXPORT "\n template <> inline const ${NAME} &GetParam(ForceType<const ${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return *(${NAME} *)instance; }") if("${NAME}" STREQUAL "ScriptEvent") string(APPEND SQUIRREL_EXPORT "\n template <> inline int Return<${NAME} *>(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; }") elseif("${NAME}" STREQUAL "ScriptText") diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index dfb2e5fbf..10d34ea58 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -63,7 +63,7 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; } { /* Get the AIInfo */ SQUserPointer instance = nullptr; - if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, 0)) || instance == nullptr) return sq_throwerror(vm, "Pass an instance of a child class of AIInfo to RegisterAI"); + if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, nullptr)) || instance == nullptr) return sq_throwerror(vm, "Pass an instance of a child class of AIInfo to RegisterAI"); AIInfo *info = (AIInfo *)instance; SQInteger res = ScriptInfo::Constructor(vm, info); @@ -107,7 +107,7 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; } { /* Get the AIInfo */ SQUserPointer instance; - sq_getinstanceup(vm, 2, &instance, 0); + sq_getinstanceup(vm, 2, &instance, nullptr); AIInfo *info = (AIInfo *)instance; info->api_version = nullptr; diff --git a/src/game/game_info.cpp b/src/game/game_info.cpp index 3d07a10c4..60b4d0dcc 100644 --- a/src/game/game_info.cpp +++ b/src/game/game_info.cpp @@ -54,7 +54,7 @@ template <> const char *GetClassName<GameInfo, ST_GS>() { return "GSInfo"; } { /* Get the GameInfo */ SQUserPointer instance = nullptr; - if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, 0)) || instance == nullptr) return sq_throwerror(vm, "Pass an instance of a child class of GameInfo to RegisterGame"); + if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, nullptr)) || instance == nullptr) return sq_throwerror(vm, "Pass an instance of a child class of GameInfo to RegisterGame"); GameInfo *info = (GameInfo *)instance; SQInteger res = ScriptInfo::Constructor(vm, info); diff --git a/src/script/api/script_text.cpp b/src/script/api/script_text.cpp index eeb7b2221..62980326c 100644 --- a/src/script/api/script_text.cpp +++ b/src/script/api/script_text.cpp @@ -109,7 +109,7 @@ SQInteger ScriptText::_SetParam(int parameter, HSQUIRRELVM vm) sq_pop(vm, 3); /* Get the 'real' instance of this class */ - sq_getinstanceup(vm, -1, &real_instance, 0); + sq_getinstanceup(vm, -1, &real_instance, nullptr); if (real_instance == nullptr) return SQ_ERROR; ScriptText *value = static_cast<ScriptText *>(real_instance); diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp index 995776408..6489c8737 100644 --- a/src/script/squirrel.cpp +++ b/src/script/squirrel.cpp @@ -256,7 +256,7 @@ void Squirrel::RunError(HSQUIRRELVM vm, const SQChar *error) SQInteger Squirrel::_RunError(HSQUIRRELVM vm) { - const SQChar *sErr = 0; + const SQChar *sErr = nullptr; if (sq_gettop(vm) >= 1) { if (SQ_SUCCEEDED(sq_getstring(vm, -1, &sErr))) { diff --git a/src/script/squirrel.hpp b/src/script/squirrel.hpp index 412011ccc..c1fdc7511 100644 --- a/src/script/squirrel.hpp +++ b/src/script/squirrel.hpp @@ -190,7 +190,7 @@ public: * @note This will only work just after a function-call from within Squirrel * to your C++ function. */ - static bool GetRealInstance(HSQUIRRELVM vm, SQUserPointer *ptr) { return SQ_SUCCEEDED(sq_getinstanceup(vm, 1, ptr, 0)); } + static bool GetRealInstance(HSQUIRRELVM vm, SQUserPointer *ptr) { return SQ_SUCCEEDED(sq_getinstanceup(vm, 1, ptr, nullptr)); } /** * Get the Squirrel-instance pointer. diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp index ff25a5d58..6a3ba6125 100644 --- a/src/script/squirrel_helper.hpp +++ b/src/script/squirrel_helper.hpp @@ -754,9 +754,9 @@ namespace SQConvert { sq_pop(vm, 3); /* Get the 'real' instance of this class */ - sq_getinstanceup(vm, 1, &real_instance, 0); + sq_getinstanceup(vm, 1, &real_instance, nullptr); /* Get the real function pointer */ - sq_getuserdata(vm, nparam, &ptr, 0); + sq_getuserdata(vm, nparam, &ptr, nullptr); if (real_instance == nullptr) return sq_throwerror(vm, "couldn't detect real instance of class for non-static call"); /* Remove the userdata from the stack */ sq_pop(vm, 1); @@ -796,9 +796,9 @@ namespace SQConvert { sq_pop(vm, 3); /* Get the 'real' instance of this class */ - sq_getinstanceup(vm, 1, &real_instance, 0); + sq_getinstanceup(vm, 1, &real_instance, nullptr); /* Get the real function pointer */ - sq_getuserdata(vm, nparam, &ptr, 0); + sq_getuserdata(vm, nparam, &ptr, nullptr); if (real_instance == nullptr) return sq_throwerror(vm, "couldn't detect real instance of class for non-static call"); /* Remove the userdata from the stack */ sq_pop(vm, 1); @@ -820,7 +820,7 @@ namespace SQConvert { SQUserPointer ptr = nullptr; /* Get the real function pointer */ - sq_getuserdata(vm, nparam, &ptr, 0); + sq_getuserdata(vm, nparam, &ptr, nullptr); try { /* Delegate it to a template that can handle this specific function */ @@ -844,7 +844,7 @@ namespace SQConvert { SQUserPointer ptr = nullptr; /* Get the real function pointer */ - sq_getuserdata(vm, nparam, &ptr, 0); + sq_getuserdata(vm, nparam, &ptr, nullptr); /* Remove the userdata from the stack */ sq_pop(vm, 1); |