diff -r ebd53632620a indra/newview/llworld.cpp --- a/indra/newview/llworld.cpp Tue Feb 01 17:55:33 2011 -0700 +++ b/indra/newview/llworld.cpp Wed Feb 02 18:31:32 2011 -0500 @@ -1450,6 +1450,30 @@ { positions->clear(); } + + // 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) + { + LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; + if(!pVOAvatar->isDead() && !pVOAvatar->isSelf()) + { + LLUUID uuid = pVOAvatar->getID(); + if(!uuid.isNull()) + { + LLVector3d pos_global = pVOAvatar->getPositionGlobal(); + 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); + } + } + } + } + // 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) { @@ -1461,13 +1485,15 @@ LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global); if(dist_vec(pos_global, relative_to) <= radius) { - if(positions != NULL) + 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()) { - positions->push_back(pos_global); - } - if(avatar_ids != NULL) - { - avatar_ids->push_back(regionp->mMapAvatarIDs.get(i)); + if(positions != NULL) + { + positions->push_back(pos_global); + } + avatar_ids->push_back(uuid); } } }