00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #ifndef GROUP_H_
00009 #define GROUP_H_
00010 
00011 
00012 #include <boost/lexical_cast.hpp>
00013 
00014 #include <identity.h>
00015 #include <ent.h>
00016 #include <string>
00017 
00018 #include <enums.h>
00019 
00020 namespace FastEcslent {
00021 
00022         class GroupAspect;
00023         class Engine;
00024 
00025 
00026         class Group {
00027 
00028         private:
00029                 std::string createGroupName(Identity gid);
00030 
00031         public:
00032                 Engine *engine;
00033                 Entity* members[MaxEnts];
00034                 std::string   groupName;
00035                 
00036                 int     leaderIndex;
00037                 int nEntitiesInGroup;
00038                 Identity gid; 
00039                 std::deque<GroupAspect*> aspects;
00040 
00041 
00042                 
00043 
00044                 Group(Engine*eng, Identity id);
00045                 Group(Engine*eng, Entity** ents, int nEntsInGroup, Identity id);
00046                 Group(Engine*eng, Entity** ents, int nEntsInGroup, std::string name, Identity id);
00047                 void reset(Engine*eng);
00048 
00049                 void setName(std::string name);
00050                 void setMembers(Entity** ents, int nEntsInGroup);
00051                 void addMember(Entity *ent);
00052                 bool isMember(Entity *ent);
00053 
00054                 void setLeaderByIndex(int i) { assert(i >= 0 && i < nEntitiesInGroup); leaderIndex = i; };
00055                 Entity*   getLeaderByIndex() { return members[leaderIndex];};
00056 
00057                 void print();
00058 
00059                 void resetAspect(GroupAspectType gat, GroupAspect *gasp);
00060                 void addAspect(GroupAspect *gasp);
00061                 int  findAspect(GroupAspectType gat);
00062                 GroupAspect* getAspect(GroupAspectType index);
00063 
00064                 void init();
00065                 void tick(double dt);
00066 
00067 
00068         };
00069 
00070 
00071 }
00072 
00073 
00074 #endif