summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-08-19 16:14:15 +0000
committeryexo <yexo@openttd.org>2009-08-19 16:14:15 +0000
commita4afa140f36673cd7dac1277aa4dd1d45618363b (patch)
tree8617da9c602cfe25338ae27da8ba08bc8ff6415c /src/script
parent0780dc8138ae6edf3aee217f48e7759804a95464 (diff)
downloadopenttd-a4afa140f36673cd7dac1277aa4dd1d45618363b.tar.xz
(svn r17223) -Change [NoAI] [FS#2980]: Crash an AI when it uses a DoCommand / Sleep instead of just printing an error message in the AI Debug Window
Diffstat (limited to 'src/script')
-rw-r--r--src/script/squirrel.cpp6
-rw-r--r--src/script/squirrel.hpp5
2 files changed, 11 insertions, 0 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index 31dcf6aea..1dd407589 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -187,6 +187,12 @@ bool Squirrel::Resume(int suspend)
return this->vm->_suspended != 0;
}
+void Squirrel::ResumeError()
+{
+ assert(!this->crashed);
+ sq_resumeerror(this->vm);
+}
+
void Squirrel::CollectGarbage()
{
sq_collectgarbage(this->vm);
diff --git a/src/script/squirrel.hpp b/src/script/squirrel.hpp
index 612c6ce2e..97dd7988d 100644
--- a/src/script/squirrel.hpp
+++ b/src/script/squirrel.hpp
@@ -107,6 +107,11 @@ public:
bool Resume(int suspend = -1);
/**
+ * Resume the VM with an error so it prints a stack trace.
+ */
+ void ResumeError();
+
+ /**
* Tell the VM to do a garbage collection run.
*/
void CollectGarbage();