载入中...
搜索中...
未找到
GameState.cpp
浏览该文件的文档.
14 eve::Diagnostic::error(eve::DiagnosticCode::ParseError, "game state field must be an object", path));
35 eve::Diagnostic::error(eve::DiagnosticCode::ParseError, "game state field must be an object", path));
41 return eve::Result<std::unordered_map<std::string, std::string>>::failure(eve::Diagnostic::error(
74void GameState::setSelfVariable(const std::string &scope, const std::string &name, double value) {
91void GameState::setSelfString(const std::string &scope, const std::string &name, std::string value) {
155 eve::Diagnostic::error(eve::DiagnosticCode::ParseError, "game state root must be an object", "$."));
159 eve::DiagnosticCode::InvalidArgument, "snapshot does not belong to RPG GameState", "$.schema"));
163 eve::DiagnosticCode::UnknownVersion, "unsupported RPG GameState snapshot version", "$.version"));
184 eve::DiagnosticCode::ParseError, "game state selfVariables must be an object", "$.selfVariables"));
全局游戏状态:开关(bool)、变量(数字)、独立变量(按作用域)。
Share string attribute map operations through the Windows Foundation DLL.
Owning, renderer-independent dynamic values.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Result< std::string > toJson() const
Serialize this value as deterministic compact JSON.
Definition Value.cpp:187
const std::string & asString() const
Return the string payload; the caller must have checked the kind.
Definition Value.cpp:207
static Result< Value > fromJson(std::string_view json)
Parse one strict JSON value into an owning Value.
Definition Value.cpp:177
const T * getIf() const noexcept
Return a typed pointer, or nullptr when the kind differs.
Definition Value.h:209
Value * find(const std::string &key) noexcept
Return an object member, or nullptr when absent.
Definition Value.cpp:244
void clearSelfString(const std::string &scope, const std::string &name)
Remove one scoped string fact; no-op when absent.
Definition GameState.cpp:108
eve::Result< void > restoreSnapshotJson(std::string_view json)
Validate and atomically restore a canonical RPG game-state JSON document.
Definition GameState.cpp:149
eve::Result< std::string > snapshotJson() const
Serialize this state as the canonical versioned RPG game-state JSON document.
Definition GameState.cpp:122
double getSelfVariable(const std::string &scope, const std::string &name) const
Returns the self variable.
Definition GameState.cpp:78
void setSelfString(const std::string &scope, const std::string &name, std::string value)
Scoped string facts (for example a .dnut story cursor JSON blob).
Definition GameState.cpp:91
bool hasSelfVariable(const std::string &scope, const std::string &name) const
True when self variable.
Definition GameState.cpp:85
std::string getSelfString(const std::string &scope, const std::string &name) const
Return a scoped string fact, or an empty string when absent.
Definition GameState.cpp:95
bool hasSelfString(const std::string &scope, const std::string &name) const
Whether a scoped string fact is present.
Definition GameState.cpp:102
void setSelfVariable(const std::string &scope, const std::string &name, double value)
独立变量:scope(如 "map:1:event:3")下按名字存数字。
Definition GameState.cpp:74
@ InvalidArgument
@ UnknownVersion
@ ParseError