當前位置: 首頁>>代碼示例>>C++>>正文


C++ AddMember函數代碼示例

本文整理匯總了C++中AddMember函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddMember函數的具體用法?C++ AddMember怎麽用?C++ AddMember使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了AddMember函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: strlen

int CBlock::Write( int member_id, const char *member_data, CIcarus* icarus )
{
	CBlockMember *bMember = new CBlockMember;

	bMember->SetID( member_id );
	
	bMember->SetData( member_data, icarus );
	bMember->SetSize( strlen(member_data) + 1 );

	AddMember( bMember );

	return true;
}
開發者ID:Elfmagi,項目名稱:OpenJK,代碼行數:13,代碼來源:BlockStream.cpp

示例2: time

bool Group::Create(ObjectGuid guid, const char* name)
{
    m_leaderGuid = guid;
    m_leaderName = name;
    m_leaderLastOnline = time(nullptr);

    m_groupType  = isBattleGroup() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL;

    if (m_groupType == GROUPTYPE_RAID)
        _initRaidSubGroupsCounter();

    m_lootMethod = GROUP_LOOT;
    m_lootThreshold = ITEM_QUALITY_UNCOMMON;
    m_masterLooterGuid = guid;
    m_currentLooterGuid = guid;                                             // used for round robin looter


    if (!isBattleGroup())
    {
        m_Id = sObjectMgr.GenerateGroupId();

        Player* leader = sObjectMgr.GetPlayer(guid);

        Player::ConvertInstancesToGroup(leader, this, guid);

        // store group in database
        CharacterDatabase.BeginTransaction();
        CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId ='%u'", m_Id);
        CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id);

        CharacterDatabase.PExecute("INSERT INTO groups(groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid) "
                                   "VALUES('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u')",
                                   m_Id, m_leaderGuid.GetCounter(), m_mainTankGuid.GetCounter(), m_mainAssistantGuid.GetCounter(), uint32(m_lootMethod),
                                   m_masterLooterGuid.GetCounter(), uint32(m_lootThreshold),
                                   m_targetIcons[0].GetRawValue(), m_targetIcons[1].GetRawValue(),
                                   m_targetIcons[2].GetRawValue(), m_targetIcons[3].GetRawValue(),
                                   m_targetIcons[4].GetRawValue(), m_targetIcons[5].GetRawValue(),
                                   m_targetIcons[6].GetRawValue(), m_targetIcons[7].GetRawValue(),
                                   isRaidGroup());
    }

    if (!AddMember(guid, name))
        return false;

    if (!isBattleGroup())
        CharacterDatabase.CommitTransaction();

    _updateLeaderFlag();

    return true;
}
開發者ID:Ghaster,項目名稱:mangos-classic,代碼行數:51,代碼來源:Group.cpp

示例3: sizeof

int CBlock::Write( int member_id, vector_t member_data )
{
	CBlockMember *bMember; 

	bMember = new CBlockMember;

	bMember->SetID( member_id );
	bMember->SetData( member_data );
	bMember->SetSize( sizeof(vector_t) );

	AddMember( bMember );

	return true;
}
開發者ID:DavidZeise,項目名稱:OpenJK,代碼行數:14,代碼來源:BlockStream.cpp

示例4: nsXBLProtoImplMethod

void
nsXBLContentSink::ConstructMethod(const PRUnichar **aAtts)
{
  mMethod = nsnull;

  const PRUnichar* name = nsnull;
  if (FindValue(aAtts, nsGkAtoms::name, &name)) {
    mMethod = new nsXBLProtoImplMethod(name);
  }

  if (mMethod) {
    AddMember(mMethod);
  }
}
開發者ID:EdgarChen,項目名稱:mozilla-cvs-history,代碼行數:14,代碼來源:nsXBLContentSink.cpp

示例5: AddMember

bool Party::AddMember(const int aid, const RogueGame &roguegame) {
	//めちゃくちゃ例外的な処理 4番目に無理やり冬(すぐ死ぬ)を入れてる
	if (aid == 23) {
		members[3] = make_shared<MyChara>(aid, actionlog, situation);
	}
	else {
		for (int i = 0; i < maxmember; ++i) {
			if (members[i] == NULL) {
				return AddMember(aid, i, roguegame);
			}
		}
	}
	return false;
}
開發者ID:yumakmc,項目名稱:cuigame,代碼行數:14,代碼來源:RogueGameParty.cpp

示例6: CreateRank

void Guild::create(uint64 lGuid, std::string gname)
{
	Player *pl;
	MemberSlot *newmember;
	std::string rname;

	pl = ObjectAccessor::Instance().FindPlayer(lGuid);
	if(!pl) return;
	
	leaderGuid = lGuid;
	name = gname;
	MOTD = "No message set.";
	
	rname = "Guild Master";
	CreateRank(rname,GR_RIGHT_ALL);
	rname = "Officer";
	CreateRank(rname,GR_RIGHT_ALL);
	rname = "Veteran";
	CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
	rname = "Member";
	CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
	rname = "Initiate";
	CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);

	Log::getSingleton().outDebug("GUILD: creating guild %s to leader:%d", gname.c_str(), leaderGuid);

	
	QueryResult *result = sDatabase.Query( "SELECT MAX(guildId) FROM guilds" );
	if( result )
	{
  		Id = (*result)[0].GetUInt32()+1;
  		delete result;
	}
	else Id = 1;	
	
	if(pl) 
	{
		pl->SetInGuild(Id);
		pl->SetRank( GR_GUILDMASTER	);
	}
	
	newmember = new MemberSlot;
	newmember->guid = leaderGuid;
	newmember->RankId = GR_GUILDMASTER;
	newmember->Pnote = "";
	newmember->OFFnote = "";
	AddMember(newmember);
	SaveGuildToDB();

}
開發者ID:Artea,項目名稱:mangos-svn,代碼行數:50,代碼來源:Guild.cpp

示例7: sizeof

int CBlock::Write( int member_id, vec3_t member_data, CIcarus* icarus )
{
	CBlockMember *bMember; 

	bMember = new CBlockMember;

	bMember->SetID( member_id );
	bMember->SetData( member_data, icarus );
	bMember->SetSize( sizeof(vec3_t) );

	AddMember( bMember );

	return true;
}
開發者ID:DingoOz,項目名稱:OpenJK,代碼行數:14,代碼來源:BlockStream.cpp

示例8: time

bool Guild::Create(Player* leader, std::string gname)
{
    if (sGuildMgr.GetGuildByName(gname))
        { return false; }

    WorldSession* lSession = leader->GetSession();
    if (!lSession)
        { return false; }

    m_LeaderGuid = leader->GetObjectGuid();
    m_Name = gname;
    GINFO.clear();
    MOTD = "No message set.";
    m_Id = sObjectMgr.GenerateGuildId();

    // creating data
    time_t now = time(0);
    tm local = *(localtime(&now));                          // dereference and assign
    m_CreatedDay   = local.tm_mday;
    m_CreatedMonth = local.tm_mon + 1;
    m_CreatedYear  = local.tm_year + 1900;

    DEBUG_LOG("GUILD: creating guild %s to leader: %s", gname.c_str(), m_LeaderGuid.GetString().c_str());

    // gname already assigned to Guild::name, use it to encode string for DB
    CharacterDatabase.escape_string(gname);

    std::string dbGINFO = GINFO;
    std::string dbMOTD = MOTD;
    CharacterDatabase.escape_string(dbGINFO);
    CharacterDatabase.escape_string(dbMOTD);

    CharacterDatabase.BeginTransaction();
    // CharacterDatabase.PExecute("DELETE FROM guild WHERE guildid='%u'", Id); - MAX(guildid)+1 not exist
    CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guildid='%u'", m_Id);
    CharacterDatabase.PExecute("INSERT INTO guild (guildid,name,leaderguid,info,motd,createdate,EmblemStyle,EmblemColor,BorderStyle,BorderColor,BackgroundColor) "
                               "VALUES('%u','%s','%u', '%s', '%s','" UI64FMTD "','%u','%u','%u','%u','%u')",
                               m_Id, gname.c_str(), m_LeaderGuid.GetCounter(), dbGINFO.c_str(), dbMOTD.c_str(), uint64(now), m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor, m_BackgroundColor);
    CharacterDatabase.CommitTransaction();

    CreateDefaultGuildRanks(lSession->GetSessionDbLocaleIndex());

    // Used by Eluna
#ifdef ENABLE_ELUNA
    sEluna->OnCreate(this, leader, gname.c_str());
#endif /* ENABLE_ELUNA */

    return AddMember(m_LeaderGuid, (uint32)GR_GUILDMASTER);
}
開發者ID:billy1arm,項目名稱:MangosMC,代碼行數:49,代碼來源:Guild.cpp

示例9: PIntRange

/* PIntRange: parse an integer range and add its members to s */
static void PIntRange(IntSet s)
{
   int i,i1,i2;

   i1 = GetInt(1,s.nMembers);
   SkipSpaces();
   if (ch == '-') {
      ReadCh();
      i2 = GetInt(1,s.nMembers);
   }
   else
      i2=i1;
   for (i=i1; i<=i2; i++)
      AddMember(s,i);
}
開發者ID:deardaniel,項目名稱:PizzaTest,代碼行數:16,代碼來源:HUtil.c

示例10: GUID_LOPART

bool ArenaTeam::Create(uint32 captainGuid, ArenaType type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
{
    // Check if arena type is valid
    if (!IsArenaTypeValid(type))
        return false;

    // Check if captain is present
    if (!sObjectMgr->GetPlayer(captainGuid))
        return false;

    // Check if arena team name is already taken
    if (sArenaTeamMgr->GetArenaTeamByName(TeamName))
        return false;


    // Generate new arena team id
    TeamId = sArenaTeamMgr->GenerateArenaTeamId();

    // Assign member variables
    CaptainGuid = captainGuid;
    Type = type;
    TeamName = teamName;
    BackgroundColor = backgroundColor;
    EmblemStyle = emblemStyle;
    EmblemColor = emblemColor;
    BorderStyle = borderStyle;
    BorderColor = borderColor;

    // Save arena team to db
    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_ARENA_TEAM);
    stmt->setUInt32(0, TeamId);
    stmt->setString(1, TeamName);
    stmt->setUInt32(2, GUID_LOPART(CaptainGuid));
    stmt->setUInt8(3, Type);
    stmt->setUInt16(4, Stats.Rating);
    stmt->setUInt32(5, BackgroundColor);
    stmt->setUInt8(6, EmblemStyle);
    stmt->setUInt32(7, EmblemColor);
    stmt->setUInt8(8, BorderStyle);
    stmt->setUInt32(9, BorderColor);
    CharacterDatabase.Execute(stmt);

    // Add captain as member
    AddMember(CaptainGuid);

    sLog->outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), GUID_LOPART(CaptainGuid));
    return true;
}
開發者ID:sk3tche,項目名稱:TrinityCore,代碼行數:48,代碼來源:ArenaTeam.cpp

示例11: assert

JSONValue JSONValue::CreateChild(const String& name, JSONValueType valueType)
{
    assert(IsObject());
    if (!IsObject())
        return JSONValue::EMPTY;

    Value jsonValue;
    if (valueType == JSON_OBJECT)
        jsonValue.SetObject();
    else if (valueType == JSON_ARRAY)
        jsonValue.SetArray();

    AddMember(name, jsonValue);

    return GetChild(name, valueType);
}
開發者ID:Boshin,項目名稱:Urho3D,代碼行數:16,代碼來源:JSONValue.cpp

示例12: GUID_LOPART

bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& arenaTeamName,
                       uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor,
                       uint8 borderStyle, uint32 borderColor)
{
    // Check if captain is present
    if (!ObjectAccessor::FindPlayer(captainGuid))
        return false;

    // Check if arena team name is already taken
    if (sArenaTeamMgr->GetArenaTeamByName(arenaTeamName))
        return false;

    // Generate new arena team id
    TeamId = sArenaTeamMgr->GenerateArenaTeamId();

    // Assign member variables
    CaptainGuid = captainGuid;
    Type = type;
    TeamName = arenaTeamName;
    BackgroundColor = backgroundColor;
    EmblemStyle = emblemStyle;
    EmblemColor = emblemColor;
    BorderStyle = borderStyle;
    BorderColor = borderColor;
    uint32 captainLowGuid = GUID_LOPART(captainGuid);

    // Save arena team to db
    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM);
    stmt->setUInt32(0, TeamId);
    stmt->setString(1, TeamName);
    stmt->setUInt32(2, captainLowGuid);
    stmt->setUInt8(3, Type);
    stmt->setUInt16(4, Stats.Rating);
    stmt->setUInt32(5, BackgroundColor);
    stmt->setUInt8(6, EmblemStyle);
    stmt->setUInt32(7, EmblemColor);
    stmt->setUInt8(8, BorderStyle);
    stmt->setUInt32(9, BorderColor);
    CharacterDatabase.Execute(stmt);

    // Add captain as member
    AddMember(CaptainGuid);

    TC_LOG_DEBUG("bg.arena", "New ArenaTeam created [Id: %u, Name: %s] [Type: %u] [Captain low GUID: %u]", GetId(), GetName().c_str(), GetType(), captainLowGuid);
    return true;
}
開發者ID:reon,項目名稱:5.4.1,代碼行數:46,代碼來源:ArenaTeam.cpp

示例13: DSP_DEBUG_BREAK_IF

CParty::CParty(CBattleEntity* PEntity)
{
	DSP_DEBUG_BREAK_IF(PEntity == NULL);
	DSP_DEBUG_BREAK_IF(PEntity->PParty != NULL);

    m_PartyID   = PEntity->id;
    m_PartyType = PEntity->objtype == TYPE_PC ? PARTY_PCS : PARTY_MOBS;

    m_PLeader       = NULL;
	m_PAlliance		= NULL;
	m_PSyncTarget 	= NULL;
	m_PQuaterMaster = NULL;


	AddMember(PEntity);
	SetLeader(PEntity);
}
開發者ID:ZeDingo,項目名稱:darkstar,代碼行數:17,代碼來源:party.cpp

示例14: DSP_DEBUG_BREAK_IF

CParty::CParty(CBattleEntity* PEntity)
{
    DSP_DEBUG_BREAK_IF(PEntity == nullptr);
    DSP_DEBUG_BREAK_IF(PEntity->PParty != nullptr);

    m_PartyID = PEntity->id;
    m_PartyType = PEntity->objtype == TYPE_PC ? PARTY_PCS : PARTY_MOBS;
    m_PartyNumber = 0;

    m_PLeader = nullptr;
    m_PAlliance = nullptr;
    m_PSyncTarget = nullptr;
    m_PQuaterMaster = nullptr;

    m_EffectsChanged = false;
    AddMember(PEntity);
    SetLeader((char*)PEntity->name.c_str());
}
開發者ID:DerpStarProject,項目名稱:darkstar,代碼行數:18,代碼來源:party.cpp

示例15: DSP_DEBUG_BREAK_IF

CParty::CParty(CBattleEntity* PEntity, Sql_t* sql)
{
	DSP_DEBUG_BREAK_IF(PEntity == NULL);
	DSP_DEBUG_BREAK_IF(PEntity->PParty != NULL);

    m_PartyID   = PEntity->id;
    m_PartyType = PEntity->objtype == TYPE_PC ? PARTY_PCS : PARTY_MOBS;
    m_PartyNumber = 0;

    m_PLeader       = NULL;
	m_PAlliance		= NULL;
	m_PSyncTarget 	= NULL;
	m_PQuaterMaster = NULL;


	AddMember(PEntity, sql);
	SetLeader((int8*)PEntity->name.c_str());
}
開發者ID:ERA-Found-It,項目名稱:darkstar,代碼行數:18,代碼來源:party.cpp


注:本文中的AddMember函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。