diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp index 0d8b45db1fe52111b4f3729690ebd4231945ef54..5bff2cb38fc336c154792872df1e13e48f20e666 100644 --- a/indra/newview/llteleporthistory.cpp +++ b/indra/newview/llteleporthistory.cpp @@ -39,6 +39,9 @@ #include "llviewerregion.h" #include "llworldmap.h" #include "llagentui.h" +// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) +#include "rlvhandler.h" +// [/RLVa:KB] ////////////////////////////////////////////////////////////////////////////// // LLTeleportHistoryItem @@ -144,8 +147,16 @@ void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos) mItems.erase (mItems.begin() + mCurrentItem + 1, mItems.end()); // Append an empty item to the history and make it current. - mItems.push_back(LLTeleportHistoryItem("", LLVector3d())); - mCurrentItem++; +// mItems.push_back(LLTeleportHistoryItem("", LLVector3d())); +// mCurrentItem++; +// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b + // Only append a new item if the list is currently empty or if not @showloc=n restricted and the last entry wasn't zero'ed out + if ( (mItems.size() == 0) || ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (!mItems.back().mGlobalPos.isExactlyZero())) ) + { + mItems.push_back(LLTeleportHistoryItem("", LLVector3d())); + mCurrentItem++; + } +// [RLVa:KB] } // Update current history item. @@ -155,11 +166,23 @@ void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos) llassert(!"Invalid current teleport histiry item"); return; } - LLVector3 new_pos_local = gAgent.getPosAgentFromGlobal(new_pos); - mItems[mCurrentItem].mFullTitle = getCurrentLocationTitle(true, new_pos_local); - mItems[mCurrentItem].mTitle = getCurrentLocationTitle(false, new_pos_local); - mItems[mCurrentItem].mGlobalPos = new_pos; - mItems[mCurrentItem].mRegionID = gAgent.getRegion()->getRegionID(); + +// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b + if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { +// [/RLVa:KB] + LLVector3 new_pos_local = gAgent.getPosAgentFromGlobal(new_pos); + mItems[mCurrentItem].mFullTitle = getCurrentLocationTitle(true, new_pos_local); + mItems[mCurrentItem].mTitle = getCurrentLocationTitle(false, new_pos_local); + mItems[mCurrentItem].mGlobalPos = new_pos; + mItems[mCurrentItem].mRegionID = gAgent.getRegion()->getRegionID(); +// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b + } + else + { + mItems[mCurrentItem] = LLTeleportHistoryItem(RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL), LLVector3d::zero); + } +// [/RLVa:KB] } dump(); diff --git a/indra/newview/llteleporthistory.h b/indra/newview/llteleporthistory.h index e45dc28f9b4bc42fa695f24f39502427174ab246..11b273f94eef131d7be0ea9fc4aa00555d200c37 100644 --- a/indra/newview/llteleporthistory.h +++ b/indra/newview/llteleporthistory.h @@ -231,6 +231,10 @@ private: * Using this connection we get notified when a teleport fails. */ boost::signals2::connection mTeleportFailedConn; + +// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b + friend class RlvUIEnabler; +// [/RLVa:KB] }; #endif diff --git a/indra/newview/llteleporthistorystorage.cpp b/indra/newview/llteleporthistorystorage.cpp index 0ba455e7d5b5de3b90c0844ce1eabf3f6eeff2c6..7961f8fba7cd3d84cf3889602d46ac0c33403b0c 100644 --- a/indra/newview/llteleporthistorystorage.cpp +++ b/indra/newview/llteleporthistorystorage.cpp @@ -33,6 +33,9 @@ #include "lldir.h" #include "llteleporthistory.h" #include "llagent.h" +// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) +#include "rlvhandler.h" +// [/RLVa:KB] // Max offset for two global positions to consider them as equal const F64 MAX_GLOBAL_POS_OFFSET = 5.0f; @@ -91,6 +94,13 @@ void LLTeleportHistoryStorage::onTeleportHistoryChange() } const LLTeleportHistoryItem &item = th->getItems()[th->getCurrentItemIndex()]; +// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b + // Make sure we don't attempt to save zero'ed out teleport history items + if (item.mGlobalPos.isExactlyZero()) + { + return; + } +// [/RLVa:KB] addItem(item.mTitle, item.mGlobalPos); save(); @@ -115,6 +125,13 @@ bool LLTeleportHistoryStorage::compareByTitleAndGlobalPos(const LLTeleportHistor void LLTeleportHistoryStorage::addItem(const std::string title, const LLVector3d& global_pos, const LLDate& date) { +// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + return; + } +// [/RLVa:KB] + LLTeleportHistoryPersistentItem item(title, global_pos, date); slurl_list_t::iterator item_iter = std::find_if(mItems.begin(), mItems.end(), diff --git a/indra/newview/llteleporthistorystorage.h b/indra/newview/llteleporthistorystorage.h index 6cae0a345477ebbfeb69e988923a4ac3f91fce1a..b0e435c1389fbf06af57b738038e72a074fd2789 100644 --- a/indra/newview/llteleporthistorystorage.h +++ b/indra/newview/llteleporthistorystorage.h @@ -111,7 +111,11 @@ public: */ void goToItem(S32 idx); -private: +//private: +// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b +protected: + friend class RlvUIEnabler; +// [/RLVa:KB] void onTeleportHistoryChange(); bool compareByTitleAndGlobalPos(const LLTeleportHistoryPersistentItem& a, const LLTeleportHistoryPersistentItem& b); diff --git a/indra/newview/rlvui.cpp b/indra/newview/rlvui.cpp index 5b5eb9ef6de1fc8845585e0be04d8949a44ab49c..685bd87cffbe9cd2477b6633d1423583a5497896 100644 --- a/indra/newview/rlvui.cpp +++ b/indra/newview/rlvui.cpp @@ -33,6 +33,8 @@ #include "llsidetray.h" #include "llsidetraypanelcontainer.h" #include "lltabcontainer.h" +#include "llteleporthistory.h" +#include "llteleporthistorystorage.h" #include "lltoolmgr.h" #include "llviewerparcelmgr.h" #include "roles_constants.h" // Group "powers" @@ -259,6 +261,38 @@ void RlvUIEnabler::onToggleShowLoc() // Hide the "God Tools" floater if it's currently visible if (LLFloaterReg::floaterInstanceVisible("god_tools")) LLFloaterReg::hideInstance("god_tools"); + + // + // Manipulate the teleport history + // + + // If the last entry in the persistent teleport history matches the current teleport history entry then we should remove it + LLTeleportHistory* pTpHistory = LLTeleportHistory::getInstance(); + LLTeleportHistoryStorage* pTpHistoryStg = LLTeleportHistoryStorage::getInstance(); + RLV_ASSERT( (pTpHistory) && (pTpHistoryStg) && (pTpHistory->getItems().size() > 0) && (pTpHistory->getCurrentItemIndex() >= 0) ); + if ( (pTpHistory) && (pTpHistory->getItems().size() > 0) && (pTpHistory->getCurrentItemIndex() >= 0) && + (pTpHistoryStg) && (pTpHistory->getItems().size() > 0) ) + { + const LLTeleportHistoryItem& tpItem = pTpHistory->getItems().back(); + const LLTeleportHistoryPersistentItem& tpItemStg = pTpHistoryStg->getItems().back(); + if (pTpHistoryStg->compareByTitleAndGlobalPos(tpItemStg, LLTeleportHistoryPersistentItem(tpItem.mTitle, tpItem.mGlobalPos))) + { + // TODO-RLVa: [RLVa-1.2.2] Is there a reason why LLTeleportHistoryStorage::removeItem() doesn't trigger history changed? + pTpHistoryStg->removeItem(pTpHistoryStg->getItems().size() - 1); + pTpHistoryStg->mHistoryChangedSignal(-1); + } + } + + // Clear the current location in the teleport history + if (pTpHistory) + pTpHistory->updateCurrentLocation(gAgent.getPositionGlobal()); + } + else + { + // Reset the current location in the teleport history (also takes care of adding it to the persistent teleport history) + LLTeleportHistory* pTpHistory = LLTeleportHistory::getInstance(); + if ( (pTpHistory) && (NULL != gAgent.getRegion()) ) + pTpHistory->updateCurrentLocation(gAgent.getPositionGlobal()); } // Start or stop filtering the "About Land" and "Region / Estate" floaters