summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--indra/newview/llviewerobject.cpp50
1 files changed, 29 insertions, 21 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index f6c9abd53d..09e568d7be 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -46,6 +46,7 @@
#include "llfontgl.h"
#include "llframetimer.h"
#include "llinventory.h"
+#include "llinventorydefines.h"
#include "llmaterialtable.h"
#include "llmutelist.h"
#include "llnamevalue.h"
@@ -60,6 +61,7 @@
#include "llaudiosourcevo.h"
#include "llagent.h"
+#include "llagentcamera.h"
#include "llbbox.h"
#include "llbox.h"
#include "llcylinder.h"
@@ -134,7 +136,15 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
{
if (id == gAgentID)
{
- res = new LLVOAvatarSelf(id, pcode, regionp);
+ if (!gAgentAvatarp)
+ {
+ gAgentAvatarp = new LLVOAvatarSelf(id, pcode, regionp);
+ }
+ else
+ {
+ gAgentAvatarp->updateRegion(regionp);
+ }
+ res = gAgentAvatarp;
}
else
{
@@ -223,7 +233,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 +245,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 +387,10 @@ void LLViewerObject::markDead()
if (flagAnimSource())
{
- LLVOAvatar* avatarp = gAgent.getAvatarObject();
- if (avatarp && !avatarp->isDead())
+ if (isAgentAvatarValid())
{
// stop motions associated with this object
- avatarp->stopMotionFromSource(mID);
+ gAgentAvatarp->stopMotionFromSource(mID);
}
}
@@ -2170,8 +2179,8 @@ void LLViewerObject::deleteInventoryItem(const LLUUID& item_id)
{
if(mInventory)
{
- InventoryObjectList::iterator it = mInventory->begin();
- InventoryObjectList::iterator end = mInventory->end();
+ LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+ LLInventoryObject::object_list_t::iterator end = mInventory->end();
for( ; it != end; ++it )
{
if((*it)->getUUID() == item_id)
@@ -2481,7 +2490,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data)
}
else
{
- object->mInventory = new InventoryObjectList();
+ object->mInventory = new LLInventoryObject::object_list_t();
}
LLPointer<LLInventoryObject> obj;
obj = new LLInventoryObject(object->mID, LLUUID::null,
@@ -2537,7 +2546,7 @@ void LLViewerObject::loadTaskInvFile(const std::string& filename)
}
else
{
- mInventory = new InventoryObjectList;
+ mInventory = new LLInventoryObject::object_list_t;
}
while(ifs.good())
{
@@ -2670,8 +2679,8 @@ LLInventoryObject* LLViewerObject::getInventoryObject(const LLUUID& item_id)
LLInventoryObject* rv = NULL;
if(mInventory)
{
- InventoryObjectList::iterator it = mInventory->begin();
- InventoryObjectList::iterator end = mInventory->end();
+ LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+ LLInventoryObject::object_list_t::iterator end = mInventory->end();
for ( ; it != end; ++it)
{
if((*it)->getUUID() == item_id)
@@ -2684,12 +2693,12 @@ LLInventoryObject* LLViewerObject::getInventoryObject(const LLUUID& item_id)
return rv;
}
-void LLViewerObject::getInventoryContents(InventoryObjectList& objects)
+void LLViewerObject::getInventoryContents(LLInventoryObject::object_list_t& objects)
{
if(mInventory)
{
- InventoryObjectList::iterator it = mInventory->begin();
- InventoryObjectList::iterator end = mInventory->end();
+ LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+ LLInventoryObject::object_list_t::iterator end = mInventory->end();
for( ; it != end; ++it)
{
if ((*it)->getType() != LLAssetType::AT_CATEGORY)
@@ -2719,8 +2728,8 @@ LLViewerInventoryItem* LLViewerObject::getInventoryItemByAsset(const LLUUID& ass
{
LLViewerInventoryItem* item = NULL;
- InventoryObjectList::iterator it = mInventory->begin();
- InventoryObjectList::iterator end = mInventory->end();
+ LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+ LLInventoryObject::object_list_t::iterator end = mInventory->end();
for( ; it != end; ++it)
{
LLInventoryObject* obj = *it;
@@ -2758,7 +2767,7 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent)
return;
}
- LLVector3 viewer_pos_agent = agent.getCameraPositionAgent();
+ LLVector3 viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
LLVector3 pos_agent = getRenderPosition();
F32 dx = viewer_pos_agent.mV[VX] - pos_agent.mV[VX];
@@ -4082,8 +4091,8 @@ S32 LLViewerObject::countInventoryContents(LLAssetType::EType type)
S32 count = 0;
if( mInventory )
{
- InventoryObjectList::const_iterator it = mInventory->begin();
- InventoryObjectList::const_iterator end = mInventory->end();
+ LLInventoryObject::object_list_t::const_iterator it = mInventory->begin();
+ LLInventoryObject::object_list_t::const_iterator end = mInventory->end();
for( ; it != end ; ++it )
{
if( (*it)->getType() == type )
@@ -4920,7 +4929,6 @@ void LLViewerObject::setIncludeInSearch(bool include_in_search)
void LLViewerObject::setRegion(LLViewerRegion *regionp)
{
- llassert(regionp);
mLatestRecvPacketID = 0;
mRegionp = regionp;