Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/system/ComponentManager.h
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | public: | ||||
void RegisterMessageType(MessageTypeId mtid, const char* name); | void RegisterMessageType(MessageTypeId mtid, const char* name); | ||||
void RegisterComponentType(InterfaceId, ComponentTypeId, AllocFunc, DeallocFunc, const char*, const std::string& schema); | void RegisterComponentType(InterfaceId, ComponentTypeId, AllocFunc, DeallocFunc, const char*, const std::string& schema); | ||||
void RegisterComponentTypeScriptWrapper(InterfaceId, ComponentTypeId, AllocFunc, DeallocFunc, const char*, const std::string& schema); | void RegisterComponentTypeScriptWrapper(InterfaceId, ComponentTypeId, AllocFunc, DeallocFunc, const char*, const std::string& schema); | ||||
void MarkScriptedComponentForSystemEntity(CComponentManager::ComponentTypeId cid); | void MarkScriptedComponentForSystemEntity(CComponentManager::ComponentTypeId cid); | ||||
/** | /** | ||||
* Subscribe the current component type to the given message type. | * Subscribe the given component type to the given message type. | ||||
* Each component's HandleMessage will be called on any BroadcastMessage of this message type, | * Each component's HandleMessage will be called on any BroadcastMessage of this message type, | ||||
* or on any PostMessage of this type targeted at the component's entity. | * or on any PostMessage of this type targeted at the component's entity. | ||||
* Must only be called by a component type's ClassInit. | * Must only be called by a component type's ClassInit. | ||||
*/ | */ | ||||
void SubscribeToMessageType(MessageTypeId mtid); | void SubscribeToMessageType(ComponentTypeId componentTypeId, MessageTypeId mtid); | ||||
/** | /** | ||||
* Subscribe the current component type to all messages of the given message type. | * Subscribe the given component type to all messages of the given message type. | ||||
* Each component's HandleMessage will be called on any BroadcastMessage or PostMessage of this message type, | * Each component's HandleMessage will be called on any BroadcastMessage or PostMessage of this message type, | ||||
* regardless of the entity. | * regardless of the entity. | ||||
* Must only be called by a component type's ClassInit. | * Must only be called by a component type's ClassInit. | ||||
*/ | */ | ||||
void SubscribeGloballyToMessageType(MessageTypeId mtid); | void SubscribeGloballyToMessageType(ComponentTypeId componentTypeId, MessageTypeId mtid); | ||||
/** | /** | ||||
* Subscribe the given component instance to all messages of the given message type. | * Subscribe the given component instance to all messages of the given message type. | ||||
* The component's HandleMessage will be called on any BroadcastMessage or PostMessage of | * The component's HandleMessage will be called on any BroadcastMessage or PostMessage of | ||||
* this message type, regardless of the entity. | * this message type, regardless of the entity. | ||||
* | * | ||||
* This can be called at any time (including inside the HandleMessage callback for this message type). | * This can be called at any time (including inside the HandleMessage callback for this message type). | ||||
* | * | ||||
▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | private: | ||||
CEntityHandle AllocateEntityHandle(entity_id_t ent); | CEntityHandle AllocateEntityHandle(entity_id_t ent); | ||||
ScriptInterface m_ScriptInterface; | ScriptInterface m_ScriptInterface; | ||||
CSimContext& m_SimContext; | CSimContext& m_SimContext; | ||||
CEntityHandle m_SystemEntity; | CEntityHandle m_SystemEntity; | ||||
ComponentTypeId m_CurrentComponent; // used when loading component types | |||||
bool m_CurrentlyHotloading; | bool m_CurrentlyHotloading; | ||||
// TODO: some of these should be vectors | // TODO: some of these should be vectors | ||||
std::map<ComponentTypeId, ComponentType> m_ComponentTypesById; | std::map<ComponentTypeId, ComponentType> m_ComponentTypesById; | ||||
std::vector<CComponentManager::ComponentTypeId> m_ScriptedSystemComponents; | std::vector<CComponentManager::ComponentTypeId> m_ScriptedSystemComponents; | ||||
std::vector<std::unordered_map<entity_id_t, IComponent*> > m_ComponentsByInterface; // indexed by InterfaceId | std::vector<std::unordered_map<entity_id_t, IComponent*> > m_ComponentsByInterface; // indexed by InterfaceId | ||||
std::map<ComponentTypeId, std::map<entity_id_t, IComponent*> > m_ComponentsByTypeId; | std::map<ComponentTypeId, std::map<entity_id_t, IComponent*> > m_ComponentsByTypeId; | ||||
std::map<MessageTypeId, std::vector<ComponentTypeId> > m_LocalMessageSubscriptions; | std::map<MessageTypeId, std::vector<ComponentTypeId> > m_LocalMessageSubscriptions; | ||||
Show All 26 Lines |
Wildfire Games · Phabricator