summaryrefslogtreecommitdiff
path: root/src/script/squirrel_class.hpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-12-19 21:00:32 +0000
committertruebrain <truebrain@openttd.org>2011-12-19 21:00:32 +0000
commit3a535690d4e9aaa896a062e7b5b5454b1b07ac47 (patch)
tree600859d25db8391542b9cc0da9e063c7bdc6f4fc /src/script/squirrel_class.hpp
parent77b7366c2947a3f2545d5542021be1cc203a74e8 (diff)
downloadopenttd-3a535690d4e9aaa896a062e7b5b5454b1b07ac47.tar.xz
(svn r23623) -Add: allow bi-directional communication with the AdminPort and GameScript
Diffstat (limited to 'src/script/squirrel_class.hpp')
-rw-r--r--src/script/squirrel_class.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script/squirrel_class.hpp b/src/script/squirrel_class.hpp
index 73117b60a..55efcdf13 100644
--- a/src/script/squirrel_class.hpp
+++ b/src/script/squirrel_class.hpp
@@ -72,6 +72,16 @@ public:
}
/**
+ * This defines a static method inside a class for Squirrel, which has access to the 'engine' (experts only!).
+ */
+ template <typename Func>
+ void DefSQAdvancedStaticMethod(Squirrel *engine, Func function_proc, const char *function_name)
+ {
+ using namespace SQConvert;
+ engine->AddMethod(function_name, DefSQAdvancedStaticCallback<CL, Func>, 0, NULL, &function_proc, sizeof(function_proc));
+ }
+
+ /**
* This defines a static method inside a class for Squirrel with defined params.
* @note If you define nparam, make sure that he first param is always 'x',
* which is the 'this' inside the function. This is hidden from the rest