summaryrefslogtreecommitdiff
path: root/src/script/squirrel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/squirrel.cpp')
-rw-r--r--src/script/squirrel.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index 7b80b24b6..9c101c7aa 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -335,12 +335,17 @@ bool Squirrel::CreateClassInstance(const char *class_name, void *real_instance,
}
Squirrel::Squirrel(const char *APIName) :
- global_pointer(NULL),
- print_func(NULL),
- crashed(false),
- overdrawn_ops(0),
APIName(APIName)
{
+ this->Initialize();
+}
+
+void Squirrel::Initialize()
+{
+ this->global_pointer = NULL;
+ this->print_func = NULL;
+ this->crashed = false;
+ this->overdrawn_ops = 0;
this->vm = sq_open(1024);
/* Handle compile-errors ourself, so we can display it nicely */
@@ -549,11 +554,22 @@ bool Squirrel::LoadScript(const char *script)
Squirrel::~Squirrel()
{
+ this->Uninitialize();
+}
+
+void Squirrel::Uninitialize()
+{
/* Clean up the stuff */
sq_pop(this->vm, 1);
sq_close(this->vm);
}
+void Squirrel::Reset()
+{
+ this->Uninitialize();
+ this->Initialize();
+}
+
void Squirrel::InsertResult(bool result)
{
sq_pushbool(this->vm, result);
@@ -587,11 +603,6 @@ bool Squirrel::HasScriptCrashed()
return this->crashed;
}
-void Squirrel::ResetCrashed()
-{
- this->crashed = false;
-}
-
void Squirrel::CrashOccurred()
{
this->crashed = true;