载入中...
搜索中...
未找到
eve::roster::Roster类 参考

Authoritative squad membership, post occupancy, and reinforce spawn requests. 更多...

#include <Roster.h>

类 eve::roster::Roster 继承关系图:
eve::Module

Public 成员函数

 Module_REG (Roster)
 
 Roster ()
 Constructs an empty roster world.
 
 ~Roster () override
 Destroys roster storage.
 
void clear ()
 Clears every post, squad, policy, vacancy and spawn request.
 
Result< void > registerPost (std::string postId, int capacity, std::string defaultRole="guard")
 Registers a named post with a fixed seat capacity.
 
Result< void > removePost (std::string_view postId, std::uint64_t tick)
 Removes a post and emits vacancies for every remaining occupant.
 
Result< void > assignPost (std::string_view postId, std::string subject, std::string role={})
 Occupies one post seat with a subject.
 
Result< void > releasePost (std::string_view postId, std::string_view subject, std::uint64_t tick)
 Releases one subject's seat on a post and records a vacancy.
 
Result< int > postOccupancy (std::string_view postId) const
 Current occupants for a post, or NotFound.
 
Result< int > postCapacity (std::string_view postId) const
 Configured capacity for a post, or NotFound.
 
Result< std::string > postAssigneeAt (std::string_view postId, int index) const
 Assignee at a stable index (sorted by subject id), or empty / failure.
 
Result< std::string > postRole (std::string_view postId, std::string_view subject) const
 Role for an assignee on a post, or NotFound.
 
Result< void > createSquad (std::string squadId, int capacity, std::string intent={})
 Creates a squad with a membership cap and optional initial intent.
 
Result< void > destroySquad (std::string_view squadId, std::uint64_t tick)
 Destroys a squad and emits vacancies for every remaining member.
 
Result< void > addMember (std::string_view squadId, std::string subject, std::string role="member")
 Adds a member with a role; rejects duplicates and capacity overflow.
 
Result< void > removeMember (std::string_view squadId, std::string_view subject, std::uint64_t tick)
 Removes a member and records a squad vacancy.
 
Result< void > setIntent (std::string_view squadId, std::string intent)
 Replaces the squad's shared intent string.
 
Result< std::string > intent (std::string_view squadId) const
 Reads the squad intent, or NotFound.
 
Result< int > memberCount (std::string_view squadId) const
 Current member count, or NotFound.
 
Result< std::string > memberAt (std::string_view squadId, int index) const
 Member subject at a stable index, or failure.
 
Result< std::string > memberRole (std::string_view squadId, std::string_view subject) const
 Role for a squad member, or NotFound.
 
Result< int > releaseSubject (std::string_view subject, std::uint64_t tick)
 Removes a subject from every post and squad, emitting one vacancy per seat.
 
int vacancyCount () const
 Queued vacancy count (stable insertion order).
 
Result< Vacancy > vacancyAt (int index) const
 Vacancy at index, or InvalidArgument when out of range.
 
void clearVacancies ()
 Clears the vacancy queue without changing occupancy.
 
Result< void > setPolicy (std::string policyId, std::string preferredDef, int delayTicks, int budget, std::string postId={}, std::string squadId={}, std::string role={})
 Upserts a reinforce policy that turns matching vacancies into spawn requests.
 
Result< void > setFallback (std::string_view policyId, std::string preferredDef, std::string fallbackDef)
 Adds or replaces a preferred→fallback definition edge for a policy.
 
Result< void > clearPolicy (std::string_view policyId)
 Removes a policy; pending requests for it remain until acked/failed.
 
Result< int > step (std::uint64_t tick)
 Advances reinforce matching for vacancies ready at or before tick.
 
int spawnRequestCount () const
 Pending spawn request count.
 
Result< SpawnRequest > spawnRequestAt (int index) const
 Spawn request at index, or InvalidArgument.
 
Result< void > ackSpawnRequest (std::string_view requestId)
 Marks a spawn request fulfilled and consumes one budget unit when limited.
 
Result< void > failSpawnRequest (std::string_view requestId, std::uint64_t tick)
 Fails a spawn request; enqueues a fallback definition when configured, else drops it.
 
- Public 成员函数 继承自 eve::Module
virtual ~Module ()
 Module.
 
virtual std::string getName () const =0
 Returns the name.
 

详细描述

Authoritative squad membership, post occupancy, and reinforce spawn requests.

Owns only roster facts (who belongs where, which seats are empty, which spawn requests are pending). Does not own HP, navigation, production queues, or NPC behavior trees — games inject subject ids and fulfill spawn requests via their own Production / ISpawnProvider path.

@thread Simulation owner thread only. @reentrancy No callbacks; no graphics includes.

在文件 Roster.h 第 46 行定义.

构造及析构函数说明

◆ Roster()

eve::roster::Roster::Roster ( )
default

Constructs an empty roster world.

◆ ~Roster()

eve::roster::Roster::~Roster ( )
overridedefault

Destroys roster storage.

成员函数说明

◆ ackSpawnRequest()

Result< void > eve::roster::Roster::ackSpawnRequest ( std::string_view  requestId)

Marks a spawn request fulfilled and consumes one budget unit when limited.

备注
Does not assign the new subject; the game calls assignPost/addMember after spawn.

在文件 Roster.cpp 第 336 行定义.

引用了 eve::Applied, eve::NotFound, request, eve::Status::success() , 以及 eve::Result< T >::success().

◆ addMember()

Result< void > eve::roster::Roster::addMember ( std::string_view  squadId,
std::string  subject,
std::string  role = "member" 
)

Adds a member with a role; rejects duplicates and capacity overflow.

在文件 Roster.cpp 第 139 行定义.

引用了 a, eve::Applied, b, eve::Conflict, eve::InvalidArgument, eve::NotFound, subject, eve::Status::success() , 以及 eve::Result< T >::success().

◆ assignPost()

Result< void > eve::roster::Roster::assignPost ( std::string_view  postId,
std::string  subject,
std::string  role = {} 
)

Occupies one post seat with a subject.

备注
Rejects when the post is full, the subject already holds any post seat, or ids are empty. Role defaults to the post's defaultRole when empty.

在文件 Roster.cpp 第 64 行定义.

引用了 a, eve::Applied, b, eve::Conflict, eve::InvalidArgument, eve::NotFound, subject, eve::Status::success() , 以及 eve::Result< T >::success().

◆ clear()

void eve::roster::Roster::clear ( )

Clears every post, squad, policy, vacancy and spawn request.

在文件 Roster.cpp 第 34 行定义.

◆ clearPolicy()

Result< void > eve::roster::Roster::clearPolicy ( std::string_view  policyId)

Removes a policy; pending requests for it remain until acked/failed.

在文件 Roster.cpp 第 261 行定义.

引用了 eve::Applied, eve::NotFound, policyId, eve::Status::success() , 以及 eve::Result< T >::success().

◆ clearVacancies()

void eve::roster::Roster::clearVacancies ( )

Clears the vacancy queue without changing occupancy.

在文件 Roster.cpp 第 229 行定义.

◆ createSquad()

Result< void > eve::roster::Roster::createSquad ( std::string  squadId,
int  capacity,
std::string  intent = {} 
)

Creates a squad with a membership cap and optional initial intent.

参数
intentShared collective intent id (e.g. "patrol", "hold"); may be empty.

在文件 Roster.cpp 第 123 行定义.

引用了 eve::AlreadyExists, eve::Applied, capacity, intent(), eve::InvalidArgument, eve::Status::success() , 以及 eve::Result< T >::success().

◆ destroySquad()

Result< void > eve::roster::Roster::destroySquad ( std::string_view  squadId,
std::uint64_t  tick 
)

Destroys a squad and emits vacancies for every remaining member.

在文件 Roster.cpp 第 131 行定义.

引用了 eve::Applied, member, eve::NotFound, eve::Status::success(), eve::Result< T >::success() , 以及 tick.

◆ failSpawnRequest()

Result< void > eve::roster::Roster::failSpawnRequest ( std::string_view  requestId,
std::uint64_t  tick 
)

Fails a spawn request; enqueues a fallback definition when configured, else drops it.

在文件 Roster.cpp 第 346 行定义.

引用了 eve::Applied, eve::NoOp, eve::NotFound, eve::roster::SpawnRequest::preferredDef, eve::roster::SpawnRequest::readyAtTick, request, eve::roster::SpawnRequest::requestId, eve::Status::success(), eve::Result< T >::success() , 以及 tick.

◆ intent()

Result< std::string > eve::roster::Roster::intent ( std::string_view  squadId) const

Reads the squad intent, or NotFound.

在文件 Roster.cpp 第 172 行定义.

引用了 eve::NotFound , 以及 eve::Result< T >::success().

被这些函数引用 createSquad() , 以及 setIntent().

◆ memberAt()

Result< std::string > eve::roster::Roster::memberAt ( std::string_view  squadId,
int  index 
) const

Member subject at a stable index, or failure.

在文件 Roster.cpp 第 184 行定义.

引用了 index, eve::InvalidArgument, eve::NotFound , 以及 eve::Result< T >::success().

◆ memberCount()

Result< int > eve::roster::Roster::memberCount ( std::string_view  squadId) const

Current member count, or NotFound.

在文件 Roster.cpp 第 178 行定义.

引用了 eve::NotFound , 以及 eve::Result< T >::success().

◆ memberRole()

Result< std::string > eve::roster::Roster::memberRole ( std::string_view  squadId,
std::string_view  subject 
) const

Role for a squad member, or NotFound.

在文件 Roster.cpp 第 192 行定义.

引用了 member, eve::NotFound, subject , 以及 eve::Result< T >::success().

◆ Module_REG()

eve::roster::Roster::Module_REG ( Roster  )

◆ postAssigneeAt()

Result< std::string > eve::roster::Roster::postAssigneeAt ( std::string_view  postId,
int  index 
) const

Assignee at a stable index (sorted by subject id), or empty / failure.

在文件 Roster.cpp 第 106 行定义.

引用了 index, eve::InvalidArgument, eve::NotFound , 以及 eve::Result< T >::success().

◆ postCapacity()

Result< int > eve::roster::Roster::postCapacity ( std::string_view  postId) const

Configured capacity for a post, or NotFound.

在文件 Roster.cpp 第 100 行定义.

引用了 eve::NotFound , 以及 eve::Result< T >::success().

◆ postOccupancy()

Result< int > eve::roster::Roster::postOccupancy ( std::string_view  postId) const

Current occupants for a post, or NotFound.

在文件 Roster.cpp 第 94 行定义.

引用了 eve::NotFound , 以及 eve::Result< T >::success().

◆ postRole()

Result< std::string > eve::roster::Roster::postRole ( std::string_view  postId,
std::string_view  subject 
) const

Role for an assignee on a post, or NotFound.

在文件 Roster.cpp 第 114 行定义.

引用了 eve::NotFound, subject , 以及 eve::Result< T >::success().

◆ registerPost()

Result< void > eve::roster::Roster::registerPost ( std::string  postId,
int  capacity,
std::string  defaultRole = "guard" 
)

Registers a named post with a fixed seat capacity.

参数
postIdStable logical id (non-empty, unique among posts).
capacityMaximum simultaneous occupants (>=1).
defaultRoleRole written on assign when caller passes an empty role.
返回
Applied, AlreadyExists, or InvalidArgument.

在文件 Roster.cpp 第 48 行定义.

引用了 eve::AlreadyExists, eve::Applied, capacity, eve::InvalidArgument, eve::Status::success() , 以及 eve::Result< T >::success().

◆ releasePost()

Result< void > eve::roster::Roster::releasePost ( std::string_view  postId,
std::string_view  subject,
std::uint64_t  tick 
)

Releases one subject's seat on a post and records a vacancy.

在文件 Roster.cpp 第 83 行定义.

引用了 eve::Applied, eve::NotFound, subject, eve::Status::success(), eve::Result< T >::success() , 以及 tick.

◆ releaseSubject()

Result< int > eve::roster::Roster::releaseSubject ( std::string_view  subject,
std::uint64_t  tick 
)

Removes a subject from every post and squad, emitting one vacancy per seat.

返回
Number of seats released.

在文件 Roster.cpp 第 201 行定义.

引用了 eve::Applied, eve::InvalidArgument, member, eve::NoOp, subject, eve::Status::success(), eve::Result< T >::success() , 以及 tick.

◆ removeMember()

Result< void > eve::roster::Roster::removeMember ( std::string_view  squadId,
std::string_view  subject,
std::uint64_t  tick 
)

Removes a member and records a squad vacancy.

在文件 Roster.cpp 第 154 行定义.

引用了 eve::Applied, member, eve::NotFound, subject, eve::Status::success(), eve::Result< T >::success() , 以及 tick.

◆ removePost()

Result< void > eve::roster::Roster::removePost ( std::string_view  postId,
std::uint64_t  tick 
)

Removes a post and emits vacancies for every remaining occupant.

在文件 Roster.cpp 第 56 行定义.

引用了 eve::Applied, eve::NotFound, eve::Status::success(), eve::Result< T >::success() , 以及 tick.

◆ setFallback()

Result< void > eve::roster::Roster::setFallback ( std::string_view  policyId,
std::string  preferredDef,
std::string  fallbackDef 
)

Adds or replaces a preferred→fallback definition edge for a policy.

在文件 Roster.cpp 第 249 行定义.

引用了 eve::Applied, eve::Conflict, eve::InvalidArgument, eve::NotFound, policyId, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setIntent()

Result< void > eve::roster::Roster::setIntent ( std::string_view  squadId,
std::string  intent 
)

Replaces the squad's shared intent string.

在文件 Roster.cpp 第 165 行定义.

引用了 eve::Applied, intent(), eve::NotFound, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setPolicy()

Result< void > eve::roster::Roster::setPolicy ( std::string  policyId,
std::string  preferredDef,
int  delayTicks,
int  budget,
std::string  postId = {},
std::string  squadId = {},
std::string  role = {} 
)

Upserts a reinforce policy that turns matching vacancies into spawn requests.

参数
policyIdStable id.
preferredDefDefinition/archetype the game should spawn first.
delayTicksTicks to wait after a vacancy before enqueueing a request (>=0).
budgetMaximum successful acks this policy may produce (0 = unlimited).
postIdWhen non-empty, only vacancies for this post match.
squadIdWhen non-empty, only vacancies for this squad match.
roleWhen non-empty, only vacancies with this role match.

在文件 Roster.cpp 第 231 行定义.

引用了 eve::Applied, eve::InvalidArgument, policyId, eve::Status::success() , 以及 eve::Result< T >::success().

◆ spawnRequestAt()

Result< SpawnRequest > eve::roster::Roster::spawnRequestAt ( int  index) const

Spawn request at index, or InvalidArgument.

在文件 Roster.cpp 第 322 行定义.

引用了 index, eve::InvalidArgument , 以及 eve::Result< T >::success().

◆ spawnRequestCount()

int eve::roster::Roster::spawnRequestCount ( ) const

Pending spawn request count.

在文件 Roster.cpp 第 320 行定义.

◆ step()

Result< int > eve::roster::Roster::step ( std::uint64_t  tick)

Advances reinforce matching for vacancies ready at or before tick.

返回
Number of newly enqueued spawn requests.
备注
Does not invent subjects. The game must ack or fail each request. @cost Linear in vacancy×policy counts; amortize once per simulation tick.

在文件 Roster.cpp 第 279 行定义.

引用了 eve::Applied, created, eve::roster::Vacancy::kind, eve::NoOp, policyId, request, eve::roster::SpawnRequest::requestId, eve::roster::Vacancy::role, eve::Status::success(), eve::Result< T >::success(), eve::roster::Vacancy::targetId, eve::roster::Vacancy::tick , 以及 tick.

◆ vacancyAt()

Result< Vacancy > eve::roster::Roster::vacancyAt ( int  index) const

Vacancy at index, or InvalidArgument when out of range.

在文件 Roster.cpp 第 223 行定义.

引用了 index, eve::InvalidArgument , 以及 eve::Result< T >::success().

◆ vacancyCount()

int eve::roster::Roster::vacancyCount ( ) const

Queued vacancy count (stable insertion order).

在文件 Roster.cpp 第 221 行定义.


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