From 94e6e10739c8321b6fb651a109901380ef92975a Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 29 Mar 2010 12:00:26 -0400 Subject: EXT-6536 : Make LLVOAvatarSelf a singleton Superficial cleanup to replace all instances of "LLVOAvatarSelf *avatarp = gAgent.getAvatarObject" with "gAgentAvatar". --- indra/newview/llviewerobject.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') 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; -- cgit v1.2.3