diff options
author | Twisted Laws twisted_laws@hotmail.com <Twisted Laws twisted_laws@hotmail.com> | 2011-03-09 17:59:59 -0500 |
---|---|---|
committer | Twisted Laws twisted_laws@hotmail.com <Twisted Laws twisted_laws@hotmail.com> | 2011-03-09 17:59:59 -0500 |
commit | 03c9c4da848b4e75055828a6d8df1d64d382928a (patch) | |
tree | dfa56834e66e7c1b0378dba12700a2522a79dde8 /indra | |
parent | 0c02401498521f87d38778df0e795960aa5445e1 (diff) |
STORM-954 patch correction
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llworld.cpp | 65 |
1 files changed, 27 insertions, 38 deletions
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<LLVector3d>* 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<LLCharacter*>::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<LLCharacter*>::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); } } |