コード例 #1
0
void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
{
	if (!mSaveToLocationHistory)
		return;
	LLLocationHistory* lh = LLLocationHistory::getInstance();

	//TODO*: do we need convert slurl into readable format?
	std::string location;
	/*NOTE:
	 * We can't use gAgent.getPositionAgent() in case of local teleport to build location.
	 * At this moment gAgent.getPositionAgent() contains previous coordinates.
	 * according to EXT-65 agent position is being reseted on each frame.  
	 */
		LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY,
					gAgent.getPosAgentFromGlobal(global_agent_pos));
	std::string tooltip (LLSLURL::buildSLURLfromPosGlobal(gAgent.getRegion()->getName(), global_agent_pos, false));
	
	LLLocationHistoryItem item (location,
			global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location
	//Touch it, if it is at list already, add new location otherwise
	if ( !lh->touchItem(item) ) {
		lh->addItem(item);
	}

	lh->save();
	
	mSaveToLocationHistory = false;
	
}