Esempio n. 1
0
void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos)
{
	if (mRequestedItem != -1) // teleport within the history in progress?
	{
		mCurrentItem = mRequestedItem;
		mRequestedItem = -1;
	}
	else
	{
		//EXT-7034
		//skip initial update if agent avatar is no valid yet
		//this may happen when updateCurrentLocation called while login process
		//sometimes isAgentAvatarValid return false and in this case new_pos
		//(which actually is gAgent.getPositionGlobal() ) is invalid
		//if this position will be saved then teleport back will teleport user to wrong position
		if ( !mGotInitialUpdate && !isAgentAvatarValid() )
		{
			return ;
		}

		// If we're getting the initial location update
		// while we already have a (loaded) non-empty history,
		// there's no need to purge forward items or add a new item.

		if (mGotInitialUpdate || mItems.size() == 0)
		{
			// Purge forward items (if any).
			if(mItems.size())
				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++;
		}

		// Update current history item.
		if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check
		{
			llwarns << "Invalid current item. (this should not happen)" << llendl;
			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();
	}

	dump();
	
	if (!mGotInitialUpdate)
		mGotInitialUpdate = true;

	// Signal the interesting party that we've changed. 
	onHistoryChanged();
}
Esempio n. 2
0
void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos)
{
	if (mRequestedItem != -1) // teleport within the history in progress?
	{
		mCurrentItem = mRequestedItem;
		mRequestedItem = -1;
	}
	else
	{
		// If we're getting the initial location update
		// while we already have a (loaded) non-empty history,
		// there's no need to purge forward items or add a new item.

		if (mGotInitialUpdate || mItems.size() == 0)
		{
			// Purge forward items (if any).
			if(mItems.size())
				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++;
		}

		// Update current history item.
		if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check
		{
			llwarns << "Invalid current item. (this should not happen)" << llendl;
			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();
	}

	dump();
	
	if (!mGotInitialUpdate)
		mGotInitialUpdate = true;

	// Signal the interesting party that we've changed. 
	onHistoryChanged();
}
void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos)
{
	if (!mTeleportHistoryStorage)
	{
		mTeleportHistoryStorage = LLTeleportHistoryStorage::getInstance();
	}
	if (mRequestedItem != -1) // teleport within the history in progress?
	{
		mCurrentItem = mRequestedItem;
		mRequestedItem = -1;
	}
	else
	{
		//EXT-7034
		//skip initial update if agent avatar is no valid yet
		//this may happen when updateCurrentLocation called while login process
		//sometimes isAgentAvatarValid return false and in this case new_pos
		//(which actually is gAgent.getPositionGlobal() ) is invalid
		//if this position will be saved then teleport back will teleport user to wrong position
		if ( !mGotInitialUpdate && !isAgentAvatarValid() )
		{
			return ;
		}

		// If we're getting the initial location update
		// while we already have a (loaded) non-empty history,
		// there's no need to purge forward items or add a new item.

		if (mGotInitialUpdate || mItems.size() == 0)
		{
			// Purge forward items (if any).
			if(mItems.size())
				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++;
// [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.
		if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check
		{
			llwarns << "Invalid current item. (this should not happen)" << llendl;
			llassert(!"Invalid current teleport history item");
			return;
		}

// [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();
	
	if (!mGotInitialUpdate)
		mGotInitialUpdate = true;

	// Signal the interesting party that we've changed. 
	onHistoryChanged();
}