📄 party.cpp
字号:
hash_map<int, Party*>::iterator before = m_PartyMap.end(); hash_map<int, Party*>::iterator current = m_PartyMap.begin(); while (current != m_PartyMap.end()) { Party* pParty = current->second; Assert(pParty != NULL); if (pParty->getSize() == 0) { //cout << "肺拿颇萍狼 荤捞令啊 0捞 登绢辑, 颇萍 按眉[" << pParty->getID() << "]甫 昏力钦聪促." << endl; SAFE_DELETE(pParty); m_PartyMap.erase(current); if (before == m_PartyMap.end()) // first element { current = m_PartyMap.begin(); } else // !first element { current = before; current ++; } } else { before = current ++; } } __LEAVE_CRITICAL_SECTION(m_Mutex); __END_CATCH}int LocalPartyManager::getAdjacentMemberSize(int PartyID, Creature* pLeader) const throw(){ __BEGIN_TRY int size = 0; __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return 0; } Party* pParty = itr->second; Assert(pParty != NULL); size = pParty->getAdjacentMemberSize(pLeader); __LEAVE_CRITICAL_SECTION(m_Mutex); return size; __END_CATCH}int LocalPartyManager::shareAttrExp(int PartyID, Creature* pLeader, int amount, int STRMultiplier, int DEXMultiplier, int INTMultiplier, ModifyInfo& LeaderModifyInfo) const throw(){ __BEGIN_TRY int rvalue = 0; __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return 0; } Party* pParty = itr->second; Assert(pParty != NULL); rvalue = pParty->shareAttrExp(pLeader, amount, STRMultiplier, DEXMultiplier, INTMultiplier, LeaderModifyInfo); __LEAVE_CRITICAL_SECTION(m_Mutex); return rvalue; __END_CATCH}int LocalPartyManager::shareVampireExp(int PartyID, Creature* pLeader, int amount, ModifyInfo& LeaderModifyInfo) const throw(){ __BEGIN_TRY int rvalue = 0; __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return 0; } Party* pParty = itr->second; Assert(pParty != NULL); rvalue = pParty->shareVampireExp(pLeader, amount, LeaderModifyInfo); __LEAVE_CRITICAL_SECTION(m_Mutex); return rvalue; __END_CATCH}int LocalPartyManager::shareOustersExp(int PartyID, Creature* pLeader, int amount, ModifyInfo& LeaderModifyInfo) const throw(){ __BEGIN_TRY int rvalue = 0; __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return 0; } Party* pParty = itr->second; Assert(pParty != NULL); rvalue = pParty->shareOustersExp(pLeader, amount, LeaderModifyInfo); __LEAVE_CRITICAL_SECTION(m_Mutex); return rvalue; __END_CATCH}int LocalPartyManager::shareRankExp(int PartyID, Creature* pLeader, int amount) const throw(){ __BEGIN_TRY //int rvalue = 0; __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return 0; } Party* pParty = itr->second; Assert(pParty != NULL); pParty->shareRankExp(pLeader, amount); __LEAVE_CRITICAL_SECTION(m_Mutex); return 0; __END_CATCH}void LocalPartyManager::shareRevealer(int PartyID, Creature* pCaster, int Duration) throw (Error){ __BEGIN_TRY __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return; } Party* pParty = itr->second; Assert(pParty != NULL); pParty->shareRevealer(pCaster, Duration); __LEAVE_CRITICAL_SECTION(m_Mutex); __END_CATCH}void LocalPartyManager::shareDetectHidden(int PartyID, Creature* pCaster, int Duration) throw (Error){ __BEGIN_TRY __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return; } Party* pParty = itr->second; Assert(pParty != NULL); pParty->shareDetectHidden(pCaster, Duration); __LEAVE_CRITICAL_SECTION(m_Mutex); __END_CATCH}void LocalPartyManager::shareDetectInvisibility(int PartyID, Creature* pCaster, int Duration) throw (Error){ __BEGIN_TRY __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return; } Party* pParty = itr->second; Assert(pParty != NULL); pParty->shareDetectInvisibility(pCaster, Duration); __LEAVE_CRITICAL_SECTION(m_Mutex); __END_CATCH}void LocalPartyManager::shareExpansion(int PartyID, Creature* pCaster, int Duration, int percent) throw (Error){ __BEGIN_TRY __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return; } Party* pParty = itr->second; Assert(pParty != NULL); pParty->shareExpansion(pCaster, Duration, percent); __LEAVE_CRITICAL_SECTION(m_Mutex); __END_CATCH}void LocalPartyManager::shareActivation(int PartyID, Creature* pCaster, int Duration) throw (Error){ __BEGIN_TRY __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return; } Party* pParty = itr->second; Assert(pParty != NULL); pParty->shareActivation(pCaster, Duration); __LEAVE_CRITICAL_SECTION(m_Mutex); __END_CATCH}void LocalPartyManager::shareGnomesWhisper(int PartyID, Creature* pCaster, int Duration, int SkillLevel) throw (Error){ __BEGIN_TRY __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return; } Party* pParty = itr->second; Assert(pParty != NULL); pParty->shareGnomesWhisper(pCaster, Duration, SkillLevel); __LEAVE_CRITICAL_SECTION(m_Mutex); __END_CATCH}void LocalPartyManager::shareHolyArmor(int PartyID, Creature* pCaster, int DefBonus, int SkillLevel) throw (Error){ __BEGIN_TRY __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return; } Party* pParty = itr->second; Assert(pParty != NULL); pParty->shareHolyArmor(pCaster, DefBonus, SkillLevel); __LEAVE_CRITICAL_SECTION(m_Mutex); __END_CATCH}bool LocalPartyManager::shareWaterElementalHeal(int PartyID, Creature* pCaster, int HealPoint) throw (Error){ __BEGIN_TRY bool ret = false; __ENTER_CRITICAL_SECTION(m_Mutex); // 秦寸窍绰 颇萍啊 乐绰瘤 茫酒夯促. hash_map<int, Party*>::const_iterator itr = m_PartyMap.find(PartyID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return false; } Party* pParty = itr->second; Assert(pParty != NULL); ret = pParty->shareWaterElementalHeal(pCaster, HealPoint); __LEAVE_CRITICAL_SECTION(m_Mutex); return ret; __END_CATCH}string LocalPartyManager::toString(void) const throw(){ __BEGIN_TRY StringStream msg; msg << "LocalPartyManager("; __ENTER_CRITICAL_SECTION(m_Mutex); hash_map<int, Party*>::const_iterator itr = m_PartyMap.begin(); for (; itr != m_PartyMap.end(); itr++) { Party* pParty = itr->second; Assert(pParty != NULL); msg << pParty->toString() << ","; } __LEAVE_CRITICAL_SECTION(m_Mutex); msg << ")"; return msg.toString(); __END_CATCH}////////////////////////////////////////////////////////////////////////////////// class GlobalPartyManager member methods////////////////////////////////////////////////////////////////////////////////GlobalPartyManager::GlobalPartyManager() throw(){ __BEGIN_TRY m_PartyIDRegistry = 0; m_Mutex.setName("GlobalPartyManager"); __END_CATCH}GlobalPartyManager::~GlobalPartyManager() throw(){ __BEGIN_TRY __END_CATCH}bool GlobalPartyManager::canAddMember(int ID) throw (NoSuchElementException, Error){ __BEGIN_TRY __ENTER_CRITICAL_SECTION(m_Mutex) hash_map<int, Party*>::iterator itr = m_PartyMap.find(ID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); return false; } Party* pParty = itr->second; if (pParty->getSize() >= PARTY_MAX_SIZE) { m_Mutex.unlock(); return false; } __LEAVE_CRITICAL_SECTION(m_Mutex) return true; __END_CATCH}bool GlobalPartyManager::addPartyMember(int ID, Creature* pCreature) throw (NoSuchElementException, DuplicatedException, Error){ __BEGIN_TRY __ENTER_CRITICAL_SECTION(m_Mutex) //cout << "GlobalPartyManager::addPartyMember() : BEGIN" << endl; // 刚历 秦寸颇萍甫 茫酒辑 乔萍盔狼 箭磊甫 犬牢茄促. hash_map<int, Party*>::iterator itr = m_PartyMap.find(ID); if (itr == m_PartyMap.end()) { m_Mutex.unlock(); //cerr << "GlobalPartyManager::addPartyMember() : NoSuchElementException" << endl; //throw NoSuchElementException("GlobalPartyManager::addPartyMember() : NoSuchElementException"); // NoSuch力芭. by sigi. 2002.5.13 return false; } Party* pParty = itr->second; if (pParty->getSize() >= PARTY_MAX_SIZE) { m_Mutex.unlock(); //cout << "颇萍 钙胶 荤捞令甫 檬苞" << endl; //cout << "GlobalPartyManager::addPartyMember() : END" << endl; return false; } // 颇萍盔阑 眠啊茄促. pParty->addMember(pCreature); pCreature->setPartyID(pParty->getID()); // 促弗 糕滚甸俊霸 颇萍盔捞 眠啊登菌促绰 荤角阑 舅妨霖促. // 弥檬俊 2疙捞 颇萍甫 备己且 版快, 1疙阑 歹茄 促澜俊 弊 荤恩俊霸 // 茄疙 捞抚父捞 甸绢啊 乐绰 颇萍 府胶飘啊 朝酒啊霸 等促. // 弊 促澜 2锅掳 糕滚啊 甸绢啊搁 2疙俊霸 2疙捞 甸绢啊 乐绰 府胶飘啊 // 瞒肥肺 朝酒啊霸 等促. // 弊矾骨肺 颇萍盔捞 1疙老 锭绰 焊郴瘤 臼酒具, 颇萍 府胶飘啊 2锅 // 朝酒啊绰 巴阑 规瘤且 荐 乐促. if (pParty->getSize() != 1) { GCPartyJoined gcPartyJoined; pParty->makeGCPartyJoined(&gcPartyJoined); pParty->broadcastPacket(&gcPartyJoined); hash_map<string, Creature*> memberMap = pParty->getMemberMap(); hash_map<string, Creature*>::iterator itr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -