CLobbyApp::~CLobbyApp() { m_plas->LogEvent(EVENTLOG_INFORMATION_TYPE, LE_ShuttingDown); // KG guard with USEAUTH for consistency #ifdef USEAUTH m_pzas = NULL; #endif m_perfshare.FreeCounters(m_pCounters); ZGameInfoClose(); FreeStaticCoreInfo(); // KGJV #114 //imago, only if we have gameinfoservers to report to if (m_cReportServers) { ZGameInfoClose(); WSACleanup(); } }
CFLServer::~CFLServer() { DeleteMission(c_AllMissions); m_pcnxn->SetPrivateData(0); // disconnect two-way link between connection and this g_pLobbyApp->FreePerServerCounters(m_pCounters); // make sure all missions on this server are dead MissionList::Iterator iter(m_missions); while (!iter.End()) { delete iter.Value(); iter.Remove(); } // KGJV #114 FreeStaticCoreInfo(); }
void CLobbyApp::BuildStaticCoreInfo() { // build the master core list // then set coremask for each server // 1. get ride of the old list FreeStaticCoreInfo(); // 2. loop thru unpaused servers and build a TList of StaticCoreInfo and the coremask ListConnections::Iterator iterCnxn(*GetFMServers().GetConnections()); TList<StaticCoreInfo*,StaticCoreInfoEquals> CoreList; while (!iterCnxn.End()) { CFLServer * pServerT = CFLServer::FromConnection(*iterCnxn.Value()); if (pServerT) // skip lost/terminating server { pServerT->SetStaticCoreMask(0); // clear the core mask, not really needed here but it doesnt hurt int c = pServerT->GetcStaticCoreInfo(); if (!pServerT->GetPaused()) // skip paused serveR for (int i=0; i<c; i++) { if (!CoreList.Find(&(pServerT->GetvStaticCoreInfo()[i]))) CoreList.PushFront(&(pServerT->GetvStaticCoreInfo()[i])); } } iterCnxn.Next(); } // 3. Allocate mem m_cStaticCoreInfo = CoreList.GetCount(); if (m_cStaticCoreInfo) m_vStaticCoreInfo = new StaticCoreInfo[m_cStaticCoreInfo]; else return; // no core, all done // 4. transform the TList into an array for (int i = 0; i < m_cStaticCoreInfo; i++) Strcpy(m_vStaticCoreInfo[i].cbIGCFile,CoreList[i]->cbIGCFile); CoreList.SetEmpty(); // 5. loop thru unpaused servers and build the coremask ListConnections::Iterator iterCnxn2(*GetFMServers().GetConnections()); while (!iterCnxn2.End()) { CFLServer * pServerT = CFLServer::FromConnection(*iterCnxn2.Value()); if (pServerT) // skip lost/terminating server { int c = pServerT->GetcStaticCoreInfo(); pServerT->SetStaticCoreMask(0); // clear the core mask if (!pServerT->GetPaused()) // skip paused server for (int i=0; i<c; i++) { for (int j = 0; j < m_cStaticCoreInfo; j++) if (strcmp(pServerT->GetvStaticCoreInfo()[i].cbIGCFile,m_vStaticCoreInfo[j].cbIGCFile) == 0) pServerT->SetStaticCoreMask(pServerT->GetStaticCoreMask() | 1<<j); } } iterCnxn2.Next(); } }