summaryrefslogtreecommitdiff
path: root/src/script/squirrel.cpp
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.cpp
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.cpp')
-rw-r--r--src/script/squirrel.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index a62c83418..f31b813da 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -234,6 +234,15 @@ bool Squirrel::CallIntegerMethod(HSQOBJECT instance, const char *method_name, in
return true;
}
+bool Squirrel::CallBoolMethod(HSQOBJECT instance, const char *method_name, bool *res, int suspend)
+{
+ HSQOBJECT ret;
+ if (!this->CallMethod(instance, method_name, &ret, suspend)) return false;
+ if (ret._type != OT_BOOL) return false;
+ *res = ObjectToBool(&ret);
+ return true;
+}
+
/* static */ bool Squirrel::CreateClassInstanceVM(HSQUIRRELVM vm, const char *class_name, void *real_instance, HSQOBJECT *instance, SQRELEASEHOOK release_hook)
{
int oldtop = sq_gettop(vm);