summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-03-29 12:00:26 -0400
committerLoren Shih <seraph@lindenlab.com>2010-03-29 12:00:26 -0400
commit94e6e10739c8321b6fb651a109901380ef92975a (patch)
tree629fec2892c2bb0bce4f35f42ef4cad54408f174 /indra/newview/llviewerobject.cpp
parent46fe5d49caef6c8db3df9d88f0d0ec773ef28095 (diff)
EXT-6536 : Make LLVOAvatarSelf a singleton
Superficial cleanup to replace all instances of "LLVOAvatarSelf *avatarp = gAgent.getAvatarObject" with "gAgentAvatar".
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--indra/newview/llviewerobject.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index abcb7e5452..f3eb75bcd0 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -134,7 +134,15 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
{
if (id == gAgentID)
{
- res = new LLVOAvatarSelf(id, pcode, regionp);
+ if (!gAgentAvatar)
+ {
+ gAgentAvatar = new LLVOAvatarSelf(id, pcode, regionp);
+ }
+ else
+ {
+ gAgentAvatar->updateRegion(regionp);
+ }
+ res = gAgentAvatar;
}
else
{
@@ -223,7 +231,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
mClickAction(0),
mAttachmentItemID(LLUUID::null)
{
- if(!is_global)
+ if (!is_global)
{
llassert(mRegionp);
}
@@ -235,7 +243,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
mPositionRegion = LLVector3(0.f, 0.f, 0.f);
- if(!is_global)
+ if (!is_global && mRegionp)
{
mPositionAgent = mRegionp->getOriginAgent();
}
@@ -377,11 +385,10 @@ void LLViewerObject::markDead()
if (flagAnimSource())
{
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (avatarp && !avatarp->isDead())
+ if (isAgentAvatarValid())
{
// stop motions associated with this object
- avatarp->stopMotionFromSource(mID);
+ gAgentAvatar->stopMotionFromSource(mID);
}
}
@@ -4920,7 +4927,6 @@ void LLViewerObject::setIncludeInSearch(bool include_in_search)
void LLViewerObject::setRegion(LLViewerRegion *regionp)
{
- llassert(regionp);
mLatestRecvPacketID = 0;
mRegionp = regionp;