void plNetTransport::DumpState() { plNetClientMgr* nc=plNetClientMgr::GetInstance(); hsLogEntry( nc->DebugMsg("-------------------\n") ); hsLogEntry( nc->DebugMsg("Num Channels=%d\n", fChannelGroups.size()) ); int i; for(i=0;i<fChannelGroups.size();i++) { plMembersList* mList = &fChannelGroups[i]; hsLogEntry( nc->DebugMsg("\tChannel %d, num mbrs=%d\n", i, mList->size()) ); int j; for(j=0; j<mList->size();j++) { plNetTransportMember * mbr = (*mList)[j]; hsLogEntry( nc->DebugMsg("\t\tMbr %s\n",(*mList)[j]->AsString().c_str()) ); } } nc->DebugMsg("Num Mbrs=%d\n", GetNumMembers()); for(i=0;i<GetNumMembers();i++) { plNetTransportMember * mbr = GetMember(i); hsLogEntry (nc->DebugMsg("\tMbr %d, name=%s, plyrID=%lu, subs=%d", i,mbr->AsString().c_str(),mbr->GetPlayerID(),mbr->GetNumSubscriptions()) ); int j; for(j=0;j<mbr->GetNumSubscriptions();j++) { hsLogEntry( nc->DebugMsg("\t\tSub %d, chan=%d\n", j, mbr->GetSubscription(j)) ); } } hsLogEntry( nc->DebugMsg("\n") ); }
void *CBlock::GetMemberData( int memberNum ) { if ( memberNum >= GetNumMembers() ) { return NULL; } return (void *) ((GetMember( memberNum ))->GetData()); }
CBlockMember *CBlock::GetMember( int memberNum ) { if ( memberNum >= GetNumMembers() ) { return NULL; } return m_members[ memberNum ]; }
CBlockMember *CBlock::GetMember( int memberNum ) { if ( memberNum > GetNumMembers()-1 ) { return false; } return m_members[ memberNum ]; }
void Channel::UserListLeaveNotify(Player* plr) { WorldPacket data(SMSG_USERLIST_REMOVE, 8+1+4+m_name.size()+1); data << plr->GetGUID(); data << uint8(m_flags); data << uint32(GetNumMembers()); data << m_name; SendToAll(&data); }
// // return array index or -1 // int plNetTransport::FindMember(const plKey avKey) const { int i; for( i=0 ;i<GetNumMembers() ;i++ ) { plNetTransportMember* mbr = GetMember(i); if (mbr->GetAvatarKey()==avKey) return i; } return -1; }
// // return array index or -1 // int plNetTransport::FindMember(uint32_t playerID) const { int i; for( i=0 ;i<GetNumMembers() ;i++ ) { plNetTransportMember* mbr = GetMember(i); if (mbr->GetPlayerID()==playerID) return i; } return -1; }
void Channel::UserListJoinNotify(Player* plr) { WorldPacket data(SMSG_USERLIST_ADD, 8+1+1+4+m_name.size()+1); if(!m_general) data.SetOpcode(SMSG_USERLIST_UPDATE); data << plr->GetGUID(); data << uint8(plr->GetChatTag()); data << uint8(m_flags); data << uint32(GetNumMembers()); data << m_name; SendToAll(&data); }
void plNetTransport::ClearMembers() { int i; for( i=0 ;i<GetNumMembers() ;i++ ) { plNetTransportMember* mbr = GetMember(i); hsAssert(mbr, "nil member?"); IUnSubscribeToAllChannelGrps(mbr); delete mbr; } // for fMembers.clear(); }
void plNetTalkList::UpdateTransportGroup(plNetClientMgr* nc) { if (fFlags & kDirty) { nc->fTransport.ClearChannelGrp(plNetClientMgr::kNetChanVoice); if (nc->IsPeerToPeer()) { int i; for(i=0;i<GetNumMembers();i++) { if (GetMember(i)->IsPeerToPeer()) nc->fTransport.SubscribeToChannelGrp(GetMember(i), plNetClientMgr::kNetChanVoice); } } fFlags &= ~kDirty; } }
int CBlock::Free( void ) { int numMembers = GetNumMembers(); CBlockMember *bMember; while ( numMembers-- ) { bMember = GetMember( numMembers ); if (!bMember) return false; delete bMember; } m_members.clear(); //List of all CBlockMembers owned by this list return true; }
int CBlock::Free( CIcarus* icarus ) { IGameInterface* game = icarus->GetGame(); int numMembers = GetNumMembers(); CBlockMember *bMember; while ( numMembers-- ) { bMember = GetMember( numMembers ); if (!bMember) return false; bMember->Free(game); } m_members.clear(); //List of all CBlockMembers owned by this list return true; }
void plNetListenList::AddMember(plNetTransportMember* e) { if (FindMember(e)==-1) { plStatusLog::AddLineS("voice.log", "Adding %s to listen list ", e->AsString().c_str()); fMembers.push_back(e); #if 0 // call the new member's win audible and set talk icon parameters plSoundMsg* pMsg = new plSoundMsg; plArmatureMod* pMod = plArmatureMod::ConvertNoRef(e->GetAvatarKey()->GetObjectPtr()); if (pMod) pMsg->AddReceiver(pMod->GetTarget(0)->GetKey()); pMsg->SetCmd(plSoundMsg::kSetTalkIcon); pMsg->fIndex = GetNumMembers(); pMsg->fNameStr = (uint32_t)e->GetName(); plgDispatch::MsgSend(pMsg); #endif } }
bool ElfArchiveFile::Load(const char* pName) { // Load the elf file Elf* elf; m_filedes = open(pName, O_RDONLY); if (m_filedes == -1) { printf("Could not open %s\n", pName); return false; } elf_version(EV_CURRENT); m_arf = elf_begin(m_filedes, ELF_C_READ, (Elf*)0); if (elf_kind(m_arf) != ELF_K_AR) { printf("Error - %s is not an archive (.a) file\n", pName); return false; } // Load the symbol table. We assume that each member has at // least one symbol. // We want a map from symbol to index; to do this, we need to know // the current index and last offset seen int iLastOffset = 0; int iOffset = 0; unsigned int uNumSyms; int iIndex = -1; // 0,1,2... for 1st,2nd,3rd... member Elf_Arsym* asym; asym = elf_getarsym(m_arf, &uNumSyms); uNumSyms--; if (asym == 0) { printf("Get archive symbol table failed\n"); return false; } for (unsigned u=0; u < uNumSyms; u++) { iOffset = asym[u].as_off; // Last entry is null, but should never see it if (iOffset == 0) break; if (iOffset != iLastOffset) { // This is a new member. Use a new index iIndex++; iLastOffset = iOffset; // Seek to that member if (elf_rand(m_arf, iOffset) == 0) { printf("Could not seek to offset %d\n", iOffset); return false; } if ((elf = elf_begin(m_filedes, ELF_C_READ, m_arf)) == 0) { printf("Could not begin member at offset %d\n", iOffset); return false; } Elf_Arhdr* ahdr; ahdr = elf_getarhdr(elf); if (ahdr == 0) { printf("Could not get header information " "for member at offset %d\n", iOffset); return false; } // Add the name to the map m_FileMap[ahdr->ar_name] = iIndex; // And to the vector of pointers to file names m_FileNames.push_back(ahdr->ar_name); // Also add the offset. These are supposed to be relatively // implementation independant m_Offsets.push_back(iOffset); } // Add an entry to the symbol->offset map m_SymMap[asym[u].as_name] = iIndex; } // Now we know the correct size for the vector of members. // Ugh - can't call constructor any more //m_Members.vector(GetNumMembers(), (BinaryFile*)0); m_Members.reserve(GetNumMembers()); return true; }