Fixed edge cases for serialization and deserialization of scripts #218
|
@ -307,7 +307,7 @@ namespace SHADE
|
|||
SHEventHandle SHScriptEngine::onEntityDestroyed(SHEventPtr eventPtr)
|
||||
{
|
||||
auto eventData = reinterpret_cast<const SHEventSpec<SHEntityDestroyedEvent>*>(eventPtr.get());
|
||||
csScriptsRemoveAll(eventData->data->eid);
|
||||
csScriptsRemoveAllImmediately(eventData->data->eid, true);
|
||||
return eventData->handle;
|
||||
}
|
||||
|
||||
|
|
|
@ -402,8 +402,8 @@ namespace SHADE
|
|||
System::Collections::Generic::List<Script^>^ scriptList = scripts[entity];
|
||||
for each (Script ^ script in scriptList)
|
||||
{
|
||||
// Call OnDestroy only if indicated and also in play mode
|
||||
if (callOnDestroy)
|
||||
// Call OnDestroy only if indicated and also if the game has run
|
||||
if (callOnDestroy && Application::IsPlaying || Application::IsPaused)
|
||||
{
|
||||
script->OnDestroy();
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ namespace SHADE
|
|||
script->OnDestroy();
|
||||
}
|
||||
auto entity = script->Owner.GetEntity();
|
||||
auto scriptList = scripts[script->Owner.GetEntity()];
|
||||
auto scriptList = scripts[script->Owner.GetEntity()]; // Unable to find here
|
||||
scriptList->Remove(script);
|
||||
if (scriptList->Count <= 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue