summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2012-05-04 14:58:24 -0400
committerOz Linden <oz@lindenlab.com>2012-05-04 14:58:24 -0400
commitaa0a0542a10ba6faeca34afd6e323b505493d8dc (patch)
tree1551d35617818a2906ddef605eae664f18cce48d /indra
parenta7454671b4ad27d55bdb0f0dd50efac8499ae72f (diff)
parent784ec584013eff80ab31d10370c14e2d954cea51 (diff)
merge changes for drtvwr-142
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llviewerobject.cpp16
-rw-r--r--indra/newview/llworld.cpp32
-rw-r--r--indra/newview/llworld.h5
3 files changed, 38 insertions, 15 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index e590f29a9a..cd300accb7 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -877,6 +877,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
LLMemType mt(LLMemType::MTYPE_OBJECT);
U32 retval = 0x0;
+ // If region is removed from the list it is also deleted.
+ if (!LLWorld::instance().isRegionListed(mRegionp))
+ {
+ llwarns << "Updating object in an invalid region" << llendl;
+ return retval;
+ }
+
// Coordinates of objects on simulators are region-local.
U64 region_handle;
mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
@@ -3478,7 +3485,8 @@ LLNameValue *LLViewerObject::getNVPair(const std::string& name) const
void LLViewerObject::updatePositionCaches() const
{
- if(mRegionp)
+ // If region is removed from the list it is also deleted.
+ if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
{
if (!isRoot())
{
@@ -3495,7 +3503,8 @@ void LLViewerObject::updatePositionCaches() const
const LLVector3d LLViewerObject::getPositionGlobal() const
{
- if(mRegionp)
+ // If region is removed from the list it is also deleted.
+ if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
{
LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion());
@@ -3514,7 +3523,8 @@ const LLVector3d LLViewerObject::getPositionGlobal() const
const LLVector3 &LLViewerObject::getPositionAgent() const
{
- if (mRegionp)
+ // If region is removed from the list it is also deleted.
+ if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
{
if (mDrawable.notNull() && (!mDrawable->isRoot() && getParent()))
{
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index fbd8b3ada3..3d971e738e 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -1188,20 +1188,23 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi
iter != LLCharacter::sInstances.end(); ++iter)
{
LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter;
- LLVector3d pos_global = pVOAvatar->getPositionGlobal();
- LLUUID uuid = pVOAvatar->getID();
- if( !pVOAvatar->isDead()
- && !pVOAvatar->isSelf()
- && !uuid.isNull() &&
- dist_vec_squared(pos_global, relative_to) <= radius_squared)
+
+ if (!pVOAvatar->isDead() && !pVOAvatar->isSelf())
{
- if(positions != NULL)
- {
- positions->push_back(pos_global);
- }
- if(avatar_ids !=NULL)
+ LLVector3d pos_global = pVOAvatar->getPositionGlobal();
+ LLUUID uuid = pVOAvatar->getID();
+
+ if (!uuid.isNull()
+ && dist_vec_squared(pos_global, relative_to) <= radius_squared)
{
- avatar_ids->push_back(uuid);
+ if(positions != NULL)
+ {
+ positions->push_back(pos_global);
+ }
+ if(avatar_ids !=NULL)
+ {
+ avatar_ids->push_back(uuid);
+ }
}
}
}
@@ -1232,6 +1235,11 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi
}
}
+bool LLWorld::isRegionListed(const LLViewerRegion* region) const
+{
+ region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region);
+ return it != mRegionList.end();
+}
LLHTTPRegistration<LLEstablishAgentCommunication>
gHTTPRegistrationEstablishAgentCommunication(
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index d8ab4bc508..f350009d10 100644
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -157,6 +157,11 @@ public:
std::vector<LLVector3d>* positions = NULL,
const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const;
+ // Returns 'true' if the region is in mRegionList,
+ // 'false' if the region has been removed due to region change
+ // or if the circuit to this simulator had been lost.
+ bool isRegionListed(const LLViewerRegion* region) const;
+
private:
region_list_t mActiveRegionList;
region_list_t mRegionList;