CSCommon: MMatchQuestMonsterGroup.h 소스 파일

MAIET

MMatchQuestMonsterGroup.h

00001 
00002 #ifndef _MMatchQuestMonsterGroupDesc_h
00003 #define _MMatchQuestMonsterGroupDesc_h
00004 
00005 #include <list>
00006 #include <map>
00007 #include <string>
00008 #include <algorithm>
00009 
00010 using namespace std;
00011 
00012 class MNPCList : public list<string> {};
00013 
00014 class MNPCGroup {
00015 public:
00016     MNPCList    m_NpcList;
00017 protected:
00018     int         m_nID;
00019     string      m_Name;
00020 public:
00021     MNPCGroup() { }
00022     virtual ~MNPCGroup() { }
00023     void SetID(int nID) { m_nID = nID; }
00024     int  GetID() { return m_nID; }
00025 
00026     const char* GetName()   { return m_Name.c_str(); }
00027     void SetName(const char* Name) { m_Name = Name; }
00028 
00029     void AddNpc(string NPCName) {
00030         m_NpcList.push_back(NPCName);
00031     }
00032 
00033     bool CheckNpcName(string NPCName) {
00034         for (MNPCList::iterator i=m_NpcList.begin(); i!=m_NpcList.end(); i++) {
00035             if (stricmp((*i).c_str(), NPCName.c_str()) == 0)
00036                 return true;
00037         }
00038         return false;
00039     }
00040 };
00041 
00042 class MXmlElement;
00043 class MZFileSystem;
00044 
00045 class MNPCGroupMgr : public map<string, MNPCGroup*>
00046 {
00047 public:
00048     MNPCGroupMgr();
00049     virtual ~MNPCGroupMgr();
00050 
00051     static MNPCGroupMgr* GetInstance();
00052     void Clear();   
00053 
00054     MNPCGroup* GetGroup(const string& strName);
00055     MNPCGroup* GetGroup(int nGroupID);
00056 
00057     bool ReadXml(const char* szFileName);
00058     bool ReadXml(MZFileSystem* pFileSystem, const char* szFileName);
00059 
00060 protected:
00061     void ParseRule(MXmlElement* element);
00062 };
00063 
00064 inline MNPCGroupMgr* MGetNPCGroupMgr() { return MNPCGroupMgr::GetInstance(); }
00065 
00066 #endif//_MMatchQuestMonsterGroupDesc_h


MAIET entertainment