当前位置: 首页>>代码示例>>C++>>正文


C++ SetLeader函数代码示例

本文整理汇总了C++中SetLeader函数的典型用法代码示例。如果您正苦于以下问题:C++ SetLeader函数的具体用法?C++ SetLeader怎么用?C++ SetLeader使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetLeader函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetLeader

void DigitalBrain::SetLead (int flag)
{
	if (flag == TRUE){
		isWing = FALSE;
		SetLeader (self);
	}
	else {
		isWing = self->GetCampaignObject()->GetComponentIndex(self);
		SetLeader (self->GetCampaignObject()->GetComponentLead());
	}
}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:11,代码来源:digimain.cpp

示例2: StringFormat

void Raid::SetRaidLeader(const char *wasLead, const char *name)
{
	std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead);
	auto results = database.QueryDatabase(query);
	if (!results.Success())
		LogFile->write(EQEMuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());

	query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name);
	results = database.QueryDatabase(query);
	if (!results.Success())
		LogFile->write(EQEMuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());

	strn0cpy(leadername, name, 64);

	Client *c = entity_list.GetClientByName(name);
	if(c)
		SetLeader(c);

	LearnMembers();
	VerifyRaid();
	SendMakeLeaderPacket(name);

	ServerPacket *pack = new ServerPacket(ServerOP_RaidLeader, sizeof(ServerRaidGeneralAction_Struct));
	ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer;
	rga->rid = GetID();
	strn0cpy(rga->playername, name, 64);
	rga->zoneid = zone->GetZoneID();
	rga->instance_id = zone->GetInstanceID();
	worldserver.SendPacket(pack);
	safe_delete(pack);
}
开发者ID:surlyone,项目名称:Server,代码行数:31,代码来源:raids.cpp

示例3: ObjectGuid

void Guild::DelMember(ObjectGuid guid, bool isDisbanding)
{
    uint32 lowguid = guid.GetCounter();

    // guild master can be deleted when loading guild and guid doesn't exist in characters table
    // or when he is removed from guild by gm command
    if (m_LeaderGuid == guid && !isDisbanding)
    {
        MemberSlot* oldLeader = NULL;
        MemberSlot* best = NULL;
        ObjectGuid newLeaderGUID;
        for (Guild::MemberList::iterator i = members.begin(); i != members.end(); ++i)
        {
            if (i->first == lowguid)
            {
                oldLeader = &(i->second);
                continue;
            }

            if (!best || best->RankId > i->second.RankId)
            {
                best = &(i->second);
                newLeaderGUID = ObjectGuid(HIGHGUID_PLAYER, i->first);
            }
        }
        if (!best)
        {
            Disband();
            return;
        }

        SetLeader(newLeaderGUID);

        // If player not online data in data field will be loaded from guild tabs no need to update it !!
        if (Player *newLeader = sObjectMgr.GetPlayer(newLeaderGUID))
            newLeader->SetRank(GR_GUILDMASTER);

        // when leader non-exist (at guild load with deleted leader only) not send broadcasts
        if (oldLeader)
        {
            BroadcastEvent(GE_LEADER_CHANGED, oldLeader->Name.c_str(), best->Name.c_str());
            BroadcastEvent(GE_LEFT, guid, oldLeader->Name.c_str());
        }
    }

    members.erase(lowguid);

    Player *player = sObjectMgr.GetPlayer(guid);
    // If player not online data in data field will be loaded from guild tabs no need to update it !!
    if (player)
    {
        player->SetInGuild(0);
        player->SetRank(0);
    }

    CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guid = '%u'", lowguid);

    if (!isDisbanding)
        UpdateAccountsNumber();
}
开发者ID:FoOtY,项目名称:ClassyWoW,代码行数:60,代码来源:Guild.cpp

示例4: cit

// Make sure our leader hasn't gone away without telling us.
void DigitalBrain::CheckLead(void)
{
	SimBaseClass *pobj;
	SimBaseClass* newLead = NULL;
	
	BOOL	done = FALSE;
	int	i = 0;

	if ( flightLead &&
		 flightLead->VuState() == VU_MEM_ACTIVE &&
		 !flightLead->IsDead() 
	){
		return;
	}

	{	
		VuListIterator	cit(self->GetCampaignObject()->GetComponents());
		pobj = (SimBaseClass*)cit.GetFirst();
		while(!done){	
			if( pobj && pobj->VuState() == VU_MEM_ACTIVE && !pobj->IsDead() ){			
				done = TRUE;
				newLead = pobj;
			}
			else if(i > 3){
				done = TRUE;
				newLead = self;
			}
			++i;
			pobj = (SimBaseClass*)cit.GetNext();
		}
	}

	SetLeader (newLead);
}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:35,代码来源:digimain.cpp

示例5: GetLeader

void Group::ChangeLeader(Mob* newleader)
{
	// this changes the current group leader, notifies other members, and updates leadship AA

	// if the new leader is invalid, do nothing
	if (!newleader)
		return;

	Mob* oldleader = GetLeader();

	EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct));
	GroupJoin_Struct* gu = (GroupJoin_Struct*) outapp->pBuffer;
	gu->action = groupActMakeLeader;

	strcpy(gu->membername, newleader->GetName());
	strcpy(gu->yourname, oldleader->GetName());
	SetLeader(newleader);
	database.SetGroupLeaderName(GetID(), newleader->GetName());
	for (uint32 i = 0; i < MAX_GROUP_MEMBERS; i++) {
		if (members[i] && members[i]->IsClient())
		{
			members[i]->CastToClient()->QueuePacket(outapp);
		}
	}
	safe_delete(outapp);
}
开发者ID:eqmactop,项目名称:Server,代码行数:26,代码来源:groups.cpp

示例6: FindFreeSubGroup

bool Group::AddMember(Player* pPlayer)
{
	if(!IsFull())
	{
		SubGroup* subgroup = FindFreeSubGroup();
		if(subgroup == NULL)
		{
			// weird shit..
			sLog.outDebug("GROUP: Tried to add member %s but FindFreeSubGroup returned NULL!", pPlayer->GetName());
			return false;
		}

		subgroup->AddPlayer(pPlayer);
		pPlayer->SetGroup(this);

		if(m_MemberCount == 1)
		{
			// We're the only member? Set us to the leader.
			SetLeader(pPlayer);
		}		

		UpdateAllOutOfRangePlayersFor(pPlayer);
		Update();	// Send group update

		return true;

	}
	else
	{
		return false;
	}
}
开发者ID:jameyboor,项目名称:Antrix,代码行数:32,代码来源:Group.cpp

示例7: SetLeader

void CBotSquad::ChangeLeader ( void )
{
	if ( m_theSquad.IsEmpty() )
	{
		SetLeader(NULL);
	}
	else
	{
		m_pLeader = m_theSquad.Pop();

		if ( m_theSquad.IsEmpty() )
			SetLeader(NULL);
		else
		{
			Init(); // new squad init
		}
	}
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:18,代码来源:bot_squads.cpp

示例8: PlayerbotAI

void PlayerbotMgr::OnBotLogin(Player * const bot)
{
    PlayerbotAI* ai = bot->GetPlayerbotAI();
    if (!ai)
    {
        PlayerbotAI* ai = new PlayerbotAI(this, bot);
        if (ai)
            bot->SetPlayerbotAI(ai);
    }
    ai = bot->GetPlayerbotAI();
    SetLeader(NULL);
}
开发者ID:Archives,项目名称:easy-mangos,代码行数:12,代码来源:PlayerbotMgr.cpp

示例9: SetName

//================================================================================
// Constructor
//================================================================================
CSquad::CSquad()
{
    // Predeterminado
    SetName( "WithoutName" );
    SetMemberLimit( 0 );
    SetTacticalMode( 99 );
    SetStrategie( ENDURE_UNTIL_DEATH );
    SetSkill( 99 );
    SetFollowLeader( false );
    SetLeader( NULL );

    m_nController = NULL;

    // Nos agregamos a la lista
    TheSquads->AddSquad( this );
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:19,代码来源:squad.cpp

示例10: CheckTeamVote

/*
==================
CheckTeamVote
==================
*/
void CheckTeamVote( int team ) 
{
	int cs_offset;

	if( team == ClientBase::TEAM_RED )
		cs_offset = 0;
	else if( team == ClientBase::TEAM_BLUE )
		cs_offset = 1;
	else
		return;

	if( !theLevel.teamVoteTime_[cs_offset] ) 
		return;

	if( theLevel.time_ - theLevel.teamVoteTime_[cs_offset] >= VOTE_TIME ) 
	{
		SV_GameSendServerCommand( -1, "print \"Team vote failed.\n\"" );
	}
	else
	{
		if( theLevel.teamVoteYes_[cs_offset] > theLevel.numteamVotingClients_[cs_offset]/2 ) 
		{
			// execute the command, then remove the vote
			SV_GameSendServerCommand( -1, "print \"Team vote passed.\n\"" );
			//
			if( !Q_strncmp( "leader", theLevel.teamVoteString_[cs_offset], 6) ) 
			{
				//set the team leader
				SetLeader(team, atoi(theLevel.teamVoteString_[cs_offset] + 7));
			}
			else
				Cbuf_ExecuteText( EXEC_APPEND, va("%s\n", theLevel.teamVoteString_[cs_offset] ) );
		}
		else if( theLevel.teamVoteNo_[cs_offset] >= theLevel.numteamVotingClients_[cs_offset]/2 ) 
		{
			// same behavior as a timeout
			SV_GameSendServerCommand( -1, "print \"Team vote failed.\n\"" );
		}
		else 
		{
			// still waiting for a majority
			return;
		}
	}
	theLevel.teamVoteTime_[cs_offset] = 0;
	SV_SetConfigstring( CS_TEAMVOTE_TIME + cs_offset, "" );
}
开发者ID:osfpsproject,项目名称:MF2,代码行数:52,代码来源:g_main.c

示例11: 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

示例12: DSP_DEBUG_BREAK_IF

void CParty::AssignPartyRole(int8* MemberName, uint8 role)
{
    DSP_DEBUG_BREAK_IF (m_PartyType != PARTY_PCS);

	switch(role)
	{
		case 0: SetLeader(MemberName);		    break;
        case 4: SetQuarterMaster(MemberName);    break;
		case 5: SetQuarterMaster(NULL);	        break;
        case 6: SetSyncTarget(MemberName, 238);	break;
        case 7: SetSyncTarget(NULL, 553);       break;
	}
	uint8 data[4];
	WBUFL(data, 0) = m_PartyID;
    message::send(MSG_PT_RELOAD, data, sizeof data, NULL);
	return;
}
开发者ID:ERA-Found-It,项目名称:darkstar,代码行数:17,代码来源:party.cpp

示例13: SetLeader

void CTeam::AddPlayer(int playerNum)
{
	// note: does it matter if this team was already dead?
	// (besides needing to restore its original unit-limit)
	if (isDead) {
		teamHandler->UpdateTeamUnitLimitsPreSpawn(teamNum);
	}

	if (!HasLeader()) {
		SetLeader(playerNum);
	}

	playerHandler->Player(playerNum)->JoinTeam(teamNum);
	playerHandler->Player(playerNum)->SetControlledTeams();

	isDead = false;
}
开发者ID:9heart,项目名称:spring,代码行数:17,代码来源:Team.cpp

示例14: SetLeader

void Group::MemberZoned(Mob* removemob) {
	uint32 i;

	if (removemob == nullptr)
		return;

	if(removemob == GetLeader())
		SetLeader(nullptr);

	for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
			if (members[i] == removemob) {
				members[i] = nullptr;
				//should NOT clear the name, it is used for world communication.
				break;
			}
	}
}
开发者ID:eqmactop,项目名称:Server,代码行数:17,代码来源:groups.cpp

示例15: DSP_DEBUG_BREAK_IF

void CParty::AssignPartyRole(int8* MemberName, uint8 role)
{
    DSP_DEBUG_BREAK_IF(m_PartyType != PARTY_PCS);

    switch (role)
    {
        case 0: SetLeader((const char*)MemberName);		    break;
        case 4: SetQuarterMaster((const char*)MemberName);   break;
        case 5: SetQuarterMaster(nullptr);	        break;
        case 6: SetSyncTarget(MemberName, 238);	break;
        case 7: SetSyncTarget(nullptr, 553);       break;
    }
    uint8 data[4] {};
    ref<uint32>(data, 0) = m_PartyID;
    message::send(MSG_PT_RELOAD, data, sizeof data, nullptr);
    return;
}
开发者ID:DerpStarProject,项目名称:darkstar,代码行数:17,代码来源:party.cpp


注:本文中的SetLeader函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。