MLadderMgr.h
00001 #pragma once 00002 00003 #include "MMatchGlobal.h" 00004 #include "MLadderGroup.h" 00005 #include "MLadderStatistics.h" 00006 #include <vector> 00007 00008 class MMatchObject; 00009 00010 00011 class MLadderMgr { 00012 protected: 00013 int m_idGenerate; 00014 unsigned long m_nLastTick; 00015 00016 MLadderGroupMap m_WaitingMaps[MLADDERTYPE_MAX]; 00017 list<MLadderGroup*> m_GroupList; 00018 00019 MLadderStatistics m_Stat; 00020 protected: 00021 unsigned long GetLastTick() { return m_nLastTick; } 00022 void SetLastTick(unsigned long nTick) { m_nLastTick = nTick; } 00023 00024 inline MLadderGroupMap* GetWaitGroupContainer(MLADDERTYPE nLadderType); 00025 00026 void AddGroup(MLADDERTYPE nLadderType, MLadderGroup* pGroup); 00027 int MakeMatch(MLADDERTYPE nLadderType); 00028 void LaunchLadder(MLADDERTYPE nLadderType, int nGroupA, int nGroupB); 00029 void RemoveFromGroupList(MLadderGroup* pGroup); 00030 void CleaningGarbages(); 00031 unsigned long int GetTickInterval(); 00032 public: 00033 MLadderMgr() { 00034 m_idGenerate = 0; 00035 } 00036 bool Init(); 00037 MLadderGroup* CreateLadderGroup(); 00038 MLadderGroup* FindLadderGroup(int nGroupID); 00039 bool Challenge(MLadderGroup* pGroup); 00040 void CancelChallenge(int nGroupID, const char* pszCancelName); 00041 00042 void Tick(unsigned long nTick); 00043 int GenerateID() { return ++m_idGenerate; } 00044 int GetNeedMemberCount(MLADDERTYPE nLadderType); 00045 int GetTotalGroupCount(); 00046 unsigned long GetChecksum(int nFirstIndex, int nGroupCount); 00047 00048 void DebugTest(); 00049 00050 list<MLadderGroup*>::iterator GetGroupListBegin() { return m_GroupList.begin(); } 00051 list<MLadderGroup*>::iterator GetGroupListEnd() { return m_GroupList.end(); } 00052 size_t GetGroupCount() { return m_GroupList.size(); } 00053 00054 MLadderStatistics* GetStatistics() { return &m_Stat; } 00055 }; 00056 00057 00058 00059
MAIET entertainment