Pyrogenesis
trunk
|
Random map generator worker thread. More...
#include <MapGenerator.h>
Public Member Functions | |
CMapGeneratorWorker () | |
~CMapGeneratorWorker () | |
void | Initialize (const VfsPath &scriptFile, const std::string &settings) |
Start the map generator thread. More... | |
int | GetProgress () |
Get status of the map generator thread. More... | |
shared_ptr< ScriptInterface::StructuredClone > | GetResults () |
Get random map data, according to this format: http://trac.wildfiregames.com/wiki/Random_Map_Generator_Internals#Dataformat. More... | |
Private Member Functions | |
bool | LoadScripts (const std::wstring &libraryName) |
Load all scripts of the given library. More... | |
bool | Run () |
Static Private Member Functions | |
static bool | LoadLibrary (ScriptInterface::CxPrivate *pCxPrivate, const std::wstring &name) |
static void | ExportMap (ScriptInterface::CxPrivate *pCxPrivate, JS::HandleValue data) |
static void | SetProgress (ScriptInterface::CxPrivate *pCxPrivate, int progress) |
static void | MaybeGC (ScriptInterface::CxPrivate *pCxPrivate) |
static std::vector< std::string > | GetCivData (ScriptInterface::CxPrivate *pCxPrivate) |
static CParamNode | GetTemplate (ScriptInterface::CxPrivate *pCxPrivate, const std::string &templateName) |
static bool | TemplateExists (ScriptInterface::CxPrivate *pCxPrivate, const std::string &templateName) |
static std::vector< std::string > | FindTemplates (ScriptInterface::CxPrivate *pCxPrivate, const std::string &path, bool includeSubdirectories) |
static std::vector< std::string > | FindActorTemplates (ScriptInterface::CxPrivate *pCxPrivate, const std::string &path, bool includeSubdirectories) |
static void * | RunThread (void *data) |
Private Attributes | |
std::set< std::wstring > | m_LoadedLibraries |
shared_ptr< ScriptInterface::StructuredClone > | m_MapData |
boost::rand48 | m_MapGenRNG |
int | m_Progress |
ScriptInterface * | m_ScriptInterface |
VfsPath | m_ScriptPath |
std::string | m_Settings |
CTemplateLoader | m_TemplateLoader |
pthread_t | m_WorkerThread |
CMutex | m_WorkerMutex |
Random map generator worker thread.
(This is run in a thread so that the GUI remains responsive while loading)
Thread-safety:
CMapGeneratorWorker::CMapGeneratorWorker | ( | ) |
CMapGeneratorWorker::~CMapGeneratorWorker | ( | ) |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
int CMapGeneratorWorker::GetProgress | ( | ) |
Get status of the map generator thread.
shared_ptr< ScriptInterface::StructuredClone > CMapGeneratorWorker::GetResults | ( | ) |
Get random map data, according to this format: http://trac.wildfiregames.com/wiki/Random_Map_Generator_Internals#Dataformat.
|
staticprivate |
void CMapGeneratorWorker::Initialize | ( | const VfsPath & | scriptFile, |
const std::string & | settings | ||
) |
Start the map generator thread.
scriptFile | The VFS path for the script, e.g. "maps/random/latium.js" |
settings | JSON string containing settings for the map generator |
|
staticprivate |
|
private |
Load all scripts of the given library.
libraryName | String specifying name of the library (subfolder of ../maps/random/) |
|
staticprivate |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |