本文整理汇总了C++中LLVOAvatar::getRegion方法的典型用法代码示例。如果您正苦于以下问题:C++ LLVOAvatar::getRegion方法的具体用法?C++ LLVOAvatar::getRegion怎么用?C++ LLVOAvatar::getRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLVOAvatar
的用法示例。
在下文中一共展示了LLVOAvatar::getRegion方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_eject
static void send_eject(const LLUUID& avatar_id, bool ban)
{
LLMessageSystem* msg = gMessageSystem;
LLVOAvatar* avatarp = gObjectList.findAvatar(avatar_id);
if (avatarp && avatarp->getRegion())
{
U32 flags = 0x0;
if (ban)
{
// eject and add to ban list
flags |= 0x1;
}
msg->newMessage("EjectUser");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->nextBlock("Data");
msg->addUUID("TargetID", avatar_id);
msg->addU32("Flags", flags);
msg->sendReliable( avatarp->getRegion()->getHost());
}
}
示例2: send_freeze
static void send_freeze(const LLUUID& avatar_id, bool freeze)
{
U32 flags = 0x0;
if (!freeze)
{
// unfreeze
flags |= 0x1;
}
LLMessageSystem* msg = gMessageSystem;
LLVOAvatar* avatarp = gObjectList.findAvatar(avatar_id);
if (avatarp && avatarp->getRegion())
{
msg->newMessage("FreezeUser");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->nextBlock("Data");
msg->addUUID("TargetID", avatar_id);
msg->addU32("Flags", flags);
msg->sendReliable( avatarp->getRegion()->getHost());
}
}
示例3: isKickable
bool PanelRadar::isKickable(const LLUUID& agent_id)
{
if (agent_id.notNull())
{
LLViewerObject* av_obj = gObjectList.findObject(agent_id);
if (av_obj != NULL && av_obj->isAvatar())
{
LLVOAvatar* avatar = (LLVOAvatar*)av_obj;
LLViewerRegion* region = avatar->getRegion();
if (region)
{
const LLVector3& pos = avatar->getPositionRegion();
if (region->isOwnedSelf(pos) ||
region->canManageEstate())
{
return true;
}
const LLVector3d& pos_global = avatar->getPositionGlobal();
if (LLWorld::getInstance()->positionRegionValidGlobal(pos_global))
{
LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel();
LLViewerParcelMgr::getInstance()->deselectLand();
if (parcel)
{
if (region->isOwnedGroup(pos) &&
(LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN) ||
LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED)))
{
return true;
}
}
}
}
}
}
return false;
}
示例4: updateAvatarList
//.........这里部分代码省略.........
switch (phoenix_name_system)
{
case 0 : name = avatar_name.getLegacyName(); break;
case 1 : name = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break;
case 2 : name = avatar_name.mDisplayName; break;
default : name = avatar_name.getLegacyName(); break;
}
first = avatar_name.mLegacyFirstName;
last = avatar_name.mLegacyLastName;
}
else continue;
// [/Ansariel: Display name support]
//duped for lower section
if (name.empty() || (name.compare(" ") == 0))// || (name.compare(gCacheName->getDefaultName()) == 0))
{
if (!gCacheName->getFullName(avid, name)) //seems redudant with LLAvatarNameCache::get above...
{
continue;
}
}
if (avid.isNull())
{
//llinfos << "Key empty for avatar " << name << llendl;
continue;
}
if (mAvatars.count(avid) > 0)
{
// Avatar already in list, update position
F32 dist = (F32)(position - mypos).magVec();
mAvatars[avid].setPosition(position, (avatarp->getRegion() == gAgent.getRegion()), true, dist < 20.0, dist < 100.0);
}
else
{
// Avatar not there yet, add it
LLAvatarListEntry entry(avid, name, position);
if(announce && avatarp->getRegion() == gAgent.getRegion())
announce_keys.push(avid);
mAvatars[avid] = entry;
}
}
else
{
if (i < positions.size())
{
position = positions[i];
}
else
{
continue;
}
if (!gCacheName->getFullName(avid, name))
{
//name = gCacheName->getDefaultName();
continue; //prevent (Loading...)
}
if (mAvatars.count(avid) > 0)
{
// Avatar already in list, update position
F32 dist = (F32)(position - mypos).magVec();
mAvatars[avid].setPosition(position, gAgent.getRegion()->pointInRegionGlobal(position), false, dist < 20.0, dist < 100.0);
示例5: updateAvatarList
//.........这里部分代码省略.........
LLViewerObject *obj = gObjectList.findObject(avid);
if (obj)
{
LLVOAvatar* avatarp = dynamic_cast<LLVOAvatar*>(obj);
if (avatarp == NULL)
{
continue;
}
// Skip if avatar is dead(what's that?)
// or if the avatar is ourselves.
if (avatarp->isDead() || avatarp->isSelf())
{
continue;
}
// Get avatar data
position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition());
name = avatarp->getFullname();
// Apparently, sometimes the name comes out empty, with a " " name. This is because
// getFullname concatenates first and last name with a " " in the middle.
// This code will avoid adding a nameless entry to the list until it acquires a name.
//duped for lower section
if (name.empty() || (name.compare(" ") == 0))// || (name.compare(gCacheName->getDefaultName()) == 0))
{
if (gCacheName->getName(avid, first, last))
{
name = first + " " + last;
}
else
{
continue;
}
}
if (avid.isNull())
{
//llinfos << "Key empty for avatar " << name << llendl;
continue;
}
if (mAvatars.count(avid) > 0)
{
// Avatar already in list, update position
F32 dist = (F32)(position - mypos).magVec();
mAvatars[avid].setPosition(position, (avatarp->getRegion() == gAgent.getRegion()), true, dist < 20.0, dist < 100.0);
}
else
{
// Avatar not there yet, add it
LLAvatarListEntry entry(avid, name, position);
mAvatars[avid] = entry;
}
}
else
{
if (i < positions.size())
{
position = positions[i];
}
else
{
continue;
}
if (gCacheName->getName(avid, first, last))
{
name = first + " " + last;
}
else
{
//name = gCacheName->getDefaultName();
continue; //prevent (Loading...)
}
if (mAvatars.count(avid) > 0)
{
// Avatar already in list, update position
F32 dist = (F32)(position - mypos).magVec();
mAvatars[avid].setPosition(position, gAgent.getRegion()->pointInRegionGlobal(position), false, dist < 20.0, dist < 100.0);
}
else
{
LLAvatarListEntry entry(avid, name, position);
mAvatars[avid] = entry;
}
}
}
}
// llinfos << "radar refresh: done" << llendl;
expireAvatarList();
refreshAvatarList();
refreshTracker();
}
示例6: updateRadarDisplay
void PanelRadar::updateRadarDisplay()
{
if (visibleItemsSelected())
{
mSelectedAvatar = mRadarList->getFirstSelected()->getUUID();
//TODO: as we expand columns, make these numbers enums
mSelectedDistance = mRadarList->getFirstSelected()->getColumn(1)->getValue().asReal();
}
else
{
mSelectedAvatar.setNull();
mSelectedDistance = -1.0f;
}
S32 scroll_pos = mRadarList->getScrollPos();
LLSD element;
// Zap all the avie names. Zap zap zap!
mRadarList->deleteAllItems();
U32 chat_distance = gSavedSettings.getU32("ChatDistance");
F32 range = gSavedSettings.getF32("NearMeRange");
bool notify_chat = gSavedSettings.getBOOL("MiniMapNotifyChatRange");
bool notify_sim = gSavedSettings.getBOOL("MiniMapNotifySimRange");
// [RLVa:KB] - Alternate: Imprudence-1.2.0
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
{
notify_chat = false;
notify_sim = false;
}
// [/RLVa:KB]
std::map<LLUUID, PanelRadarEntry>::iterator mIt;
for (mIt = mAvatars.begin(); mIt != mAvatars.end(); ++mIt)
{
PanelRadarEntry* entry = &mIt->second;
LL_DEBUGS("Radar") << "Avatar :" << entry->getName()
<< " Position: " << entry->getPosition()
<< " Your Position: " << gAgent.getPositionGlobal()
<< " Distance: " << entry->getDistance()
<< " Status: " << entry->getStatus()
<< " Notified: " << entry->getNotified()
<< " Timer Seconds: " << entry->getStatusTimer().getElapsedTimeF32()
<< LL_ENDL;
// Check if they're in certain ranges and notify user if we've enabled that, starting with chat range
// We round for accuracy when avs tp in
std::string dist_string = llformat("%.1f", llround(entry->getDistance(), 0.1f));
// Don't notify if we don't know their name. It takes a few seconds for names to load on OpenSim, anyway
if (entry->getName() != getString("unknown_avatar"))
{
if (notify_sim &&
(entry->getNotified() < RADAR_NOTIFIED_SIM))
{
LLViewerObject *av_obj = gObjectList.findObject(entry->getID());
if (av_obj != NULL && av_obj->isAvatar())
{
LLVOAvatar* avatarp = (LLVOAvatar*)av_obj;
if (avatarp != NULL)
{
if (avatarp->getRegion() == gAgent.getRegion())
{
LLChat chat;
LLUIString notify = getString("entering_sim_range");
notify.setArg("[NAME]", entry->getName());
notify.setArg("[DISTANCE]", dist_string);
chat.mText = notify;
chat.mSourceType = CHAT_SOURCE_SYSTEM;
LLFloaterChat::addChat(chat, FALSE, FALSE);
entry->setNotified(RADAR_NOTIFIED_SIM);
}
}
}
}
else if (notify_chat &&
(entry->getDistance() < chat_distance) &&
(entry->getNotified() < RADAR_NOTIFIED_CHAT))
{
LLChat chat;
LLUIString notify = getString("entering_chat_range");
notify.setArg("[NAME]", entry->getName());
notify.setArg("[DISTANCE]", dist_string);
chat.mText = notify;
chat.mSourceType = CHAT_SOURCE_SYSTEM;
LLFloaterChat::addChat(chat, FALSE, FALSE);
entry->setNotified(RADAR_NOTIFIED_CHAT);
}
}
// Only display avatars in range
if (entry->getDistance() <= range)
{
// Append typing string
std::string typing = "";
if (entry->getStatus() == RADAR_STATUS_TYPING)
{
typing = getString("is_typing")+ " ";
//.........这里部分代码省略.........
示例7: tick
BOOL FloaterAvatarList::tick()
{
if(!gDisconnected)
{
LLCheckboxCtrl* check = getChild<LLCheckboxCtrl>("update_enabled_cb");
if(check && check->getValue())
{
//UPDATES//
LLVector3d agent_pos = gAgent.getPositionGlobal();
std::vector<LLUUID> avatar_ids;
std::vector<LLUUID> sorted_avatar_ids;
std::vector<LLVector3d> positions;
LLWorld::instance().getAvatars(&avatar_ids, &positions,agent_pos);
sorted_avatar_ids = avatar_ids;
std::sort(sorted_avatar_ids.begin(), sorted_avatar_ids.end());
for(std::vector<LLCharacter*>::const_iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter)
{
LLUUID avid = (*iter)->getID();
if(!std::binary_search(sorted_avatar_ids.begin(), sorted_avatar_ids.end(), avid))
{
avatar_ids.push_back(avid);
}
}
int i = 0;
int len = avatar_ids.size();
for(i = 0; i < len; i++)
{
LLUUID &avid = avatar_ids[i];
if(avid != gAgent.getID())
{
std::string name;
std::string first;
std::string last;
LLVector3d position;
LLViewerObject *obj = gObjectList.findObject(avid);
bool same_region = false;
bool in_draw = false;
if(obj)
{
LLVOAvatar* avatarp = dynamic_cast<LLVOAvatar*>(obj);
if (avatarp == NULL)
{
continue;
}
if (avatarp->isDead())
{
continue;
}
position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition());
in_draw = true;
same_region = avatarp->getRegion() == gAgent.getRegion();
}else
{
if( i < (int)positions.size())
{
position = positions[i];
}
else
{
continue;
}
same_region = gAgent.getRegion()->pointInRegionGlobal(position);
}
if(gCacheName->getName(avid, first, last))
{
name = first + " " + last;
}
else
{
continue;//name = LLCacheName::getDefaultName();
}
if (mAvatars.find(avid) == mAvatars.end())
{
avatar_entry new_entry;
new_entry.id = avid;
new_entry.is_linden = (strcmp(last.c_str(),"Linden") == 0 || strcmp(last.c_str(),"Tester") == 0) ? true : false;
mAvatars[avid] = new_entry;
if(gSavedSettings.getBOOL("EmeraldRadarChatKeys"))
{
gMessageSystem->newMessage("ScriptDialogReply");
gMessageSystem->nextBlock("AgentData");
gMessageSystem->addUUID("AgentID", gAgent.getID());
//.........这里部分代码省略.........
示例8: updateAvatarList
//.........这里部分代码省略.........
// or if the avatar is a dummy
if (avatarp->isDead() || avatarp->isSelf() || avatarp->mIsDummy)
{
continue;
}
// Get avatar data
position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition());
name = avatarp->getFullname();
if (!LLAvatarNameCache::getPNSName(avatarp->getID(), name))
continue;
//duped for lower section
if (name.empty() || (name.compare(" ") == 0))// || (name.compare(gCacheName->getDefaultName()) == 0))
{
if (!gCacheName->getFullName(avid, name)) //seems redudant with LLAvatarNameCache::getPNSName above...
{
continue;
}
}
if (avid.isNull())
{
//llinfos << "Key empty for avatar " << name << llendl;
continue;
}
LLAvatarListEntry* entry = getAvatarEntry(avid);
if (entry)
{
// Avatar already in list, update position
F32 dist = (F32)(position - mypos).magVec();
entry->setPosition(position, (avatarp->getRegion() == gAgent.getRegion()), true, dist < 20.0, dist < 100.0);
if(avatarp->isTyping())entry->setActivity(LLAvatarListEntry::ACTIVITY_TYPING);
}
else
{
// Avatar not there yet, add it
if(announce && avatarp->getRegion() == gAgent.getRegion())
announce_keys.push(avid);
mAvatars.push_back(LLAvatarListEntryPtr(new LLAvatarListEntry(avid, name, position)));
}
}
else
{
if (i < positions.size())
{
position = positions[i];
}
else
{
continue;
}
if (!LLAvatarNameCache::getPNSName(avid, name))
{
//name = gCacheName->getDefaultName();
continue; //prevent (Loading...)
}
LLAvatarListEntry* entry = getAvatarEntry(avid);
if (entry)
{
// Avatar already in list, update position
F32 dist = (F32)(position - mypos).magVec();
示例9: updateAvatarList
//.........这里部分代码省略.........
{
continue;
}
}
ifdef LL_DISPLAY_NAMES
std::string display_name = name;
if (LLAvatarNameCache::useDisplayNames())
{
LLAvatarName avatar_name;
if (LLAvatarNameCache::get(avid, &avatar_name))
{
if (LLAvatarNameCache::useDisplayNames() == 2)
{
display_name = avatar_name.mDisplayName;
}
else
{
display_name = avatar_name.getNames();
}
}
}
#endif
if (avid.isNull())
{
//llinfos << "Key empty for avatar " << name << llendl;
continue;
}
if (mAvatars.count(avid) > 0)
{
// Avatar already in list, update position
F32 dist = (F32)(position - mypos).magVec();
mAvatars[avid].setPosition(position, (avatarp->getRegion() == gAgent.getRegion()), true, dist < 20.0, dist < 100.0);
}
else
{
// Avatar not there yet, add it
LLAvatarListEntry entry(avid, name, position);
if(announce && avatarp->getRegion() == gAgent.getRegion())
announce_keys.push(avid);
mAvatars[avid] = entry;
}
#ifdef LL_DISPLAY_NAMES
// update avatar display name.
mAvatars[avid].setDisplayName(display_name);
#endif
}
else
{
if (i < positions.size())
{
position = positions[i];
}
else
{
continue;
}
if (gCacheName->getName(avid, first, last))
{
name = first + " " + last;
}
else
{