Updating the teleport-me-to-it behavior for the characters and linksets. Firstly, to remove the direct call to gAgent.teleportRequest() which is being made into a private function. Secondly, to check the viewer object list to see if the object exists there, and if so, to use that location as the teleport destination.

meow-7.2.2
Todd Stinson 2012-06-26 14:47:50 -07:00
parent 2cd321eaa9
commit 16ba7ae82c
1 changed files with 15 additions and 8 deletions

View File

@ -57,9 +57,10 @@
#include "llviewerobject.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
#include "v4color.h"
#include "pipeline.h"
#include "llfloaterreg.h"
#include "v3dmath.h"
#include "v3math.h"
#include "v4color.h"
#define DEFAULT_BEACON_WIDTH 6
@ -488,14 +489,20 @@ void LLFloaterPathfindingObjects::teleportToSelectedObject()
std::vector<LLScrollListItem*>::const_reference selectedItemRef = selectedItems.front();
const LLScrollListItem *selectedItem = selectedItemRef;
llassert(mObjectList != NULL);
const LLPathfindingObjectPtr objectPtr = mObjectList->find(selectedItem->getUUID().asString());
const LLVector3 &objectLocation = objectPtr->getLocation();
LLViewerRegion* region = gAgent.getRegion();
if (region != NULL)
LLVector3d teleportLocation;
LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
if (viewerObject == NULL)
{
gAgent.teleportRequest(region->getHandle(), objectLocation, true);
// If we cannot find the object in the viewer list, teleport to the last reported position
const LLPathfindingObjectPtr objectPtr = mObjectList->find(selectedItem->getUUID().asString());
teleportLocation = gAgent.getPosGlobalFromAgent(objectPtr->getLocation());
}
else
{
// If we can find the object in the viewer list, teleport to the known current position
teleportLocation = viewerObject->getPositionGlobal();
}
gAgent.teleportViaLocationLookAt(teleportLocation);
}
}