summaryrefslogtreecommitdiff
path: root/indra/newview/lllandmarkactions.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-08-26 20:47:27 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-08-26 20:47:27 +0000
commitaf98aad98d43ec8b128ecac3089426d6ae6edc3f (patch)
tree5971f87afc04580df470a003793dcc8c974e29a7 /indra/newview/lllandmarkactions.cpp
parent6a364e6f32c12c1ab2c0f33e8ef07d885a8765a2 (diff)
svn merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1471 https://svn.aws.productengine.com/secondlife/pe/stable-1@1476 -> viewer-2.0.0-3
EXT-65 EXT-270 EXT-359 EXT-361 EXT-367 EXT-367 EXT-368 EXT-455 EXT-468 EXT-530 EXT-539 EXT-540 EXT-542 EXT-545 EXT-555 EXT-557 EXT-558 EXT-559 EXT-559 EXT-560 EXT-561 EXT-562 EXT-563 EXT-564 EXT-566 EXT-568 EXT-569 EXT-570 EXT-571 EXT-581 EXT-590 EXT-594 EXT-596 EXT-597 EXT-601 EXT-602 EXT-603 EXT-613 EXT-620 EXT-624 EXT-628 EXT-630 EXT-631 EXT-632 EXT-639 EXT-640 EXT-641 EXT-642 EXT-662 EXT-671 EXT-672 EXT-676 EXT-682 EXT-692 EXT-703 EXT-717
Diffstat (limited to 'indra/newview/lllandmarkactions.cpp')
-rw-r--r--indra/newview/lllandmarkactions.cpp58
1 files changed, 45 insertions, 13 deletions
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index aa5432740c..2c56a70ced 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -50,6 +50,7 @@
#include "llworldmap.h"
#include "lllandmark.h"
#include "llinventorymodel.h"
+#include "llagentui.h"
// Returns true if the given inventory item is a landmark pointing to the current parcel.
// Used to filter inventory items.
@@ -78,6 +79,8 @@ class LLFetchLandmarksByName : public LLInventoryCollectFunctor
private:
std::string name;
BOOL use_substring;
+ //this member will be contain copy of founded items to keep the result unique
+ std::set<std::string> check_duplicate;
public:
LLFetchLandmarksByName(std::string &landmark_name, BOOL if_use_substring)
@@ -97,28 +100,35 @@ public:
if (!landmark) // the landmark not been loaded yet
return false;
+ bool acceptable = false;
std::string landmark_name = item->getName();
LLStringUtil::toLower(landmark_name);
if(use_substring)
{
- if ( landmark_name.find( name ) != std::string::npos)
- return true;
+ acceptable = landmark_name.find( name ) != std::string::npos;
}
else
{
- if ( landmark_name == name )
- return true;
+ acceptable = landmark_name == name;
+ }
+ if(acceptable){
+ if(check_duplicate.find(landmark_name) != check_duplicate.end()){
+ // we have duplicated items in landmarks
+ acceptable = false;
+ }else{
+ check_duplicate.insert(landmark_name);
+ }
}
- return false;
+ return acceptable;
}
};
-LLInventoryModel::item_array_t LLLandmarkActions::fetchLandmarksByName(std::string& name, BOOL if_starts_with)
+LLInventoryModel::item_array_t LLLandmarkActions::fetchLandmarksByName(std::string& name, BOOL use_substring)
{
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
- LLFetchLandmarksByName fetchLandmarks(name, if_starts_with);
+ LLFetchLandmarksByName fetchLandmarks(name, use_substring);
gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
cats,
items,
@@ -135,6 +145,27 @@ bool LLLandmarkActions::landmarkAlreadyExists()
return !items.empty();
}
+
+LLViewerInventoryItem* LLLandmarkActions::findLandmarkForAgentParcel()
+{
+ // Determine whether there are landmarks pointing to the current parcel.
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLIsAgentParcelLandmark is_current_parcel_landmark;
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_current_parcel_landmark);
+
+ if(items.empty())
+ {
+ return NULL;
+ }
+
+ return items[0];
+}
+
bool LLLandmarkActions::canCreateLandmarkHere()
{
LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
@@ -187,21 +218,20 @@ void LLLandmarkActions::createLandmarkHere()
{
std::string landmark_name, landmark_desc;
- gAgent.buildLocationString(landmark_name, LLAgent::LOCATION_FORMAT_LANDMARK);
- gAgent.buildLocationString(landmark_desc, LLAgent::LOCATION_FORMAT_FULL);
+ LLAgentUI::buildLocationString(landmark_name, LLAgent::LOCATION_FORMAT_LANDMARK);
+ LLAgentUI::buildLocationString(landmark_desc, LLAgent::LOCATION_FORMAT_FULL);
LLUUID folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK);
createLandmarkHere(landmark_name, landmark_desc, folder_id);
}
-void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb)
+void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped /* = true */)
{
std::string sim_name;
bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
if (gotSimName)
{
- std::string slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos);
-
+ std::string slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos, escaped);
cb(slurl);
return;
@@ -213,6 +243,7 @@ void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slur
LLWorldMap::url_callback_t url_cb = boost::bind(&LLLandmarkActions::onRegionResponse,
cb,
global_pos,
+ escaped,
_1, _2, _3, _4);
LLWorldMap::getInstance()->sendHandleRegionRequest(new_region_handle, url_cb, std::string("unused"), false);
@@ -221,6 +252,7 @@ void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slur
void LLLandmarkActions::onRegionResponse(slurl_callback_t cb,
const LLVector3d& global_pos,
+ bool escaped,
U64 region_handle,
const std::string& url,
const LLUUID& snapshot_id,
@@ -231,7 +263,7 @@ void LLLandmarkActions::onRegionResponse(slurl_callback_t cb,
bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
if (gotSimName)
{
- slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos);
+ slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos, escaped);
}
else
{