|
Pyrogenesis
13997
|
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 (void *cbdata, std::wstring name) |
| static void | ExportMap (void *cbdata, CScriptValRooted data) |
| static void | SetProgress (void *cbdata, int progress) |
| static void | MaybeGC (void *cbdata) |
| static std::vector< std::string > | GetCivData (void *cbdata) |
| 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 |
| 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:
Definition at line 82 of file MapGenerator.h.
| CMapGeneratorWorker::CMapGeneratorWorker | ( | ) |
Definition at line 30 of file MapGenerator.cpp.
| CMapGeneratorWorker::~CMapGeneratorWorker | ( | ) |
Definition at line 36 of file MapGenerator.cpp.
|
staticprivate |
Definition at line 157 of file MapGenerator.cpp.
|
staticprivate |
Definition at line 182 of file MapGenerator.cpp.
| int CMapGeneratorWorker::GetProgress | ( | ) |
Get status of the map generator thread.
Definition at line 138 of file MapGenerator.cpp.
| shared_ptr< ScriptInterface::StructuredClone > CMapGeneratorWorker::GetResults | ( | ) |
Get random map data, according to this format: http://trac.wildfiregames.com/wiki/Random_Map_Generator_Internals#Dataformat.
Definition at line 144 of file MapGenerator.cpp.
| 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 |
Definition at line 49 of file MapGenerator.cpp.
|
staticprivate |
Definition at line 150 of file MapGenerator.cpp.
|
private |
Load all scripts of the given library.
| libraryName | String specifying name of the library (subfolder of ../maps/random/) |
Definition at line 219 of file MapGenerator.cpp.
|
staticprivate |
Definition at line 176 of file MapGenerator.cpp.
|
private |
Definition at line 87 of file MapGenerator.cpp.
|
staticprivate |
Definition at line 63 of file MapGenerator.cpp.
|
staticprivate |
Definition at line 167 of file MapGenerator.cpp.
|
private |
Definition at line 129 of file MapGenerator.h.
|
private |
Definition at line 130 of file MapGenerator.h.
|
private |
Definition at line 131 of file MapGenerator.h.
|
private |
Definition at line 132 of file MapGenerator.h.
|
private |
Definition at line 133 of file MapGenerator.h.
|
private |
Definition at line 134 of file MapGenerator.h.
|
private |
Definition at line 135 of file MapGenerator.h.
|
private |
Definition at line 142 of file MapGenerator.h.
|
private |
Definition at line 141 of file MapGenerator.h.
1.8.5