Get rid of LLAvatarList and LLAvatarListItem as data model for the radar
parent
fda3891887
commit
e83052b6ba
|
|
@ -159,6 +159,7 @@ set(viewer_SOURCE_FILES
|
|||
fspanelprofileclassifieds.cpp
|
||||
fspose.cpp
|
||||
fsradar.cpp
|
||||
fsradarentry.cpp
|
||||
fsradarlistctrl.cpp
|
||||
fsradarmenu.cpp
|
||||
fsslurlcommand.cpp
|
||||
|
|
@ -824,6 +825,7 @@ set(viewer_HEADER_FILES
|
|||
fspanelprofileclassifieds.h
|
||||
fspose.h
|
||||
fsradar.h
|
||||
fsradarentry.h
|
||||
fsradarlistctrl.h
|
||||
fsradarmenu.h
|
||||
fsslurl.h
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include "fsradar.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llavatarlist.h"
|
||||
#include "llcalc.h"
|
||||
// <FS:Ansariel> [FS communication UI]
|
||||
//#include "llfloaternearbychat.h"
|
||||
|
|
@ -1172,20 +1171,17 @@ LLUUID cmdline_partial_name2key(std::string partial_name)
|
|||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
std::vector<LLPanel*> items;
|
||||
LLAvatarList* nearbyList = radar->getNearbyList();
|
||||
nearbyList->getItems(items);
|
||||
|
||||
for (std::vector<LLPanel*>::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem)
|
||||
FSRadar::entry_map_t radar_list = radar->getRadarList();
|
||||
FSRadar::entry_map_t::iterator it_end = radar_list.end();
|
||||
for (FSRadar::entry_map_t::iterator it = radar_list.begin(); it != it_end; ++it)
|
||||
{
|
||||
LLAvatarListItem* av = static_cast<LLAvatarListItem*>(*itItem);
|
||||
|
||||
av_name = av->getUserName();
|
||||
FSRadarEntry* entry = it->second;
|
||||
av_name = entry->getUserName();
|
||||
|
||||
LLStringUtil::toLower(av_name);
|
||||
if (strstr(av_name.c_str(), partial_name.c_str()))
|
||||
{
|
||||
return av->getAvatarId();
|
||||
return entry->getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1198,10 +1194,10 @@ void cmdline_tp2name(std::string target)
|
|||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (avkey.notNull() && radar)
|
||||
{
|
||||
LLAvatarListItem* avatar_list_item = radar->getNearbyList()->getAvatarListItem(avkey);
|
||||
if (avatar_list_item)
|
||||
FSRadarEntry* entry = radar->getEntry(avkey);
|
||||
if (entry)
|
||||
{
|
||||
LLVector3d pos = avatar_list_item->getPosition();
|
||||
LLVector3d pos = entry->getGlobalPos();
|
||||
pos.mdV[VZ] += 2.0;
|
||||
gAgent.teleportViaLocation(pos);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@
|
|||
#include <string>
|
||||
#include <boost/tokenizer.hpp> // for radar
|
||||
#include "fsradar.h"
|
||||
#include "llavatarlist.h"
|
||||
#include "llavatarlistitem.h"
|
||||
|
||||
#ifdef LL_STANDALONE
|
||||
#include <expat.h>
|
||||
|
|
@ -96,8 +94,6 @@ void FSLSLBridgeRequestRadarPosResponder::result(const LLSD& content)
|
|||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
LLAvatarList* nearbyList = radar->getNearbyList();
|
||||
|
||||
std::string strContent = content.asString();
|
||||
//llinfos << "Got info: " << strContent << llendl;
|
||||
// AO: parse content into pairs of [agent UUID,agent zHeight] , update our peoplepanel radar for each one
|
||||
|
|
@ -113,10 +109,10 @@ void FSLSLBridgeRequestRadarPosResponder::result(const LLSD& content)
|
|||
targetAv = LLUUID(*(tok_iter++));
|
||||
targetZ = (F32)::atof((*tok_iter).c_str());
|
||||
|
||||
LLAvatarListItem* avListItem = nearbyList->getAvatarListItem(targetAv);
|
||||
if (avListItem != NULL)
|
||||
FSRadarEntry* entry = radar->getEntry(targetAv);
|
||||
if (entry)
|
||||
{
|
||||
avListItem->setZOffset((F32)(targetZ));
|
||||
entry->setZOffset((F32)(targetZ));
|
||||
//llinfos << targetAv << " ::: " << targetZ << llendl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
// libs
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llcommonutils.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "lleventtimer.h"
|
||||
|
||||
|
|
@ -41,8 +42,8 @@
|
|||
#include "llagent.h"
|
||||
#include "llavataractions.h"
|
||||
#include "llavatarconstants.h" // for range constants
|
||||
#include "llavatarlist.h"
|
||||
#include "llgroupactions.h"
|
||||
#include "llmutelist.h"
|
||||
#include "llnotificationmanager.h"
|
||||
#include "lltracker.h"
|
||||
#include "llviewercontrol.h" // for gSavedSettings
|
||||
|
|
@ -91,25 +92,23 @@ public:
|
|||
//=============================================================================
|
||||
|
||||
FSRadar::FSRadar() :
|
||||
mNearbyList(NULL),
|
||||
mRadarAlertRequest(false),
|
||||
mRadarFrameCount(0),
|
||||
mRadarLastBulkOffsetRequestTime(0),
|
||||
mRadarLastRequestTime(0.f)
|
||||
{
|
||||
// TODO: Ewwww ugly! Need to get rid of LLAvatarList -Ansariel
|
||||
mNearbyList = new LLAvatarList(LLAvatarList::Params::Params());
|
||||
// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d
|
||||
mNearbyList->setRlvCheckShowNames(true);
|
||||
// [/RLVa:KB]
|
||||
|
||||
mRadarListUpdater = new FSRadarListUpdater(boost::bind(&FSRadar::updateRadarList, this));
|
||||
}
|
||||
|
||||
FSRadar::~FSRadar()
|
||||
{
|
||||
delete mRadarListUpdater;
|
||||
delete mNearbyList;
|
||||
|
||||
entry_map_t::iterator em_it_end = mEntryList.end();
|
||||
for (entry_map_t::iterator em_it = mEntryList.begin(); em_it != em_it_end; ++em_it)
|
||||
{
|
||||
delete em_it->second;
|
||||
}
|
||||
}
|
||||
|
||||
void FSRadar::radarAlertMsg(const LLUUID& agent_id, const LLAvatarName& av_name, const std::string& postMsg)
|
||||
|
|
@ -147,12 +146,6 @@ void FSRadar::radarAlertMsg(const LLUUID& agent_id, const LLAvatarName& av_name,
|
|||
|
||||
void FSRadar::updateRadarList()
|
||||
{
|
||||
//AO : Warning, reworked heavily for Firestorm.
|
||||
if (!mNearbyList)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Configuration
|
||||
LLWorld* world = LLWorld::getInstance();
|
||||
LLMuteList* mutelist = LLMuteList::getInstance();
|
||||
|
|
@ -211,9 +204,38 @@ void FSRadar::updateRadarList()
|
|||
{
|
||||
world->getAvatars(&avatar_ids, &positions);
|
||||
}
|
||||
mNearbyList->getIDs() = avatar_ids; // copy constructor, refreshing underlying mNearbyList
|
||||
mNearbyList->setDirty(true, true); // AO: These optional arguements force updating even when we're not a visible window.
|
||||
mNearbyList->getItems(items);
|
||||
|
||||
// Determine lists of new added and removed avatars
|
||||
uuid_vec_t current_vec, added_vec, removed_vec;
|
||||
uuid_vec_t::iterator vec_it_end;
|
||||
entry_map_t::iterator em_it_end = mEntryList.end();
|
||||
for (entry_map_t::iterator em_it = mEntryList.begin(); em_it != em_it_end; ++em_it)
|
||||
{
|
||||
current_vec.push_back(em_it->first);
|
||||
}
|
||||
LLCommonUtils::computeDifference(avatar_ids, current_vec, added_vec, removed_vec);
|
||||
|
||||
// Remove old avatars from our list
|
||||
vec_it_end = removed_vec.end();
|
||||
for (uuid_vec_t::iterator it = removed_vec.begin(); it != vec_it_end; ++it)
|
||||
{
|
||||
LLUUID avid = *it;
|
||||
entry_map_t::iterator found = mEntryList.find(avid);
|
||||
if (found != mEntryList.end())
|
||||
{
|
||||
delete found->second;
|
||||
mEntryList.erase(found);
|
||||
}
|
||||
}
|
||||
|
||||
// Add new avatars
|
||||
vec_it_end = added_vec.end();
|
||||
for (uuid_vec_t::iterator it = added_vec.begin(); it != vec_it_end; ++it)
|
||||
{
|
||||
LLUUID avid = *it;
|
||||
mEntryList[avid] = new FSRadarEntry(avid);
|
||||
}
|
||||
|
||||
LLLocalSpeakerMgr::getInstance()->update(TRUE);
|
||||
|
||||
//STEP 2: Transform detected model list data into more flexible multimap data structure;
|
||||
|
|
@ -233,14 +255,14 @@ void FSRadar::updateRadarList()
|
|||
//
|
||||
|
||||
LLUUID avId = static_cast<LLUUID>(*item_it);
|
||||
LLAvatarListItem* av = mNearbyList->getAvatarListItem(avId);
|
||||
LLVector3d avPos = static_cast<LLVector3d>(*pos_it);
|
||||
S32 seentime = 0;
|
||||
LLUUID avRegion;
|
||||
|
||||
// Skip modelling this avatar if its basic data is either inaccessible, or it's a dummy placeholder
|
||||
FSRadarEntry* ent = getEntry(avId);
|
||||
LLViewerRegion *reg = world->getRegionFromPosGlobal(avPos);
|
||||
if (!reg || !av) // don't update this radar listing if data is inaccessible
|
||||
if (!reg || !ent) // don't update this radar listing if data is inaccessible
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -272,24 +294,23 @@ void FSRadar::updateRadarList()
|
|||
}
|
||||
else
|
||||
{
|
||||
seentime = (S32)difftime(now, av->getFirstSeen());
|
||||
seentime = (S32)difftime(now, ent->mFirstSeen);
|
||||
}
|
||||
//av->setFirstSeen(now - (time_t)seentime); // maintain compatibility with underlying list, deprecated
|
||||
S32 hours = (S32)(seentime / 3600);
|
||||
S32 mins = (S32)((seentime - hours * 3600) / 60);
|
||||
S32 secs = (S32)((seentime - hours * 3600 - mins * 60));
|
||||
std::string avSeenStr = llformat("%d:%02d:%02d", hours, mins, secs);
|
||||
S32 avStatusFlags = av->getAvStatus();
|
||||
S32 avStatusFlags = ent->mStatus;
|
||||
std::string avFlagStr = "";
|
||||
if (avStatusFlags & AVATAR_IDENTIFIED)
|
||||
{
|
||||
avFlagStr += "$";
|
||||
}
|
||||
std::string avAgeStr = av->getAvatarAge();
|
||||
S32 avAge = ent->mAge;
|
||||
std::string avName = getRadarName(avId);
|
||||
av->setAvatarName(avName); // maintain compatibility with underlying list; used in other locations!
|
||||
U32 lastZOffsetTime = av->getLastZOffsetTime();
|
||||
F32 avZOffset = av->getZOffset();
|
||||
ent->mName = avName;
|
||||
U32 lastZOffsetTime = ent->mLastZOffsetTime;
|
||||
F32 avZOffset = ent->mZOffset;
|
||||
if (avPos[VZ] == AVATAR_UNKNOWN_Z_OFFSET) // if our official z position is AVATAR_UNKNOWN_Z_OFFSET, we need a correction.
|
||||
{
|
||||
// set correction if we have it
|
||||
|
|
@ -302,12 +323,12 @@ void FSRadar::updateRadarList()
|
|||
if (sUseLSLBridge && (now > (mRadarLastBulkOffsetRequestTime + FSRADAR_COARSE_OFFSET_INTERVAL)) && (now > lastZOffsetTime + FSRADAR_COARSE_OFFSET_INTERVAL))
|
||||
{
|
||||
mRadarOffsetRequests.push_back(avId);
|
||||
av->setLastZOffsetTime(now);
|
||||
ent->mLastZOffsetTime = now;
|
||||
}
|
||||
}
|
||||
F32 avRange = (avPos[VZ] != AVATAR_UNKNOWN_Z_OFFSET ? dist_vec(avPos, posSelf) : AVATAR_UNKNOWN_RANGE);
|
||||
av->setRange(avRange); // maintain compatibility with underlying list; used in other locations!
|
||||
av->setPosition(avPos); // maintain compatibility with underlying list; used in other locations!
|
||||
ent->mRange = avRange;
|
||||
ent->mGlobalPos = avPos;
|
||||
|
||||
//
|
||||
//2b. Process newly detected avatars
|
||||
|
|
@ -420,7 +441,7 @@ void FSRadar::updateRadarList()
|
|||
}
|
||||
else
|
||||
{
|
||||
LLAvatarNameCache::get(avId,boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, str_region_entering));
|
||||
LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, str_region_entering));
|
||||
}
|
||||
}
|
||||
else if (RadarReportSimRangeLeave && (rf.lastRegion == regionSelf) && (avRegion != regionSelf))
|
||||
|
|
@ -523,7 +544,7 @@ void FSRadar::updateRadarList()
|
|||
entry["name"] = avName;
|
||||
entry["in_region"] = (regionSelf == avRegion);
|
||||
entry["flags"] = avFlagStr;
|
||||
entry["age"] = avAgeStr;
|
||||
entry["age"] = avAge;
|
||||
entry["seen"] = avSeenStr;
|
||||
entry["range"] = (avRange > AVATAR_UNKNOWN_RANGE ? llformat("%3.2f", avRange) : llformat(">%3.2f", drawRadius));
|
||||
|
||||
|
|
@ -667,7 +688,7 @@ void FSRadar::updateRadarList()
|
|||
for (std::multimap<LLUUID, radarFields>::const_iterator i = lastRadarSweep.begin(); i != lastRadarSweep.end(); ++i)
|
||||
{
|
||||
LLUUID prevId = i->first;
|
||||
if (!mNearbyList->contains(prevId))
|
||||
if (mEntryList.find(prevId) == mEntryList.end())
|
||||
{
|
||||
radarFields rf = i->second;
|
||||
if (RadarReportChatRangeLeave && (rf.lastDistance <= chat_range_say) && rf.lastDistance > AVATAR_UNKNOWN_RANGE)
|
||||
|
|
@ -766,22 +787,23 @@ void FSRadar::updateRadarList()
|
|||
//
|
||||
|
||||
lastRadarSweep.clear();
|
||||
for (std::vector<LLPanel*>::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem)
|
||||
em_it_end = mEntryList.end();
|
||||
for (entry_map_t::iterator em_it = mEntryList.begin(); em_it != em_it_end; ++em_it)
|
||||
{
|
||||
LLAvatarListItem* av = static_cast<LLAvatarListItem*>(*itItem);
|
||||
FSRadarEntry* ent = em_it->second;
|
||||
radarFields rf;
|
||||
rf.avName = av->getAvatarName();
|
||||
rf.lastDistance = av->getRange();
|
||||
rf.firstSeen = av->getFirstSeen();
|
||||
rf.lastStatus = av->getAvStatus();
|
||||
rf.ZOffset = av->getZOffset();
|
||||
rf.lastGlobalPos = av->getPosition();
|
||||
rf.avName = ent->mName;
|
||||
rf.lastDistance = ent->mRange;
|
||||
rf.firstSeen = ent->mFirstSeen;
|
||||
rf.lastStatus = ent->mStatus;
|
||||
rf.ZOffset = ent->mZOffset;
|
||||
rf.lastGlobalPos = ent->mGlobalPos;
|
||||
// Ansariel: This seems to be wrong and isn't needed anywhere
|
||||
//if ((rf.ZOffset > 0) && (rf.lastGlobalPos[VZ] < 1024)) // if our position may need an offset correction, see if we have one to apply
|
||||
//{
|
||||
// rf.lastGlobalPos[VZ] = rf.lastGlobalPos[VZ] + (1024 * rf.ZOffset);
|
||||
//}
|
||||
//rf.lastZOffsetTime = av->getLastZOffsetTime();
|
||||
//rf.lastZOffsetTime = ent->mLastZOffsetTime;
|
||||
if (rf.lastGlobalPos != LLVector3d(0.0f, 0.0f, 0.0f))
|
||||
{
|
||||
LLViewerRegion* lastRegion = world->getRegionFromPosGlobal(rf.lastGlobalPos);
|
||||
|
|
@ -795,7 +817,7 @@ void FSRadar::updateRadarList()
|
|||
rf.lastRegion = LLUUID(0);
|
||||
}
|
||||
|
||||
lastRadarSweep.insert(std::pair<LLUUID, radarFields>(av->getAvatarId(), rf));
|
||||
lastRadarSweep.insert(std::pair<LLUUID, radarFields>(ent->mID, rf));
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -825,28 +847,33 @@ void FSRadar::requestRadarChannelAlertSync()
|
|||
}
|
||||
}
|
||||
|
||||
FSRadarEntry* FSRadar::getEntry(const LLUUID& avatar_id)
|
||||
{
|
||||
entry_map_t::iterator found = mEntryList.find(avatar_id);
|
||||
if (found == mEntryList.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return found->second;
|
||||
}
|
||||
|
||||
void FSRadar::teleportToAvatar(const LLUUID& targetAv)
|
||||
// Teleports user to last scanned location of nearby avatar
|
||||
// Note: currently teleportViaLocation is disrupted by enforced landing points set on a parcel.
|
||||
{
|
||||
std::vector<LLPanel*> items;
|
||||
mNearbyList->getItems(items);
|
||||
for (std::vector<LLPanel*>::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem)
|
||||
FSRadarEntry* entry = getEntry(targetAv);
|
||||
if (entry)
|
||||
{
|
||||
LLAvatarListItem* av = static_cast<LLAvatarListItem*>(*itItem);
|
||||
if (av->getAvatarId() == targetAv)
|
||||
LLVector3d avpos = entry->mGlobalPos;
|
||||
if (avpos.mdV[VZ] == AVATAR_UNKNOWN_Z_OFFSET)
|
||||
{
|
||||
LLVector3d avpos = av->getPosition();
|
||||
if (avpos.mdV[VZ] == AVATAR_UNKNOWN_Z_OFFSET)
|
||||
{
|
||||
LLNotificationsUtil::add("TeleportToAvatarNotPossible");
|
||||
}
|
||||
else
|
||||
{
|
||||
gAgent.teleportViaLocation(avpos);
|
||||
}
|
||||
return;
|
||||
LLNotificationsUtil::add("TeleportToAvatarNotPossible");
|
||||
}
|
||||
else
|
||||
{
|
||||
gAgent.teleportViaLocation(avpos);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1033,21 +1060,27 @@ void FSRadar::updateTracking()
|
|||
|
||||
void FSRadar::zoomAvatar(const LLUUID& avatar_id, const std::string& name)
|
||||
{
|
||||
LLAvatarListItem* avl_item = mNearbyList->getAvatarListItem(avatar_id);
|
||||
|
||||
if (!avl_item)
|
||||
FSRadarEntry* entry = getEntry(avatar_id);
|
||||
if (entry)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (avl_item->getRange() <= gSavedSettings.getF32("RenderFarClip"))
|
||||
{
|
||||
handle_zoom_to_object(avatar_id, avl_item->getPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
LLStringUtil::format_map_t args;
|
||||
args["AVATARNAME"] = name.c_str();
|
||||
reportToNearbyChat(LLTrans::getString("camera_no_focus", args));
|
||||
if (entry->mRange <= gSavedSettings.getF32("RenderFarClip"))
|
||||
{
|
||||
handle_zoom_to_object(avatar_id, entry->mGlobalPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLStringUtil::format_map_t args;
|
||||
args["AVATARNAME"] = name.c_str();
|
||||
reportToNearbyChat(LLTrans::getString("camera_no_focus", args));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FSRadar::updateNames()
|
||||
{
|
||||
const entry_map_t::iterator it_end = mEntryList.end();
|
||||
for (entry_map_t::iterator it = mEntryList.begin(); it != it_end; ++it)
|
||||
{
|
||||
it->second->updateName();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@
|
|||
|
||||
#include "llsingleton.h"
|
||||
|
||||
class LLAvatarList;
|
||||
#include "fsradarentry.h"
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
class LLAvatarName;
|
||||
|
||||
const U32 FSRADAR_MAX_AVATARS_PER_ALERT = 6; // maximum number of UUIDs we can cram into a single channel radar alert message
|
||||
|
|
@ -37,10 +39,13 @@ const U32 FSRADAR_COARSE_OFFSET_INTERVAL = 7; // seconds after which we query th
|
|||
const U32 FSRADAR_MAX_OFFSET_REQUESTS = 60; // 2048 / UUID size, leaving overhead space
|
||||
const U32 FSRADAR_CHAT_MIN_SPACING = 6; // minimum delay between radar chat messages
|
||||
|
||||
const U32 FSRADAR_NAMEFORMAT_DISPLAYNAME = 0;
|
||||
const U32 FSRADAR_NAMEFORMAT_USERNAME = 1;
|
||||
const U32 FSRADAR_NAMEFORMAT_DISPLAYNAME_USERNAME = 2;
|
||||
const U32 FSRADAR_NAMEFORMAT_USERNAME_DISPLAYNAME = 3;
|
||||
typedef enum e_radar_name_format
|
||||
{
|
||||
FSRADAR_NAMEFORMAT_DISPLAYNAME,
|
||||
FSRADAR_NAMEFORMAT_USERNAME,
|
||||
FSRADAR_NAMEFORMAT_DISPLAYNAME_USERNAME,
|
||||
FSRADAR_NAMEFORMAT_USERNAME_DISPLAYNAME
|
||||
} ERadarNameFormat;
|
||||
|
||||
|
||||
class FSRadar
|
||||
|
|
@ -51,14 +56,14 @@ class FSRadar
|
|||
friend class LLSingleton<FSRadar>;
|
||||
|
||||
public:
|
||||
// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.0d) | Added: RLVa-1.2.0d
|
||||
LLAvatarList* getNearbyList() { return mNearbyList; }
|
||||
// [/RLVa:KB]
|
||||
typedef boost::unordered_map<const LLUUID, FSRadarEntry*, FSUUIDHash> entry_map_t;
|
||||
entry_map_t getRadarList() { return mEntryList; }
|
||||
|
||||
void startTracking(const LLUUID& avatar_id);
|
||||
void zoomAvatar(const LLUUID& avatar_id, const std::string& name);
|
||||
void teleportToAvatar(const LLUUID& targetAv);
|
||||
void requestRadarChannelAlertSync();
|
||||
void updateNames();
|
||||
|
||||
static void onRadarNameFmtClicked(const LLSD& userdata);
|
||||
static bool radarNameFmtCheck(const LLSD& userdata);
|
||||
|
|
@ -66,6 +71,7 @@ public:
|
|||
static bool radarReportToCheck(const LLSD& userdata);
|
||||
|
||||
void getCurrentData(std::vector<LLSD>& entries, LLSD& stats) const { entries = mRadarEntriesData; stats = mAvatarStats; }
|
||||
FSRadarEntry* getEntry(const LLUUID& avatar_id);
|
||||
|
||||
// internals
|
||||
class Updater
|
||||
|
|
@ -106,8 +112,6 @@ private:
|
|||
std::string getRadarName(const LLAvatarName& avName);
|
||||
void radarAlertMsg(const LLUUID& agent_id, const LLAvatarName& av_name, const std::string& postMsg);
|
||||
|
||||
LLAvatarList* mNearbyList;
|
||||
|
||||
Updater* mRadarListUpdater;
|
||||
|
||||
struct radarFields
|
||||
|
|
@ -120,9 +124,10 @@ private:
|
|||
S32 lastStatus;
|
||||
U32 ZOffset;
|
||||
time_t lastZOffsetTime;
|
||||
|
||||
};
|
||||
|
||||
entry_map_t mEntryList;
|
||||
|
||||
std::multimap < LLUUID, radarFields > lastRadarSweep;
|
||||
std::vector <LLUUID> mRadarEnterAlerts;
|
||||
std::vector <LLUUID> mRadarLeaveAlerts;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
/**
|
||||
* @file fsradarentry.cpp
|
||||
* @brief Firestorm radar entry implementation
|
||||
*
|
||||
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
|
||||
* Copyright (c) 2013 Ansariel Hiller @ Second Life
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
|
||||
* http://www.firestormviewer.org
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "fsradarentry.h"
|
||||
|
||||
#include "llavatarnamecache.h"
|
||||
#include "rlvhandler.h"
|
||||
|
||||
FSRadarEntry::FSRadarEntry(const LLUUID& avid)
|
||||
: mID(avid),
|
||||
mName(LLStringUtil::null),
|
||||
mUserName(LLStringUtil::null),
|
||||
mDisplayName(LLStringUtil::null),
|
||||
mRange(0.f),
|
||||
mFirstSeen(time(NULL)),
|
||||
mGlobalPos(LLVector3d(0.0f,0.0f,0.0f)),
|
||||
mRegion(LLUUID::null),
|
||||
mStatus(0),
|
||||
mZOffset(0.f),
|
||||
mLastZOffsetTime(time(NULL))
|
||||
{
|
||||
// NOTE: typically we request these once on creation to avoid excess traffic/processing.
|
||||
//This means updates to these properties won't typically be seen while target is in nearby range.
|
||||
LLAvatarPropertiesProcessor* processor = LLAvatarPropertiesProcessor::getInstance();
|
||||
processor->addObserver(mID, this);
|
||||
processor->sendAvatarPropertiesRequest(mID);
|
||||
|
||||
updateName();
|
||||
}
|
||||
|
||||
FSRadarEntry::~FSRadarEntry()
|
||||
{
|
||||
if (mID.notNull())
|
||||
{
|
||||
LLAvatarPropertiesProcessor::getInstance()->removeObserver(mID, this); // may try to remove null observer
|
||||
}
|
||||
}
|
||||
|
||||
void FSRadarEntry::updateName()
|
||||
{
|
||||
LLAvatarNameCache::get(mID, boost::bind(&FSRadarEntry::onAvatarNameCache, this, _2));
|
||||
}
|
||||
|
||||
void FSRadarEntry::onAvatarNameCache(const LLAvatarName& av_name)
|
||||
{
|
||||
if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
|
||||
{
|
||||
mUserName = av_name.mUsername;
|
||||
mDisplayName = av_name.mDisplayName;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string name = RlvStrings::getAnonym(av_name);
|
||||
mUserName = name;
|
||||
mDisplayName = name;
|
||||
}
|
||||
}
|
||||
|
||||
void FSRadarEntry::processProperties(void* data, EAvatarProcessorType type)
|
||||
{
|
||||
if (data && type == APT_PROPERTIES)
|
||||
{
|
||||
LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
|
||||
mAge = ((LLDate::now().secondsSinceEpoch() - (avatar_data->born_on).secondsSinceEpoch()) / 86400);
|
||||
mStatus = avatar_data->flags;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* @file fsradarentry.h
|
||||
* @brief Firestorm radar entry implementation
|
||||
*
|
||||
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
|
||||
* Copyright (c) 2013 Ansariel Hiller @ Second Life
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
|
||||
* http://www.firestormviewer.org
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef FS_RADARENTRY_H
|
||||
#define FS_RADARENTRY_H
|
||||
|
||||
#include "llavatarpropertiesprocessor.h"
|
||||
|
||||
class LLAvatarName;
|
||||
|
||||
class FSRadarEntry : public LLAvatarPropertiesObserver
|
||||
{
|
||||
friend class FSRadar;
|
||||
|
||||
public:
|
||||
FSRadarEntry(const LLUUID& avid);
|
||||
~FSRadarEntry();
|
||||
|
||||
LLUUID getId() const { return mID; }
|
||||
std::string getName() const { return mName; }
|
||||
std::string getUserName() const { return mUserName; }
|
||||
std::string getDisplayName() const { return mDisplayName; }
|
||||
F32 getRange() const { return mRange; }
|
||||
LLVector3d getGlobalPos() const { return mGlobalPos; }
|
||||
LLUUID getRegion() const { return mRegion; }
|
||||
time_t getFirstSeen() const { return mFirstSeen; }
|
||||
S32 getStatus() const { return mStatus; }
|
||||
S32 getAge() const { return mAge; }
|
||||
F32 getZOffset() const { return mZOffset; }
|
||||
time_t getLastZOffsetTime() const { return mLastZOffsetTime; }
|
||||
|
||||
void setZOffset(F32 offset) { mZOffset = offset; }
|
||||
|
||||
private:
|
||||
void updateName();
|
||||
void onAvatarNameCache(const LLAvatarName& av_name);
|
||||
void processProperties(void* data, EAvatarProcessorType type);
|
||||
|
||||
LLUUID mID;
|
||||
std::string mName;
|
||||
std::string mUserName;
|
||||
std::string mDisplayName;
|
||||
F32 mRange;
|
||||
LLVector3d mGlobalPos;
|
||||
LLUUID mRegion;
|
||||
time_t mFirstSeen;
|
||||
S32 mStatus;
|
||||
S32 mAge;
|
||||
F32 mZOffset;
|
||||
time_t mLastZOffsetTime;
|
||||
|
||||
};
|
||||
|
||||
#endif // FS_RADARENTRY_H
|
||||
|
|
@ -31,24 +31,10 @@
|
|||
#include "fsradar.h"
|
||||
#include "llagent.h"
|
||||
#include "llavataractions.h"
|
||||
#include "llavatarlist.h"
|
||||
#include "llavatarlistitem.h"
|
||||
#include "llcommandhandler.h"
|
||||
#include "llnotificationsutil.h"
|
||||
|
||||
|
||||
LLAvatarListItem* getAvatarListItem(const LLUUID& avatar_id)
|
||||
{
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
return radar->getNearbyList()->getAvatarListItem(avatar_id);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
class FSSlurlCommandHandler : public LLCommandHandler
|
||||
{
|
||||
public:
|
||||
|
|
@ -98,13 +84,17 @@ public:
|
|||
{
|
||||
if (gAgentID != target_id)
|
||||
{
|
||||
LLAvatarListItem* avatar_list_item = getAvatarListItem(target_id);
|
||||
if (avatar_list_item)
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
LLVector3d pos = avatar_list_item->getPosition();
|
||||
pos.mdV[VZ] += 2.0;
|
||||
gAgent.teleportViaLocation(pos);
|
||||
return true;
|
||||
FSRadarEntry* entry = radar->getEntry(target_id);
|
||||
if (entry)
|
||||
{
|
||||
LLVector3d pos = entry->getGlobalPos();
|
||||
pos.mdV[VZ] += 2.0;
|
||||
gAgent.teleportViaLocation(pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
LLNotificationsUtil::add("TeleportToAvatarNotPossible");
|
||||
|
|
@ -118,13 +108,17 @@ public:
|
|||
if (gAgentID != target_id)
|
||||
{
|
||||
FSRadar* radar = FSRadar::getInstance();
|
||||
LLAvatarListItem* avatar_list_item = getAvatarListItem(target_id);
|
||||
if (avatar_list_item && radar)
|
||||
if (radar)
|
||||
{
|
||||
radar->startTracking(target_id);
|
||||
return true;
|
||||
FSRadarEntry* entry = radar->getEntry(target_id);
|
||||
if (entry)
|
||||
{
|
||||
radar->startTracking(target_id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LLNotificationsUtil::add("TrackAvatarNotPossible");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,8 +80,6 @@
|
|||
#include "llmutelist.h"
|
||||
|
||||
// Ansariel: For accessing the radar data
|
||||
#include "llavatarlist.h"
|
||||
#include "llavatarlistitem.h"
|
||||
#include "fsradar.h"
|
||||
#include "lggcontactsets.h"
|
||||
#include "fscommon.h"
|
||||
|
|
@ -1017,10 +1015,10 @@ BOOL LLNetMap::handleToolTipAgent(const LLUUID& avatar_id)
|
|||
FSRadar* radar = FSRadar::getInstance();
|
||||
if (radar)
|
||||
{
|
||||
LLAvatarListItem* avatar_list_item = radar->getNearbyList()->getAvatarListItem(avatar_id);
|
||||
if (avatar_list_item)
|
||||
FSRadarEntry* entry = radar->getEntry(avatar_id);
|
||||
if (entry)
|
||||
{
|
||||
F32 radar_distance = avatar_list_item->getRange();
|
||||
F32 radar_distance = entry->getRange();
|
||||
|
||||
if (radar_distance > AVATAR_UNKNOWN_RANGE)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -372,9 +372,9 @@ void RlvUIEnabler::onToggleShowNames(bool fQuitting)
|
|||
//if ( (pPeoplePanel) && (pPeoplePanel->getNearbyList()) )
|
||||
// pPeoplePanel->getNearbyList()->updateAvatarNames();
|
||||
FSRadar* pRadar = FSRadar::getInstance();
|
||||
RLV_ASSERT( (pRadar) && (pRadar->getNearbyList()) );
|
||||
if ( (pRadar) && (pRadar->getNearbyList()) )
|
||||
pRadar->getNearbyList()->updateAvatarNames();
|
||||
RLV_ASSERT( (pRadar) );
|
||||
if ( (pRadar) )
|
||||
pRadar->updateNames();
|
||||
// </FS:Ansariel> [Standalone radar]
|
||||
|
||||
// Refresh the speaker list
|
||||
|
|
|
|||
Loading…
Reference in New Issue