summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerparcelmgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerparcelmgr.cpp')
-rw-r--r--indra/newview/llviewerparcelmgr.cpp240
1 files changed, 85 insertions, 155 deletions
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index d6002e7320..77e382b8c7 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -67,6 +67,7 @@
#include "llworld.h"
#include "roles_constants.h"
#include "llweb.h"
+#include "llvieweraudio.h"
const F32 PARCEL_COLLISION_DRAW_SECS = 1.f;
@@ -81,7 +82,6 @@ LLPointer<LLViewerTexture> sBlockedImage;
LLPointer<LLViewerTexture> sPassImage;
// Local functions
-void optionally_start_music(const std::string& music_url);
void callback_start_music(S32 option, void* data);
void optionally_prepare_video(const LLParcel *parcelp);
void callback_prepare_video(S32 option, void* data);
@@ -545,9 +545,6 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1,
mRequestResult = PARCEL_RESULT_NO_DATA;
- // clear the list of segments to prevent flashing
- resetSegments(mHighlightSegments);
-
mFloatingParcelSelection->setParcel(mCurrentParcel);
mCurrentParcelSelection->setParcel(NULL);
mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
@@ -1457,6 +1454,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
S32 other_clean_time = 0;
+ LLViewerParcelMgr& parcel_mgr = LLViewerParcelMgr::instance();
+
msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_RequestResult, request_result );
msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_SequenceID, sequence_id );
@@ -1472,31 +1471,31 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
if (sequence_id == SELECTED_PARCEL_SEQ_ID)
{
// ...selected parcels report this sequence id
- LLViewerParcelMgr::getInstance()->mRequestResult = PARCEL_RESULT_SUCCESS;
- parcel = LLViewerParcelMgr::getInstance()->mCurrentParcel;
+ parcel_mgr.mRequestResult = PARCEL_RESULT_SUCCESS;
+ parcel = parcel_mgr.mCurrentParcel;
}
else if (sequence_id == HOVERED_PARCEL_SEQ_ID)
{
- LLViewerParcelMgr::getInstance()->mHoverRequestResult = PARCEL_RESULT_SUCCESS;
- parcel = LLViewerParcelMgr::getInstance()->mHoverParcel;
+ parcel_mgr.mHoverRequestResult = PARCEL_RESULT_SUCCESS;
+ parcel = parcel_mgr.mHoverParcel;
}
else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID ||
sequence_id == COLLISION_NOT_ON_LIST_PARCEL_SEQ_ID ||
sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
{
- LLViewerParcelMgr::getInstance()->mHoverRequestResult = PARCEL_RESULT_SUCCESS;
- parcel = LLViewerParcelMgr::getInstance()->mCollisionParcel;
+ parcel_mgr.mHoverRequestResult = PARCEL_RESULT_SUCCESS;
+ parcel = parcel_mgr.mCollisionParcel;
}
- else if (sequence_id == 0 || sequence_id > LLViewerParcelMgr::getInstance()->mAgentParcelSequenceID)
+ else if (sequence_id == 0 || sequence_id > parcel_mgr.mAgentParcelSequenceID)
{
// new agent parcel
- LLViewerParcelMgr::getInstance()->mAgentParcelSequenceID = sequence_id;
- parcel = LLViewerParcelMgr::getInstance()->mAgentParcel;
+ parcel_mgr.mAgentParcelSequenceID = sequence_id;
+ parcel = parcel_mgr.mAgentParcel;
}
else
{
llinfos << "out of order agent parcel sequence id " << sequence_id
- << " last good " << LLViewerParcelMgr::getInstance()->mAgentParcelSequenceID
+ << " last good " << parcel_mgr.mAgentParcelSequenceID
<< llendl;
return;
}
@@ -1567,15 +1566,15 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
parcel->setRegionDenyAgeUnverifiedOverride(region_deny_age_unverified_override);
parcel->unpackMessage(msg);
- if (parcel == LLViewerParcelMgr::getInstance()->mAgentParcel)
+ if (parcel == parcel_mgr.mAgentParcel)
{
- S32 bitmap_size = LLViewerParcelMgr::getInstance()->mParcelsPerEdge
- * LLViewerParcelMgr::getInstance()->mParcelsPerEdge
+ S32 bitmap_size = parcel_mgr.mParcelsPerEdge
+ * parcel_mgr.mParcelsPerEdge
/ 8;
U8* bitmap = new U8[ bitmap_size ];
msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
- LLViewerParcelMgr::getInstance()->writeAgentParcelFromBitmap(bitmap);
+ parcel_mgr.writeAgentParcelFromBitmap(bitmap);
delete[] bitmap;
// Let interesting parties know about agent parcel change.
@@ -1586,7 +1585,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
if (instance->mTeleportInProgress)
{
instance->mTeleportInProgress = FALSE;
- instance->mTeleportFinishedSignal(gAgent.getPositionGlobal());
+ instance->mTeleportFinishedSignal(gAgent.getPositionGlobal(), false);
}
}
}
@@ -1595,11 +1594,11 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
if (sequence_id == SELECTED_PARCEL_SEQ_ID)
{
// Update selected counts
- LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedSelfCount = self_count;
- LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedOtherCount = other_count;
- LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedPublicCount = public_count;
+ parcel_mgr.mCurrentParcelSelection->mSelectedSelfCount = self_count;
+ parcel_mgr.mCurrentParcelSelection->mSelectedOtherCount = other_count;
+ parcel_mgr.mCurrentParcelSelection->mSelectedPublicCount = public_count;
- LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedMultipleOwners =
+ parcel_mgr.mCurrentParcelSelection->mSelectedMultipleOwners =
(request_result == PARCEL_RESULT_MULTIPLE);
// Select the whole parcel
@@ -1610,67 +1609,64 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
{
// don't muck with the westsouth and eastnorth.
// just highlight it
- LLVector3 west_south = region->getPosRegionFromGlobal(LLViewerParcelMgr::getInstance()->mWestSouth);
- LLVector3 east_north = region->getPosRegionFromGlobal(LLViewerParcelMgr::getInstance()->mEastNorth);
+ LLVector3 west_south = region->getPosRegionFromGlobal(parcel_mgr.mWestSouth);
+ LLVector3 east_north = region->getPosRegionFromGlobal(parcel_mgr.mEastNorth);
- LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mHighlightSegments);
- LLViewerParcelMgr::getInstance()->writeHighlightSegments(
+ parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
+ parcel_mgr.writeHighlightSegments(
west_south.mV[VX],
west_south.mV[VY],
east_north.mV[VX],
east_north.mV[VY] );
- LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mWholeParcelSelected = FALSE;
+ parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = FALSE;
}
else if (0 == local_id)
{
// this is public land, just highlight the selection
- LLViewerParcelMgr::getInstance()->mWestSouth = region->getPosGlobalFromRegion( aabb_min );
- LLViewerParcelMgr::getInstance()->mEastNorth = region->getPosGlobalFromRegion( aabb_max );
+ parcel_mgr.mWestSouth = region->getPosGlobalFromRegion( aabb_min );
+ parcel_mgr.mEastNorth = region->getPosGlobalFromRegion( aabb_max );
- LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mHighlightSegments);
- LLViewerParcelMgr::getInstance()->writeHighlightSegments(
+ parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
+ parcel_mgr.writeHighlightSegments(
aabb_min.mV[VX],
aabb_min.mV[VY],
aabb_max.mV[VX],
aabb_max.mV[VY] );
- LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mWholeParcelSelected = TRUE;
+ parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = TRUE;
}
else
{
- LLViewerParcelMgr::getInstance()->mWestSouth = region->getPosGlobalFromRegion( aabb_min );
- LLViewerParcelMgr::getInstance()->mEastNorth = region->getPosGlobalFromRegion( aabb_max );
+ parcel_mgr.mWestSouth = region->getPosGlobalFromRegion( aabb_min );
+ parcel_mgr.mEastNorth = region->getPosGlobalFromRegion( aabb_max );
// Owned land, highlight the boundaries
- S32 bitmap_size = LLViewerParcelMgr::getInstance()->mParcelsPerEdge
- * LLViewerParcelMgr::getInstance()->mParcelsPerEdge
+ S32 bitmap_size = parcel_mgr.mParcelsPerEdge
+ * parcel_mgr.mParcelsPerEdge
/ 8;
U8* bitmap = new U8[ bitmap_size ];
msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
- LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mHighlightSegments);
- LLViewerParcelMgr::getInstance()->writeSegmentsFromBitmap( bitmap, LLViewerParcelMgr::getInstance()->mHighlightSegments );
+ parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
+ parcel_mgr.writeSegmentsFromBitmap( bitmap, parcel_mgr.mHighlightSegments );
delete[] bitmap;
bitmap = NULL;
- LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mWholeParcelSelected = TRUE;
+ parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = TRUE;
}
// Request access list information for this land
- LLViewerParcelMgr::getInstance()->sendParcelAccessListRequest(AL_ACCESS | AL_BAN);
-
- // Request the media url filter list for this land
- LLViewerParcelMgr::getInstance()->requestParcelMediaURLFilter();
+ parcel_mgr.sendParcelAccessListRequest(AL_ACCESS | AL_BAN);
// Request dwell for this land, if it's not public land.
- LLViewerParcelMgr::getInstance()->mSelectedDwell = DWELL_NAN;
+ parcel_mgr.mSelectedDwell = DWELL_NAN;
if (0 != local_id)
{
- LLViewerParcelMgr::getInstance()->sendParcelDwellRequest();
+ parcel_mgr.sendParcelDwellRequest();
}
- LLViewerParcelMgr::getInstance()->mSelected = TRUE;
- LLViewerParcelMgr::getInstance()->notifyObservers();
+ parcel_mgr.mSelected = TRUE;
+ parcel_mgr.notifyObservers();
}
}
else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID ||
@@ -1678,32 +1674,32 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
{
// We're about to collide with this parcel
- LLViewerParcelMgr::getInstance()->mRenderCollision = TRUE;
- LLViewerParcelMgr::getInstance()->mCollisionTimer.reset();
+ parcel_mgr.mRenderCollision = TRUE;
+ parcel_mgr.mCollisionTimer.reset();
// Differentiate this parcel if we are banned from it.
if (sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
{
- LLViewerParcelMgr::getInstance()->mCollisionBanned = BA_BANNED;
+ parcel_mgr.mCollisionBanned = BA_BANNED;
}
else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID)
{
- LLViewerParcelMgr::getInstance()->mCollisionBanned = BA_NOT_IN_GROUP;
+ parcel_mgr.mCollisionBanned = BA_NOT_IN_GROUP;
}
else
{
- LLViewerParcelMgr::getInstance()->mCollisionBanned = BA_NOT_ON_LIST;
+ parcel_mgr.mCollisionBanned = BA_NOT_ON_LIST;
}
- S32 bitmap_size = LLViewerParcelMgr::getInstance()->mParcelsPerEdge
- * LLViewerParcelMgr::getInstance()->mParcelsPerEdge
+ S32 bitmap_size = parcel_mgr.mParcelsPerEdge
+ * parcel_mgr.mParcelsPerEdge
/ 8;
U8* bitmap = new U8[ bitmap_size ];
msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
- LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mCollisionSegments);
- LLViewerParcelMgr::getInstance()->writeSegmentsFromBitmap( bitmap, LLViewerParcelMgr::getInstance()->mCollisionSegments );
+ parcel_mgr.resetSegments(parcel_mgr.mCollisionSegments);
+ parcel_mgr.writeSegmentsFromBitmap( bitmap, parcel_mgr.mCollisionSegments );
delete[] bitmap;
bitmap = NULL;
@@ -1714,18 +1710,21 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
LLViewerRegion *region = LLWorld::getInstance()->getRegion( msg->getSender() );
if (region)
{
- LLViewerParcelMgr::getInstance()->mHoverWestSouth = region->getPosGlobalFromRegion( aabb_min );
- LLViewerParcelMgr::getInstance()->mHoverEastNorth = region->getPosGlobalFromRegion( aabb_max );
+ parcel_mgr.mHoverWestSouth = region->getPosGlobalFromRegion( aabb_min );
+ parcel_mgr.mHoverEastNorth = region->getPosGlobalFromRegion( aabb_max );
}
else
{
- LLViewerParcelMgr::getInstance()->mHoverWestSouth.clearVec();
- LLViewerParcelMgr::getInstance()->mHoverEastNorth.clearVec();
+ parcel_mgr.mHoverWestSouth.clearVec();
+ parcel_mgr.mHoverEastNorth.clearVec();
}
}
else
{
- // look for music.
+ // Check for video
+ LLViewerParcelMedia::update(parcel);
+
+ // Then check for music
if (gAudiop)
{
if (parcel)
@@ -1736,56 +1735,44 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
std::string music_url = music_url_raw;
LLStringUtil::trim(music_url);
- // On entering a new parcel, stop the last stream if the
- // new parcel has a different music url. (Empty URL counts
- // as different.)
- const std::string& stream_url = gAudiop->getInternetStreamURL();
-
- if (music_url.empty() || music_url != stream_url)
+ // If there is a new music URL and it's valid, play it.
+ if (music_url.size() > 12)
{
- // URL is different from one currently playing.
- gAudiop->stopInternetStream();
-
- // If there is a new music URL and it's valid, play it.
- if (music_url.size() > 12)
+ if (music_url.substr(0,7) == "http://")
{
- if (music_url.substr(0,7) == "http://")
- {
- optionally_start_music(music_url);
- }
- else
- {
- llinfos << "Stopping parcel music (invalid audio stream URL)" << llendl;
- // clears the URL
- gAudiop->startInternetStream(LLStringUtil::null);
- }
+ optionally_start_music(music_url);
}
- else if (!gAudiop->getInternetStreamURL().empty())
+ else
{
- llinfos << "Stopping parcel music (parcel stream URL is empty)" << llendl;
- gAudiop->startInternetStream(LLStringUtil::null);
+ llinfos << "Stopping parcel music (invalid audio stream URL)" << llendl;
+ // clears the URL
+ // null value causes fade out
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
}
}
+ else if (!gAudiop->getInternetStreamURL().empty())
+ {
+ llinfos << "Stopping parcel music (parcel stream URL is empty)" << llendl;
+ // null value causes fade out
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
+ }
}
else
{
// Public land has no music
- gAudiop->stopInternetStream();
+ LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
}
}//if gAudiop
-
- // now check for video
- LLViewerParcelMedia::update( parcel );
};
}
-void optionally_start_music(const std::string& music_url)
+void LLViewerParcelMgr::optionally_start_music(const std::string& music_url)
{
if (gSavedSettings.getBOOL("AudioStreamingMusic"))
{
// only play music when you enter a new parcel if the UI control for this
// was not *explicitly* stopped by the user. (part of SL-4878)
- LLPanelNearByMedia* nearby_media_panel = gStatusBar->getNearbyMediaPanel();;
+ LLPanelNearByMedia* nearby_media_panel = gStatusBar->getNearbyMediaPanel();
if ((nearby_media_panel &&
nearby_media_panel->getParcelAudioAutoStart()) ||
// or they have expressed no opinion in the UI, but have autoplay on...
@@ -1794,7 +1781,11 @@ void optionally_start_music(const std::string& music_url)
gSavedSettings.getBOOL("MediaTentativeAutoPlay")))
{
llinfos << "Starting parcel music " << music_url << llendl;
- gAudiop->startInternetStream(music_url);
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(music_url);
+ }
+ else
+ {
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
}
}
}
@@ -1995,67 +1986,6 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which)
}
}
-class LLParcelMediaURLFilterResponder : public LLHTTPClient::Responder
-{
- virtual void result(const LLSD& content)
- {
- LLViewerParcelMgr::getInstance()->receiveParcelMediaURLFilter(content);
- }
-};
-
-void LLViewerParcelMgr::requestParcelMediaURLFilter()
-{
- if (!mSelected)
- {
- return;
- }
-
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
- if (!region)
- {
- return;
- }
-
- LLParcel* parcel = mCurrentParcel;
- if (!parcel)
- {
- llwarns << "no parcel" << llendl;
- return;
- }
-
- LLSD body;
- body["local-id"] = parcel->getLocalID();
- body["list"] = parcel->getMediaURLFilterList();
-
- std::string url = region->getCapability("ParcelMediaURLFilterList");
- if (!url.empty())
- {
- LLHTTPClient::post(url, body, new LLParcelMediaURLFilterResponder);
- }
- else
- {
- llwarns << "can't get ParcelMediaURLFilterList cap" << llendl;
- }
-}
-
-
-void LLViewerParcelMgr::receiveParcelMediaURLFilter(const LLSD &content)
-{
- if (content.has("list"))
- {
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->mCurrentParcel;
- if (!parcel) return;
-
- if (content["local-id"].asInteger() == parcel->getLocalID())
- {
- parcel->setMediaURLFilterList(content["list"]);
-
- LLViewerParcelMgr::getInstance()->notifyObservers();
- }
- }
-}
-
-
void LLViewerParcelMgr::deedLandToGroup()
{
std::string group_name;
@@ -2561,7 +2491,7 @@ void LLViewerParcelMgr::onTeleportFinished(bool local, const LLVector3d& new_pos
{
// Local teleport. We already have the agent parcel data.
// Emit the signal immediately.
- getInstance()->mTeleportFinishedSignal(new_pos);
+ getInstance()->mTeleportFinishedSignal(new_pos, local);
}
else
{