Exposes published player resource ledgers through the shared gameplay protocol. 更多...
#include <EconomyControl.h>
Public 成员函数 | |
| EconomyControl () | |
| Create an unpublished adapter and register it as the economy domain. | |
| ~EconomyControl () override | |
| Unpublish every instance. | |
| EconomyControl (const EconomyControl &)=delete | |
| EconomyControl & | operator= (const EconomyControl &)=delete |
| Result< void > | publish (SubjectRef instance, SubjectRef owner, int player) |
| Publish one player ledger under a stable instance identity. | |
| Result< void > | unpublish (SubjectRef instance) |
Drop one publication; NotFound when that instance is not published. | |
| void | clear () |
| Drop every publication. | |
| 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 published player resource ledgers through the shared gameplay protocol.
The economy module already owned the authoritative ledger (EconomySystem), but nothing bridged it to the gameplay protocol, so an unattended agent had to call eve_eval on module internals to read or change a balance. The action vocabulary here is the module's own: economy:debit is an ordinary spend, and economy:credit is a grant, refused for GameplayAccess::PlayerEquivalent and accepted only for the test-driver and developer-cheat profiles.
Gathering stays with the game: GatherNode/Collector drive extraction over simulated ticks, and re-exposing a cheaper "harvest now" shortcut here would be a second write path for the same fact.
One adapter serves every published instance (the shared router requires exactly one provider per domain), so several players can be observed at once.
@ownership The adapter stores only the integer player id, its own revision and event ledger, and the borrowed publication identity; the ledger itself stays owned by EconomySystem. @thread Owner-simulation thread only, like every gameplay provider. @reentrancy No method invokes callbacks; submitGameplay credits/debits the module ledger directly and appends to its own event ledger.
在文件 EconomyControl.h 第 37 行定义.
构造及析构函数说明
◆ EconomyControl() [1/2]
| eve::economy::EconomyControl::EconomyControl | ( | ) |
Create an unpublished adapter and register it as the economy domain.
在文件 EconomyControl.cpp 第 65 行定义.
◆ ~EconomyControl()
|
override |
Unpublish every instance.
在文件 EconomyControl.cpp 第 70 行定义.
◆ EconomyControl() [2/2]
|
delete |
成员函数说明
◆ advanceGameplay()
|
overridevirtual |
Advance one provider-owned instance using injected deterministic time.
Advance gameplay.
实现了 eve::IGameplayControlProvider.
在文件 EconomyControl.cpp 第 329 行定义.
引用了 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.
在文件 EconomyControl.cpp 第 198 行定义.
引用了 actions, id, eve::NotFound, observeGameplay(), eve::PlayerEquivalent, eve::PreconditionViolation, session , 以及 subject.
◆ clear()
| void eve::economy::EconomyControl::clear | ( | ) |
Drop every publication.
在文件 EconomyControl.cpp 第 100 行定义.
◆ count()
| int eve::economy::EconomyControl::count | ( | ) | const |
Number of published instances.
在文件 EconomyControl.cpp 第 102 行定义.
◆ gameplayDomain()
|
overridevirtualnoexcept |
Stable provider domain used for discovery and routing.
Gameplay domain.
实现了 eve::IGameplayControlProvider.
在文件 EconomyControl.cpp 第 111 行定义.
◆ gameplayEvents()
|
overridevirtual |
Return events strictly newer than an instance-local sequence cursor.
Gameplay events.
实现了 eve::IGameplayControlProvider.
在文件 EconomyControl.cpp 第 344 行定义.
引用了 eve::Applied, eve::NoOp, eve::NotFound, observeGameplay(), session , 以及 eve::Status::success().
◆ gameplayInstances()
|
overridevirtual |
Instances currently served, in publication order.
Gameplay instances.
实现了 eve::IGameplayInstanceCatalog.
在文件 EconomyControl.cpp 第 113 行定义.
引用了 instances().
◆ instances()
| std::vector< SubjectRef > eve::economy::EconomyControl::instances | ( | ) | const |
Published instance identities, in publication order.
在文件 EconomyControl.cpp 第 104 行定义.
被这些函数引用 gameplayInstances().
◆ observeGameplay()
|
overridevirtual |
Observe one provider-owned gameplay instance without mutation.
Observe gameplay.
实现了 eve::IGameplayControlProvider.
在文件 EconomyControl.cpp 第 181 行定义.
引用了 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::economy::EconomyControl::publish | ( | SubjectRef | instance, |
| SubjectRef | owner, | ||
| int | player | ||
| ) |
Publish one player ledger under a stable instance identity.
- 参数
-
instance Stable identity of the instance, a canonical persistent id. owner Stable identity of the player/actor controlling it. player Module-level player id whose ledger this instance observes.
- 返回
- Success, or
Conflictwhen that instance is already published.
在文件 EconomyControl.cpp 第 75 行定义.
引用了 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.
在文件 EconomyControl.cpp 第 223 行定义.
引用了 eve::GameplayCommandReceipt::acceptedTick, eve::GameplayCommand::action, action, eve::Applied, eve::GameplayEvent::causationCommandId, eve::GameplayCommandReceipt::commandId, eve::Conflict, eve::GameplayEvent::correlationId, eve::economy::EconomySystem::credit(), eve::economy::EconomyLedger::Snapshot::current, eve::economy::EconomySystem::debit(), detail, eve::GameplayCommandReceipt::details, eve::GameplayCommandReceipt::executionId, eve::GameplayCommand::expectedRevision, eve::economy::EconomyLedger::Snapshot::expense, eve::Failed, eve::Result< T >::failure(), eve::economy::ResourceTypeRegistry::find(), eve::LogicalId::format(), eve::economy::EconomySystem::get(), eve::GameplayCommand::id, eve::economy::EconomyLedger::Snapshot::income, eve::InvalidArgument, eve::NotFound, object, eve::GameplayCommand::observedTick, eve::GameplayCommand::parameters, eve::GameplayEvent::payload, eve::PlayerEquivalent, eve::PreconditionViolation, eve::GameplayCommandReceipt::resultingRevision, eve::GameplayEvent::sequence, session, eve::economy::EconomySystem::snapshot(), eve::GameplayCommand::subject, eve::GameplayEvent::subject, eve::Status::success(), eve::Result< T >::success(), text, eve::GameplayEvent::tick, eve::GameplayEvent::type, type, eve::Unsupported , 以及 values.
◆ unpublish()
| Result< void > eve::economy::EconomyControl::unpublish | ( | SubjectRef | instance | ) |
Drop one publication; NotFound when that instance is not published.
在文件 EconomyControl.cpp 第 90 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), found, eve::NotFound , 以及 eve::Result< T >::success().
该类的文档由以下文件生成:
- src/modules/economy/EconomyControl.h
- src/modules/economy/EconomyControl.cpp
Public 成员函数 继承自