diff options
author | Rick Pasetto <rick@lindenlab.com> | 2009-11-03 09:44:09 -0800 |
---|---|---|
committer | Rick Pasetto <rick@lindenlab.com> | 2009-11-03 09:44:09 -0800 |
commit | a0bbe8d8eb98aaba1dc55c7cbcb70d58125781ce (patch) | |
tree | 279f3421a88280d6003d6973dcb5556702e2c52f /indra/newview/lllandmarkactions.cpp | |
parent | c59e2d21174415842b1418c5f389becb7c013706 (diff) | |
parent | c9d121dd01625790cb963372c861f8e4072430d2 (diff) |
merge from remote repo
Diffstat (limited to 'indra/newview/lllandmarkactions.cpp')
-rw-r--r-- | indra/newview/lllandmarkactions.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index 091346d3b4..0b07dd4f21 100644 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -133,6 +133,33 @@ public: } }; +// Returns true if the given inventory item is a landmark pointing to the current parcel. +// Used to find out if there is at least one landmark from current parcel. +class LLFistAgentParcelLandmark : public LLInventoryCollectFunctor +{ +private: + bool mFounded;// to avoid unnecessary check + +public: + LLFistAgentParcelLandmark(): mFounded(false){} + + /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) + { + if (mFounded || !item || item->getType() != LLAssetType::AT_LANDMARK) + return false; + + LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID()); + if (!landmark) // the landmark not been loaded yet + return false; + + LLVector3d landmark_global_pos; + if (!landmark->getGlobalPos(landmark_global_pos)) + return false; + mFounded = LLViewerParcelMgr::getInstance()->inAgentParcel(landmark_global_pos); + return mFounded; + } +}; + static void fetch_landmarks(LLInventoryModel::cat_array_t& cats, LLInventoryModel::item_array_t& items, LLInventoryCollectFunctor& add) @@ -172,6 +199,16 @@ bool LLLandmarkActions::landmarkAlreadyExists() return findLandmarkForAgentPos() != NULL; } +//static +bool LLLandmarkActions::hasParcelLandmark() +{ + LLFistAgentParcelLandmark get_first_agent_landmark; + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + fetch_landmarks(cats, items, get_first_agent_landmark); + return !items.empty(); + +} // *TODO: This could be made more efficient by only fetching the FIRST // landmark that meets the criteria |