diff options
author | peter1138 <peter1138@openttd.org> | 2019-04-11 22:08:56 +0100 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-04-11 22:42:11 +0100 |
commit | 5bd2b15e863eaf54bfee4dfebb280d6884169354 (patch) | |
tree | bfbc83ead970d236ef828f1fedb24ea0578a05e7 /src/script/api/squirrel_export.vbs | |
parent | c0836bccefb7fbc6ebc8c5fa28886602067070f8 (diff) | |
download | openttd-5bd2b15e863eaf54bfee4dfebb280d6884169354.tar.xz |
Codechange: Replace NULL with nullptr in squirrel interface.
Diffstat (limited to 'src/script/api/squirrel_export.vbs')
-rw-r--r-- | src/script/api/squirrel_export.vbs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/script/api/squirrel_export.vbs b/src/script/api/squirrel_export.vbs index a13869509..d9d5d643d 100644 --- a/src/script/api/squirrel_export.vbs +++ b/src/script/api/squirrel_export.vbs @@ -62,7 +62,7 @@ Function DumpClassTemplates(name, file) file.WriteLine " 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; }" file.WriteLine " 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; }" If name = "ScriptEvent" Then - file.WriteLine " template <> inline int Return<" & name & " *>(HSQUIRRELVM vm, " & name & " *res) { if (res == NULL) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, " & Chr(34) & realname & Chr(34) & ", res, NULL, DefSQDestructorCallback<" & name & ">, true); return 1; }" + file.WriteLine " template <> inline int Return<" & name & " *>(HSQUIRRELVM vm, " & name & " *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, " & Chr(34) & realname & Chr(34) & ", res, nullptr, DefSQDestructorCallback<" & name & ">, true); return 1; }" ElseIf name = "ScriptText" Then file.WriteLine "" file.WriteLine " template <> inline Text *GetParam(ForceType<Text *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) {" @@ -72,10 +72,10 @@ Function DumpClassTemplates(name, file) file.WriteLine " if (sq_gettype(vm, index) == OT_STRING) {" file.WriteLine " return new RawText(GetParam(ForceType<const char *>(), vm, index, ptr));" file.WriteLine " }" - file.WriteLine " return NULL;" + file.WriteLine " return nullptr;" file.WriteLine " }" Else - file.WriteLine " template <> inline int Return<" & name & " *>(HSQUIRRELVM vm, " & name & " *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, " & Chr(34) & realname & Chr(34) & ", res, NULL, DefSQDestructorCallback<" & name & ">, true); return 1; }" + file.WriteLine " template <> inline int Return<" & name & " *>(HSQUIRRELVM vm, " & name & " *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, " & Chr(34) & realname & Chr(34) & ", res, nullptr, DefSQDestructorCallback<" & name & ">, true); return 1; }" End If End Function |