summaryrefslogtreecommitdiff
path: root/indra/newview/lllandmarkactions.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-10-01 17:52:30 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-10-01 17:52:30 +0000
commit1713a3552b7017cbf781f2effd448f2e8cfb9372 (patch)
tree1ffbfd1155ee84a9db937ba9cf1520c0248e6c92 /indra/newview/lllandmarkactions.cpp
parentcf9814bc05f17e233e5d03e63fc2e519512b3e58 (diff)
merge -r 1879-1884 https://svn.aws.productengine.com/secondlife/pe/stable-2
* Major Bugs: EXT-1248 EXT-1127 EXT-844 EXT-1160 * Changes: EXT-1139 (places context menu)
Diffstat (limited to 'indra/newview/lllandmarkactions.cpp')
-rw-r--r--indra/newview/lllandmarkactions.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index 2ad83c76b5..0542199fc1 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -53,10 +53,15 @@
#include "llagentui.h"
-class LLFetchlLandmarkByAgentPos : public LLInventoryCollectFunctor
+class LLFetchlLandmarkByPos : public LLInventoryCollectFunctor
{
-
+private:
+ LLVector3d mPos;
public:
+ LLFetchlLandmarkByPos(const LLVector3d& pos) :
+ mPos(pos)
+ {}
+
/*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
if (!item || item->getType() != LLAssetType::AT_LANDMARK)
@@ -69,11 +74,10 @@ public:
LLVector3d landmark_global_pos;
if (!landmark->getGlobalPos(landmark_global_pos))
return false;
- LLVector3d a_pos = gAgent.getPositionGlobal();
//we have to round off each coordinates to compare positions properly
- return llround(a_pos.mdV[VX]) == llround(landmark_global_pos.mdV[VX])
- && llround(a_pos.mdV[VY]) == llround(landmark_global_pos.mdV[VY])
- && llround(a_pos.mdV[VZ]) == llround(landmark_global_pos.mdV[VZ]);
+ return llround(mPos.mdV[VX]) == llround(landmark_global_pos.mdV[VX])
+ && llround(mPos.mdV[VY]) == llround(landmark_global_pos.mdV[VY])
+ && llround(mPos.mdV[VZ]) == llround(landmark_global_pos.mdV[VZ]);
}
};
@@ -147,12 +151,12 @@ bool LLLandmarkActions::landmarkAlreadyExists()
}
-LLViewerInventoryItem* LLLandmarkActions::findLandmarkForAgentPos()
+LLViewerInventoryItem* LLLandmarkActions::findLandmarkForGlobalPos(const LLVector3d &pos)
{
// Determine whether there are landmarks pointing to the current parcel.
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
- LLFetchlLandmarkByAgentPos is_current_pos_landmark;
+ LLFetchlLandmarkByPos is_current_pos_landmark(pos);
gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
cats,
items,
@@ -167,6 +171,11 @@ LLViewerInventoryItem* LLLandmarkActions::findLandmarkForAgentPos()
return items[0];
}
+LLViewerInventoryItem* LLLandmarkActions::findLandmarkForAgentPos()
+{
+ return findLandmarkForGlobalPos(gAgent.getPositionGlobal());
+}
+
bool LLLandmarkActions::canCreateLandmarkHere()
{
LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();