From 03c9c4da848b4e75055828a6d8df1d64d382928a Mon Sep 17 00:00:00 2001 From: "Twisted Laws twisted_laws@hotmail.com" Date: Wed, 9 Mar 2011 17:59:59 -0500 Subject: STORM-954 patch correction --- indra/newview/llworld.cpp | 65 ++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 38 deletions(-) (limited to 'indra/newview/llworld.cpp') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 8f7197c607..8ace747d60 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1454,59 +1454,48 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi { positions->clear(); } - for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + // get the list of avatars from the character list first, so distances are correct + // when agent is above 1020m and other avatars are nearby + for (std::vector::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) { - LLViewerRegion* regionp = *iter; - const LLVector3d& origin_global = regionp->getOriginGlobal(); - S32 count = regionp->mMapAvatars.count(); - for (S32 i = 0; i < count; i++) + LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; + if(!pVOAvatar->isDead() && !pVOAvatar->isSelf()) { - LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global); - if(dist_vec(pos_global, relative_to) <= radius) + LLUUID uuid = pVOAvatar->getID(); + if(!uuid.isNull()) { - if(positions != NULL) - { - positions->push_back(pos_global); - } - if(avatar_ids != NULL) + LLVector3d pos_global = pVOAvatar->getPositionGlobal(); + if(dist_vec(pos_global, relative_to) <= radius) { - avatar_ids->push_back(regionp->mMapAvatarIDs.get(i)); + if(positions != NULL) + positions->push_back(pos_global); + if(avatar_ids !=NULL) + avatar_ids->push_back(uuid); } } } } - // retrieve the list of close avatars from viewer objects as well - // for when we are above 1000m, only do this when we are retrieving - // uuid's too as there could be duplicates - if(avatar_ids != NULL) + // region avatars added for situations where radius is greater than RenderFarClip + for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { - for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + LLViewerRegion* regionp = *iter; + const LLVector3d& origin_global = regionp->getOriginGlobal(); + S32 count = regionp->mMapAvatars.count(); + for (S32 i = 0; i < count; i++) { - LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; - if(pVOAvatar->isDead() || pVOAvatar->isSelf()) - continue; - LLUUID uuid = pVOAvatar->getID(); - if(uuid.isNull()) - continue; - LLVector3d pos_global = pVOAvatar->getPositionGlobal(); + LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global); if(dist_vec(pos_global, relative_to) <= radius) { - bool found = false; - uuid_vec_t::iterator sel_iter = avatar_ids->begin(); - for (; sel_iter != avatar_ids->end(); sel_iter++) - { - if(*sel_iter == uuid) - { - found = true; - break; - } - } - if(!found) + LLUUID uuid = regionp->mMapAvatarIDs.get(i); + // if this avatar doesn't already exist in the list, add it + if(uuid.notNull() && avatar_ids!=NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end()) { if(positions != NULL) + { positions->push_back(pos_global); + } avatar_ids->push_back(uuid); } } -- cgit v1.2.3 From c9c192e2c476e73807d23cdda0814cb221a96b95 Mon Sep 17 00:00:00 2001 From: "Twisted Laws twisted_laws@hotmail.com" Date: Thu, 31 Mar 2011 16:46:25 -0400 Subject: Storm 954 - corrected use of braces --- indra/newview/llworld.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llworld.cpp') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 8ace747d60..6a2b4cf0a5 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1469,9 +1469,13 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi if(dist_vec(pos_global, relative_to) <= radius) { if(positions != NULL) + { positions->push_back(pos_global); + } if(avatar_ids !=NULL) + { avatar_ids->push_back(uuid); + } } } } -- cgit v1.2.3