diff options
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 53832422d8..082b1349cf 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -818,7 +818,8 @@ LLVOAvatar::~LLVOAvatar() { sInstances.remove(this); - if (gSavedSettings.getBOOL("IMShowArrivalsDepartures")) + static LLCachedControl<bool> show_arrival_departures(gSavedSettings, "IMShowArrivalsDepartures", false); + if (show_arrival_departures) { LLAvatarName av_name; LLAvatarNameCache::get(getID(), &av_name); @@ -2583,31 +2584,21 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, { mDebugExistenceTimer.reset(); debugAvatarRezTime("AvatarRezArrivedNotification", "avatar arrived"); - if (gSavedSettings.getBOOL("IMShowArrivalsDepartures")) + static LLCachedControl<bool> show_arrival_departures(gSavedSettings, "IMShowArrivalsDepartures", false); + if (show_arrival_departures) { - uuid_vec_t uuids; - std::vector<LLVector3d> positions; - LLWorld::getInstance()->getAvatars(&uuids, &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("MPVNearMeRange")); - auto pos_it = positions.begin(); - auto id_it = uuids.begin(); - for (;pos_it != positions.end() && id_it != uuids.end(); ++pos_it, ++id_it) - { - if (*id_it == getID() && !isSelf()) - { - LLAvatarName av_name; - LLAvatarNameCache::get(getID(), &av_name); - auto display_name = av_name.getDisplayName(); - if (!display_name.empty()) - { - LLChat chat{llformat("%s arrived (%.1f m).", display_name.c_str(), dist_vec(*pos_it, gAgent.getPositionGlobal()))}; - chat.mFromName = display_name; - chat.mFromID = getID(); - LLSD args; - args["COLOR"] = "ChatHistoryTextColor"; - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); - } - break; - } + LLAvatarName av_name; + LLAvatarNameCache::get(getID(), &av_name); + auto display_name = av_name.getDisplayName(); + if (!display_name.empty()) + { + auto avatarsPositions = gAgent.getAvatarsPositions(); + LLChat chat{llformat("%s arrived (%.1f m).", display_name.c_str(), dist_vec(avatarsPositions[getID()], gAgent.getPositionGlobal()))}; + chat.mFromName = display_name; + chat.mFromID = getID(); + LLSD args; + args["COLOR"] = "ChatHistoryTextColor"; + LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); } } } |