diff options
author | truebrain <truebrain@openttd.org> | 2011-12-19 21:01:03 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-12-19 21:01:03 +0000 |
commit | e0ffe4faf268298f3a20427cd87462c70e3d9bc2 (patch) | |
tree | b2958b45d880e8ed5fe40f2a176652ef072ea5a6 /src/script/api/template | |
parent | ad48ab923764087bf66153d1c26ed0eb05a19989 (diff) | |
download | openttd-e0ffe4faf268298f3a20427cd87462c70e3d9bc2.tar.xz |
(svn r23627) -Add: ScriptNews::Create, to create custom news messages (GameScript only)
Diffstat (limited to 'src/script/api/template')
-rw-r--r-- | src/script/api/template/template_news.hpp.sq | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/script/api/template/template_news.hpp.sq b/src/script/api/template/template_news.hpp.sq new file mode 100644 index 000000000..f0a09bb49 --- /dev/null +++ b/src/script/api/template/template_news.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_news.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptNews::NewsType GetParam(ForceType<ScriptNews::NewsType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptNews::NewsType)tmp; } + template <> inline int Return<ScriptNews::NewsType>(HSQUIRRELVM vm, ScriptNews::NewsType res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptNews to be used as Squirrel parameter */ + template <> inline ScriptNews *GetParam(ForceType<ScriptNews *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptNews *)instance; } + template <> inline ScriptNews &GetParam(ForceType<ScriptNews &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptNews *)instance; } + template <> inline const ScriptNews *GetParam(ForceType<const ScriptNews *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptNews *)instance; } + template <> inline const ScriptNews &GetParam(ForceType<const ScriptNews &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptNews *)instance; } + template <> inline int Return<ScriptNews *>(HSQUIRRELVM vm, ScriptNews *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "News", res, NULL, DefSQDestructorCallback<ScriptNews>, true); return 1; } +} // namespace SQConvert |