void* CMapGeneratorWorker::RunThread(void *data) { debug_SetThreadName("MapGenerator"); CMapGeneratorWorker* self = static_cast<CMapGeneratorWorker*>(data); self->m_ScriptInterface = new ScriptInterface("RMS", "MapGenerator", ScriptInterface::CreateRuntime(RMS_RUNTIME_SIZE)); // Run map generation scripts if ((!self->Run()) || (self->m_Progress > 0)) { // Don't leave progress in an unknown state, if generator failed, set it to -1 CScopeLock lock(self->m_WorkerMutex); self->m_Progress = -1; } // At this point the random map scripts are done running, so the thread has no further purpose // and can die. The data will be stored in m_MapData already if successful, or m_Progress // will contain an error value on failure. return NULL; }
bool CMapGeneratorWorker::LoadLibrary(ScriptInterface::CxPrivate* pCxPrivate, std::wstring name) { CMapGeneratorWorker* self = static_cast<CMapGeneratorWorker*>(pCxPrivate->pCBData); return self->LoadScripts(name); }
bool CMapGeneratorWorker::LoadLibrary(void* cbdata, std::wstring name) { CMapGeneratorWorker* self = static_cast<CMapGeneratorWorker*>(cbdata); return self->LoadScripts(name); }