diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f611cb14c..a264b810c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7768,17 +7768,6 @@ This should be as low as possible, but too low may break functionality Value 1 - RadarUpdateRate - - Comment - Radar update rate (0 = high, 1 = medium, 2 = low) - Persist - 1 - Type - U32 - Value - 1 - RadarAlertShowDist Comment diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index 549a010c0..025f4fa1f 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -559,12 +559,9 @@ LLUUID cmdline_partial_name2key(std::string partial_name) std::string av_name; LLStringUtil::toLower(partial_name); LLWorld::getInstance()->getAvatars(&avatars); - bool has_avatarlist = LLFloaterAvatarList::instanceExists(); - if (has_avatarlist) - LLFloaterAvatarList::getInstance()->updateAvatarList(); for(std::vector::const_iterator i = avatars.begin(); i != avatars.end(); ++i) { - if (LLAvatarListEntry* entry = has_avatarlist ? LLFloaterAvatarList::instance().getAvatarEntry(*i) : NULL) + if (LLAvatarListEntry* entry = LLFloaterAvatarList::instanceExists() ? LLFloaterAvatarList::instance().getAvatarEntry(*i) : NULL) av_name = entry->getName(); else if (gCacheName->getFullName(*i, av_name)); else if (LLVOAvatar* avatarp = gObjectList.findAvatar(*i)) diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 7a6adbee9..738a260de 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -35,7 +35,6 @@ #include "llagent.h" #include "llagentcamera.h" #include "llavataractions.h" -#include "llcallbacklist.h" #include "llfloaterchat.h" #include "llfloaterregioninfo.h" #include "llfloaterreporter.h" @@ -59,10 +58,7 @@ #include "rlvhandler.h" // [/RLVa:KB] -/** - * @brief How long to keep people who are gone in the list and in memory. - */ -const F32 DEAD_KEEP_TIME = 0.5f; +LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& origin); extern U32 gFrameCount; @@ -138,7 +134,7 @@ namespace LLAvatarListEntry::LLAvatarListEntry(const LLUUID& id, const std::string& name, const LLVector3d& position) : mID(id), mName(name), mPosition(position), mMarked(false), mFocused(false), - mUpdateTimer(), mFrame(gFrameCount), mStats(), + mStats(), mActivityType(ACTIVITY_NEW), mActivityTimer(), mIsInList(false), mAge(-1), mTime(time(NULL)) { @@ -190,7 +186,6 @@ void LLAvatarListEntry::processProperties(void* data, EAvatarProcessorType type) void LLAvatarListEntry::setPosition(const LLVector3d& position, const F32& dist, bool drawn) { mPosition = position; - mFrame = gFrameCount; bool here(dist != F32_MIN); // F32_MIN only if dead bool this_sim(here && (gAgent.getRegion()->pointInRegionGlobal(position) || !(LLWorld::getInstance()->positionRegionValidGlobal(position)))); if (this_sim != mStats[STAT_TYPE_SIM]) chat_avatar_status(mName, mID, STAT_TYPE_SIM, mStats[STAT_TYPE_SIM] = this_sim, dist); @@ -199,22 +194,6 @@ void LLAvatarListEntry::setPosition(const LLVector3d& position, const F32& dist, if (shoutrange != mStats[STAT_TYPE_SHOUTRANGE]) chat_avatar_status(mName, mID, STAT_TYPE_SHOUTRANGE, mStats[STAT_TYPE_SHOUTRANGE] = shoutrange, dist); bool chatrange(here && dist < LFSimFeatureHandler::getInstance()->sayRange()); if (chatrange != mStats[STAT_TYPE_CHATRANGE]) chat_avatar_status(mName, mID, STAT_TYPE_CHATRANGE, mStats[STAT_TYPE_CHATRANGE] = chatrange, dist); - mUpdateTimer.start(); -} - -bool LLAvatarListEntry::getAlive() const -{ - return ((gFrameCount - mFrame) <= 2); -} - -F32 LLAvatarListEntry::getEntryAgeSeconds() const -{ - return mUpdateTimer.getElapsedTimeF32(); -} - -bool LLAvatarListEntry::isDead() const -{ - return getEntryAgeSeconds() > DEAD_KEEP_TIME; } void LLAvatarListEntry::resetName(const bool& hide_tags, const bool& anon_names, const std::string& hidden) @@ -244,7 +223,6 @@ const LLAvatarListEntry::ACTIVITY_TYPE LLAvatarListEntry::getActivity() { mActivityType = ACTIVITY_NONE; } - if (isDead()) return ACTIVITY_DEAD; return mActivityType; } @@ -253,7 +231,6 @@ LLFloaterAvatarList::LLFloaterAvatarList() : LLFloater(std::string("radar")), mTracking(false), mUpdate("RadarUpdateEnabled"), mDirtyAvatarSorting(false), - mUpdateRate(gSavedSettings.getU32("RadarUpdateRate") * 3 + 3), mAvatarList(NULL) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_radar.xml"); @@ -261,7 +238,6 @@ LLFloaterAvatarList::LLFloaterAvatarList() : LLFloater(std::string("radar")), LLFloaterAvatarList::~LLFloaterAvatarList() { - gIdleCallbacks.deleteFunction(LLFloaterAvatarList::callbackIdle); } //static @@ -423,9 +399,6 @@ BOOL LLFloaterAvatarList::postBuild() childSetAction("send_keys_btn", boost::bind(&LLFloaterAvatarList::sendKeys, this)); - getChild("update_rate")->setSelectedIndex(gSavedSettings.getU32("RadarUpdateRate")); - getChild("update_rate")->setCommitCallback(boost::bind(&LLFloaterAvatarList::onCommitUpdateRate, this)); - gSavedSettings.getControl("RadarColumnMarkHidden")->getSignal()->connect(boost::bind(&LLFloaterAvatarList::assessColumns, this)); gSavedSettings.getControl("RadarColumnPositionHidden")->getSignal()->connect(boost::bind(&LLFloaterAvatarList::assessColumns, this)); gSavedSettings.getControl("RadarColumnAltitudeHidden")->getSignal()->connect(boost::bind(&LLFloaterAvatarList::assessColumns, this)); @@ -443,8 +416,6 @@ BOOL LLFloaterAvatarList::postBuild() mAvatarList->setSortChangedCallback(boost::bind(&LLFloaterAvatarList::onAvatarSortingChanged,this)); refreshAvatarList(); - gIdleCallbacks.addFunction(LLFloaterAvatarList::callbackIdle); - assessColumns(); if(gHippoGridManager->getConnectedGrid()->isSecondLife()) @@ -538,10 +509,8 @@ void updateParticleActivity(LLDrawable *drawablep) } } -void LLFloaterAvatarList::updateAvatarList() +void LLFloaterAvatarList::updateAvatarList(const LLViewerRegion* region) { - //LL_INFOS() << "radar refresh: updating map" << LL_ENDL; - // Check whether updates are enabled if (!mUpdate) { @@ -550,10 +519,12 @@ void LLFloaterAvatarList::updateAvatarList() } { - LLWorld::pos_map_t avs; - LLVector3d mypos = gAgent.getPositionGlobal(); + const std::vector& map_avs(region->mMapAvatars); + const std::vector& map_avids(region->mMapAvatarIDs); + const LLVector3d& mypos(gAgent.getPositionGlobal()); + const LLVector3d& origin(region->getOriginGlobal()); static const LLCachedControl radar_range_radius("RadarRangeRadius", 0); - LLWorld::instance().getAvatars(&avs, mypos, radar_range_radius ? radar_range_radius : F32_MAX); + const F32 max_range(radar_range_radius * radar_range_radius); static LLCachedControl announce(gSavedSettings, "RadarChatKeys"); std::queue announce_keys; @@ -561,19 +532,21 @@ void LLFloaterAvatarList::updateAvatarList() bool no_names(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)); bool anon_names(!no_names && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); const std::string& rlv_hidden(RlvStrings::getString(RLV_STRING_HIDDEN)); - for (LLWorld::pos_map_t::const_iterator i = avs.cbegin(), end = avs.cend(); i != end; ++i) + for (size_t i = 0, size = map_avs.size(); i < size; ++i) { - const LLUUID& avid = i->first; + const LLUUID& avid = map_avids[i]; + LLVector3d position(unpackLocalToGlobalPosition(map_avs[i], origin)); + + LLVOAvatar* avatarp = gObjectList.findAvatar(avid); + if (avatarp) position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition()); + + if (max_range && dist_vec_squared(position, mypos) > max_range) continue; // Out of desired range + std::string name; if (no_names) name = rlv_hidden; else if (!LLAvatarNameCache::getNSName(avid, name, radar_namesystem())) continue; //prevent (Loading...) else if (anon_names) name = RlvStrings::getAnonym(name); - LLVector3d position = i->second; - - LLVOAvatar* avatarp = gObjectList.findAvatar(avid); - if (avatarp) position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition()); - LLAvatarListEntry* entry = getAvatarEntry(avid); if (!entry) { @@ -617,10 +590,20 @@ void LLFloaterAvatarList::updateAvatarList() if (num_ids) send_keys_message(transact_num, num_ids, ids.str()); } } +} -// LL_INFOS() << "radar refresh: done" << LL_ENDL; - - expireAvatarList(); +void LLFloaterAvatarList::expireAvatarList(const std::list& ids) +{ + BOOST_FOREACH(const LLUUID& id, ids) + { + av_list_t::iterator it(std::find_if(mAvatars.begin(), mAvatars.end(), LLAvatarListEntry::uuidMatch(id))); + if (it != mAvatars.end()) + { + LLAvatarListEntry* entry = it->get(); + entry->setPosition(entry->getPosition(), F32_MIN, false); // Dead and gone + mAvatars.erase(it); + } + } if (mAvatars.empty()) setTitle(getString("Title")); @@ -637,24 +620,6 @@ void LLFloaterAvatarList::updateAvatarList() refreshTracker(); } -void LLFloaterAvatarList::expireAvatarList() -{ -// LL_INFOS() << "radar: expiring" << LL_ENDL; - for(av_list_t::iterator it = mAvatars.begin(); it != mAvatars.end();) - { - LLAvatarListEntry* entry = it->get(); - if (entry->getAlive() && !entry->isDead()) - { - ++it; - } - else - { - entry->setPosition(entry->getPosition(), F32_MIN, false); // Dead and gone - it = mAvatars.erase(it); - } - } -} - void LLFloaterAvatarList::updateAvatarSorting() { if (mDirtyAvatarSorting) @@ -707,9 +672,6 @@ void LLFloaterAvatarList::refreshAvatarList() bool name_restricted(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS) || gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); BOOST_FOREACH(av_list_t::value_type& entry, mAvatars) { - // Skip if avatar hasn't been around - if (entry->isDead()) continue; - LLVector3d position = entry->getPosition(); LLVector3d delta = position - mypos; bool UnknownAltitude = position.mdV[VZ] == (gHippoGridManager->getConnectedGrid()->isSecondLife() ? 1020.f : 0.f); @@ -1510,19 +1472,6 @@ void LLFloaterAvatarList::callbackBanFromEstate(const LLSD& notification, const } } -//static -void LLFloaterAvatarList::callbackIdle(void*) -{ - if (instanceExists()) - { - LLFloaterAvatarList& inst(instance()); - const U32& rate = inst.mUpdateRate; - // Do not update at every frame: this would be insane! - if (rate == 0 || (gFrameCount % rate == 0)) - inst.updateAvatarList(); - } -} - void LLFloaterAvatarList::onClickFreeze() { LLSD args; @@ -1580,8 +1529,3 @@ void LLFloaterAvatarList::onSelectName() } } } - -void LLFloaterAvatarList::onCommitUpdateRate() -{ - mUpdateRate = gSavedSettings.getU32("RadarUpdateRate") * 3 + 3; -} diff --git a/indra/newview/llfloateravatarlist.h b/indra/newview/llfloateravatarlist.h index c77d87c53..93230f9a5 100644 --- a/indra/newview/llfloateravatarlist.h +++ b/indra/newview/llfloateravatarlist.h @@ -62,7 +62,6 @@ enum ACTIVITY_TYPE ACTIVITY_TYPING, /** Typing */ ACTIVITY_NEW, /** Avatar just appeared */ ACTIVITY_SOUND, /** Playing a sound */ - ACTIVITY_DEAD /** Avatar isn't around anymore, and will be removed soon from the list */ }; /** * @brief Initializes a list entry @@ -84,19 +83,6 @@ enum ACTIVITY_TYPE const LLVector3d& getPosition() const { return mPosition; } - /** - * @brief Returns the age of this entry in frames - * - * This is only used for determining whether the avatar is still around. - * @see getEntryAgeSeconds - */ - bool getAlive() const; - - /** - * @brief Returns the age of this entry in seconds - */ - F32 getEntryAgeSeconds() const; - /* * @brief resets the name accordance with RLVa */ @@ -137,11 +123,6 @@ enum ACTIVITY_TYPE void setInList() { mIsInList = true; } bool isInList() const { return mIsInList; } - /** - * @brief Returns whether the item is dead and shouldn't appear in the list - * @returns true if dead - */ - bool isDead() const; void toggleMark() { mMarked = !mMarked; } @@ -169,20 +150,9 @@ private: */ std::bitset mStats; - /** - * @brief Timer to keep track of whether avatars are still there - */ - - LLTimer mUpdateTimer; - ACTIVITY_TYPE mActivityType; LLTimer mActivityTimer; - - /** - * @brief Last frame when this avatar was updated - */ - U32 mFrame; }; @@ -232,7 +202,7 @@ public: /** * @brief Updates the internal avatar list with the currently present avatars. */ - void updateAvatarList(); + void updateAvatarList(const class LLViewerRegion* region); /** * @brief Refresh avatar list (display) @@ -327,7 +297,6 @@ public: void onClickGetKey(); void onSelectName(); - void onCommitUpdateRate(); /** * @brief These callbacks fire off notifications, which THEN fire the related callback* functions. @@ -359,7 +328,7 @@ public: * to keep people passing by in the list long enough that it's possible * to do something to them. */ - void expireAvatarList(); + void expireAvatarList(const std::list& ids); void updateAvatarSorting(); private: @@ -375,11 +344,6 @@ private: */ const LLCachedControl mUpdate; - /** - * @brief Update rate (if min frames per update) - */ - U32 mUpdateRate; - // tracking data bool mTracking; // Tracking ? LLUUID mTrackedAvatar; // Who we are tracking diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 257433332..fe478f309 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -57,6 +57,7 @@ #include "llcommandhandler.h" #include "lldir.h" #include "lleventpoll.h" +#include "llfloateravatarlist.h" #include "llfloatergodtools.h" #include "llfloaterperms.h" #include "llfloaterreporter.h" @@ -1250,6 +1251,7 @@ LLHTTPRegistration void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) { //LL_INFOS() << "CoarseLocationUpdate" << LL_ENDL; + std::list map_avids(mMapAvatarIDs.begin(), mMapAvatarIDs.end()); mMapAvatars.reset(); mMapAvatarIDs.reset(); // only matters in a rare case but it's good to be safe. @@ -1304,9 +1306,16 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) if(has_agent_data) { mMapAvatarIDs.put(agent_id); + map_avids.remove(agent_id); } } } + if (LLFloaterAvatarList::instanceExists()) + { + LLFloaterAvatarList& inst(LLFloaterAvatarList::instance()); + inst.updateAvatarList(this); + inst.expireAvatarList(map_avids); + } } void LLViewerRegion::getInfo(LLSD& info) diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 5d0d0757f..020c6a53e 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1530,7 +1530,7 @@ void send_agent_resume() LLAppViewer::instance()->resumeMainloopTimeout(); } -static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin) +LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin) { LLVector3d pos_local; diff --git a/indra/newview/skins/default/xui/de/floater_radar.xml b/indra/newview/skins/default/xui/de/floater_radar.xml index 6aca43c8a..25493ba0c 100644 --- a/indra/newview/skins/default/xui/de/floater_radar.xml +++ b/indra/newview/skins/default/xui/de/floater_radar.xml @@ -65,12 +65,6 @@ - Intervall: - - Hoch - Mittel - Niedrig -