diff options
| author | Jonathan Yap <none@none> | 2013-11-19 16:56:17 -0500 | 
|---|---|---|
| committer | Jonathan Yap <none@none> | 2013-11-19 16:56:17 -0500 | 
| commit | 410a084f9a2e030efda635f5a51280b599ab7f78 (patch) | |
| tree | 2c2f095cee8cf0b233d59eee2c8d99ad68c44c70 /indra/newview/llagent.cpp | |
| parent | dad992ea31b6b823c316400e61d50d1aa9e52330 (diff) | |
| parent | fcc885d4fc5ef63dad33e89a9324edc39d466d37 (diff) | |
STORM-1980 Merge changes Oz made (new way of detecting an agent has changed regions)
Modify code to make use of the changed callback
Diffstat (limited to 'indra/newview/llagent.cpp')
| -rwxr-xr-x | indra/newview/llagent.cpp | 75 | 
1 files changed, 49 insertions, 26 deletions
| diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 49f77e6c34..6ee8f26b9f 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -259,11 +259,9 @@ bool handleSlowMotionAnimation(const LLSD& newvalue)  	return true;  } -// static -void LLAgent::parcelChangedCallback() +void LLAgent::setCanEditParcel() // called via mParcelChangedSignal  {  	bool can_edit = LLToolMgr::getInstance()->canEdit(); -  	gAgent.mCanEditParcel = can_edit;  } @@ -425,6 +423,8 @@ LLAgent::LLAgent() :  	mListener.reset(new LLAgentListener(*this)); +	addParcelChangedCallback(&setCanEditParcel); +  	mMoveTimer.stop();  } @@ -451,8 +451,6 @@ void LLAgent::init()  	mLastKnownRequestMaturity = mLastKnownResponseMaturity;  	mIsDoSendMaturityPreferenceToServer = true; -	LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLAgent::parcelChangedCallback)); -  	if (!mTeleportFinishedSlot.connected())  	{  		mTeleportFinishedSlot = LLViewerParcelMgr::getInstance()->setTeleportFinishedCallback(boost::bind(&LLAgent::handleTeleportFinished, this)); @@ -835,22 +833,33 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id)  	}  } +void LLAgent::changeParcels() +{ +	LL_DEBUGS("AgentLocation") << "Calling ParcelChanged callbacks" << LL_ENDL; +	// Notify anything that wants to know about parcel changes +	mParcelChangedSignal(); +} + +boost::signals2::connection LLAgent::addParcelChangedCallback(parcel_changed_callback_t cb) +{ +	return mParcelChangedSignal.connect(cb); +} +  //-----------------------------------------------------------------------------  // setRegion()  //-----------------------------------------------------------------------------  void LLAgent::setRegion(LLViewerRegion *regionp)  { -	bool teleport = true; - +	bool notifyRegionChange; +	  	llassert(regionp);  	if (mRegionp != regionp)  	{ -		// std::string host_name; -		// host_name = regionp->getHost().getHostName(); - +		notifyRegionChange = true; +		  		std::string ip = regionp->getHost().getString(); -		llinfos << "Moving agent into region: " << regionp->getName() -				<< " located at " << ip << llendl; +		LL_INFOS("AgentLocation") << "Moving agent into region: " << regionp->getName() +				<< " located at " << ip << LL_ENDL;  		if (mRegionp)  		{  			// We've changed regions, we're now going to change our agent coordinate frame. @@ -878,9 +887,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp)  			{  				gSky.mVOGroundp->setRegion(regionp);  			} - -			// Notify windlight managers -			teleport = (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE);  		}  		else  		{ @@ -902,8 +908,14 @@ void LLAgent::setRegion(LLViewerRegion *regionp)  		// Pass new region along to metrics components that care about this level of detail.  		LLAppViewer::metricsUpdateRegion(regionp->getHandle());  	} +	else +	{ +		notifyRegionChange = false; +	}  	mRegionp = regionp; +	// TODO - most of what follows probably should be moved into callbacks +  	// Pass the region host to LLUrlEntryParcel to resolve parcel name  	// with a server request.  	LLUrlEntryParcel::setRegionHost(getRegionHost()); @@ -922,15 +934,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp)  	LLFloaterMove::sUpdateFlyingStatus(); -	if (teleport) -	{ -		LLEnvManagerNew::instance().onTeleport(); -	} -	else -	{ -		LLEnvManagerNew::instance().onRegionCrossing(); -	} -  	// If the newly entered region is using server bakes, and our  	// current appearance is non-baked, request appearance update from  	// server. @@ -943,6 +946,12 @@ void LLAgent::setRegion(LLViewerRegion *regionp)  		// Need to handle via callback after caps arrive.  		mRegionp->setCapabilitiesReceivedCallback(boost::bind(&LLAgent::handleServerBakeRegionTransition,this,_1));  	} + +	if (notifyRegionChange) +	{ +		LL_DEBUGS("AgentLocation") << "Calling RegionChanged callbacks" << LL_ENDL; +		mRegionChangedSignal(); +	}  } @@ -967,6 +976,12 @@ LLHost LLAgent::getRegionHost() const  	}  } +boost::signals2::connection LLAgent::addRegionChangedCallback(region_changed_callback_t cb) +{ +	return mRegionChangedSignal.connect(cb); +} + +  //-----------------------------------------------------------------------------  // inPrelude()  //----------------------------------------------------------------------------- @@ -1092,11 +1107,19 @@ const LLVector3d &LLAgent::getPositionGlobal() const  //-----------------------------------------------------------------------------  const LLVector3 &LLAgent::getPositionAgent()  { -	if (isAgentAvatarValid() && !gAgentAvatarp->mDrawable.isNull()) +	if (isAgentAvatarValid())  	{ -		mFrameAgent.setOrigin(gAgentAvatarp->getRenderPosition());	 +		if(gAgentAvatarp->mDrawable.isNull()) +		{ +			mFrameAgent.setOrigin(gAgentAvatarp->getPositionAgent()); +		} +		else +		{ +			mFrameAgent.setOrigin(gAgentAvatarp->getRenderPosition()); +		}  	} +  	return mFrameAgent.getOrigin();  } | 
