void CChoiceTypeInfo::Assign(TObjectPtr dst, TConstObjectPtr src, ESerialRecursionMode how) const { TMemberIndex index; index = GetVariants().FirstIndex(); const CVariantInfo* variantInfo = GetVariantInfo(index); if (variantInfo->GetId().IsAttlist()) { const CMemberInfo* info = dynamic_cast<const CMemberInfo*>(GetVariants().GetItemInfo(index)); info->GetTypeInfo()->Assign(GetMember(info, dst), GetMember(info, src),how); } index = GetIndex(src); if ( index == kEmptyChoice ) ResetIndex(dst); else { _ASSERT(index >= GetVariants().FirstIndex() && index <= GetVariants().LastIndex()); SetIndex(dst, index); GetVariantInfo(index)->GetTypeInfo()->Assign(GetData(dst, index), GetData(src, index), how); } // User defined assignment CallUserOp_Assign(dst, src); }
SPGREchoSequence::SPGREchoSequence(const rapidjson::Value &json) { if (json.IsNull()) QI::Fail("Could not read sequence: {}", name()); TR = GetMember(json, "TR").GetDouble(); TE = GetMember(json, "TE").GetDouble(); FA = ArrayFromJSON(json, "FA", M_PI / 180); }
void CChoiceTypeInfoFunctions::AssignDefault(TTypeInfo typeInfo, TObjectPtr dst, TConstObjectPtr src, ESerialRecursionMode how) { const CChoiceTypeInfo* choiceType = static_cast<const CChoiceTypeInfo*>(typeInfo); TMemberIndex index; index = choiceType->GetVariants().FirstIndex(); const CVariantInfo* variantInfo = choiceType->GetVariantInfo(index); if (variantInfo->GetId().IsAttlist()) { const CMemberInfo* info = static_cast<const CMemberInfo*>(choiceType->GetVariants().GetItemInfo(index)); info->GetTypeInfo()->Assign(GetMember(info, dst), GetMember(info, src),how); } index = choiceType->GetIndex(src); if ( index == kEmptyChoice ) choiceType->ResetIndex(dst); else { _ASSERT(index >= choiceType->GetVariants().FirstIndex() && index <= choiceType->GetVariants().LastIndex()); choiceType->SetIndex(dst, index); choiceType->GetVariantInfo(index)->GetTypeInfo()->Assign(choiceType->GetData(dst, index), choiceType->GetData(src, index), how); } choiceType->CallUserOp_Assign(dst, src); }
/* * Regularly spaced sequence */ MultiEchoSequence::MultiEchoSequence(const rapidjson::Value &json) { if (json.IsNull()) QI::Fail("Could not read sequence: {}", name()); TR = GetMember(json, "TR").GetDouble(); TE1 = GetMember(json, "TE1").GetDouble(); ESP = GetMember(json, "ESP").GetDouble(); ETL = GetMember(json, "ETL").GetInt(); TE = Eigen::ArrayXd::LinSpaced(ETL, TE1, TE1 + ESP * (ETL - 1)); }
void Port::Draw(wxDC& dc) const { Shape::Draw(dc); wxColor fill = m_parent->GetMember(wxT("Fill_color"))->GetColor(); dc.SetPen(*wxBLACK_PEN); dc.SetBrush(wxBrush(fill)); dc.DrawRectangle(m_bbox); dc.SetFont(Node::GetFont()); dc.SetTextForeground(Util::TextColorFromBG(fill)); wxString name = GetMember(wxT("Name"))->GetString(); wxRect text(dc.GetTextExtent(name)); text = text.CentreIn(m_bbox); dc.DrawText(name, text.GetX(), text.GetY()); wxColor color; switch (GetStatus()) { case Ok: color.Set(0, 255, 0); break; case Disconnected: color.Set(255, 255, 0); break; case Required: case TypeMismatch: color.Set(255, 0, 0); break; } wxPoint pos = GetConnPoint(); wxPoint points[3] = { wxPoint(pos.x - 3, pos.y - 4), wxPoint(pos.x + 4, pos.y), wxPoint(pos.x - 3, pos.y + 4) }; dc.SetBrush(wxBrush(color)); dc.DrawPolygon(3, points); }
VOID CTeamOrGroup::UpdateMemberInfo(TeamMemberInfo* member, GUID_t guid) { TeamMemberInfo* pTMInfo; pTMInfo = GetMember(guid); if( pTMInfo == NULL ) { Assert(FALSE); return; } switch(m_Type) { case TEAM_TYPE: { // 队伍情况 } break; case GROUP_TYPE: { // 团队情况 } break; default: Assert(FALSE); return; } }
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 > m_numMembers-1 ) return NULL; return (void *) ((GetMember( memberNum ))->GetData()); }
BinaryFile* ArchiveFile::GetMemberByProcName(const string& sSym) { // Get the index int idx = m_SymMap[sSym]; // Look it up return GetMember(idx); }
bool CItemStone::WeDeclareWar(CItemStone * pEnemyStone) { ADDTOCALLSTACK("CItemStone::WeDeclareWar"); if (!pEnemyStone) return false; // See if they've already declared war on us CStoneMember * pMember = GetMember(pEnemyStone); if ( pMember ) { if ( pMember->GetWeDeclared()) return true; } else // They haven't, make a record of this { pMember = new CStoneMember( this, pEnemyStone->GetUID(), STONEPRIV_ENEMY ); } pMember->SetWeDeclared(true); // Now inform the other stone // See if they have already declared war on us CStoneMember * pEnemyMember = pEnemyStone->GetMember(this); if (!pEnemyMember) // Not yet it seems pEnemyMember = new CStoneMember( pEnemyStone, GetUID(), STONEPRIV_ENEMY ); pEnemyMember->SetTheyDeclared(true); return( true ); }
BinaryFile* ArchiveFile::GetMemberByFileName(const string& sFile) { // Get the index int idx = m_FileMap[sFile]; // Look it up return GetMember(idx); }
VOID CTeamOrGroup::ExchangeMemberPosition(GUID_t guid1, GUID_t guid2, BYTE TeamIndex1, BYTE TeamIndex2) { TeamMemberInfo *pTMInfo1, *pTMInfo2; pTMInfo1 = GetMember(guid1); if ( pTMInfo1 == NULL ) { Assert(FALSE); return; } pTMInfo2 = GetMember(guid2); if ( pTMInfo2 == NULL ) { Assert(FALSE); return; } switch(m_Type) { case TEAM_TYPE: { // 队伍情况 for( UINT i = 0; i < m_TeamMembers.size(); ++i ) { if ( m_TeamMembers[i]->m_GUID == pTMInfo1->m_GUID ) { m_TeamMembers[i] = pTMInfo2; continue; } if ( m_TeamMembers[i]->m_GUID == pTMInfo2->m_GUID ) { m_TeamMembers[i] = pTMInfo1; continue; } } } break; case GROUP_TYPE: { // 团队情况(暂时不考虑) } break; default: Assert(FALSE); return; } }
int CCampus::GetMemberLv( u_long idPlayer ) { CCampusMember* pMember = GetMember( idPlayer ); if( pMember ) return pMember->GetLevel(); return 0; }
bool CItemStone::IsPrivMember( const CChar * pChar ) const { ADDTOCALLSTACK("CItemStone::IsPrivMember"); const CStoneMember * pMember = GetMember(pChar); if ( pMember == NULL ) return( false ); return( pMember->IsPrivMember()); }
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; } }
BOOL CCampus::IsMember( u_long idPlayer ) { CCampusMember* pCM = GetMember( idPlayer ); if( pCM ) return TRUE; return FALSE; }
void *CBlock::GetMemberData( int memberNum ) { if ( memberNum >= GetNumMembers() ) { return NULL; } return (void *) ((GetMember( memberNum ))->GetData()); }
void BnxChannel::UpdateMember(const std::string &strNick, const std::string &strNewNick) { MemberIterator memberItr = GetMember(strNick); if (memberItr != MemberEnd()) memberItr->GetUser().SetNickname(strNewNick); if (IsVoteBanInProgress() && !IrcStrCaseCmp(m_clVoteBanMask.GetNickname().c_str(), strNick.c_str(), m_eCaseMapping)) m_clVoteBanMask.SetNickname(strNewNick); }
// 设置模型信息 VOID CTeamOrGroup::SetModelLook() { if( !HasTeam() ) { // 没有队伍不进行操作 return; } TeamMemberInfo* pMyTMInfo; GUID_t guid; guid = CObjectManager::GetMe()->GetMySelf()->GetServerGUID(); pMyTMInfo = GetMember(guid); if ( pMyTMInfo == NULL ) { return; } // 设置ui模型 pMyTMInfo->m_UIModel.SetUIModelInfo(HEQUIP_MAINHAND, pMyTMInfo->m_WeaponID); pMyTMInfo->m_UIModel.SetUIModelInfo(HEQUIP_ASSIHAND, pMyTMInfo->m_AssiID); // 设置ui模型 pMyTMInfo->m_UIModel.SetUIModelInfo( HEQUIP_HEAD, pMyTMInfo->m_CapID); pMyTMInfo->m_UIModel.SetUIModelInfo( HEQUIP_BACK, pMyTMInfo->m_ArmourID); pMyTMInfo->m_UIModel.SetUIModelInfo( HEQUIP_SHOULDER, pMyTMInfo->m_ShoulderID ); pMyTMInfo->m_UIModel.SetUIModelInfo( HEQUIP_WRIST,pMyTMInfo->m_CuffID ); pMyTMInfo->m_UIModel.SetUIModelInfo( HEQUIP_FEET,pMyTMInfo->m_FootID ); if(pMyTMInfo->m_uFaceMeshID < 255) { // 设置脸形 pMyTMInfo->m_UIModel.SetFaceMeshId(pMyTMInfo->m_uFaceMeshID); } if(pMyTMInfo->m_uHairMeshID < 255) { // 设置发型 pMyTMInfo->m_UIModel.SetFaceHairId(pMyTMInfo->m_uHairMeshID); } //if(pMyTMInfo->m_uHairColor < 255) //{ // // 设置颜色 // pMyTMInfo->m_UIModel.SetHairColor(pMyTMInfo->m_uHairColor); //} //else //{ // // 设置颜色 // pMyTMInfo->m_UIModel.SetHairColor(0); //}// // 设置颜色 pMyTMInfo->m_UIModel.SetHairColor(pMyTMInfo->m_uHairColor); }
// // remove member from master list, and all subscription channels. // return true on success. // hsBool plNetTransport::RemoveMember(int idx) { if (idx>=0) { plNetTransportMember* mbr=GetMember(idx); IRemoveMember(mbr); return true; } return false; }
// // 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; }
// // 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; }
BOOL CCampus::RemoveMember( u_long idPlayer ) { CCampusMember* pMember = GetMember( idPlayer ); if( pMember ) { SAFE_DELETE( pMember ); m_mapCM.erase( idPlayer ); return TRUE; } Error( "Member not found - idCampus : %d, idPlayer : %d", GetCampusId(), idPlayer ); return FALSE; }
bool CChoiceTypeInfo::Equals(TConstObjectPtr object1, TConstObjectPtr object2, ESerialRecursionMode how) const { // User defined comparison if ( IsCObject() ) { if ( const CSerialUserOp* op1 = dynamic_cast<const CSerialUserOp*> (static_cast<const CObject*>(object1)) ) { if ( const CSerialUserOp* op2 = dynamic_cast<const CSerialUserOp*> (static_cast<const CObject*>(object2)) ) { if ( !op1->UserOp_Equals(*op2) ) return false; } } } TMemberIndex index; index = GetVariants().FirstIndex(); const CVariantInfo* variantInfo = GetVariantInfo(index); if (variantInfo->GetId().IsAttlist()) { const CMemberInfo* info = dynamic_cast<const CMemberInfo*>(GetVariants().GetItemInfo(index)); if ( !info->GetTypeInfo()->Equals(GetMember(info, object1), GetMember(info, object2), how) ) { return false; } } // Default comparison index = GetIndex(object1); if ( index != GetIndex(object2) ) return false; if ( index == kEmptyChoice ) return true; return GetVariantInfo(index)->GetTypeInfo()->Equals(GetData(object1, index), GetData(object2, index), how); }
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 BnxChannel::VoteNay(const std::string &strNickname) { MemberIterator memberItr = GetMember(strNickname); // Only allow those members who were present prior to the voteban if (memberItr == MemberEnd() || memberItr->GetTimeStamp() > m_voteBanTime) return; int iOldVote = memberItr->GetVote(); memberItr->VoteNay(); m_iVoteCount += memberItr->GetVote() - iOldVote; }
JSONValue JSONValue::GetChild(const String& name, JSONValueType valueType) const { assert(IsObject()); if (!value_->HasMember(name.CString())) return JSONValue::EMPTY; Value& value = GetMember(name); if (valueType != JSON_ANY && value.GetType() != ToRapidJsonType(valueType)) return JSONValue::EMPTY; return JSONValue(file_, &value); }
BOOL CCampus::AddMember( CCampusMember* pMember ) { if( GetMember( pMember->GetPlayerId() ) ) { Error( "Pupil is already campus member - idCampus : %d, idPlayer : %d", GetCampusId(), pMember->GetPlayerId() ); return FALSE; } if( GetPupilNum() >= MAX_PUPIL_NUM ) { Error( "Pupil is full - idCampus : %d", GetCampusId() ); return FALSE; } m_mapCM.insert( MAP_CM::value_type( pMember->GetPlayerId(), pMember ) ); return TRUE; }
void ArenaTeam::Inspect(WorldSession* session, uint64 guid) { ArenaTeamMember* member = GetMember(guid); if (!member) return; WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6); data << uint64(guid); // player guid data << uint8(GetSlot()); // slot (0...2) data << uint32(GetId()); // arena team id data << uint32(Stats.Rating); // rating data << uint32(Stats.SeasonGames); // season played data << uint32(Stats.SeasonWins); // season wins data << uint32(member->SeasonGames); // played (count of all games, that the inspected member participated...) data << uint32(member->PersonalRating); // personal rating session->SendPacket(&data); }
void ArenaTeam::InspectStats(WorldSession *session, ObjectGuid guid) { ArenaTeamMember* member = GetMember(guid); if(!member) return; WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6); data << guid; // player guid data << uint8(GetSlot()); // slot (0...2) data << uint32(GetId()); // arena team id data << uint32(m_stats.rating); // rating data << uint32(m_stats.games_season); // season played data << uint32(m_stats.wins_season); // season wins data << uint32(member->games_season); // played (count of all games, that the inspected member participated...) data << uint32(member->personal_rating); // personal rating session->SendPacket(&data); }