Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
#include "precompiled.h"
#include "MapGenerator.h"
#include "graphics/MapIO.h"
#include "graphics/Patch.h"
#include "graphics/Terrain.h"
#include "lib/status.h"
#include "lib/timer.h"
#include "lib/file/vfs/vfs_path.h"
#include "maths/MathUtil.h"
#include "ps/CLogger.h"
#include "ps/FileIo.h"
#include "ps/scripting/JSInterface_VFS.h"
#include "ps/TemplateLoader.h"
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/JSON.h"
#include "scriptinterface/Object.h"
#include "scriptinterface/ScriptContext.h"
#include "scriptinterface/ScriptConversions.h"
#include "scriptinterface/ScriptInterface.h"
#include "simulation2/helpers/MapEdgeTiles.h"
#include <boost/random/linear_congruential.hpp>
#include <set>
#include <string>
#include <vector>
Classes | |
class | anonymous_namespace{MapGenerator.cpp}::CMapGenerationCallbacks |
Provides callback's for the JavaScript. More... | |
Namespaces | |
namespace | anonymous_namespace{MapGenerator.cpp} |
Macros | |
#define | REGISTER_MAPGEN_FUNC(func) |
Functions | |
bool | IsQuitRequested () |
bool | anonymous_namespace{MapGenerator.cpp}::MapGenerationInterruptCallback (JSContext *cx) |
Script::StructuredClone | RunMapGenerationScript (std::atomic< int > &progress, ScriptInterface &scriptInterface, const VfsPath &script, const std::string &settings, const u16 flags) |
Generate the map. More... | |
Variables | |
constexpr const char * | anonymous_namespace{MapGenerator.cpp}::GENERATOR_NAME {"GenerateMap"} |
#define REGISTER_MAPGEN_FUNC | ( | func | ) |
bool IsQuitRequested | ( | ) |
Script::StructuredClone RunMapGenerationScript | ( | std::atomic< int > & | progress, |
ScriptInterface & | scriptInterface, | ||
const VfsPath & | script, | ||
const std::string & | settings, | ||
const u16 | flags = JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT |
||
) |
Generate the map.
This does take a long time.
progress | Destination to write the function progress to. You must not write to it while RunMapGenerationScript is running. |
script | The VFS path for the script, e.g. "maps/random/latium.js". |
settings | JSON string containing settings for the map generator. |
flags | With thous flags the engine functions get registered g_MapSettings also respects this flags. |
nullptr
is returned. Otherwise random map data, according to this format: https://trac.wildfiregames.com/wiki/Random_Map_Generator_Internals#Dataformat