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()
|
static |
Apply damage; may mark destroyed and push events.
在文件 WarshipSystem.cpp 第 341 行定义.
引用了 eve::warship::Damaged, eve::warship::WarshipEvent::defId, eve::warship::Destroyed, flags, pushEvent(), stop(), eve::warship::WarshipEvent::type , 以及 eve::warship::WarshipEvent::warshipId.
被这些函数引用 eve::warship::Warship::applyDamage().
◆ clearCompartment()
|
static |
Vacate one cell.
在文件 WarshipSystem.cpp 第 227 行定义.
引用了 index, eve::warship::LayoutChanged, ok, pushEvent(), recomputeCapabilities(), eve::Result< T >::success() , 以及 eve::warship::WarshipEvent::type.
◆ clearEvents()
|
static |
在文件 WarshipSystem.cpp 第 402 行定义.
被这些函数引用 eve::warship::Warship::clearEvents().
◆ 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()
|
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/updatethat 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()
|
static |
在文件 WarshipSystem.cpp 第 404 行定义.
被这些函数引用 eventAt() , 以及 eve::warship::Warship::getEventCount().
◆ mobilityCount()
|
static |
Number of registered mobility implementations (includes builtins).
在文件 WarshipSystem.cpp 第 161 行定义.
◆ moveTo()
|
static |
Issue a move order toward (x, y).
在文件 WarshipSystem.cpp 第 322 行定义.
被这些函数引用 eve::warship::Warship::moveTo().
◆ placeCompartment()
|
static |
Place or replace a function in one cell. @cost One cell write + full capability recompute.
在文件 WarshipSystem.cpp 第 208 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::warship::WarshipRegistry::hasFunction(), index, eve::InvalidArgument, eve::warship::LayoutChanged, ok, pushEvent(), recomputeCapabilities(), eve::Result< T >::success() , 以及 eve::warship::WarshipEvent::type.
◆ pushEvent()
|
static |
在文件 WarshipSystem.cpp 第 411 行定义.
被这些函数引用 applyDamage(), clearCompartment(), placeCompartment(), rearrangeFromJson(), recomputeCapabilities() , 以及 swapCompartments().
◆ rearrangeFromJson()
|
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.
◆ recomputeCapabilities()
|
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()
|
static |
Register a mobility plugin (same name replaces). Takes ownership.
在文件 WarshipSystem.cpp 第 156 行定义.
◆ stop()
|
static |
Cancel move order and zero helm input.
在文件 WarshipSystem.cpp 第 331 行定义.
引用了 input.
被这些函数引用 applyDamage() , 以及 eve::warship::Warship::stop().
◆ swapCompartments()
|
static |
Swap two cells atomically.
在文件 WarshipSystem.cpp 第 241 行定义.
引用了 cells, eve::warship::LayoutChanged, ok, pushEvent(), recomputeCapabilities(), eve::Result< T >::success() , 以及 eve::warship::WarshipEvent::type.
◆ update()
|
static |
Advance all warships one step.
- 参数
-
dt Seconds; non-finite or negative is ignored.
在文件 WarshipSystem.cpp 第 363 行定义.
引用了 dt, end, ensureBuiltinMobility(), eve::warship::kMobilitySurface, eve::warship::WarshipDefinition::mobility , 以及 r.
被这些函数引用 eve::warship::Warship::update().
该类的文档由以下文件生成:
- src/modules/warship/WarshipSystem.h
- src/modules/warship/WarshipSystem.cpp