Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/MapGenerator.h
Show All 21 Lines | |||||
#include "ps/ThreadUtil.h" | #include "ps/ThreadUtil.h" | ||||
#include "ps/TemplateLoader.h" | #include "ps/TemplateLoader.h" | ||||
#include "scriptinterface/ScriptInterface.h" | #include "scriptinterface/ScriptInterface.h" | ||||
#include <boost/random/linear_congruential.hpp> | #include <boost/random/linear_congruential.hpp> | ||||
#include <set> | #include <set> | ||||
#include <string> | #include <string> | ||||
#include <thread> | |||||
class CMapGeneratorWorker; | class CMapGeneratorWorker; | ||||
/** | /** | ||||
* Random map generator interface. Initialized by CMapReader and then checked | * Random map generator interface. Initialized by CMapReader and then checked | ||||
* periodically during loading, until it's finished (progress value is 0). | * periodically during loading, until it's finished (progress value is 0). | ||||
* | * | ||||
* The actual work is performed by CMapGeneratorWorker in a separate thread. | * The actual work is performed by CMapGeneratorWorker in a separate thread. | ||||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | // Mapgen | ||||
boost::rand48 m_MapGenRNG; | boost::rand48 m_MapGenRNG; | ||||
int m_Progress; | int m_Progress; | ||||
ScriptInterface* m_ScriptInterface; | ScriptInterface* m_ScriptInterface; | ||||
VfsPath m_ScriptPath; | VfsPath m_ScriptPath; | ||||
std::string m_Settings; | std::string m_Settings; | ||||
CTemplateLoader m_TemplateLoader; | CTemplateLoader m_TemplateLoader; | ||||
// Thread | // Thread | ||||
static void* RunThread(void* data); | static void* RunThread(CMapGeneratorWorker* self); | ||||
bool Run(); | bool Run(); | ||||
pthread_t m_WorkerThread; | std::thread m_WorkerThread; | ||||
std::mutex m_WorkerMutex; | std::mutex m_WorkerMutex; | ||||
}; | }; | ||||
#endif //INCLUDED_MAPGENERATOR | #endif //INCLUDED_MAPGENERATOR |
Wildfire Games · Phabricator