- fixed : teleporting to a new location shouldn't be reflected in the (peristent) teleport history when @showloc=n restricted

-> @showloc=n will clear any forward entries in the teleport history (ie A => B => C and then back to B will clear C)
    -> @showloc=n will not prevent teleporting back to previous locations when those locations were visited while not @showloc=n restricted

--HG--
branch : RLVa
meow-7.2.2
Kitty Barnett 2010-09-03 23:09:49 +02:00
parent 68214d610e
commit da18b53d20
5 changed files with 90 additions and 8 deletions

View File

@ -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();

View File

@ -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

View File

@ -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(),

View File

@ -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);

View File

@ -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