Pyrogenesis trunk
Functions
MapGenerator.h File Reference
#include "lib/file/vfs/vfs_path.h"
#include "scriptinterface/ScriptTypes.h"
#include "scriptinterface/StructuredClone.h"
#include <atomic>
#include <string>
Include dependency graph for MapGenerator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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. More...
 

Function Documentation

◆ RunMapGenerationScript()

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.

Parameters
progressDestination to write the function progress to. You must not write to it while RunMapGenerationScript is running.
scriptThe VFS path for the script, e.g. "maps/random/latium.js".
settingsJSON string containing settings for the map generator.
flagsWith thous flags the engine functions get registered g_MapSettings also respects this flags.
Returns
If there is an error nullptr is returned. Otherwise random map data, according to this format: https://trac.wildfiregames.com/wiki/Random_Map_Generator_Internals#Dataformat