Add: [Script] Native priority queue; useful e.g. for pathfinders.
This commit is contained in:
@@ -58,6 +58,7 @@ ScriptInstance::ScriptInstance(const char *APIName) :
|
||||
is_save_data_on_stack(false),
|
||||
suspend(0),
|
||||
is_paused(false),
|
||||
in_shutdown(false),
|
||||
callback(nullptr)
|
||||
{
|
||||
this->storage = new ScriptStorage();
|
||||
@@ -136,6 +137,7 @@ bool ScriptInstance::LoadCompatibilityScripts(const char *api_version, Subdirect
|
||||
ScriptInstance::~ScriptInstance()
|
||||
{
|
||||
ScriptObject::ActiveInstance active(this);
|
||||
this->in_shutdown = true;
|
||||
|
||||
if (instance != nullptr) this->engine->ReleaseObject(this->instance);
|
||||
if (engine != nullptr) delete this->engine;
|
||||
@@ -154,6 +156,7 @@ void ScriptInstance::Died()
|
||||
{
|
||||
DEBUG(script, 0, "The script died unexpectedly.");
|
||||
this->is_dead = true;
|
||||
this->in_shutdown = true;
|
||||
|
||||
this->last_allocated_memory = this->GetAllocatedMemory(); // Update cache
|
||||
|
||||
@@ -718,3 +721,8 @@ size_t ScriptInstance::GetAllocatedMemory() const
|
||||
if (this->engine == nullptr) return this->last_allocated_memory;
|
||||
return this->engine->GetAllocatedMemory();
|
||||
}
|
||||
|
||||
void ScriptInstance::ReleaseSQObject(HSQOBJECT *obj)
|
||||
{
|
||||
if (!this->in_shutdown) this->engine->ReleaseObject(obj);
|
||||
}
|
||||
|
Reference in New Issue
Block a user