载入中...
搜索中...
未找到
RTSSnapshotInternal.h
浏览该文件的文档.
1#pragma once
2#include "rts/RTSTypes.h"
4inline SubjectRef subjectOf(ecs::Entity* entity) {
5 if (auto* value = dynamic_cast<Unit*>(entity)) return value->identity()->subject;
6 if (auto* value = dynamic_cast<Building*>(entity)) return value->identity()->subject;
7 if (auto* value = dynamic_cast<ResourceNode*>(entity)) return value->identity()->subject;
8 if (auto* value = dynamic_cast<Player*>(entity)) return value->identity()->subject;
9 if (auto* value = dynamic_cast<Faction*>(entity)) return value->identity()->subject;
10 if (auto* value = dynamic_cast<Match*>(entity)) return value->identity()->subject;
11 return {};
12}
13
14inline SubjectRef subjectOf(ecs::EntityHandle handle) {
15 if (handle.table != ecs::current()) return {};
16 return subjectOf(ecs::try_get(handle));
17}
18
19} // namespace eve::rts::snapshot_internal
double value
PrimitiveHandle handle
RTS domain roots and composition-only components.
Strong, domain-neutral reference to a runtime subject.
Definition SubjectRef.h:26
RTS building domain root with placement and production composition.
Definition RTSTypes.h:840
Faction domain root; membership is a set of typed runtime handles.
Definition RTSTypes.h:1178
Independent match composition root; factions may participate in different matches.
Definition RTSTypes.h:1295
Player domain root; selection is RTS-local, authority/economy/social are links.
Definition RTSTypes.h:1119
Harvestable RTS resource node; deposited balances are owned by an external resource account.
Definition RTSTypes.h:1071
RTS unit domain root.
Definition RTSTypes.h:495
SubjectRef subjectOf(ecs::Entity *entity)