Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
SavedGames Namespace Reference

Classes

struct  LoadResult
 

Functions

Status Save (const CStrW &name, const CStrW &description, CSimulation2 &simulation, const Script::StructuredClone &guiMetadataClone)
 Create new saved game archive with given name and simulation data. More...
 
Status SavePrefix (const CStrW &prefix, const CStrW &description, CSimulation2 &simulation, const Script::StructuredClone &guiMetadataClone)
 Create new saved game archive with given prefix and simulation data. More...
 
std::optional< LoadResult > Load (const Script::Interface &scriptInterface, const std::wstring &name)
 Load saved game archive with the given name. More...
 
JS::Value GetSavedGames (const Script::Interface &scriptInterface)
 Get list of saved games for GUI script usage. More...
 
bool DeleteSavedGame (const std::wstring &name)
 Permanently deletes the saved game archive with the given name. More...
 

Function Documentation

◆ DeleteSavedGame()

bool SavedGames::DeleteSavedGame ( const std::wstring &  name)

Permanently deletes the saved game archive with the given name.

Parameters
namefilename of saved game (without path or extension)
Returns
true if deletion was successful, or false on error

◆ GetSavedGames()

JS::Value SavedGames::GetSavedGames ( const Script::Interface &  scriptInterface)

Get list of saved games for GUI script usage.

Parameters
scriptInterfacethe Script::Interface in which to create the return data.
Returns
array of objects containing saved game data

◆ Load()

std::optional< SavedGames::LoadResult > SavedGames::Load ( const Script::Interface &  scriptInterface,
const std::wstring &  name 
)

Load saved game archive with the given name.

Parameters
namefilename of saved game (without path or extension)
scriptInterface
Returns
An empty std::optional if an error ocoured.

◆ Save()

Status SavedGames::Save ( const CStrW &  name,
const CStrW &  description,
CSimulation2 &  simulation,
const Script::StructuredClone &  guiMetadataClone 
)

Create new saved game archive with given name and simulation data.

Parameters
nameName to save the game with
descriptionA user-given description of the save
simulation
guiMetadataCloneif not NULL, store some UI-related data with the saved game
Returns
INFO::OK if successfully saved, else an error Status

◆ SavePrefix()

Status SavedGames::SavePrefix ( const CStrW &  prefix,
const CStrW &  description,
CSimulation2 &  simulation,
const Script::StructuredClone &  guiMetadataClone 
)

Create new saved game archive with given prefix and simulation data.

Parameters
prefixCreate new numbered file starting with this prefix
descriptionA user-given description of the save
simulation
guiMetadataCloneif not NULL, store some UI-related data with the saved game
Returns
INFO::OK if successfully saved, else an error Status