aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerparcelmgr.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llviewerparcelmgr.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerparcelmgr.cpp312
1 files changed, 53 insertions, 259 deletions
diff --git a/linden/indra/newview/llviewerparcelmgr.cpp b/linden/indra/newview/llviewerparcelmgr.cpp
index 4730799..de88ac0 100644
--- a/linden/indra/newview/llviewerparcelmgr.cpp
+++ b/linden/indra/newview/llviewerparcelmgr.cpp
@@ -38,7 +38,6 @@
38#include "indra_constants.h" 38#include "indra_constants.h"
39#include "llcachename.h" 39#include "llcachename.h"
40#include "llgl.h" 40#include "llgl.h"
41#include "llmediaengine.h"
42#include "llparcel.h" 41#include "llparcel.h"
43#include "llsecondlifeurls.h" 42#include "llsecondlifeurls.h"
44#include "message.h" 43#include "message.h"
@@ -55,14 +54,17 @@
55#include "llfloatersellland.h" 54#include "llfloatersellland.h"
56#include "llfloatertools.h" 55#include "llfloatertools.h"
57#include "llnotify.h" 56#include "llnotify.h"
57#include "llparcelselection.h"
58#include "llresmgr.h" 58#include "llresmgr.h"
59#include "llsdutil.h"
59#include "llstatusbar.h" 60#include "llstatusbar.h"
60#include "llui.h" 61#include "llui.h"
62#include "llviewerimage.h"
61#include "llviewerimagelist.h" 63#include "llviewerimagelist.h"
62#include "llviewermenu.h" 64#include "llviewermenu.h"
65#include "llviewerparcelmedia.h"
63#include "llviewerparceloverlay.h" 66#include "llviewerparceloverlay.h"
64#include "llviewerregion.h" 67#include "llviewerregion.h"
65//#include "llwebbrowserctrl.h"
66#include "llworld.h" 68#include "llworld.h"
67#include "lloverlaybar.h" 69#include "lloverlaybar.h"
68#include "roles_constants.h" 70#include "roles_constants.h"
@@ -78,11 +80,8 @@ U8* LLViewerParcelMgr::sPackedOverlay = NULL;
78 80
79LLUUID gCurrentMovieID = LLUUID::null; 81LLUUID gCurrentMovieID = LLUUID::null;
80 82
81static LLParcelSelection* get_null_parcel_selection(); 83LLPointer<LLViewerImage> sBlockedImage;
82template<> 84LLPointer<LLViewerImage> sPassImage;
83 const LLHandle<LLParcelSelection>::NullFunc
84 LLHandle<LLParcelSelection>::sNullFunc = get_null_parcel_selection;
85
86 85
87// Local functions 86// Local functions
88void optionally_start_music(const LLString& music_url); 87void optionally_start_music(const LLString& music_url);
@@ -141,10 +140,10 @@ LLViewerParcelMgr::LLViewerParcelMgr()
141 resetSegments(mCollisionSegments); 140 resetSegments(mCollisionSegments);
142 141
143 mBlockedImageID.set(gViewerArt.getString("noentrylines.tga")); 142 mBlockedImageID.set(gViewerArt.getString("noentrylines.tga"));
144 mBlockedImage = gImageList.getImage(mBlockedImageID, TRUE, TRUE); 143 sBlockedImage = gImageList.getImage(mBlockedImageID, TRUE, TRUE);
145 144
146 mPassImageID.set(gViewerArt.getString("noentrypasslines.tga")); 145 mPassImageID.set(gViewerArt.getString("noentrypasslines.tga"));
147 mPassImage = gImageList.getImage(mPassImageID, TRUE, TRUE); 146 sPassImage = gImageList.getImage(mPassImageID, TRUE, TRUE);
148 147
149 S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / PARCEL_OVERLAY_CHUNKS; 148 S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / PARCEL_OVERLAY_CHUNKS;
150 sPackedOverlay = new U8[overlay_size]; 149 sPackedOverlay = new U8[overlay_size];
@@ -189,6 +188,9 @@ LLViewerParcelMgr::~LLViewerParcelMgr()
189 188
190 delete[] mAgentParcelOverlay; 189 delete[] mAgentParcelOverlay;
191 mAgentParcelOverlay = NULL; 190 mAgentParcelOverlay = NULL;
191
192 sBlockedImage = NULL;
193 sPassImage = NULL;
192} 194}
193 195
194void LLViewerParcelMgr::dump() 196void LLViewerParcelMgr::dump()
@@ -1255,30 +1257,46 @@ const LLString& LLViewerParcelMgr::getAgentParcelName() const
1255} 1257}
1256 1258
1257 1259
1258void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel) 1260void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_agent_region)
1259{ 1261{
1260 if (!parcel) return; 1262 if (!parcel) return;
1261 if(!gWorldp) return; 1263 if(!gWorldp) return;
1262 LLViewerRegion *region = gWorldp->getRegionFromPosGlobal( mWestSouth ); 1264 LLViewerRegion *region = use_agent_region ? gAgent.getRegion() : gWorldp->getRegionFromPosGlobal( mWestSouth );
1263 if (!region) return; 1265 if (!region) return;
1264 1266
1265 LLMessageSystem *msg = gMessageSystem; 1267 LLSD body;
1268 std::string url = gAgent.getRegion()->getCapability("ParcelPropertiesUpdate");
1269 if (!url.empty())
1270 {
1271 U32 message_flags = 0x01;
1272 // request new properties update from simulator
1273 body["flags"] = ll_sd_from_U32(message_flags);
1274 parcel->packMessage(body);
1266 1275
1267 msg->newMessageFast(_PREHASH_ParcelPropertiesUpdate); 1276 llinfos << "Sending parcel properties update via capability to:" << url << llendl;
1268 msg->nextBlockFast(_PREHASH_AgentData);
1269 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
1270 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
1271 msg->nextBlockFast(_PREHASH_ParcelData);
1272 msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID() );
1273 1277
1274 U32 flags = 0x0; 1278 LLHTTPClient::post(url, body, new LLHTTPClient::Responder());
1275 // request new properties update from simulator 1279 }
1276 flags |= 0x01; 1280 else
1277 msg->addU32("Flags", flags); 1281 {
1282 LLMessageSystem *msg = gMessageSystem;
1283
1284 msg->newMessageFast(_PREHASH_ParcelPropertiesUpdate);
1285 msg->nextBlockFast(_PREHASH_AgentData);
1286 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
1287 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
1288 msg->nextBlockFast(_PREHASH_ParcelData);
1289 msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID() );
1290
1291 U32 message_flags = 0x01;
1292 msg->addU32("Flags", message_flags);
1293
1294 parcel->packMessage(msg);
1295
1296 msg->sendReliable( region->getHost() );
1297 }
1278 1298
1279 parcel->packMessage(msg);
1280 1299
1281 msg->sendReliable( region->getHost() );
1282} 1300}
1283 1301
1284 1302
@@ -1363,7 +1381,6 @@ void LLViewerParcelMgr::processParcelOverlay(LLMessageSystem *msg, void **user)
1363 } 1381 }
1364} 1382}
1365 1383
1366
1367// static 1384// static
1368void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **user) 1385void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **user)
1369{ 1386{
@@ -1657,19 +1674,6 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
1657 } 1674 }
1658 else 1675 else
1659 { 1676 {
1660 // It's the agent parcel
1661 BOOL new_parcel = parcel ? FALSE : TRUE;
1662 if (parcel)
1663 {
1664 S32 parcelid = parcel->getLocalID();
1665 U64 regionid = gAgent.getRegion()->getHandle();
1666 if (parcelid != gParcelMgr->mMediaParcelId || regionid != gParcelMgr->mMediaRegionId)
1667 {
1668 gParcelMgr->mMediaParcelId = parcelid;
1669 gParcelMgr->mMediaRegionId = regionid;
1670 new_parcel = TRUE;
1671 }
1672 }
1673 // look for music. 1677 // look for music.
1674 if (gAudiop) 1678 if (gAudiop)
1675 { 1679 {
@@ -1714,75 +1718,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
1714 }//if gAudiop 1718 }//if gAudiop
1715 1719
1716 // now check for video 1720 // now check for video
1717 if (LLMediaEngine::getInstance ()->isAvailable ()) 1721 LLViewerParcelMedia::update( parcel );
1718 {
1719 // we have a player
1720 if (parcel)
1721 {
1722 // we're in a parcel
1723 std::string mediaUrl = std::string ( parcel->getMediaURL () );
1724 LLString::trim(mediaUrl);
1725
1726 // clean spaces and whatnot
1727 mediaUrl = LLWeb::escapeURL(mediaUrl);
1728
1729
1730 // something changed
1731 LLMediaEngine* me = LLMediaEngine::getInstance();
1732 if ( ( me->getUrl () != mediaUrl )
1733 || ( me->getImageUUID () != parcel->getMediaID () )
1734 || ( me->isAutoScaled () != parcel->getMediaAutoScale () ) )
1735 {
1736 BOOL video_was_playing = FALSE;
1737 LLMediaBase* renderer = me->getMediaRenderer();
1738 if (renderer && (renderer->isPlaying() || renderer->isLooping()))
1739 {
1740 video_was_playing = TRUE;
1741 }
1742
1743 stop_video();
1744
1745 if ( !mediaUrl.empty () )
1746 {
1747 // Someone has "changed the channel", changing the URL of a video
1748 // you were already watching. Do we want to automatically start playing? JC
1749 if (!new_parcel
1750 && gSavedSettings.getBOOL("AudioStreamingVideo")
1751 && video_was_playing)
1752 {
1753 start_video(parcel);
1754 }
1755 else
1756 {
1757 // "Prepare" the media engine, but don't auto-play. JC
1758 optionally_prepare_video(parcel);
1759 }
1760 }
1761 }
1762 }
1763 else
1764 {
1765 stop_video();
1766 }
1767 }
1768 else
1769 {
1770 // no audio player, do a first use dialog if their is media here
1771 if (parcel)
1772 {
1773 std::string mediaUrl = std::string ( parcel->getMediaURL () );
1774 if (!mediaUrl.empty ())
1775 {
1776 if (gSavedSettings.getWarning("QuickTimeInstalled"))
1777 {
1778 gSavedSettings.setWarning("QuickTimeInstalled", FALSE);
1779
1780 LLNotifyBox::showXml("NoQuickTime" );
1781 };
1782 }
1783 }
1784 }
1785
1786 }; 1722 };
1787} 1723}
1788 1724
@@ -1835,94 +1771,6 @@ void callback_start_music(S32 option, void* data)
1835 music_url = NULL; 1771 music_url = NULL;
1836} 1772}
1837 1773
1838void prepare_video(const LLParcel *parcel)
1839{
1840 std::string mediaUrl;
1841 if (parcel->getParcelFlag(PF_URL_RAW_HTML))
1842 {
1843 mediaUrl = std::string("data:");
1844 mediaUrl.append(parcel->getMediaURL());
1845 }
1846 else
1847 {
1848 mediaUrl = std::string ( parcel->getMediaURL () );
1849 }
1850
1851 // clean spaces and whatnot
1852 mediaUrl = LLWeb::escapeURL(mediaUrl);
1853
1854 LLMediaEngine::getInstance ()->setUrl ( mediaUrl );
1855 LLMediaEngine::getInstance ()->setImageUUID ( parcel->getMediaID () );
1856 LLMediaEngine::getInstance ()->setAutoScaled ( parcel->getMediaAutoScale () ? TRUE : FALSE ); // (U8 instead of BOOL for future expansion)
1857}
1858
1859void start_video(const LLParcel *parcel)
1860{
1861 prepare_video(parcel);
1862 std::string path( "" );
1863 LLMediaEngine::getInstance ()->convertImageAndLoadUrl ( true, false, path);
1864}
1865
1866void stop_video()
1867{
1868 // set up remote control so stop is selected
1869 LLMediaEngine::getInstance ()->stop ();
1870 if (gOverlayBar)
1871 {
1872 gOverlayBar->refresh ();
1873 }
1874
1875 if (LLMediaEngine::getInstance ()->isLoaded())
1876 {
1877 LLMediaEngine::getInstance ()->unload ();
1878
1879 gImageList.updateMovieImage(LLUUID::null, FALSE);
1880 gCurrentMovieID.setNull();
1881 }
1882
1883 LLMediaEngine::getInstance ()->setUrl ( "" );
1884 LLMediaEngine::getInstance ()->setImageUUID ( LLUUID::null );
1885
1886}
1887
1888void optionally_prepare_video(const LLParcel *parcelp)
1889{
1890 if (gSavedSettings.getWarning("FirstStreamingVideo"))
1891 {
1892 gViewerWindow->alertXml("ParcelCanPlayMedia",
1893 callback_prepare_video,
1894 (void*)parcelp);
1895 }
1896 else
1897 {
1898 llinfos << "Entering parcel " << parcelp->getLocalID() << " with video " << parcelp->getMediaURL() << llendl;
1899 prepare_video(parcelp);
1900 }
1901}
1902
1903
1904void callback_prepare_video(S32 option, void* data)
1905{
1906 const LLParcel *parcelp = (const LLParcel *)data;
1907
1908 if (0 == option)
1909 {
1910 gSavedSettings.setBOOL("AudioStreamingVideo", TRUE);
1911 llinfos << "Starting parcel video " << parcelp->getMediaURL() << " on parcel " << parcelp->getLocalID() << llendl;
1912 gMessageSystem->setHandlerFunc("ParcelMediaCommandMessage", LLMediaEngine::process_parcel_media);
1913 gMessageSystem->setHandlerFunc ( "ParcelMediaUpdate", LLMediaEngine::process_parcel_media_update );
1914 prepare_video(parcelp);
1915 }
1916 else
1917 {
1918 gMessageSystem->setHandlerFunc("ParcelMediaCommandMessage", null_message_callback);
1919 gMessageSystem->setHandlerFunc ( "ParcelMediaUpdate", null_message_callback );
1920 gSavedSettings.setBOOL("AudioStreamingVideo", FALSE);
1921 }
1922
1923 gSavedSettings.setWarning("FirstStreamingVideo", FALSE);
1924}
1925
1926// static 1774// static
1927void LLViewerParcelMgr::processParcelAccessListReply(LLMessageSystem *msg, void **user) 1775void LLViewerParcelMgr::processParcelAccessListReply(LLMessageSystem *msg, void **user)
1928{ 1776{
@@ -2123,17 +1971,14 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which)
2123 1971
2124void LLViewerParcelMgr::deedLandToGroup() 1972void LLViewerParcelMgr::deedLandToGroup()
2125{ 1973{
2126 char group_name[MAX_STRING]; /* Flawfinder: ignore */ 1974 std::string group_name;
2127 gCacheName->getGroupName(mCurrentParcel->getGroupID(), group_name); 1975 gCacheName->getGroupName(mCurrentParcel->getGroupID(), group_name);
2128 LLString::format_map_t args; 1976 LLString::format_map_t args;
2129 args["[AREA]"] = llformat("%d", mCurrentParcel->getArea()); 1977 args["[AREA]"] = llformat("%d", mCurrentParcel->getArea());
2130 args["[GROUP_NAME]"] = group_name; 1978 args["[GROUP_NAME]"] = group_name;
2131 if(mCurrentParcel->getContributeWithDeed()) 1979 if(mCurrentParcel->getContributeWithDeed())
2132 { 1980 {
2133 char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ 1981 std::string first_name, last_name;
2134 first_name[0] = '\0';
2135 char last_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
2136 last_name[0] = '\0';
2137 gCacheName->getName(mCurrentParcel->getOwnerID(), first_name, last_name); 1982 gCacheName->getName(mCurrentParcel->getOwnerID(), first_name, last_name);
2138 args["[FIRST_NAME]"] = first_name; 1983 args["[FIRST_NAME]"] = first_name;
2139 args["[LAST_NAME]"] = last_name; 1984 args["[LAST_NAME]"] = last_name;
@@ -2551,71 +2396,20 @@ void sanitize_corners(const LLVector3d &corner1,
2551 east_north_top.mdV[VZ] = llmax( corner1.mdV[VZ], corner2.mdV[VZ] ); 2396 east_north_top.mdV[VZ] = llmax( corner1.mdV[VZ], corner2.mdV[VZ] );
2552} 2397}
2553 2398
2554//
2555// LLParcelSelection
2556//
2557LLParcelSelection::LLParcelSelection() :
2558 mParcel(NULL),
2559 mSelectedMultipleOwners(FALSE),
2560 mWholeParcelSelected(FALSE),
2561 mSelectedSelfCount(0),
2562 mSelectedOtherCount(0),
2563 mSelectedPublicCount(0)
2564{
2565}
2566
2567LLParcelSelection::LLParcelSelection(LLParcel* parcel) :
2568 mParcel(parcel),
2569 mSelectedMultipleOwners(FALSE),
2570 mWholeParcelSelected(FALSE),
2571 mSelectedSelfCount(0),
2572 mSelectedOtherCount(0),
2573 mSelectedPublicCount(0)
2574{
2575}
2576 2399
2577LLParcelSelection::~LLParcelSelection() 2400void LLViewerParcelMgr::cleanupGlobals()
2578{
2579}
2580
2581BOOL LLParcelSelection::getMultipleOwners() const
2582{
2583 return mSelectedMultipleOwners;
2584}
2585
2586
2587BOOL LLParcelSelection::getWholeParcelSelected() const
2588{
2589 return mWholeParcelSelected;
2590}
2591
2592
2593S32 LLParcelSelection::getClaimableArea() const
2594{
2595 const S32 UNIT_AREA = S32( PARCEL_GRID_STEP_METERS * PARCEL_GRID_STEP_METERS );
2596 return mSelectedPublicCount * UNIT_AREA;
2597}
2598
2599bool LLParcelSelection::hasOthersSelected() const
2600{ 2401{
2601 return mSelectedOtherCount != 0; 2402 delete gParcelMgr;
2403 gParcelMgr = NULL;
2404 LLParcelSelection::sNullSelection = NULL;
2602} 2405}
2603 2406
2604static LLPointer<LLParcelSelection> sNullSelection; 2407LLViewerImage* LLViewerParcelMgr::getBlockedImage() const
2605
2606LLParcelSelection* get_null_parcel_selection()
2607{ 2408{
2608 if (sNullSelection.isNull()) 2409 return sBlockedImage;
2609 {
2610 sNullSelection = new LLParcelSelection;
2611 }
2612
2613 return sNullSelection;
2614} 2410}
2615 2411
2616void LLViewerParcelMgr::cleanupGlobals() 2412LLViewerImage* LLViewerParcelMgr::getPassImage() const
2617{ 2413{
2618 delete gParcelMgr; 2414 return sPassImage;
2619 gParcelMgr = NULL;
2620 sNullSelection = NULL;
2621} 2415}