#pragma once #include "namelist.h" #include "node.h" #include "chain.h" #include "network.h" class Entity; //########################################################################## //######################### EntityGroup ############################## //########################################################################## class EntityGroup : public Node { friend class EntityManager; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Construction and Destruction // protected: EntityGroup(); ~EntityGroup(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Naming functions // public: const char* GetGroupName() { Check(this); return groupName; } protected: const char *groupName; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Grouping functions // public: void Add(Entity *entity) { Check(this); groupMembers.Add(Cast_Object(Node*,entity)); } void Add(EntityGroup *group) { Check(this); Check(group); groupMembers.Add(group); } ChainOf groupMembers; }; //########################################################################## //######################## EntityManager ############################# //########################################################################## class EntityManager : public NetworkClient { friend class Entity; //########################################################################## // Shared Data support // protected: static Derivation *GetClassDerivations(); static SharedData DefaultData; //########################################################################## // Construction and destruction support // public: EntityManager(); ~EntityManager(); void FryDeathRow(); protected: EntityGroup *deathRow; //########################################################################## // Message packet receiving // public: void ReceiveNetworkPacket(NetworkPacket *packet, Receiver::Message *packet_message); //########################################################################## // Entity grouping // public: EntityGroup* UseGroup(const char *name); EntityGroup* FindGroup(const char *name) { Check_Pointer(name); return (EntityGroup*)groupList.FindObject(name); } void RemoveGroup(EntityGroup* group); Logical TestInstance() const; protected: ObjectNameList groupList; };