MSaveGame
UE's USaveGame: the player's progress, saved apart from the world. Unlocks, a crew dossier, the trophy record, settings that follow a profile — what a world-state slot has no place for, and what must survive a patch that changes the level. A save object is written to a NAMED slot (SaveGameManager::SaveGameObject, <name>.msavegame in the save folder) and never carries the scene, so a patched level always loads from the package.
- Module
- Game
- Header
#include "Game/MSaveGame.h"- Namespace
Mowo- Reflection
- Reflected by MowoHeaderTool
Two ways to hold data. A Visual Script graph uses the named values (SetInt, GetInt, ...) on the object MSaveStatics::GetSaveGame hands out. C++ subclasses MSaveGame and declares MPROPERTY fields: every supported field (bool, the integer widths, float/double, Vec2-4, Quat, string, string array, enum by name) is written in full and read back by name, so a field added later keeps its default on an older save and a removed one is ignored.
Properties
| Type | Name | Description |
|---|---|---|
std::string | DisplayName | What a slot browser shows: a chapter or character name, and the time played on the profile. |
int32_t | PlayTimeSeconds | Default 0. |
Constructors
| Signature | Name | Description |
|---|---|---|
MSaveGame() = default | MSaveGame |
Public functions
| Returns | Name | Description |
|---|---|---|
void | SetDisplayName | |
std::string | GetDisplayName | |
void | SetPlayTimeSeconds | |
int32_t | GetPlayTimeSeconds | |
void | SetString | |
std::string | GetString | |
void | SetInt | |
int32_t | GetInt | |
void | SetFloat | |
float | GetFloat | |
void | SetBool | |
bool | GetBool | |
bool | HasValue | |
void | RemoveValue | |
void | ClearValues | |
SaveData& | GetData | The named values as MDF, for C++ that stores nested data (an inventory list, a quest log) as child nodes. |
const SaveData& | GetData | |
void | SerializeToNode | Properties (the reflected fields) and Values (the named store) as children of out. |
void | DeserializeFromNode |
Function details
MSaveGame
MSaveGame() = defaultSetDisplayName
void SetDisplayName(const std::string& name)GetDisplayName
std::string GetDisplayName() constSetPlayTimeSeconds
void SetPlayTimeSeconds(int32_t seconds)GetPlayTimeSeconds
int32_t GetPlayTimeSeconds() constSetString
void SetString(const std::string& key, const std::string& value)GetString
std::string GetString(const std::string& key, const std::string& defaultValue) constSetInt
void SetInt(const std::string& key, int32_t value)GetInt
int32_t GetInt(const std::string& key, int32_t defaultValue) constSetFloat
void SetFloat(const std::string& key, float value)GetFloat
float GetFloat(const std::string& key, float defaultValue) constSetBool
void SetBool(const std::string& key, bool value)GetBool
bool GetBool(const std::string& key, bool defaultValue) constHasValue
bool HasValue(const std::string& key) constRemoveValue
void RemoveValue(const std::string& key)ClearValues
void ClearValues()GetData
SaveData& GetData()The named values as MDF, for C++ that stores nested data (an inventory list, a quest log) as child nodes.
GetData
const SaveData& GetData() constSerializeToNode
void SerializeToNode(MdfNode& out) constProperties (the reflected fields) and Values (the named store) as children of out. Read is merge-by-name: a field the node does not carry keeps its current value.
DeserializeFromNode
void DeserializeFromNode(const MdfNode& in)