本文整理汇总了C++中Reference::clearCharacterBit方法的典型用法代码示例。如果您正苦于以下问题:C++ Reference::clearCharacterBit方法的具体用法?C++ Reference::clearCharacterBit怎么用?C++ Reference::clearCharacterBit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reference
的用法示例。
在下文中一共展示了Reference::clearCharacterBit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createGroup
GroupObject* GroupManager::createGroup(CreatureObject* leader) {
// Pre: leader locked
// Post: GroupObject is a new group with leader, leader locked.
Zone* zone = leader->getZone();
if (zone == NULL)
return NULL;
ManagedReference<ZoneServer*> server = leader->getZone()->getZoneServer();
ManagedReference<GroupObject*> group = cast<GroupObject*>( ObjectManager::instance()->createObject(0x13dcb432, 0, ""));
Locker locker(group);
group->initializeLeader(leader);
group->startChatRoom();
group->setZone(leader->getZone());
group->sendTo(leader, true);
leader->updateGroup(group);
leader->sendSystemMessage("@group:formed_self");
// clear inviter's LFG setting once a group is created
Reference<PlayerObject*> ghost = leader->getSlottedObject("ghost").castTo<PlayerObject*>();
if (ghost != NULL)
ghost->clearCharacterBit(PlayerObject::LFG, true);
if (leader->getGroupInviterID() != 0)
leader->updateGroupInviterID(0);
// Set the band song if anyone is playing music
if (leader->isPlayingMusic()) {
ManagedReference<Facade*> facade = leader->getActiveSession(SessionFacadeType::ENTERTAINING);
ManagedReference<EntertainingSession*> session = dynamic_cast<EntertainingSession*> (facade.get());
if (session != NULL && session->isPlayingMusic()) {
group->setBandSong(session->getPerformanceName());
for (int i = 0; i < group->getGroupSize(); ++i) {
Reference<CreatureObject*> groupMember = (group->getGroupMember(i)).castTo<CreatureObject*>();
if (groupMember == leader) {
continue;
} else {
ManagedReference<Facade*> otherFacade = groupMember->getActiveSession(SessionFacadeType::ENTERTAINING);
ManagedReference<EntertainingSession*> otherSession = dynamic_cast<EntertainingSession*> (otherFacade.get());
if (otherSession != NULL && otherSession->isPlayingMusic()) {
if (otherSession->getPerformanceName() != group->getBandSong()) {
groupMember->sendSystemMessage("@performance:music_join_band_stop"); // You must play the same song as the band.
otherSession->stopPlayingMusic();
} else {
groupMember->sendSystemMessage("@performance:music_join_band_self"); // You join with the band in the currently playing song.
}
}
}
}
}
} else {
for (int i = 0; i < group->getGroupSize(); ++i) {
Reference<CreatureObject*> groupMember = (group->getGroupMember(i)).castTo<CreatureObject*>();
if (groupMember->isPlayingMusic()) {
ManagedReference<Facade*> facade = groupMember->getActiveSession(SessionFacadeType::ENTERTAINING);
ManagedReference<EntertainingSession*> session = dynamic_cast<EntertainingSession*> (facade.get());
if (session != NULL && session->isPlayingMusic()) {
String bandSong = group->getBandSong();
String song = session->getPerformanceName();
if (bandSong == "") {
group->setBandSong(song);
} else if (song != bandSong) {
groupMember->sendSystemMessage("@performance:music_join_band_stop"); // You must play the same song as the band.
session->stopPlayingMusic();
} else {
groupMember->sendSystemMessage("@performance:music_join_band_self"); // You join with the band in the currently playing song.
}
}
}
}
}
return group;
}
示例2: joinGroup
void GroupManager::joinGroup(CreatureObject* player) {
//Pre: player locked
//Post: player locked
uint64 inviterID = player->getGroupInviterID();
Zone* zone = player->getZone();
if (zone == NULL)
return;
ManagedReference<ZoneServer*> server = zone->getZoneServer();
ManagedReference<SceneObject*> object = server->getObject(inviterID);
if (object == NULL || !object->isPlayerCreature() || object == player)
return;
CreatureObject* inviter = cast<CreatureObject*>( object.get());
GroupObject* group = NULL;
Locker clocker(inviter, player);
group = inviter->getGroup();
if (group == NULL) {
group = createGroup(inviter);
if (group == NULL)
return;
}
Locker clocker2(group, player);
if (group->getGroupSize() >= 20) {
clocker.release();
player->updateGroupInviterID(0);
player->sendSystemMessage("The group is full.");
return;
}
// if inviter IS in the group but is not the leader
if (group->getLeader() != inviter && !playerIsInvitingOwnPet(inviter, player)) {
player->updateGroupInviterID(0);
StringIdChatParameter param("group", "prose_leader_changed"); // "%TU has abdicated group leadership to %TT."
param.setTU( inviter->getDisplayedName() );
param.setTT( group->getLeader()->getDisplayedName() ) ;
player->sendSystemMessage(param);
return;
}
player->info("joining group");
player->updateGroup(group);
group->addMember(player);
if (player->isPlayerCreature()) {
player->sendSystemMessage("@group:joined_self");
//Inform new member who the Master Looter is.
if (group->getLootRule() == MASTERLOOTER) {
StringIdChatParameter masterLooter("group","set_new_master_looter");
masterLooter.setTT(group->getMasterLooterID());
player->sendSystemMessage(masterLooter);
}
// clear invitee's LFG setting once a group is joined
Reference<PlayerObject*> ghost = player->getSlottedObject("ghost").castTo<PlayerObject*>();
if (ghost != NULL)
ghost->clearCharacterBit(PlayerObject::LFG, true);
ManagedReference<ChatRoom*> groupChannel = group->getGroupChannel();
if (groupChannel != NULL) {
groupChannel->sendTo(cast<CreatureObject*>(player));
groupChannel->addPlayer(cast<CreatureObject*>(player), false);
}
if (player->isPlayingMusic()) {
ManagedReference<Facade*> facade = player->getActiveSession(SessionFacadeType::ENTERTAINING);
ManagedReference<EntertainingSession*> session = dynamic_cast<EntertainingSession*> (facade.get());
if (session != NULL && session->isPlayingMusic()) {
String song = session->getPerformanceName();
String bandSong = group->getBandSong();
if (bandSong == "") {
Locker locker(group);
group->setBandSong(song);
} else {
if (bandSong != song) {
player->sendSystemMessage("@performance:music_join_band_stop"); // You must play the same song as the band.
session->stopPlayingMusic();
} else {
player->sendSystemMessage("@performance:music_join_band_self"); // You join with the band in the currently playing song.
}
}
}
}
}
//.........这里部分代码省略.........