(svn r26617) -Fix [FS#5973]: [Script] Loading/parsing of info .nuts was done in the same VM, causing e.g. constants to break the loading of info of other scripts

This commit is contained in:
rubidium
2014-05-25 19:53:46 +00:00
parent 105306609f
commit a6b4e59963
4 changed files with 44 additions and 21 deletions

View File

@@ -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 */
@@ -548,12 +553,23 @@ 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;