summaryrefslogtreecommitdiff
path: root/src/script/api/template
diff options
context:
space:
mode:
authorzuu <zuu@openttd.org>2014-02-06 19:50:34 +0000
committerzuu <zuu@openttd.org>2014-02-06 19:50:34 +0000
commit96030141026ded3f892510ff9e3643319f27ebd8 (patch)
treee6e7475076685c561a7d1ff9e1161dbdc56d5f8b /src/script/api/template
parent1dbd59e6ab9a917214d98c53a8ab8ca5b0d47223 (diff)
downloadopenttd-96030141026ded3f892510ff9e3643319f27ebd8.tar.xz
(svn r26307) -Add: [nogo] Allow GS to hide story page date
Diffstat (limited to 'src/script/api/template')
-rw-r--r--src/script/api/template/template_date.hpp.sq4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/script/api/template/template_date.hpp.sq b/src/script/api/template/template_date.hpp.sq
index 976ddb7a5..cca4a258b 100644
--- a/src/script/api/template/template_date.hpp.sq
+++ b/src/script/api/template/template_date.hpp.sq
@@ -12,6 +12,10 @@
#include "../script_date.hpp"
namespace SQConvert {
+ /* Allow enums to be used as Squirrel parameters */
+ template <> inline ScriptDate::Date GetParam(ForceType<ScriptDate::Date>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptDate::Date)tmp; }
+ template <> inline int Return<ScriptDate::Date>(HSQUIRRELVM vm, ScriptDate::Date res) { sq_pushinteger(vm, (int32)res); return 1; }
+
/* Allow ScriptDate to be used as Squirrel parameter */
template <> inline ScriptDate *GetParam(ForceType<ScriptDate *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptDate *)instance; }
template <> inline ScriptDate &GetParam(ForceType<ScriptDate &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptDate *)instance; }