void MMatchClanMap::AddObject(const MUID& uid, MMatchObject* pObj) { if (! IsEnabledObject(pObj)) return; int nCLID = pObj->GetCharInfo()->m_ClanInfo.m_nClanID; if (nCLID == 0) return; // 임시코드... AddObject()하는 어느곳에서 잘못된 값을 가져와서 서버 크래쉬 유발시키기 때문에 일단 여기서 막음 // 또한 AddObject()하는곳에서 log를 남겨 배포후 원인을 잡는 과정이 있을거임...20090224 by kammir if (nCLID <= -1) return; // nCLID는 정수형 if (nCLID >= 9000000) return; // 현재(20090224) 한국 최고 클랜ID가 "1399559"이다.(DB에서는 1씩증가시킴) // 클랜이 없으면 새로 생성 iterator itor = find(nCLID); if (itor == end()) { CreateClan(nCLID, pObj->GetCharInfo()->m_ClanInfo.m_szClanName); } itor = find(nCLID); if (itor != end()) { MMatchClan* pClan = (*itor).second; pClan->AddObject(uid, pObj); } }
void MMatchClanMap::CreateClan(int nCLID, const char* szClanName) { MMatchClan* pNewClan = new MMatchClan; pNewClan->Create(nCLID, szClanName); insert(value_type(nCLID, pNewClan)); m_ClanNameMap.insert(map<std::string, MMatchClan*>::value_type(string(szClanName), pNewClan)); }
void MMatchClanMap::RemoveObject(const MUID& uid, MMatchObject* pObj) { if (! IsEnabledObject(pObj)) return; int nCLID = pObj->GetCharInfo()->m_ClanInfo.m_nClanID; if (nCLID == 0) return; iterator itor = find(nCLID); if (itor != end()) { MMatchClan* pClan = (*itor).second; pClan->RemoveObject(uid); } }
void MMatchObjectCacheBuilder::AddObject(MMatchObject* pObj) { MMatchObjCache* pCache = new MMatchObjCache; int nItemID=0; MMatchItemDesc* pItemDesc = NULL; MMatchCharInfo* pCharInfo = pObj->GetCharInfo(); // _ASSERT(pCharInfo); if (pCharInfo == NULL) { delete pCache; return; } MMatchObjectDuelTournamentCharInfo* pDTCharInfo = pObj->GetDuelTournamentCharInfo(); int nDTLastWeekGrade = pDTCharInfo ? pDTCharInfo->GetLastWeekGrade() : 0; pCache->SetInfo(pObj->GetUID(), pObj->GetName(), pCharInfo->m_ClanInfo.m_szClanName, pCharInfo->m_nLevel, pObj->GetAccountInfo()->m_nUGrade, pObj->GetAccountInfo()->m_nPGrade , pCharInfo->m_nRank, pCharInfo->m_nTotalKillCount, pCharInfo->m_nTotalDeathCount, nDTLastWeekGrade ); pCache->SetCLID(pObj->GetCharInfo()->m_ClanInfo.m_nClanID); MMatchClan* pClan = MMatchServer::GetInstance()->GetClanMap()->GetClan(pObj->GetCharInfo()->m_ClanInfo.m_nClanID); if (pClan) pCache->SetEmblemChecksum(pClan->GetEmblemChecksum()); else pCache->SetEmblemChecksum(0); pCache->GetCostume()->nSex = pObj->GetCharInfo()->m_nSex; pCache->GetCostume()->nHair = pObj->GetCharInfo()->m_nHair; pCache->GetCostume()->nFace = pObj->GetCharInfo()->m_nFace; for (int i=0; i < MMCIP_END; i++) { if (!pObj->GetCharInfo()->m_EquipedItem.IsEmpty(MMatchCharItemParts(i))) { pCache->GetCostume()->nEquipedItemID[i] = pObj->GetCharInfo()->m_EquipedItem.GetItem(MMatchCharItemParts(i))->GetDescID(); } else { pCache->GetCostume()->nEquipedItemID[i] = 0; } } pCache->SetFlags(pObj->GetPlayerFlags()); m_ObjectCacheList.push_back(pCache); }
void MMatchClanMap::Tick(u64 nClock) { if (!CheckTick(nClock)) return; // Update Clans for(MMatchClanMap::iterator iClan=begin(); iClan!=end();) { MMatchClan* pClan = (*iClan).second; pClan->Tick(nClock); if (pClan->CheckLifePeriod() == false) { DestroyClan(pClan->GetCLID(), &iClan); continue; } else { ++iClan; } } }
void MMatchClanMap::AddObject(const MUID& uid, MMatchObject* pObj) { if (! IsEnabledObject(pObj)) return; int nCLID = pObj->GetCharInfo()->m_ClanInfo.m_nClanID; if (nCLID == 0) return; // 클랜이 없으면 새로 생성 iterator itor = find(nCLID); if (itor == end()) { CreateClan(nCLID, pObj->GetCharInfo()->m_ClanInfo.m_szClanName); } itor = find(nCLID); if (itor != end()) { MMatchClan* pClan = (*itor).second; pClan->AddObject(uid, pObj); } }
void MMatchClanMap::DestroyClan(int nCLID, MMatchClanMap::iterator* pNextItor) { iterator itor = find(nCLID); if (itor != end()) { MMatchClan* pClan = (*itor).second; map<std::string, MMatchClan*>::iterator itorClanNameMap = m_ClanNameMap.find(string(pClan->GetName())); if (itorClanNameMap != m_ClanNameMap.end()) { m_ClanNameMap.erase(itorClanNameMap); } delete pClan; MMatchClanMap::iterator itorTemp = erase(itor); if (pNextItor) *pNextItor = itorTemp; } }