summaryrefslogtreecommitdiff
path: root/src/script/squirrel.hpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-04-21 19:13:32 +0000
committeryexo <yexo@openttd.org>2009-04-21 19:13:32 +0000
commit3949050714463bf13ffb6da231019de6db22a8e5 (patch)
treeb6dc258527d34f2a1db659be97eb7f48e16a7da6 /src/script/squirrel.hpp
parentd4d163e127a90aecc64ddcfb37c96acbde91d658 (diff)
downloadopenttd-3949050714463bf13ffb6da231019de6db22a8e5.tar.xz
(svn r16113) -Feature [NoAI]: Add UseAsRandomAI as function in info.nut. When an AI returns false, it'll never be chosen as random AI.
Diffstat (limited to 'src/script/squirrel.hpp')
-rw-r--r--src/script/squirrel.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/script/squirrel.hpp b/src/script/squirrel.hpp
index 31b36f968..ee597f87a 100644
--- a/src/script/squirrel.hpp
+++ b/src/script/squirrel.hpp
@@ -116,6 +116,7 @@ public:
bool CallMethod(HSQOBJECT instance, const char *method_name, int suspend = -1) { return this->CallMethod(instance, method_name, NULL, suspend); }
bool CallStringMethodStrdup(HSQOBJECT instance, const char *method_name, const char **res, int suspend = -1);
bool CallIntegerMethod(HSQOBJECT instance, const char *method_name, int *res, int suspend = -1);
+ bool CallBoolMethod(HSQOBJECT instance, const char *method_name, bool *res, int suspend = -1);
/**
* Check if a method exists in an instance.
@@ -162,6 +163,11 @@ public:
static int ObjectToInteger(HSQOBJECT *ptr) { return sq_objtointeger(ptr); }
/**
+ * Convert a Squirrel-object to a bool.
+ */
+ static bool ObjectToBool(HSQOBJECT *ptr) { return sq_objtobool(ptr) == 1; }
+
+ /**
* Sets a pointer in the VM that is reachable from where ever you are in SQ.
* Useful to keep track of the main instance.
*/