CSCommon: MMatchObjCache.h 소스 파일

MAIET

MMatchObjCache.h

00001 #ifndef MMATCHOBJCACHE_H
00002 #define MMATCHOBJCACHE_H
00003 
00004 #include "MMatchGlobal.h"
00005 #include <list>
00006 #include <map>
00007 using namespace std;
00008 
00009 #include "MMatchObject.h"
00010 #include "MUID.h"
00011 
00012 
00013 class MCommand;
00014 class MCommandCommunicator;
00015 class MMatchObject;
00016 
00017 
00018 struct MMatchObjCacheCostume
00019 {
00020     MMatchSex           nSex;
00021     unsigned char       nHair;
00022     unsigned char       nFace;
00023     unsigned long int   nEquipedItemID[MMCIP_END];
00024 };
00025 
00026 class MMatchObjCache {
00027 protected:
00028     MUID                    m_uidObject;
00029     char                    m_szName[32];
00030     char                    m_szClanName[CLAN_NAME_LENGTH];
00031     char                    m_nLevel;
00032     MMatchUserGradeID       m_nUGrade;
00033     unsigned char           m_nPlayerFlags;     // 플레이어 속성(운영자숨김등) - MTD_PlayerFlags 사용
00034     unsigned int            m_nCLID;            // ClanID
00035     unsigned int            m_nEmblemChecksum;  // Emblem Checksum
00036     MMatchObjCacheCostume   m_Costume;
00037     
00038 public:
00039     MMatchObjCache()                { 
00040         m_szName[0] = NULL;
00041         m_nLevel = 0;
00042         m_nUGrade = MMUG_FREE;
00043         memset(&m_Costume, 0, sizeof(MMatchObjCacheCostume));
00044         ResetFlag();
00045     }
00046     virtual ~MMatchObjCache()       {}
00047 
00048     MUID GetUID()                   { return m_uidObject; }
00049 
00050     char* GetName()         { return m_szName; }
00051     char* GetClanName()     { return m_szClanName; }
00052     int GetLevel()                  { return m_nLevel; }
00053     MMatchUserGradeID GetUGrade()   { return m_nUGrade; }
00054     
00055     void SetInfo(const MUID& uid, const char* szName, const char* szClanName, int nLevel, MMatchUserGradeID nUGrade)
00056     {
00057         m_uidObject = uid;
00058         strcpy(m_szName, szName);
00059         strcpy(m_szClanName, szClanName);
00060         m_nLevel = (char)nLevel;
00061         m_nUGrade = nUGrade;
00062         m_nPlayerFlags = 0;
00063     }
00064 
00065     unsigned char GetFlags()                { return m_nPlayerFlags; }
00066     void SetFlags(unsigned char nFlags)     { m_nPlayerFlags = nFlags; }
00067     bool CheckFlag(unsigned char nFlagIdx)  { return (m_nPlayerFlags & nFlagIdx) ? true:false; }
00068     void ResetFlag()                        { m_nPlayerFlags = 0; }
00069     void SetFlag(unsigned char nFlagIdx, bool bSet) 
00070     { 
00071         if (bSet) m_nPlayerFlags |= nFlagIdx; 
00072         else m_nPlayerFlags &= (0xff ^ nFlagIdx);
00073     }
00074     unsigned int GetCLID()                  { return m_nCLID; }
00075     void SetCLID(unsigned int nCLID)        { m_nCLID = nCLID; }
00076     unsigned int GetEmblemChecksum()        { return m_nEmblemChecksum; }
00077     void SetEmblemChecksum(unsigned int nChecksum)  { m_nEmblemChecksum = nChecksum; }
00078 
00079     void AssignCostume(MMatchObjCacheCostume* pCostume) { memcpy(&m_Costume, pCostume, sizeof(MMatchObjCacheCostume)); }
00080     MMatchObjCacheCostume* GetCostume() { return &m_Costume; }
00081 };
00082 
00083 class MMatchObjCacheList : public list<MMatchObjCache*>{};
00084 class MMatchObjCacheMap : public map<MUID, MMatchObjCache*>{
00085 public:
00086     void Insert(const MUID& uid, MMatchObjCache* pCache)    {   
00087         insert(value_type(uid, pCache));    
00088     }
00089 };
00090 
00091 
00092 enum MATCHCACHEMODE {
00093     MATCHCACHEMODE_ADD,
00094     MATCHCACHEMODE_REMOVE,
00095     MATCHCACHEMODE_UPDATE,      // 모두 업데이트
00096     MATCHCACHEMODE_REPLACE      // 새로운 내용으로 교체
00097 };
00098 
00099 class MMatchObjectCacheBuilder {
00100     MMatchObjCacheList  m_ObjectCacheList;
00101 
00102 public:
00103     MMatchObjectCacheBuilder();
00104     virtual ~MMatchObjectCacheBuilder();
00105 
00106     void AddObject(MMatchObject* pObj);
00107     void Reset();
00108     MCommand* GetResultCmd(MATCHCACHEMODE nType, MCommandCommunicator* pCmdComm);
00109 };
00110 
00111 
00112 #endif


MAIET entertainment