History

Fix script loading bug

Atlante45 committed 9 years ago

Commit 07da0c51 parent 3203e8c1 file · +4 −4Browse files

Showing the changes to assignment-client/src/scripts/EntityScriptServer.cpp (1 of 1 file). Show all

Unified · Split

assignment-client/src/scripts/EntityScriptServer.cpp+4−4
@@ -281,12 +281,12 @@ void EntityScriptServer::entityServerScriptChanging(const EntityItemID& entityID · 280 unmodified lines
281}281}
282 282
283void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const bool reload) {283void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const bool reload) {
284 EntityScriptDetails details;284 if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine) {
285 if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine &&
286 _entitiesScriptEngine->getEntityScriptDetails(entityID, details)) {
287 285
288 EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID);286 EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID);
289 if (entity && (details.scriptText != entity->getServerScripts() || reload)) {287 EntityScriptDetails details;
288 bool notRunning = !_entitiesScriptEngine->getEntityScriptDetails(entityID, details);
289 if (entity && (reload || notRunning || details.scriptText != entity->getServerScripts())) {
290 QString scriptUrl = entity->getServerScripts();290 QString scriptUrl = entity->getServerScripts();
291 scriptUrl = ResourceManager::normalizeURL(scriptUrl);291 scriptUrl = ResourceManager::normalizeURL(scriptUrl);
292 qDebug() << "Loading entity server script" << scriptUrl << "for" << entityID;292 qDebug() << "Loading entity server script" << scriptUrl << "for" << entityID;