void LLFloaterAvatarList::focusOnCurrent() { std::map<LLUUID, LLAvatarListEntry>::iterator iter; LLAvatarListEntry *entry; if (mAvatars.size() == 0) { return; } for (iter = mAvatars.begin(); iter != mAvatars.end(); iter++) { entry = &iter->second; if (entry->isDead()) continue; if (entry->getID() == mFocusedAvatar) { removeFocusFromAll(); entry->setFocus(TRUE); gAgentCamera.lookAtObject(mFocusedAvatar, false); return; } } }
void LLFloaterAvatarList::expireAvatarList() { // llinfos << "radar: expiring" << llendl; std::map<LLUUID, LLAvatarListEntry>::iterator iter; std::queue<LLUUID> delete_queue; bool alive; for (iter = mAvatars.begin(); iter != mAvatars.end(); iter++) { LLAvatarListEntry *entry = &iter->second; alive = entry->getAlive(); if (entry->isDead()) { //llinfos << "radar: expiring avatar " << entry->getName() << llendl; LLUUID av_id = entry->getID(); delete_queue.push(av_id); } } while (!delete_queue.empty()) { mAvatars.erase(delete_queue.front()); delete_queue.pop(); } }
BOOL LLFloaterAvatarList::handleKeyHere(KEY key, MASK mask) { LLFloaterAvatarList* self = getInstance(); LLScrollListItem* item = self->mAvatarList->getFirstSelected(); if(item) { LLUUID agent_id = item->getUUID(); if (( KEY_RETURN == key ) && (MASK_NONE == mask)) { self->mFocusedAvatar = agent_id; self->focusOnCurrent(); return TRUE; } else if (( KEY_RETURN == key ) && (MASK_CONTROL == mask)) { LLAvatarListEntry* entry = self->getAvatarEntry(agent_id); if (entry) { // llinfos << "Trying to teleport to " << entry->getName() << " at " << entry->getPosition() << llendl; gAgent.teleportViaLocation(entry->getPosition()); } return TRUE; } } if (( KEY_RETURN == key ) && (MASK_SHIFT == mask)) { LLDynamicArray<LLUUID> ids = self->mAvatarList->getSelectedIDs(); if (ids.size() > 0) { if (ids.size() == 1) { // Single avatar LLUUID agent_id = ids[0]; // [Ansariel: Display name support] LLAvatarName avatar_name; if (LLAvatarNameCache::get(agent_id, &avatar_name)) { gIMMgr->setFloaterOpen(TRUE); gIMMgr->addSession(LLCacheName::cleanFullName(avatar_name.getLegacyName()),IM_NOTHING_SPECIAL,agent_id); } // [Ansariel: Display name support] } else { // Group IM LLUUID session_id; session_id.generate(); gIMMgr->setFloaterOpen(TRUE); gIMMgr->addSession("Avatars Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); } } } return LLPanel::handleKeyHere(key, mask); }
void LLFloaterAvatarList::removeFocusFromAll() { std::map<LLUUID, LLAvatarListEntry>::iterator iter; for (iter = mAvatars.begin(); iter != mAvatars.end(); iter++) { LLAvatarListEntry *entry = &iter->second; entry->setFocus(FALSE); } }
std::string LLFloaterAvatarList::getSelectedName() { LLUUID id = getSelectedID(); LLAvatarListEntry *entry = getAvatarEntry(id); if (entry) { return entry->getName(); } return ""; }
//static void LLFloaterAvatarList::onClickAR(void *userdata) { LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; LLScrollListItem *item = self->mAvatarList->getFirstSelected(); if (item) { LLUUID agent_id = item->getUUID(); LLAvatarListEntry *entry = self->getAvatarEntry(agent_id); if (entry) { LLFloaterReporter::showFromObject(entry->getID()); } } }
void LLFloaterAvatarList::doCommand(void (*func)(const LLUUID &avatar, const std::string &name)) { LLDynamicArray<LLUUID> ids = mAvatarList->getSelectedIDs(); for (LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr) { LLUUID avid = *itr; LLAvatarListEntry *entry = getAvatarEntry(avid); if (entry != NULL) { llinfos << "Executing command on " << entry->getName() << llendl; func(avid, entry->getName()); } } }
//static void LLFloaterAvatarList::onClickMark(void *userdata) { LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; LLDynamicArray<LLUUID> ids = self->mAvatarList->getSelectedIDs(); for (LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr) { LLUUID avid = *itr; LLAvatarListEntry *entry = self->getAvatarEntry(avid); if (entry != NULL) { entry->toggleMark(); } } }
//static void LLFloaterAvatarList::onClickTeleport(void* userdata) { LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; LLScrollListItem *item = self->mAvatarList->getFirstSelected(); if (item) { LLUUID agent_id = item->getUUID(); LLAvatarListEntry *entry = self->getAvatarEntry(agent_id); if (entry) { // llinfos << "Trying to teleport to " << entry->getName() << " at " << entry->getPosition() << llendl; gAgent.teleportViaLocation(entry->getPosition()); } } }
void updateParticleActivity(LLDrawable *drawablep) { if (LLFloaterAvatarList::instanceExists()) { LLViewerObject *vobj = drawablep->getVObj(); if (vobj && vobj->isParticleSource()) { LLUUID id = vobj->mPartSourcep->getOwnerUUID(); LLAvatarListEntry *ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(id); if ( NULL != ent ) { ent->setActivity(LLAvatarListEntry::ACTIVITY_PARTICLES); } } } }
void LLFloaterAvatarList::onClickSendKeys(void *userdata) { LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; std::map<LLUUID, LLAvatarListEntry>::iterator iter; LLAvatarListEntry *entry; if (self->mAvatars.size() == 0) return; for (iter = self->mAvatars.begin(); iter != self->mAvatars.end(); iter++) { entry = &iter->second; if (!entry->isDead() && entry->isInSim()) announce(entry->getID().asString()); } }
std::string LLFloaterAvatarList::getSelectedNames(const std::string& separator) { std::string ret = ""; LLDynamicArray<LLUUID> ids = mAvatarList->getSelectedIDs(); for (LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr) { LLUUID avid = *itr; LLAvatarListEntry *entry = getAvatarEntry(avid); if (entry != NULL) { if (!ret.empty()) ret += separator; ret += entry->getName(); } } return ret; }
void LLFloaterAvatarList::onSelectName(LLUICtrl*, void* userdata) { LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata; LLScrollListItem *item = self->mAvatarList->getFirstSelected(); if (item) { LLUUID agent_id = item->getUUID(); LLAvatarListEntry *entry = self->getAvatarEntry(agent_id); if (entry) { BOOL enabled = entry->isDrawn(); self->childSetEnabled("focus_btn", enabled); self->childSetEnabled("prev_in_list_btn", enabled); self->childSetEnabled("next_in_list_btn", enabled); } } }
void LLFloaterAvatarList::focusOnNext(BOOL marked_only) { std::map<LLUUID, LLAvatarListEntry>::iterator iter; BOOL found = FALSE; LLAvatarListEntry *next = NULL; LLAvatarListEntry *entry; if (mAvatars.size() == 0) { return; } for (iter = mAvatars.begin(); iter != mAvatars.end(); iter++) { entry = &iter->second; if (entry->isDead()) continue; if (next == NULL && ((!marked_only && entry->isDrawn()) || entry->isMarked())) { next = entry; } if (found && ((!marked_only && entry->isDrawn()) || entry->isMarked())) { next = entry; break; } if (entry->getID() == mFocusedAvatar) { found = TRUE; } } if (next != NULL) { removeFocusFromAll(); next->setFocus(TRUE); mFocusedAvatar = next->getID(); gAgentCamera.lookAtObject(mFocusedAvatar, false); } }
void LLFloaterAvatarList::focusOnPrev(BOOL marked_only) { std::map<LLUUID, LLAvatarListEntry>::iterator iter; LLAvatarListEntry *prev = NULL; LLAvatarListEntry *entry; if (mAvatars.size() == 0) { return; } for (iter = mAvatars.begin(); iter != mAvatars.end(); iter++) { entry = &iter->second; if (entry->isDead()) continue; if (prev != NULL && entry->getID() == mFocusedAvatar) { break; } if ((!marked_only && entry->isDrawn()) || entry->isMarked()) { prev = entry; } } if (prev != NULL) { removeFocusFromAll(); prev->setFocus(TRUE); mFocusedAvatar = prev->getID(); gAgentCamera.lookAtObject(mFocusedAvatar, false); } }
/** * Redraws the avatar list * Only does anything if the avatar list is visible. * @author Dale Glass */ void LLFloaterAvatarList::refreshAvatarList() { // Don't update list when interface is hidden if (!sInstance->getVisible()) return; // We rebuild the list fully each time it's refreshed // The assumption is that it's faster to refill it and sort than // to rebuild the whole list. LLDynamicArray<LLUUID> selected = mAvatarList->getSelectedIDs(); S32 scrollpos = mAvatarList->getScrollPos(); mAvatarList->deleteAllItems(); LLVector3d mypos = gAgent.getPositionGlobal(); LLVector3d posagent; posagent.setVec(gAgent.getPositionAgent()); LLVector3d simpos = mypos - posagent; std::map<LLUUID, LLAvatarListEntry>::iterator iter; for (iter = mAvatars.begin(); iter != mAvatars.end(); iter++) { LLSD element; LLUUID av_id; std::string av_name; LLAvatarListEntry *entry = &iter->second; // Skip if avatar hasn't been around if (entry->isDead()) { continue; } av_id = entry->getID(); av_name = entry->getName().c_str(); LLVector3d position = entry->getPosition(); BOOL UnknownAltitude = false; LLVector3d delta = position - mypos; F32 distance = (F32)delta.magVec(); if (position.mdV[VZ] == 0.0) { UnknownAltitude = true; distance = 9000.0; } delta.mdV[2] = 0.0f; F32 side_distance = (F32)delta.magVec(); // HACK: Workaround for an apparent bug: // sometimes avatar entries get stuck, and are registered // by the client as perpetually moving in the same direction. // this makes sure they get removed from the visible list eventually //jcool410 -- this f***s up seeing dueds thru minimap data > 1024m away, so, lets just say > 2048m to the side is bad //aka 8 sims if (side_distance > 2048.0f) { continue; } if (av_id.isNull()) { //llwarns << "Avatar with null key somehow got into the list!" << llendl; continue; } element["id"] = av_id; element["columns"][LIST_MARK]["column"] = "marked"; element["columns"][LIST_MARK]["type"] = "text"; if (entry->isMarked()) { element["columns"][LIST_MARK]["value"] = "X"; element["columns"][LIST_MARK]["color"] = LLColor4::blue.getValue(); element["columns"][LIST_MARK]["font-style"] = "BOLD"; } else { element["columns"][LIST_MARK]["value"] = ""; } element["columns"][LIST_AVATAR_NAME]["column"] = "avatar_name"; element["columns"][LIST_AVATAR_NAME]["type"] = "text"; element["columns"][LIST_AVATAR_NAME]["value"] = av_name; if (entry->isFocused()) { element["columns"][LIST_AVATAR_NAME]["font-style"] = "BOLD"; } //<edit> custom colors for certain types of avatars! //Changed a bit so people can modify them in settings. And since they're colors, again it's possibly account-based. Starting to think I need a function just to determine that. - HgB //element["columns"][LIST_AVATAR_NAME]["color"] = gColors.getColor( "MapAvatar" ).getValue(); LLViewerRegion* parent_estate = LLWorld::getInstance()->getRegionFromPosGlobal(entry->getPosition()); LLUUID estate_owner = LLUUID::null; if(parent_estate && parent_estate->isAlive()) { estate_owner = parent_estate->getOwner(); } static const LLCachedControl<LLColor4> unselected_color(gColors, "ScrollUnselectedColor",LLColor4(LLColor4U(0, 0, 0, 204)) ); LLColor4 name_color = unselected_color; //Lindens are always more Linden than your friend, make that take precedence if(LLMuteList::getInstance()->isLinden(av_name)) { static const LLCachedControl<LLColor4> ascent_linden_color("AscentLindenColor",LLColor4(0.f,0.f,1.f,1.f)); name_color = ascent_linden_color; } //check if they are an estate owner at their current position else if(estate_owner.notNull() && av_id == estate_owner) { static const LLCachedControl<LLColor4> ascent_estate_owner_color("AscentEstateOwnerColor",LLColor4(1.f,0.6f,1.f,1.f)); name_color = ascent_estate_owner_color; } //without these dots, SL would suck. else if(is_agent_friend(av_id)) { static const LLCachedControl<LLColor4> ascent_friend_color("AscentFriendColor",LLColor4(1.f,1.f,0.f,1.f)); name_color = ascent_friend_color; } //big fat jerkface who is probably a jerk, display them as such. else if(LLMuteList::getInstance()->isMuted(av_id)) { static const LLCachedControl<LLColor4> ascent_muted_color("AscentMutedColor",LLColor4(0.7f,0.7f,0.7f,1.f)); name_color = ascent_muted_color; } name_color = name_color*0.5f + unselected_color*0.5f; element["columns"][LIST_AVATAR_NAME]["color"] = name_color.getValue(); char temp[32]; LLColor4 color = LLColor4::black; element["columns"][LIST_DISTANCE]["column"] = "distance"; element["columns"][LIST_DISTANCE]["type"] = "text"; if (UnknownAltitude) { strcpy(temp, "?"); if (entry->isDrawn()) { color = LLColor4::green2; } } else { if (distance < 100.0) { snprintf(temp, sizeof(temp), "%.1f", distance); if (distance > 20.0f) { color = LLColor4::yellow1; } else { color = LLColor4::red; } } else { if (entry->isDrawn()) { color = LLColor4::green2; } snprintf(temp, sizeof(temp), "%d", (S32)distance); } } element["columns"][LIST_DISTANCE]["value"] = temp; element["columns"][LIST_DISTANCE]["color"] = color.getValue(); position = position - simpos; S32 x = (S32)position.mdV[VX]; S32 y = (S32)position.mdV[VY]; if (x >= 0 && x <= 256 && y >= 0 && y <= 256) { snprintf(temp, sizeof(temp), "%d, %d", x, y); } else { temp[0] = '\0'; if (y < 0) { strcat(temp, "S"); } else if (y > 256) { strcat(temp, "N"); } if (x < 0) { strcat(temp, "W"); } else if (x > 256) { strcat(temp, "E"); } } element["columns"][LIST_POSITION]["column"] = "position"; element["columns"][LIST_POSITION]["type"] = "text"; element["columns"][LIST_POSITION]["value"] = temp; element["columns"][LIST_ALTITUDE]["column"] = "altitude"; element["columns"][LIST_ALTITUDE]["type"] = "text"; if (UnknownAltitude) { strcpy(temp, "?"); } else { snprintf(temp, sizeof(temp), "%d", (S32)position.mdV[VZ]); } element["columns"][LIST_ALTITUDE]["value"] = temp; element["columns"][LIST_CLIENT]["column"] = "client"; element["columns"][LIST_CLIENT]["type"] = "text"; //element["columns"][LIST_METADATA]["column"] = "metadata"; //element["columns"][LIST_METADATA]["type"] = "text"; static const LLCachedControl<LLColor4> avatar_name_color(gColors, "AvatarNameColor",LLColor4(LLColor4U(251, 175, 93, 255)) ); LLColor4 client_color(avatar_name_color); std::string client; LLVOAvatar *avatarp = gObjectList.findAvatar(av_id); if(avatarp) { avatarp->getClientInfo(client, client_color, TRUE); if(client == "") { client_color = unselected_color; client = "?"; } element["columns"][LIST_CLIENT]["value"] = client.c_str(); // <dogmode> // Don't expose Emerald's metadata. //if(avatarp->extraMetadata.length()) //{ // element["columns"][LIST_METADATA]["value"] = avatarp->extraMetadata.c_str(); //} } else { element["columns"][LIST_CLIENT]["value"] = "Out Of Range"; } //Blend to make the color show up better client_color = client_color *.5f + unselected_color * .5f; element["columns"][LIST_CLIENT]["color"] = client_color.getValue(); // Add to list mAvatarList->addElement(element, ADD_BOTTOM); } // finish mAvatarList->sortItems(); mAvatarList->selectMultiple(selected); mAvatarList->setScrollPos(scrollpos); // llinfos << "radar refresh: done" << llendl; }
void LLFloaterAvatarList::updateAvatarList() { //llinfos << "radar refresh: updating map" << llendl; // Check whether updates are enabled LLCheckboxCtrl* check = getChild<LLCheckboxCtrl>("update_enabled_cb"); if (check && !check->getValue()) { mUpdate = FALSE; refreshTracker(); return; } else { mUpdate = TRUE; } //moved to pipeline to prevent a crash //gPipeline.forAllVisibleDrawables(updateParticleActivity); //todo: make this less of a hacked up copypasta from dales 1.18. if(gAudiop != NULL) { LLAudioEngine::source_map::iterator iter; for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter) { LLAudioSource *sourcep = iter->second; LLUUID uuid = sourcep->getOwnerID(); LLAvatarListEntry *ent = getAvatarEntry(uuid); if ( ent ) { ent->setActivity(LLAvatarListEntry::ACTIVITY_SOUND); } } } LLVector3d mypos = gAgent.getPositionGlobal(); { std::vector<LLUUID> avatar_ids; std::vector<LLUUID> sorted_avatar_ids; std::vector<LLVector3d> positions; LLWorld::instance().getAvatars(&avatar_ids, &positions, mypos, F32_MAX); 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); } } size_t i; size_t count = avatar_ids.size(); bool announce = gSavedSettings.getBOOL("RadarChatKeys"); std::queue<LLUUID> announce_keys; for (i = 0; i < count; ++i) { std::string name; std::string first; std::string last; const LLUUID &avid = avatar_ids[i]; LLVector3d position; LLVOAvatar* avatarp = gObjectList.findAvatar(avid); if (avatarp) { // Skip if avatar is dead(what's that?) // or if the avatar is ourselves. // 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(); // [Ansariel: Display name support] LLAvatarName avatar_name; if (LLAvatarNameCache::get(avatarp->getID(), &avatar_name)) { static LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0); 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); if(avatarp->isTyping())mAvatars[avid].setActivity(LLAvatarListEntry::ACTIVITY_TYPING); } 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); } else { LLAvatarListEntry entry(avid, name, position); if(announce && gAgent.getRegion()->pointInRegionGlobal(position)) announce_keys.push(avid); mAvatars[avid] = entry; } } } //let us send the keys in a more timely fashion if(announce && !announce_keys.empty()) { std::ostringstream ids; int transact_num = (int)gFrameCount; int num_ids = 0; while(!announce_keys.empty()) { LLUUID id = announce_keys.front(); announce_keys.pop(); ids << "," << id.asString(); ++num_ids; if(ids.tellp() > 200) { gMessageSystem->newMessage("ScriptDialogReply"); gMessageSystem->nextBlock("AgentData"); gMessageSystem->addUUID("AgentID", gAgent.getID()); gMessageSystem->addUUID("SessionID", gAgent.getSessionID()); gMessageSystem->nextBlock("Data"); gMessageSystem->addUUID("ObjectID", gAgent.getID()); gMessageSystem->addS32("ChatChannel", -777777777); gMessageSystem->addS32("ButtonIndex", 1); gMessageSystem->addString("ButtonLabel",llformat("%d,%d", transact_num, num_ids) + ids.str()); gAgent.sendReliableMessage(); num_ids = 0; ids.seekp(0); ids.str(""); } } if(num_ids > 0) { gMessageSystem->newMessage("ScriptDialogReply"); gMessageSystem->nextBlock("AgentData"); gMessageSystem->addUUID("AgentID", gAgent.getID()); gMessageSystem->addUUID("SessionID", gAgent.getSessionID()); gMessageSystem->nextBlock("Data"); gMessageSystem->addUUID("ObjectID", gAgent.getID()); gMessageSystem->addS32("ChatChannel", -777777777); gMessageSystem->addS32("ButtonIndex", 1); gMessageSystem->addString("ButtonLabel",llformat("%d,%d", transact_num, num_ids) + ids.str()); gAgent.sendReliableMessage(); } } } // llinfos << "radar refresh: done" << llendl; expireAvatarList(); refreshAvatarList(); refreshTracker(); }
/** * Redraws the avatar list * Only does anything if the avatar list is visible. * @author Dale Glass */ void LLFloaterAvatarList::refreshAvatarList() { // Don't update list when interface is hidden if (!sInstance->getVisible()) return; // We rebuild the list fully each time it's refreshed // The assumption is that it's faster to refill it and sort than // to rebuild the whole list. LLDynamicArray<LLUUID> selected = mAvatarList->getSelectedIDs(); S32 scrollpos = mAvatarList->getScrollPos(); mAvatarList->deleteAllItems(); LLVector3d mypos = gAgent.getPositionGlobal(); LLVector3d posagent; posagent.setVec(gAgent.getPositionAgent()); LLVector3d simpos = mypos - posagent; std::map<LLUUID, LLAvatarListEntry>::iterator iter; for (iter = mAvatars.begin(); iter != mAvatars.end(); iter++) { LLSD element; LLUUID av_id; LLAvatarListEntry *entry = &iter->second; // Skip if avatar hasn't been around if (entry->isDead()) { continue; } av_id = entry->getID(); LLVector3d position = entry->getPosition(); BOOL UnknownAltitude = false; LLVector3d delta = position - mypos; F32 distance = (F32)delta.magVec(); if (position.mdV[VZ] == 0.0) { UnknownAltitude = true; distance = 9000.0; } delta.mdV[2] = 0.0f; F32 side_distance = (F32)delta.magVec(); // HACK: Workaround for an apparent bug: // sometimes avatar entries get stuck, and are registered // by the client as perpetually moving in the same direction. // this makes sure they get removed from the visible list eventually //jcool410 -- this f***s up seeing dueds thru minimap data > 1024m away, so, lets just say > 2048m to the side is bad //aka 8 sims if (side_distance > 2048.0f) { continue; } if (av_id.isNull()) { //llwarns << "Avatar with null key somehow got into the list!" << llendl; continue; } element["id"] = av_id; element["columns"][LIST_MARK]["column"] = "marked"; element["columns"][LIST_MARK]["type"] = "text"; if (entry->isMarked()) { element["columns"][LIST_MARK]["value"] = "X"; element["columns"][LIST_MARK]["color"] = LLColor4::blue.getValue(); element["columns"][LIST_MARK]["font-style"] = "BOLD"; } else { element["columns"][LIST_MARK]["value"] = ""; } element["columns"][LIST_AVATAR_NAME]["column"] = "avatar_name"; element["columns"][LIST_AVATAR_NAME]["type"] = "text"; element["columns"][LIST_AVATAR_NAME]["value"] = entry->getName().c_str(); if (entry->isFocused()) { element["columns"][LIST_AVATAR_NAME]["font-style"] = "BOLD"; } if (LLMuteList::getInstance()->isMuted(av_id)) { element["columns"][LIST_AVATAR_NAME]["color"] = LLColor4::red2.getValue(); } char temp[32]; LLColor4 color = LLColor4::black; element["columns"][LIST_DISTANCE]["column"] = "distance"; element["columns"][LIST_DISTANCE]["type"] = "text"; if (UnknownAltitude) { strcpy(temp, "?"); if (entry->isDrawn()) { color = LLColor4::red; } } else { if (distance < 100.0) { snprintf(temp, sizeof(temp), "%.1f", distance); if (distance > 20.0f) { color = LLColor4::yellow1; } else { color = LLColor4::green2; } } else { if (entry->isDrawn()) { color = LLColor4::red; } snprintf(temp, sizeof(temp), "%d", (S32)distance); } } element["columns"][LIST_DISTANCE]["value"] = temp; element["columns"][LIST_DISTANCE]["color"] = color.getValue(); position = position - simpos; S32 x = (S32)position.mdV[VX]; S32 y = (S32)position.mdV[VY]; if (x >= 0 && x <= 256 && y >= 0 && y <= 256) { snprintf(temp, sizeof(temp), "%d, %d", x, y); } else { temp[0] = '\0'; if (y < 0) { strcat(temp, "S"); } else if (y > 256) { strcat(temp, "N"); } if (x < 0) { strcat(temp, "W"); } else if (x > 256) { strcat(temp, "E"); } } element["columns"][LIST_POSITION]["column"] = "position"; element["columns"][LIST_POSITION]["type"] = "text"; element["columns"][LIST_POSITION]["value"] = temp; element["columns"][LIST_ALTITUDE]["column"] = "altitude"; element["columns"][LIST_ALTITUDE]["type"] = "text"; if (UnknownAltitude) { strcpy(temp, "?"); } else { snprintf(temp, sizeof(temp), "%d", (S32)position.mdV[VZ]); } element["columns"][LIST_ALTITUDE]["value"] = temp; // Add to list mAvatarList->addElement(element, ADD_BOTTOM); } // finish mAvatarList->sortItems(); mAvatarList->selectMultiple(selected); mAvatarList->setScrollPos(scrollpos); // llinfos << "radar refresh: done" << llendl; }
void LLFloaterAvatarList::updateAvatarList() { //llinfos << "radar refresh: updating map" << llendl; // Check whether updates are enabled LLCheckboxCtrl* check = getChild<LLCheckboxCtrl>("update_enabled_cb"); if (check && !check->getValue()) { mUpdate = FALSE; refreshTracker(); return; } else { mUpdate = TRUE; } //moved to pipeline to prevent a crash //gPipeline.forAllVisibleDrawables(updateParticleActivity); //todo: make this less of a hacked up copypasta from dales 1.18. if(gAudiop != NULL) { LLAudioEngine::source_map::iterator iter; for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter) { LLAudioSource *sourcep = iter->second; LLUUID uuid = sourcep->getOwnerID(); LLAvatarListEntry *ent = getAvatarEntry(uuid); if ( ent ) { ent->setActivity(LLAvatarListEntry::ACTIVITY_SOUND); } } } LLVector3d mypos = gAgent.getPositionGlobal(); { std::vector<LLUUID> avatar_ids; std::vector<LLUUID> sorted_avatar_ids; std::vector<LLVector3d> positions; LLWorld::instance().getAvatars(&avatar_ids, &positions, mypos, F32_MAX); sorted_avatar_ids = avatar_ids; std::sort(sorted_avatar_ids.begin(), sorted_avatar_ids.end()); BOOST_FOREACH(std::vector<LLCharacter*>::value_type& iter, LLCharacter::sInstances) { LLUUID avid = iter->getID(); if (!std::binary_search(sorted_avatar_ids.begin(), sorted_avatar_ids.end(), avid)) { avatar_ids.push_back(avid); } } size_t i; size_t count = avatar_ids.size(); static LLCachedControl<bool> announce(gSavedSettings, "RadarChatKeys"); std::queue<LLUUID> announce_keys; for (i = 0; i < count; ++i) { std::string name; const LLUUID &avid = avatar_ids[i]; LLVector3d position; LLVOAvatar* avatarp = gObjectList.findAvatar(avid); if (avatarp) { // Skip if avatar is dead(what's that?) // or if the avatar is ourselves. // 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(); entry->setPosition(position, gAgent.getRegion()->pointInRegionGlobal(position), false, dist < 20.0, dist < 100.0); } else { if(announce && gAgent.getRegion()->pointInRegionGlobal(position)) announce_keys.push(avid); mAvatars.push_back(LLAvatarListEntryPtr(new LLAvatarListEntry(avid, name, position))); } } } //let us send the keys in a more timely fashion if (announce && !announce_keys.empty()) { // NOTE: This fragment is repeated in sendKey std::ostringstream ids; int transact_num = (int)gFrameCount; int num_ids = 0; while(!announce_keys.empty()) { LLUUID id = announce_keys.front(); announce_keys.pop(); ids << "," << id.asString(); ++num_ids; if (ids.tellp() > 200) { send_keys_message(transact_num, num_ids, ids.str()); num_ids = 0; ids.seekp(0); ids.str(""); } } if (num_ids > 0) send_keys_message(transact_num, num_ids, ids.str()); } }
BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ) { BOOL handled = FALSE; if (gDisconnected) { return FALSE; } LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y , gSavedSettings.getBOOL( "MiniMapRotate" )) ); if( region ) { msg.assign(""); std::string fullname; if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname)) { // msg.append(fullname); // [RLVa:KB] - Version: 1.23.4 | Alternate: Meta7-370 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : gRlvHandler.getAnonym(fullname) ); // [/RLVa:KB] LLVector3d mypos = gAgent.getPositionGlobal(); LLVector3d position = mClosestAgentPosition; if ( LLFloaterAvatarList::getInstance() ) { LLAvatarListEntry *ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(mClosestAgentToCursor); if ( NULL != ent ) { //position = LLFloaterAvatarList::AvatarPosition(mClosestAgentToCursor); position = ent->getPosition(); } } LLVector3d delta = position - mypos; F32 distance = (F32)delta.magVec(); //llinfos << distance << " - " << position << llendl; msg.append( llformat("\n(Distance: %.02fm)\n\n",distance) ); } // [RLVa:KB] - Version: 1.23.4 | Alternate: Meta7-370 | Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-0.2.0b msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? region->getName() : rlv_handler_t::cstrHidden ); // [/RLVa:KB] // msg.append( region->getName() ); #ifndef LL_RELEASE_FOR_DOWNLOAD std::string buffer; msg.append("\n"); buffer = region->getHost().getHostName(); msg.append(buffer); msg.append("\n"); buffer = region->getHost().getString(); msg.append(buffer); #endif msg.append("\n"); msg.append(getToolTip()); S32 SLOP = 4; localPointToScreen( x - SLOP, y - SLOP, &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; handled = TRUE; } if(!handled) { return LLPanel::handleToolTip(x, y, msg, sticky_rect_screen); } return handled; }
BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ) { BOOL handled = FALSE; if (gDisconnected) { return FALSE; } LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(viewPosToGlobal(x, y, gSavedSettings.getBOOL( "MiniMapRotate" ))); if( region ) { msg.assign(""); std::string fullname; if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname)) { //msg.append(fullname); // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b // [Ansariel: Display name support] // msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname) ); if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { msg.append(RlvStrings::getAnonym(fullname)); } else { if (LLAvatarNameCache::useDisplayNames()) { LLAvatarName avatar_name; if (LLAvatarNameCache::get(mClosestAgentToCursor, &avatar_name)) { static const LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0); if (phoenix_name_system == 2 || (phoenix_name_system == 1 && avatar_name.mIsDisplayNameDefault)) { fullname = avatar_name.mDisplayName; } else { fullname = avatar_name.getCompleteName(true); } } } msg.append(fullname); } // [/Ansariel: Display name support] // [/RLVa:KB] msg.append("\n"); LLVector3d mypos = gAgent.getPositionGlobal(); LLVector3d position = mClosestAgentPosition; if ( LLFloaterAvatarList::instanceExists() ) { LLAvatarListEntry *ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(mClosestAgentToCursor); if ( NULL != ent ) { //position = LLFloaterAvatarList::AvatarPosition(mClosestAgentToCursor); position = ent->getPosition(); } } LLVector3d delta = position - mypos; F32 distance = (F32)delta.magVec(); //llinfos << distance << " - " << position << llendl; msg.append( llformat("\n(Distance: %.02fm)\n\n",distance) ); } // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-0.2.0b msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? region->getName() : RlvStrings::getString(RLV_STRING_HIDDEN) ); // [/RLVa:KB] //msg.append( region->getName() ); //#ifndef LL_RELEASE_FOR_DOWNLOAD std::string buffer; msg.append("\n"); buffer = region->getHost().getHostName(); msg.append(buffer); msg.append("\n"); buffer = region->getHost().getString(); msg.append(buffer); //#endif msg.append("\n"); msg.append(getToolTip()); S32 SLOP = 4; localPointToScreen( x - SLOP, y - SLOP, &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; handled = TRUE; } if(!handled) { return LLPanel::handleToolTip(x, y, msg, sticky_rect_screen); } return handled; }
BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ) { BOOL handled = FALSE; if (gDisconnected) { return FALSE; } LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y , gSavedSettings.getBOOL( "MiniMapRotate" )) ); if( region ) { msg.assign(""); std::string fullname; if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname)) { // msg.append(fullname); // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b // [Ansariel/Henri: Display name support] // msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname) ); if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { msg.append(RlvStrings::getAnonym(fullname)); } else { if (LLAvatarNameCache::useDisplayNames()) { LLAvatarName avatar_name; if (LLAvatarNameCache::get(mClosestAgentToCursor, &avatar_name)) { static LLCachedControl<S32> sPhoenixNameSystem(gSavedSettings, "PhoenixNameSystem"); if (sPhoenixNameSystem == 2 || (sPhoenixNameSystem == 1 && avatar_name.mIsDisplayNameDefault)) { fullname = avatar_name.mDisplayName; } else { fullname = avatar_name.getCompleteName(true); } } } msg.append(fullname); } // [/Ansariel/Henri: Display name support] // [/RLVa:KB] msg.append("\n"); LLVector3d mypos = gAgent.getPositionGlobal(); LLVector3d position = mClosestAgentPosition; bool isHigher1020mBug = (position.mdV[VZ] == 0.0); if ( LLFloaterAvatarList::getInstance() ) { LLAvatarListEntry *ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(mClosestAgentToCursor); if ( NULL != ent ) { //position = LLFloaterAvatarList::AvatarPosition(mClosestAgentToCursor); position = ent->getPosition(); // If avatar is >1020m and no viewer object exists, // it is beyond far clip, so the distance value is wrong! isHigher1020mBug = (isHigher1020mBug && gObjectList.findObject(mClosestAgentToCursor) == NULL); } } F32 distance; static LLCachedControl<F32> farClip(gSavedSettings, "RenderFarClip"); if (!isHigher1020mBug) { LLVector3d delta = position - mypos; distance = (F32)delta.magVec(); msg.append( llformat("\n(Distance: %.02fm)\n\n",distance) ); } else { distance = F32(farClip); msg.append( llformat("\n(Distance: > %.02fm)\n\n",distance) ); } } // msg.append( region->getName() ); // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-0.2.0b msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? region->getName() : RlvStrings::getString(RLV_STRING_HIDDEN) ); // [/RLVa:KB] // msg.append( region->getName() ); #ifndef LL_RELEASE_FOR_DOWNLOAD std::string buffer; msg.append("\n"); buffer = region->getHost().getHostName(); msg.append(buffer); msg.append("\n"); buffer = region->getHost().getString(); msg.append(buffer); #endif msg.append("\n"); msg.append(getToolTip()); S32 SLOP = 4; localPointToScreen( x - SLOP, y - SLOP, &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; handled = TRUE; } if(!handled) { return LLPanel::handleToolTip(x, y, msg, sticky_rect_screen); } return handled; }