summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-04 23:20:14 +0000
committerrubidium <rubidium@openttd.org>2011-11-04 23:20:14 +0000
commit65d0d19b1616e5867afdf9d9f1c68972d2c3f2b0 (patch)
tree75d5607cc3393395003137b92c580a4bf8dae3f2 /src/script
parent02913f40b0ab1a7771e96e4c6af4ef15b6953cc7 (diff)
downloadopenttd-65d0d19b1616e5867afdf9d9f1c68972d2c3f2b0.tar.xz
(svn r23118) -Feature: [NoAI] Allow AIs to query the amount of remaining operations for the current tick
Diffstat (limited to 'src/script')
-rw-r--r--src/script/squirrel.cpp5
-rw-r--r--src/script/squirrel.hpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index 890630eeb..e4657a7dd 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -553,3 +553,8 @@ bool Squirrel::CanSuspend()
{
return sq_can_suspend(this->vm);
}
+
+SQInteger Squirrel::GetOpsTillSuspend()
+{
+ return this->vm->_ops_till_suspend;
+}
diff --git a/src/script/squirrel.hpp b/src/script/squirrel.hpp
index 1ada519cc..69e01e647 100644
--- a/src/script/squirrel.hpp
+++ b/src/script/squirrel.hpp
@@ -253,6 +253,11 @@ public:
* Are we allowed to suspend the squirrel script at this moment?
*/
bool CanSuspend();
+
+ /**
+ * How many operations can we execute till suspension?
+ */
+ SQInteger GetOpsTillSuspend();
};
#endif /* SQUIRREL_HPP */