Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 7 files). Show all
Unified · Split
| @@ -168,7 +168,8 @@ static bool hadUncaughtExceptions(QScriptEngine& engine, const QString& fileName · 167 unmodified lines | ||
| 168 | 168 | return false; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | −ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNameString) : | |
| 171 | +ScriptEngine::ScriptEngine(Context context, const QString& scriptContents, const QString& fileNameString) : | |
| 172 | + _context(context), | |
| 172 | 173 | _scriptContents(scriptContents), |
| 173 | 174 | _timerFunctionMap(), |
| 174 | 175 | _fileNameString(fileNameString), |
| @@ -183,6 +184,22 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam · 8 unmodified lines | ||
| 183 | 184 | setProcessEventsInterval(MSECS_PER_SECOND); |
| 184 | 185 | } |
| 185 | 186 | |
| 187 | +QString ScriptEngine::getContext() const { | |
| 188 | + switch (_context) { | |
| 189 | + case CLIENT_SCRIPT: | |
| 190 | + return "client"; | |
| 191 | + case ENTITY_CLIENT_SCRIPT: | |
| 192 | + return "entity_client"; | |
| 193 | + case ENTITY_SERVER_SCRIPT: | |
| 194 | + return "entity_server"; | |
| 195 | + case AGENT_SCRIPT: | |
| 196 | + return "agent"; | |
| 197 | + default: | |
| 198 | + return "unknown"; | |
| 199 | + } | |
| 200 | + return "unknown"; | |
| 201 | +} | |
| 202 | + | |
| 186 | 203 | ScriptEngine::~ScriptEngine() { |
| 187 | 204 | scriptInfoMessage("Script Engine shutting down:" + getFilename()); |
| 188 | 205 | |