ScScript *ScScript::invokeEventHandler(const Common::String &eventName, bool unbreakable) { //if (_state!=SCRIPT_PERSISTENT) return nullptr; uint32 pos = getEventPos(eventName); if (!pos) { return nullptr; } #if EXTENDED_DEBUGGER_ENABLED == true // TODO: Not pretty DebuggableScEngine* debuggableEngine; debuggableEngine = dynamic_cast<DebuggableScEngine*>(_engine); assert(debuggableEngine); ScScript *thread = new DebuggableScript(_gameRef, debuggableEngine); #else ScScript *thread = new ScScript(_gameRef, _engine); #endif if (thread) { bool ret = thread->createThread(this, pos, eventName); if (DID_SUCCEED(ret)) { thread->_unbreakable = unbreakable; _engine->_scripts.add(thread); return thread; } else { delete thread; return nullptr; } } else { return nullptr; } }
ScScript *ScScript::invokeEventHandler(const Common::String &eventName, bool unbreakable) { //if (_state!=SCRIPT_PERSISTENT) return nullptr; uint32 pos = getEventPos(eventName); if (!pos) { return nullptr; } ScScript *thread = new ScScript(_gameRef, _engine); if (thread) { bool ret = thread->createThread(this, pos, eventName); if (DID_SUCCEED(ret)) { thread->_unbreakable = unbreakable; _engine->_scripts.add(thread); return thread; } else { delete thread; return nullptr; } } else { return nullptr; } }