载入中...
搜索中...
未找到
eve::warship::WarshipSystem类 参考

Behavior for WarshipEntity: layout projection, mobility, orders. 更多...

#include <WarshipSystem.h>

静态 Public 成员函数

static void registerMobility (IWarshipMobility *mobility)
 Register a mobility plugin (same name replaces). Takes ownership.
 
static int mobilityCount ()
 Number of registered mobility implementations (includes builtins).
 
static void ensureBuiltinMobility ()
 Ensure built-in surface/sail/carrier/space models are registered.
 
static void recomputeCapabilities (WarshipEntity &ship)
 Recompute Capabilities from Layout + function catalogue. @cost Linear in cell count; amortize across layout edits, not per pixel.
 
static Result< void > placeCompartment (WarshipEntity &ship, int deck, int row, int col, const std::string &functionId)
 Place or replace a function in one cell. @cost One cell write + full capability recompute.
 
static Result< void > clearCompartment (WarshipEntity &ship, int deck, int row, int col)
 Vacate one cell.
 
static Result< void > swapCompartments (WarshipEntity &ship, int deckA, int rowA, int colA, int deckB, int rowB, int colB)
 Swap two cells atomically.
 
static Result< void > rearrangeFromJson (WarshipEntity &ship, const std::string &json)
 Replace the entire layout from a JSON array of {deck,row,col,function}.
 
static void moveTo (WarshipEntity &ship, float x, float y, float arriveRadius=24.f)
 Issue a move order toward (x, y).
 
static void stop (WarshipEntity &ship)
 Cancel move order and zero helm input.
 
static void applyDamage (WarshipEntity &ship, float amount, const std::string &sourceId={})
 Apply damage; may mark destroyed and push events.
 
static void update (float dt)
 Advance all warships one step.
 
static void clearEvents ()
 
static int eventCount ()
 
static const WarshipEvent * eventAt (int index)
 Borrow one buffered event by index.
 
static void pushEvent (WarshipEvent event)
 

详细描述

Behavior for WarshipEntity: layout projection, mobility, orders.

System scope: every live WarshipEntity. View: WarshipEntity components Identity/Definition/Input/Motion/Health/ Hull/Layout/Capabilities/Flags. Reads: Layout cells + function catalogue; Input; Motion targets. Writes: Motion, Capabilities, Flags, event queue. Structural mutations: none while iterating (destroy deferred to callers). Phase: simulation fixed-step (Warship::update).

在文件 WarshipSystem.h 第 23 行定义.

成员函数说明

◆ applyDamage()

void eve::warship::WarshipSystem::applyDamage ( WarshipEntity &  ship,
float  amount,
const std::string &  sourceId = {} 
)
static

◆ clearCompartment()

Result< void > eve::warship::WarshipSystem::clearCompartment ( WarshipEntity &  ship,
int  deck,
int  row,
int  col 
)
static

◆ clearEvents()

void eve::warship::WarshipSystem::clearEvents ( )
static

在文件 WarshipSystem.cpp 第 402 行定义.

被这些函数引用 eve::warship::Warship::clearEvents().

◆ ensureBuiltinMobility()

void eve::warship::WarshipSystem::ensureBuiltinMobility ( )
static

Ensure built-in surface/sail/carrier/space models are registered.

在文件 WarshipSystem.cpp 第 166 行定义.

引用了 eve::warship::kMobilityCarrier, eve::warship::kMobilitySail, eve::warship::kMobilitySpace , 以及 eve::warship::kMobilitySurface.

被这些函数引用 mobilityCount() , 以及 update().

◆ eventAt()

const WarshipEvent * eve::warship::WarshipSystem::eventAt ( int  index)
static

Borrow one buffered event by index.

返回
Borrowed pointer into the module event queue, or nullptr when out of range. @ownership Borrowed; WarshipSystem owns the queue storage. Callers must not free it. @lifetime Valid until the next clearEvents / pushEvent / update that mutates the queue. @thread Owner / composition thread only. @reentrancy Does not invoke callbacks.

在文件 WarshipSystem.cpp 第 406 行定义.

引用了 eventCount() , 以及 index.

被这些函数引用 eve::warship::Warship::getEventDefId(), eve::warship::Warship::getEventDetail(), eve::warship::Warship::getEventType() , 以及 eve::warship::Warship::getEventWarshipId().

◆ eventCount()

int eve::warship::WarshipSystem::eventCount ( )
static

在文件 WarshipSystem.cpp 第 404 行定义.

被这些函数引用 eventAt() , 以及 eve::warship::Warship::getEventCount().

◆ mobilityCount()

int eve::warship::WarshipSystem::mobilityCount ( )
static

Number of registered mobility implementations (includes builtins).

在文件 WarshipSystem.cpp 第 161 行定义.

引用了 ensureBuiltinMobility().

被这些函数引用 eve::warship::Warship::getMobilityCount().

◆ moveTo()

void eve::warship::WarshipSystem::moveTo ( WarshipEntity &  ship,
float  x,
float  y,
float  arriveRadius = 24.f 
)
static

Issue a move order toward (x, y).

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

引用了 x , 以及 y.

被这些函数引用 eve::warship::Warship::moveTo().

◆ placeCompartment()

Result< void > eve::warship::WarshipSystem::placeCompartment ( WarshipEntity &  ship,
int  deck,
int  row,
int  col,
const std::string &  functionId 
)
static

◆ pushEvent()

void eve::warship::WarshipSystem::pushEvent ( WarshipEvent  event)
static

◆ rearrangeFromJson()

Result< void > eve::warship::WarshipSystem::rearrangeFromJson ( WarshipEntity &  ship,
const std::string &  json 
)
static

Replace the entire layout from a JSON array of {deck,row,col,function}.

备注
Failure leaves the previous layout untouched. @cost Parses JSON then rebuilds every cell; amortize across remodel actions.

在文件 WarshipSystem.cpp 第 259 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Value::fromJson(), eve::warship::WarshipRegistry::hasFunction(), index, eve::InvalidArgument, key, layout, eve::warship::LayoutChanged, object, pushEvent(), eve::readIntValue(), eve::readStringMember(), recomputeCapabilities(), eve::Result< T >::success() , 以及 eve::warship::WarshipEvent::type.

被这些函数引用 eve::warship::Warship::rearrangeFromJson().

◆ recomputeCapabilities()

void eve::warship::WarshipSystem::recomputeCapabilities ( WarshipEntity &  ship)
static

Recompute Capabilities from Layout + function catalogue. @cost Linear in cell count; amortize across layout edits, not per pixel.

在文件 WarshipSystem.cpp 第 174 行定义.

引用了 caps, cell, eve::warship::WarshipRegistry::findFunction(), fn, layout, pushEvent(), eve::warship::WarshipCapabilities::thrustMul, eve::warship::WarshipEvent::type, eve::warship::Underpowered , 以及 values.

被这些函数引用 clearCompartment(), eve::warship::Warship::newWarship(), placeCompartment(), rearrangeFromJson() , 以及 swapCompartments().

◆ registerMobility()

void eve::warship::WarshipSystem::registerMobility ( IWarshipMobility *  mobility)
static

Register a mobility plugin (same name replaces). Takes ownership.

在文件 WarshipSystem.cpp 第 156 行定义.

引用了 eve::warship::IWarshipMobility::name().

被这些函数引用 eve::warship::Warship::registerMobility().

◆ stop()

void eve::warship::WarshipSystem::stop ( WarshipEntity &  ship)
static

Cancel move order and zero helm input.

在文件 WarshipSystem.cpp 第 331 行定义.

引用了 input.

被这些函数引用 applyDamage() , 以及 eve::warship::Warship::stop().

◆ swapCompartments()

Result< void > eve::warship::WarshipSystem::swapCompartments ( WarshipEntity &  ship,
int  deckA,
int  rowA,
int  colA,
int  deckB,
int  rowB,
int  colB 
)
static

◆ update()

void eve::warship::WarshipSystem::update ( float  dt)
static

Advance all warships one step.

参数
dtSeconds; non-finite or negative is ignored.

在文件 WarshipSystem.cpp 第 363 行定义.

引用了 dt, end, ensureBuiltinMobility(), eve::warship::kMobilitySurface, eve::warship::WarshipDefinition::mobility , 以及 r.

被这些函数引用 eve::warship::Warship::update().


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