载入中...
搜索中...
未找到
eve::rpg::WorldState类 参考

Non-owning typed adapter for persistent per-map object lifecycle state. 更多...

#include <WorldState.h>

Public 成员函数

 WorldState (GameState &gameState) noexcept
 Bind an adapter to one authoritative game state.
 
bool isObjectConsumed (std::string_view mapId, std::string_view objectId) const
 Query whether a stable object has been consumed in one map.
 
eve::Result< void > consumeObject (std::string_view mapId, std::string_view objectId)
 Idempotently publish the consumed fact for one stable map object.
 
eve::Result< void > resetObject (std::string_view mapId, std::string_view objectId)
 Idempotently clear the consumed fact for one stable map object.
 

详细描述

Non-owning typed adapter for persistent per-map object lifecycle state.

GameState remains the sole authoritative owner and therefore participates in existing save-session transactions without another snapshot. This adapter only standardizes stable IDs and mutation semantics.

在文件 WorldState.h 第 19 行定义.

构造及析构函数说明

◆ WorldState()

eve::rpg::WorldState::WorldState ( GameState &  gameState)
inlineexplicitnoexcept

Bind an adapter to one authoritative game state.

参数
gameStateState owner that must outlive this adapter. @ownership Borrowed; the adapter never destroys or retains ownership of GameState. @thread Create and use on the GameState owning simulation thread. @reentrancy No callbacks are invoked.

在文件 WorldState.h 第 28 行定义.

成员函数说明

◆ consumeObject()

eve::Result< void > eve::rpg::WorldState::consumeObject ( std::string_view  mapId,
std::string_view  objectId 
)

Idempotently publish the consumed fact for one stable map object.

返回
Applied for a new fact, NoOp when already consumed, or InvalidArgument without mutation. @thread Owning simulation thread only. @reentrancy No callbacks are invoked.

在文件 WorldState.cpp 第 31 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, isObjectConsumed(), eve::NoOp, scope, eve::rpg::GameState::setSelfVariable(), eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 eve::rpg::WorldInteraction::collectLoot() , 以及 eve::rpg::BattleVictory::settle().

◆ isObjectConsumed()

bool eve::rpg::WorldState::isObjectConsumed ( std::string_view  mapId,
std::string_view  objectId 
) const

Query whether a stable object has been consumed in one map.

参数
mapIdStable non-empty content ID.
objectIdStable non-empty object ID unique within the map.
返回
False for invalid IDs or objects without a consumed fact.

在文件 WorldState.cpp 第 23 行定义.

引用了 eve::rpg::GameState::getSelfVariable(), eve::rpg::GameState::hasSelfVariable() , 以及 scope.

被这些函数引用 eve::rpg::WorldInteraction::collectLoot(), consumeObject(), resetObject() , 以及 eve::rpg::BattleVictory::settle().

◆ resetObject()

eve::Result< void > eve::rpg::WorldState::resetObject ( std::string_view  mapId,
std::string_view  objectId 
)

Idempotently clear the consumed fact for one stable map object.

返回
Applied when a fact changed, NoOp when already clear, or InvalidArgument without mutation. @thread Owning simulation thread only. @reentrancy No callbacks are invoked.

在文件 WorldState.cpp 第 44 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, isObjectConsumed(), eve::NoOp, scope, eve::rpg::GameState::setSelfVariable(), eve::Status::success() , 以及 eve::Result< T >::success().


该类的文档由以下文件生成: