本文整理汇总了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());
}
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
}
示例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
}
}
}
示例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);
}
示例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 );
}
示例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, "" );
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}