Exposes the module's published player inventories through the shared gameplay command protocol. 更多...
#include <InventoryControl.h>
Public 成员函数 | |
| InventoryControl () | |
| Create an unpublished adapter and register it as the inventory domain. | |
| ~InventoryControl () override | |
| Unpublish every instance without destroying borrowed authorities. | |
| InventoryControl (const InventoryControl &)=delete | |
| InventoryControl & | operator= (const InventoryControl &)=delete |
| Result< void > | publish (SubjectRef instance, SubjectRef owner, Bag &bag, EquipmentSet *equipment) |
| Publish one borrowed inventory instance under a stable identity. | |
| Result< void > | unpublish (SubjectRef instance) |
Drop one publication; NotFound when that instance is not published. | |
| void | clear () |
| Drop every publication without destroying borrowed containers. | |
| int | count () const |
| Number of published instances. | |
| std::vector< SubjectRef > | instances () const |
| Published instance identities, in publication order. | |
| std::string_view | gameplayDomain () const noexcept override |
| Stable provider domain used for discovery and routing. | |
| std::vector< SubjectRef > | gameplayInstances () const override |
| Instances currently served, in publication order. | |
| Result< GameplayObservation > | observeGameplay (const GameplaySession &session, SubjectRef instance) const override |
| Observe one provider-owned gameplay instance without mutation. | |
| Result< std::vector< GameplayActionDescriptor > > | availableGameplayActions (const GameplaySession &session, SubjectRef instance, SubjectRef subject) const override |
| Discover currently legal player-semantic actions for one subject. | |
| Result< GameplayCommandReceipt > | submitGameplay (const GameplaySession &session, SubjectRef instance, const GameplayCommand &command) override |
| Validate authority and atomically submit one domain command. | |
| Result< GameplayObservation > | advanceGameplay (const GameplaySession &session, SubjectRef instance, const SimulationStep &step) override |
| Advance one provider-owned instance using injected deterministic time. | |
| Result< std::vector< GameplayEvent > > | gameplayEvents (const GameplaySession &session, SubjectRef instance, std::uint64_t afterSequence) const override |
| Return events strictly newer than an instance-local sequence cursor. | |
Public 成员函数 继承自 eve::IGameplayControlProvider | |
| virtual | ~IGameplayControlProvider ()=default |
| Releases IGameplayControlProvider resources. | |
Public 成员函数 继承自 eve::IGameplayInstanceCatalog | |
| virtual | ~IGameplayInstanceCatalog ()=default |
| Releases IGameplayInstanceCatalog resources. | |
额外继承的成员函数 | |
静态 Public 属性 继承自 eve::IGameplayControlProvider | |
| static constexpr const char * | capabilityName = "IGameplayControlProvider" |
静态 Public 属性 继承自 eve::IGameplayInstanceCatalog | |
| static constexpr const char * | capabilityName = "IGameplayInstanceCatalog" |
详细描述
Exposes the module's published player inventories through the shared gameplay command protocol.
Until now the inventory domain had no player-equivalent agent surface at all: eve_gameplay could not reach it, so an unattended agent had to fall back to eve_eval against bag internals. The action vocabulary here is the module's own vocabulary; add/remove/split/equip/unequip map one-to-one onto Bag and EquipmentSet operations, not onto a new write path invented by the adapter.
One adapter serves every published instance, because the shared router requires exactly one provider per domain: a per-instance listener would make the second published inventory unusable for everyone.
Authority: inventory:add-item is a grant, so it is refused for GameplayAccess::PlayerEquivalent and only accepted for the test-driver and developer-cheat profiles. Every other action is player-equivalent and requires the session to control the instance owner.
Partial effects stay observable: inventory:remove-item keeps the Bag take-up-to-N contract, so a request for more than the container holds applies what it can and reports the applied amount as quantity in the receipt and event instead of silently claiming the full requested amount.
@ownership Published bags and equipment sets are borrowed authorities that must outlive their publication; the adapter copies no inventory state and keeps only per-instance revision and event ledgers. clear() drops the publications without touching the containers. @thread Owner-simulation thread only, like every gameplay provider. @reentrancy No method invokes callbacks; submitGameplay mutates the borrowed bag/equipment directly and appends to its own event ledger.
在文件 InventoryControl.h 第 47 行定义.
构造及析构函数说明
◆ InventoryControl() [1/2]
| eve::inventory::InventoryControl::InventoryControl | ( | ) |
Create an unpublished adapter and register it as the inventory domain.
在文件 InventoryControl.cpp 第 55 行定义.
◆ ~InventoryControl()
|
override |
Unpublish every instance without destroying borrowed authorities.
在文件 InventoryControl.cpp 第 60 行定义.
◆ InventoryControl() [2/2]
|
delete |
成员函数说明
◆ advanceGameplay()
|
overridevirtual |
Advance one provider-owned instance using injected deterministic time.
Advance gameplay.
实现了 eve::IGameplayControlProvider.
在文件 InventoryControl.cpp 第 380 行定义.
引用了 eve::Conflict, eve::Result< T >::failure(), eve::NotFound, observeGameplay(), session , 以及 step.
◆ availableGameplayActions()
|
overridevirtual |
Discover currently legal player-semantic actions for one subject.
Available gameplay actions.
实现了 eve::IGameplayControlProvider.
在文件 InventoryControl.cpp 第 193 行定义.
引用了 actions, id, eve::NotFound, observeGameplay(), eve::PlayerEquivalent, eve::PreconditionViolation, session , 以及 subject.
◆ clear()
| void eve::inventory::InventoryControl::clear | ( | ) |
Drop every publication without destroying borrowed containers.
在文件 InventoryControl.cpp 第 91 行定义.
◆ count()
| int eve::inventory::InventoryControl::count | ( | ) | const |
Number of published instances.
在文件 InventoryControl.cpp 第 93 行定义.
◆ gameplayDomain()
|
overridevirtualnoexcept |
Stable provider domain used for discovery and routing.
Gameplay domain.
实现了 eve::IGameplayControlProvider.
在文件 InventoryControl.cpp 第 114 行定义.
◆ gameplayEvents()
|
overridevirtual |
Return events strictly newer than an instance-local sequence cursor.
Gameplay events.
实现了 eve::IGameplayControlProvider.
在文件 InventoryControl.cpp 第 395 行定义.
引用了 eve::Applied, eve::NoOp, eve::NotFound, observeGameplay(), session , 以及 eve::Status::success().
◆ gameplayInstances()
|
overridevirtual |
Instances currently served, in publication order.
Gameplay instances.
实现了 eve::IGameplayInstanceCatalog.
在文件 InventoryControl.cpp 第 116 行定义.
引用了 instances().
◆ instances()
| std::vector< SubjectRef > eve::inventory::InventoryControl::instances | ( | ) | const |
Published instance identities, in publication order.
在文件 InventoryControl.cpp 第 95 行定义.
被这些函数引用 gameplayInstances().
◆ observeGameplay()
|
overridevirtual |
Observe one provider-owned gameplay instance without mutation.
Observe gameplay.
实现了 eve::IGameplayControlProvider.
在文件 InventoryControl.cpp 第 175 行定义.
引用了 eve::GameplayObservation::domain, id, eve::GameplayObservation::instance, eve::NotFound, eve::PreconditionViolation, eve::GameplayObservation::revision, session, eve::GameplayObservation::state, eve::Result< T >::success() , 以及 eve::GameplayObservation::tick.
被这些函数引用 advanceGameplay(), availableGameplayActions() , 以及 gameplayEvents().
◆ operator=()
|
delete |
◆ publish()
| Result< void > eve::inventory::InventoryControl::publish | ( | SubjectRef | instance, |
| SubjectRef | owner, | ||
| Bag & | bag, | ||
| EquipmentSet * | equipment | ||
| ) |
Publish one borrowed inventory instance under a stable identity.
- 参数
-
instance Stable identity of the instance, a canonical persistent id. owner Stable identity of the player/actor controlling it. bag Borrowed container observed and mutated by this adapter. equipment Borrowed equipment set, or null when the instance has none.
- 返回
- Success, or
Conflictwhen that instance is already published. @ownership The publication does not take ownership ofbagorequipment.
在文件 InventoryControl.cpp 第 65 行定义.
引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::SubjectRef::isValid() , 以及 eve::Result< T >::success().
◆ submitGameplay()
|
overridevirtual |
Validate authority and atomically submit one domain command.
Submit gameplay.
实现了 eve::IGameplayControlProvider.
在文件 InventoryControl.cpp 第 228 行定义.
引用了 eve::GameplayCommandReceipt::acceptedTick, eve::GameplayCommand::action, action, eve::inventory::Bag::addItem(), eve::Applied, eve::inventory::Bag::canAddItem(), eve::inventory::Bag::canAddItemReason(), eve::GameplayCommandReceipt::commandId, eve::Conflict, detail, eve::GameplayCommandReceipt::details, eve::GameplayCommandReceipt::executionId, eve::GameplayCommand::expectedRevision, eve::Failed, eve::Result< T >::failure(), eve::LogicalId::format(), eve::GameplayCommand::id, eve::InvalidArgument, itemId, eve::NotFound, object, eve::GameplayCommand::observedTick, eve::GameplayCommand::parameters, eve::PlayerEquivalent, eve::PreconditionViolation, removed, eve::inventory::Bag::removeItem(), eve::GameplayCommandReceipt::resultingRevision, eve::GameplayEvent::sequence, session, eve::inventory::Bag::splitStack(), eve::GameplayCommand::subject, eve::Status::success(), eve::Result< T >::success(), text, eve::Unsupported , 以及 values.
◆ unpublish()
| Result< void > eve::inventory::InventoryControl::unpublish | ( | SubjectRef | instance | ) |
Drop one publication; NotFound when that instance is not published.
在文件 InventoryControl.cpp 第 81 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), found, eve::NotFound , 以及 eve::Result< T >::success().
该类的文档由以下文件生成:
- src/modules/inventory/InventoryControl.h
- src/modules/inventory/InventoryControl.cpp
Public 成员函数 继承自