Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/Simulation2.h
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | public: | ||||
*/ | */ | ||||
bool LoadDefaultScripts(); | bool LoadDefaultScripts(); | ||||
/** | /** | ||||
* Loads the player settings script (called before map is loaded) | * Loads the player settings script (called before map is loaded) | ||||
* @param newPlayers will delete all the existing player entities (if any) and create new ones | * @param newPlayers will delete all the existing player entities (if any) and create new ones | ||||
* (needed for loading maps, but Atlas might want to update existing player data) | * (needed for loading maps, but Atlas might want to update existing player data) | ||||
*/ | */ | ||||
void LoadPlayerSettings(bool newPlayers); | void ParsePlayerSettings(bool newPlayers); | ||||
/** | /** | ||||
* Loads the map settings script (called after map is loaded) | * Parse the map settings (called after map is loaded) | ||||
*/ | */ | ||||
void LoadMapSettings(); | void ParseMapSettings(); | ||||
/** | /** | ||||
* Set a startup script, which will get executed before the first turn. | * Set a startup script, which will get executed before the first turn. | ||||
*/ | */ | ||||
void SetStartupScript(const std::string& script); | void SetStartupScript(const std::string& script); | ||||
/** | /** | ||||
* Get the current startup script. | * Get the current startup script. | ||||
*/ | */ | ||||
const std::string& GetStartupScript(); | const std::string& GetStartupScript(); | ||||
/** | /** | ||||
* Set the attributes identifying the scenario/RMS used to initialise this | * Set the attributes identifying the scenario/RMS used to initialise this | ||||
* simulation. | * simulation. | ||||
*/ | */ | ||||
void SetInitAttributes(JS::HandleValue settings); | void SetInitAttributes(JS::HandleValue settings); | ||||
/** | /** | ||||
* Get the data passed to SetInitAttributes. | * Get the data passed to SetInitAttributes. | ||||
*/ | */ | ||||
JS::Value GetInitAttributes(); | JS::Value GetInitAttributes(); | ||||
void GetInitAttributes(JS::MutableHandleValue ret); | void GetInitAttributes(JS::MutableHandleValue ret); | ||||
/** | /** | ||||
* Set the initial map settings (as a UTF-8-encoded JSON string), | * 'Legacy' path: create InitAttributes from a string. | ||||
* which will be used to set up the simulation state. | * This sets attributes to { "setting": ParseJSON(@param settings) }. | ||||
* Called from atlas. | * Called from atlas & the mapReader (as fallback). | ||||
* TODO: the 'settings' object should be dropped, and then this can be simplified. | |||||
* @see SetInitAttributes | |||||
*/ | */ | ||||
void SetMapSettings(const std::string& settings); | void SetInitAttributesFromSettings(const std::string& settings); | ||||
/** | /** | ||||
* Set the initial map settings, which will be used | * Returns the 'settings' property of the init attributes. | ||||
* to set up the simulation state. | * TODO: the 'settings' object should be dropped, and then this can be simplified. | ||||
* Called from MapReader (for all map-types). | |||||
*/ | */ | ||||
void SetMapSettings(JS::HandleValue settings); | std::string GetSettingsFromInitAttributes(); | ||||
/** | |||||
* Get the current map settings as a UTF-8 JSON string. | |||||
*/ | |||||
std::string GetMapSettingsString(); | |||||
/** | |||||
* Get the current map settings. | |||||
*/ | |||||
void GetMapSettings(JS::MutableHandleValue ret); | |||||
/** | /** | ||||
* RegMemFun incremental loader function. | * RegMemFun incremental loader function. | ||||
*/ | */ | ||||
int ProgressiveLoad(); | int ProgressiveLoad(); | ||||
/** | /** | ||||
* Reload any scripts that were loaded from the given filename. | * Reload any scripts that were loaded from the given filename. | ||||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator