aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerparcelmgr.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llviewerparcelmgr.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerparcelmgr.cpp400
1 files changed, 206 insertions, 194 deletions
diff --git a/linden/indra/newview/llviewerparcelmgr.cpp b/linden/indra/newview/llviewerparcelmgr.cpp
index af910e8..a21d2f7 100644
--- a/linden/indra/newview/llviewerparcelmgr.cpp
+++ b/linden/indra/newview/llviewerparcelmgr.cpp
@@ -65,6 +65,7 @@
65 65
66const F32 PARCEL_COLLISION_DRAW_SECS = 1.f; 66const F32 PARCEL_COLLISION_DRAW_SECS = 1.f;
67 67
68
68// Globals 69// Globals
69LLViewerParcelMgr *gParcelMgr = NULL; 70LLViewerParcelMgr *gParcelMgr = NULL;
70 71
@@ -72,6 +73,12 @@ U8* LLViewerParcelMgr::sPackedOverlay = NULL;
72 73
73LLUUID gCurrentMovieID = LLUUID::null; 74LLUUID gCurrentMovieID = LLUUID::null;
74 75
76static LLParcelSelection* get_null_parcel_selection();
77template<>
78 const LLHandle<LLParcelSelection>::NullFunc
79 LLHandle<LLParcelSelection>::sNullFunc = get_null_parcel_selection;
80
81
75// Local functions 82// Local functions
76void optionally_start_music(const LLString& music_url); 83void optionally_start_music(const LLString& music_url);
77void callback_start_music(S32 option, void* data); 84void callback_start_music(S32 option, void* data);
@@ -102,8 +109,6 @@ struct LLGodForceOwnerData
102// 109//
103LLViewerParcelMgr::LLViewerParcelMgr() 110LLViewerParcelMgr::LLViewerParcelMgr()
104: mSelected(FALSE), 111: mSelected(FALSE),
105 mSelectedMultipleOwners(FALSE),
106 mWholeParcelSelected(FALSE),
107 mWestSouth(), 112 mWestSouth(),
108 mEastNorth(), 113 mEastNorth(),
109 mSelectedDwell(0.f), 114 mSelectedDwell(0.f),
@@ -113,11 +118,12 @@ LLViewerParcelMgr::LLViewerParcelMgr()
113 mRenderCollision(FALSE), 118 mRenderCollision(FALSE),
114 mRenderSelection(TRUE), 119 mRenderSelection(TRUE),
115 mCollisionBanned(0), 120 mCollisionBanned(0),
116 mCollisionTimer(), 121 mCollisionTimer()
117 mMediaParcelId(0),
118 mMediaRegionId(0)
119{ 122{
120 mParcel = new LLParcel(); 123 mCurrentParcel = new LLParcel();
124 mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
125 mFloatingParcelSelection = new LLParcelSelection(mCurrentParcel);
126
121 mAgentParcel = new LLParcel(); 127 mAgentParcel = new LLParcel();
122 mHoverParcel = new LLParcel(); 128 mHoverParcel = new LLParcel();
123 mCollisionParcel = new LLParcel(); 129 mCollisionParcel = new LLParcel();
@@ -149,8 +155,14 @@ LLViewerParcelMgr::LLViewerParcelMgr()
149 155
150LLViewerParcelMgr::~LLViewerParcelMgr() 156LLViewerParcelMgr::~LLViewerParcelMgr()
151{ 157{
152 delete mParcel; 158 mCurrentParcelSelection->setParcel(NULL);
153 mParcel = NULL; 159 mCurrentParcelSelection = NULL;
160
161 mFloatingParcelSelection->setParcel(NULL);
162 mFloatingParcelSelection = NULL;
163
164 delete mCurrentParcel;
165 mCurrentParcel = NULL;
154 166
155 delete mAgentParcel; 167 delete mAgentParcel;
156 mAgentParcel = NULL; 168 mAgentParcel = NULL;
@@ -175,32 +187,17 @@ LLViewerParcelMgr::~LLViewerParcelMgr()
175 mAgentParcelOverlay = NULL; 187 mAgentParcelOverlay = NULL;
176} 188}
177 189
178
179void LLViewerParcelMgr::destroyGL()
180{
181 mBlockedImage = NULL;
182 mPassImage = NULL;
183}
184
185
186void LLViewerParcelMgr::restoreGL()
187{
188 mBlockedImage = gImageList.getImage(mBlockedImageID, TRUE, TRUE);
189 mPassImage = gImageList.getImage(mPassImageID, TRUE, TRUE);
190}
191
192
193void LLViewerParcelMgr::dump() 190void LLViewerParcelMgr::dump()
194{ 191{
195 llinfos << "Parcel Manager Dump" << llendl; 192 llinfos << "Parcel Manager Dump" << llendl;
196 llinfos << "mSelected " << S32(mSelected) << llendl; 193 llinfos << "mSelected " << S32(mSelected) << llendl;
197 llinfos << "Selected parcel: " << llendl; 194 llinfos << "Selected parcel: " << llendl;
198 llinfos << mWestSouth << " to " << mEastNorth << llendl; 195 llinfos << mWestSouth << " to " << mEastNorth << llendl;
199 mParcel->dump(); 196 mCurrentParcel->dump();
200 llinfos << "banning " << mParcel->mBanList.size() << llendl; 197 llinfos << "banning " << mCurrentParcel->mBanList.size() << llendl;
201 198
202 access_map_const_iterator cit = mParcel->mBanList.begin(); 199 access_map_const_iterator cit = mCurrentParcel->mBanList.begin();
203 access_map_const_iterator end = mParcel->mBanList.end(); 200 access_map_const_iterator end = mCurrentParcel->mBanList.end();
204 for ( ; cit != end; ++cit) 201 for ( ; cit != end; ++cit)
205 { 202 {
206 llinfos << "ban id " << (*cit).first << llendl; 203 llinfos << "ban id " << (*cit).first << llendl;
@@ -233,27 +230,27 @@ void LLViewerParcelMgr::getDisplayInfo(S32* area_out, S32* claim_out,
233 230
234 if (mSelected) 231 if (mSelected)
235 { 232 {
236 if (mSelectedMultipleOwners) 233 if (mCurrentParcelSelection->mSelectedMultipleOwners)
237 { 234 {
238 area = getClaimableArea(); 235 area = mCurrentParcelSelection->getClaimableArea();
239 } 236 }
240 else 237 else
241 { 238 {
242 area = getSelectedArea(); 239 area = getSelectedArea();
243 } 240 }
244 241
245 if (mParcel->getForSale()) 242 if (mCurrentParcel->getForSale())
246 { 243 {
247 price = mParcel->getSalePrice(); 244 price = mCurrentParcel->getSalePrice();
248 for_sale = TRUE; 245 for_sale = TRUE;
249 } 246 }
250 else 247 else
251 { 248 {
252 price = area * mParcel->getClaimPricePerMeter(); 249 price = area * mCurrentParcel->getClaimPricePerMeter();
253 for_sale = FALSE; 250 for_sale = FALSE;
254 } 251 }
255 252
256 rent = mParcel->getTotalRent(); 253 rent = mCurrentParcel->getTotalRent();
257 254
258 dwell = mSelectedDwell; 255 dwell = mSelectedDwell;
259 } 256 }
@@ -267,51 +264,27 @@ void LLViewerParcelMgr::getDisplayInfo(S32* area_out, S32* claim_out,
267 264
268void LLViewerParcelMgr::getPrimInfo(S32 &sw_max, S32 &sw_total, S32 &max, S32 &total, S32 &owner, S32 &group, S32 &other, S32& selected, F32 &parcel_object_bonus, S32 &other_clean) 265void LLViewerParcelMgr::getPrimInfo(S32 &sw_max, S32 &sw_total, S32 &max, S32 &total, S32 &owner, S32 &group, S32 &other, S32& selected, F32 &parcel_object_bonus, S32 &other_clean)
269{ 266{
270 if (mSelected && mParcel) 267 if (mSelected && mCurrentParcel)
271 { 268 {
272 sw_max = mParcel->getSimWideMaxPrimCapacity(); 269 sw_max = mCurrentParcel->getSimWideMaxPrimCapacity();
273 sw_total = mParcel->getSimWidePrimCount(); 270 sw_total = mCurrentParcel->getSimWidePrimCount();
274 max = llround(mParcel->getMaxPrimCapacity()*mParcel->getParcelPrimBonus()); 271 max = llround(mCurrentParcel->getMaxPrimCapacity()*mCurrentParcel->getParcelPrimBonus());
275 total = mParcel->getPrimCount(); 272 total = mCurrentParcel->getPrimCount();
276 owner = mParcel->getOwnerPrimCount(); 273 owner = mCurrentParcel->getOwnerPrimCount();
277 group = mParcel->getGroupPrimCount(); 274 group = mCurrentParcel->getGroupPrimCount();
278 other = mParcel->getOtherPrimCount(); 275 other = mCurrentParcel->getOtherPrimCount();
279 selected = mParcel->getSelectedPrimCount(); 276 selected = mCurrentParcel->getSelectedPrimCount();
280 parcel_object_bonus = mParcel->getParcelPrimBonus(); 277 parcel_object_bonus = mCurrentParcel->getParcelPrimBonus();
281 other_clean = mParcel->getCleanOtherTime(); 278 other_clean = mCurrentParcel->getCleanOtherTime();
282 } 279 }
283} 280}
284 281
285BOOL LLViewerParcelMgr::getMultipleOwners() const
286{
287 return mSelectedMultipleOwners;
288}
289
290
291BOOL LLViewerParcelMgr::getWholeParcelSelected() const
292{
293 return mWholeParcelSelected;
294}
295
296
297S32 LLViewerParcelMgr::getClaimableArea() const
298{
299 const S32 UNIT_AREA = S32( PARCEL_GRID_STEP_METERS * PARCEL_GRID_STEP_METERS );
300 return mSelectedPublicCount * UNIT_AREA;
301}
302
303bool LLViewerParcelMgr::hasOthersSelected() const
304{
305 return mSelectedOtherCount != 0;
306}
307
308
309S32 LLViewerParcelMgr::getSelectedArea() const 282S32 LLViewerParcelMgr::getSelectedArea() const
310{ 283{
311 S32 rv = 0; 284 S32 rv = 0;
312 if(mSelected && mParcel && mWholeParcelSelected) 285 if(mSelected && mCurrentParcel && mCurrentParcelSelection->mWholeParcelSelected)
313 { 286 {
314 rv = mParcel->getArea(); 287 rv = mCurrentParcel->getArea();
315 } 288 }
316 else if(mSelected) 289 else if(mSelected)
317 { 290 {
@@ -447,7 +420,7 @@ void LLViewerParcelMgr::writeAgentParcelFromBitmap(U8* bitmap)
447 420
448// Given a point, find the PARCEL_GRID_STEP x PARCEL_GRID_STEP block 421// Given a point, find the PARCEL_GRID_STEP x PARCEL_GRID_STEP block
449// containing it and select that. 422// containing it and select that.
450void LLViewerParcelMgr::selectParcelAt(const LLVector3d& pos_global) 423LLParcelSelectionHandle LLViewerParcelMgr::selectParcelAt(const LLVector3d& pos_global)
451{ 424{
452 LLVector3d southwest = pos_global; 425 LLVector3d southwest = pos_global;
453 LLVector3d northeast = pos_global; 426 LLVector3d northeast = pos_global;
@@ -461,14 +434,14 @@ void LLViewerParcelMgr::selectParcelAt(const LLVector3d& pos_global)
461 northeast.mdV[VY] = llround( northeast.mdV[VY], (F64)PARCEL_GRID_STEP_METERS ); 434 northeast.mdV[VY] = llround( northeast.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
462 435
463 // Snap to parcel 436 // Snap to parcel
464 selectLand( southwest, northeast, TRUE ); 437 return selectLand( southwest, northeast, TRUE );
465} 438}
466 439
467 440
468// Tries to select the parcel inside the rectangle 441// Tries to select the parcel inside the rectangle
469void LLViewerParcelMgr::selectParcelInRectangle() 442LLParcelSelectionHandle LLViewerParcelMgr::selectParcelInRectangle()
470{ 443{
471 selectLand(mWestSouth, mEastNorth, TRUE); 444 return selectLand(mWestSouth, mEastNorth, TRUE);
472} 445}
473 446
474 447
@@ -498,28 +471,32 @@ void LLViewerParcelMgr::selectCollisionParcel()
498 mRequestResult = PARCEL_RESULT_NO_DATA; 471 mRequestResult = PARCEL_RESULT_NO_DATA;
499 472
500 // Hack: Copy some data over temporarily 473 // Hack: Copy some data over temporarily
501 mParcel->setName( mCollisionParcel->getName() ); 474 mCurrentParcel->setName( mCollisionParcel->getName() );
502 mParcel->setDesc( mCollisionParcel->getDesc() ); 475 mCurrentParcel->setDesc( mCollisionParcel->getDesc() );
503 mParcel->setPassPrice(mCollisionParcel->getPassPrice()); 476 mCurrentParcel->setPassPrice(mCollisionParcel->getPassPrice());
504 mParcel->setPassHours(mCollisionParcel->getPassHours()); 477 mCurrentParcel->setPassHours(mCollisionParcel->getPassHours());
505 478
506 // clear the list of segments to prevent flashing 479 // clear the list of segments to prevent flashing
507 resetSegments(mHighlightSegments); 480 resetSegments(mHighlightSegments);
508 481
482 mFloatingParcelSelection->setParcel(mCurrentParcel);
483 mCurrentParcelSelection->setParcel(NULL);
484 mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
485
509 mSelected = TRUE; 486 mSelected = TRUE;
510 mWholeParcelSelected = TRUE; 487 mCurrentParcelSelection->mWholeParcelSelected = TRUE;
511 notifyObservers(); 488 notifyObservers();
512 return; 489 return;
513} 490}
514 491
515 492
516// snap_selection = auto-select the hit parcel, if there is exactly one 493// snap_selection = auto-select the hit parcel, if there is exactly one
517void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &corner2, 494LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &corner2,
518 BOOL snap_selection) 495 BOOL snap_selection)
519{ 496{
520 if (!gWorldp) 497 if (!gWorldp)
521 { 498 {
522 return; 499 return NULL;
523 } 500 }
524 501
525 sanitize_corners( corner1, corner2, mWestSouth, mEastNorth ); 502 sanitize_corners( corner1, corner2, mWestSouth, mEastNorth );
@@ -530,7 +507,7 @@ void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &
530 { 507 {
531 mSelected = FALSE; 508 mSelected = FALSE;
532 notifyObservers(); 509 notifyObservers();
533 return; 510 return NULL;
534 } 511 }
535 512
536 // ...y isn't more than one meter away 513 // ...y isn't more than one meter away
@@ -539,7 +516,7 @@ void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &
539 { 516 {
540 mSelected = FALSE; 517 mSelected = FALSE;
541 notifyObservers(); 518 notifyObservers();
542 return; 519 return NULL;
543 } 520 }
544 521
545 // Can't select across region boundary 522 // Can't select across region boundary
@@ -556,7 +533,7 @@ void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &
556 { 533 {
557 // just in case they somehow selected no land. 534 // just in case they somehow selected no land.
558 mSelected = FALSE; 535 mSelected = FALSE;
559 return; 536 return NULL;
560 } 537 }
561 538
562 if (region != region_other) 539 if (region != region_other)
@@ -564,50 +541,13 @@ void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &
564 LLNotifyBox::showXml("CantSelectLandFromMultipleRegions"); 541 LLNotifyBox::showXml("CantSelectLandFromMultipleRegions");
565 mSelected = FALSE; 542 mSelected = FALSE;
566 notifyObservers(); 543 notifyObservers();
567 return; 544 return NULL;
568 } 545 }
569 546
570 // Build region global copies of corners 547 // Build region global copies of corners
571 LLVector3 wsb_region = region->getPosRegionFromGlobal( mWestSouth ); 548 LLVector3 wsb_region = region->getPosRegionFromGlobal( mWestSouth );
572 LLVector3 ent_region = region->getPosRegionFromGlobal( mEastNorth ); 549 LLVector3 ent_region = region->getPosRegionFromGlobal( mEastNorth );
573 550
574 /*
575 // Check land to make sure all is either public, owned, or self
576 LLViewerParcelOverlay* overlay = region->getParcelOverlay();
577 if (!overlay)
578 {
579 llerrs << "No overlay in LLViewerParcelMgr::selectLand" << llendl;
580 return;
581 }
582
583 U8 start_ownership = overlay->ownership( wsb_region );
584 BOOL identical = TRUE;
585 S32 x_steps = S32( getSelectionWidth() / PARCEL_GRID_STEP_METERS );
586 S32 y_steps = S32( getSelectionHeight() / PARCEL_GRID_STEP_METERS );
587
588 for (S32 x = 0; x < x_steps && identical; x++ )
589 {
590 for (S32 y = 0; y < y_steps && identical; y++ )
591 {
592 // strange recomputation each time to avoid error accumulation
593 LLVector3 check = wsb_region;
594 check.mV[VX] += x * PARCEL_GRID_STEP_METERS;
595 check.mV[VY] += y * PARCEL_GRID_STEP_METERS;
596
597 identical = (start_ownership == overlay->ownership(check));
598 }
599 }
600
601 if (!identical)
602 {
603 add_chat("Can't select mix of your own, other people's and public land.", FALSE, "", FALSE, CHAT_SOURCE_SYSTEM);
604 add_chat("Try selecting a smaller piece of land.", FALSE, "", FALSE, CHAT_SOURCE_SYSTEM);
605 mSelected = FALSE;
606 notifyObservers();
607 return;
608 }
609 */
610
611 // Send request message 551 // Send request message
612 LLMessageSystem *msg = gMessageSystem; 552 LLMessageSystem *msg = gMessageSystem;
613 msg->newMessageFast(_PREHASH_ParcelPropertiesRequest); 553 msg->newMessageFast(_PREHASH_ParcelPropertiesRequest);
@@ -628,12 +568,24 @@ void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &
628 // clear the list of segments to prevent flashing 568 // clear the list of segments to prevent flashing
629 resetSegments(mHighlightSegments); 569 resetSegments(mHighlightSegments);
630 570
571 mFloatingParcelSelection->setParcel(mCurrentParcel);
572 mCurrentParcelSelection->setParcel(NULL);
573 mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
574
631 mSelected = TRUE; 575 mSelected = TRUE;
632 mWholeParcelSelected = snap_selection; 576 mCurrentParcelSelection->mWholeParcelSelected = snap_selection;
633 notifyObservers(); 577 notifyObservers();
634 return; 578 return mCurrentParcelSelection;
635} 579}
636 580
581void LLViewerParcelMgr::deselectUnused()
582{
583 // no more outstanding references to this selection, other than our own
584 if (mCurrentParcelSelection->getNumRefs() == 1 && mFloatingParcelSelection->getNumRefs() == 1)
585 {
586 deselectLand();
587 }
588}
637 589
638void LLViewerParcelMgr::deselectLand() 590void LLViewerParcelMgr::deselectLand()
639{ 591{
@@ -642,14 +594,20 @@ void LLViewerParcelMgr::deselectLand()
642 mSelected = FALSE; 594 mSelected = FALSE;
643 595
644 // Invalidate the selected parcel 596 // Invalidate the selected parcel
645 mParcel->setLocalID(-1); 597 mCurrentParcel->setLocalID(-1);
646 mParcel->mAccessList.clear(); 598 mCurrentParcel->mAccessList.clear();
647 mParcel->mBanList.clear(); 599 mCurrentParcel->mBanList.clear();
648 //mParcel->mRenterList.reset(); 600 //mCurrentParcel->mRenterList.reset();
649 601
650 mSelectedDwell = 0.f; 602 mSelectedDwell = 0.f;
651 603
652 notifyObservers(); 604 notifyObservers();
605
606 // invalidate parcel selection so that existing users of this selection can clean up
607 mCurrentParcelSelection->setParcel(NULL);
608 mFloatingParcelSelection->setParcel(NULL);
609 // create new parcel selection
610 mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
653 } 611 }
654} 612}
655 613
@@ -694,18 +652,15 @@ BOOL LLViewerParcelMgr::selectionEmpty() const
694} 652}
695 653
696 654
697LLParcel *LLViewerParcelMgr::getSelectedParcel() const 655LLParcelSelectionHandle LLViewerParcelMgr::getParcelSelection() const
698{ 656{
699 if (mSelected) 657 return mCurrentParcelSelection;
700 {
701 return mParcel;
702 }
703 else
704 {
705 return NULL;
706 }
707} 658}
708 659
660LLParcelSelectionHandle LLViewerParcelMgr::getFloatingParcelSelection() const
661{
662 return mFloatingParcelSelection;
663}
709 664
710LLParcel *LLViewerParcelMgr::getAgentParcel() const 665LLParcel *LLViewerParcelMgr::getAgentParcel() const
711{ 666{
@@ -717,9 +672,10 @@ BOOL LLViewerParcelMgr::agentCanBuild() const
717{ 672{
718 if (mAgentParcel) 673 if (mAgentParcel)
719 { 674 {
720 return gAgent.isGodlike() 675 return (gAgent.isGodlike()
721 || (mAgentParcel->getOwnerID() == gAgent.getID()) 676 || (mAgentParcel->allowModifyBy(
722 || (mAgentParcel->getAllowModify()); 677 gAgent.getID(),
678 gAgent.getGroupID())));
723 } 679 }
724 else 680 else
725 { 681 {
@@ -923,11 +879,11 @@ void LLViewerParcelMgr::sendParcelAccessListRequest(U32 flags)
923 879
924 if (flags & AL_BAN) 880 if (flags & AL_BAN)
925 { 881 {
926 mParcel->mBanList.clear(); 882 mCurrentParcel->mBanList.clear();
927 } 883 }
928 if (flags & AL_ACCESS) 884 if (flags & AL_ACCESS)
929 { 885 {
930 mParcel->mAccessList.clear(); 886 mCurrentParcel->mAccessList.clear();
931 } 887 }
932 888
933 // Only the headers differ 889 // Only the headers differ
@@ -938,7 +894,7 @@ void LLViewerParcelMgr::sendParcelAccessListRequest(U32 flags)
938 msg->nextBlockFast(_PREHASH_Data); 894 msg->nextBlockFast(_PREHASH_Data);
939 msg->addS32Fast(_PREHASH_SequenceID, 0); 895 msg->addS32Fast(_PREHASH_SequenceID, 0);
940 msg->addU32Fast(_PREHASH_Flags, flags); 896 msg->addU32Fast(_PREHASH_Flags, flags);
941 msg->addS32("LocalID", mParcel->getLocalID() ); 897 msg->addS32("LocalID", mCurrentParcel->getLocalID() );
942 msg->sendReliable( region->getHost() ); 898 msg->sendReliable( region->getHost() );
943} 899}
944 900
@@ -961,7 +917,7 @@ void LLViewerParcelMgr::sendParcelDwellRequest()
961 msg->addUUID("AgentID", gAgent.getID() ); 917 msg->addUUID("AgentID", gAgent.getID() );
962 msg->addUUID("SessionID", gAgent.getSessionID()); 918 msg->addUUID("SessionID", gAgent.getSessionID());
963 msg->nextBlock("Data"); 919 msg->nextBlock("Data");
964 msg->addS32("LocalID", mParcel->getLocalID()); 920 msg->addS32("LocalID", mCurrentParcel->getLocalID());
965 msg->addUUID("ParcelID", LLUUID::null); // filled in on simulator 921 msg->addUUID("ParcelID", LLUUID::null); // filled in on simulator
966 msg->sendReliable( region->getHost() ); 922 msg->sendReliable( region->getHost() );
967} 923}
@@ -1000,8 +956,8 @@ void LLViewerParcelMgr::sendParcelGodForceOwner(const LLUUID& owner_id)
1000 956
1001 llinfos << "Region " << region->getOriginGlobal() << llendl; 957 llinfos << "Region " << region->getOriginGlobal() << llendl;
1002 958
1003 LLGodForceOwnerData* data = new LLGodForceOwnerData(owner_id, mParcel->getLocalID(), region->getHost()); 959 LLGodForceOwnerData* data = new LLGodForceOwnerData(owner_id, mCurrentParcel->getLocalID(), region->getHost());
1004 if(mParcel->getAuctionID()) 960 if(mCurrentParcel->getAuctionID())
1005 { 961 {
1006 gViewerWindow->alertXml("ForceOwnerAuctionWarning", 962 gViewerWindow->alertXml("ForceOwnerAuctionWarning",
1007 callback_god_force_owner, 963 callback_god_force_owner,
@@ -1051,7 +1007,7 @@ void LLViewerParcelMgr::sendParcelGodForceToContent()
1051 msg->addUUID("AgentID", gAgent.getID()); 1007 msg->addUUID("AgentID", gAgent.getID());
1052 msg->addUUID("SessionID", gAgent.getSessionID()); 1008 msg->addUUID("SessionID", gAgent.getSessionID());
1053 msg->nextBlock("ParcelData"); 1009 msg->nextBlock("ParcelData");
1054 msg->addS32("LocalID", mParcel->getLocalID()); 1010 msg->addS32("LocalID", mCurrentParcel->getLocalID());
1055 msg->sendReliable(region->getHost()); 1011 msg->sendReliable(region->getHost());
1056} 1012}
1057 1013
@@ -1079,7 +1035,7 @@ void LLViewerParcelMgr::sendParcelRelease()
1079 msg->addUUID("AgentID", gAgent.getID() ); 1035 msg->addUUID("AgentID", gAgent.getID() );
1080 msg->addUUID("SessionID", gAgent.getSessionID() ); 1036 msg->addUUID("SessionID", gAgent.getSessionID() );
1081 msg->nextBlock("Data"); 1037 msg->nextBlock("Data");
1082 msg->addS32("LocalID", mParcel->getLocalID() ); 1038 msg->addS32("LocalID", mCurrentParcel->getLocalID() );
1083 //msg->addU32("Flags", flags); 1039 //msg->addU32("Flags", flags);
1084 msg->sendReliable( region->getHost() ); 1040 msg->sendReliable( region->getHost() );
1085 1041
@@ -1117,7 +1073,7 @@ LLViewerParcelMgr::ParcelBuyInfo* LLViewerParcelMgr::setupParcelBuy(
1117 BOOL is_claim, 1073 BOOL is_claim,
1118 BOOL remove_contribution) 1074 BOOL remove_contribution)
1119{ 1075{
1120 if (!mSelected || !mParcel) 1076 if (!mSelected || !mCurrentParcel)
1121 { 1077 {
1122 gViewerWindow->alertXml("CannotBuyLandNothingSelected"); 1078 gViewerWindow->alertXml("CannotBuyLandNothingSelected");
1123 return NULL; 1079 return NULL;
@@ -1162,7 +1118,7 @@ LLViewerParcelMgr::ParcelBuyInfo* LLViewerParcelMgr::setupParcelBuy(
1162 1118
1163 if (!is_claim) 1119 if (!is_claim)
1164 { 1120 {
1165 info->mParcelID = mParcel->getLocalID(); 1121 info->mParcelID = mCurrentParcel->getLocalID();
1166 } 1122 }
1167 else 1123 else
1168 { 1124 {
@@ -1215,7 +1171,7 @@ void LLViewerParcelMgr::deleteParcelBuy(ParcelBuyInfo*& info)
1215 1171
1216void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id) 1172void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id)
1217{ 1173{
1218 if (!mSelected || !mParcel) 1174 if (!mSelected || !mCurrentParcel)
1219 { 1175 {
1220 gViewerWindow->alertXml("CannotDeedLandNothingSelected"); 1176 gViewerWindow->alertXml("CannotDeedLandNothingSelected");
1221 return; 1177 return;
@@ -1239,7 +1195,7 @@ void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id)
1239 msg->addUUID("SessionID", gAgent.getSessionID() ); 1195 msg->addUUID("SessionID", gAgent.getSessionID() );
1240 msg->nextBlock("Data"); 1196 msg->nextBlock("Data");
1241 msg->addUUID("GroupID", group_id ); 1197 msg->addUUID("GroupID", group_id );
1242 msg->addS32("LocalID", mParcel->getLocalID() ); 1198 msg->addS32("LocalID", mCurrentParcel->getLocalID() );
1243 //msg->addU32("JoinNeighbors", join); 1199 //msg->addU32("JoinNeighbors", join);
1244 msg->sendReliable( region->getHost() ); 1200 msg->sendReliable( region->getHost() );
1245} 1201}
@@ -1253,7 +1209,7 @@ void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id)
1253void LLViewerParcelMgr::makeLandmarkAtSelection() 1209void LLViewerParcelMgr::makeLandmarkAtSelection()
1254{ 1210{
1255 // Don't create for parcels you don't own 1211 // Don't create for parcels you don't own
1256 if (gAgent.getID() != mParcel->getOwnerID()) 1212 if (gAgent.getID() != mCurrentParcel->getOwnerID())
1257 { 1213 {
1258 return; 1214 return;
1259 } 1215 }
@@ -1289,7 +1245,7 @@ const char* LLViewerParcelMgr::getAgentParcelName() const
1289} 1245}
1290 1246
1291 1247
1292void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, BOOL want_reply_to_update) 1248void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel)
1293{ 1249{
1294 if (!parcel) return; 1250 if (!parcel) return;
1295 1251
@@ -1306,7 +1262,8 @@ void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, BOOL want_r
1306 msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID() ); 1262 msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID() );
1307 1263
1308 U32 flags = 0x0; 1264 U32 flags = 0x0;
1309 if (want_reply_to_update) flags |= 0x01; 1265 // request new properties update from simulator
1266 flags |= 0x01;
1310 msg->addU32("Flags", flags); 1267 msg->addU32("Flags", flags);
1311 1268
1312 parcel->packMessage(msg); 1269 parcel->packMessage(msg);
@@ -1450,7 +1407,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
1450 { 1407 {
1451 // ...selected parcels report this sequence id 1408 // ...selected parcels report this sequence id
1452 gParcelMgr->mRequestResult = PARCEL_RESULT_SUCCESS; 1409 gParcelMgr->mRequestResult = PARCEL_RESULT_SUCCESS;
1453 parcel = gParcelMgr->mParcel; 1410 parcel = gParcelMgr->mCurrentParcel;
1454 } 1411 }
1455 else if (sequence_id == HOVERED_PARCEL_SEQ_ID) 1412 else if (sequence_id == HOVERED_PARCEL_SEQ_ID)
1456 { 1413 {
@@ -1559,11 +1516,11 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
1559 if (sequence_id == SELECTED_PARCEL_SEQ_ID) 1516 if (sequence_id == SELECTED_PARCEL_SEQ_ID)
1560 { 1517 {
1561 // Update selected counts 1518 // Update selected counts
1562 gParcelMgr->mSelectedSelfCount = self_count; 1519 gParcelMgr->mCurrentParcelSelection->mSelectedSelfCount = self_count;
1563 gParcelMgr->mSelectedOtherCount = other_count; 1520 gParcelMgr->mCurrentParcelSelection->mSelectedOtherCount = other_count;
1564 gParcelMgr->mSelectedPublicCount = public_count; 1521 gParcelMgr->mCurrentParcelSelection->mSelectedPublicCount = public_count;
1565 1522
1566 gParcelMgr->mSelectedMultipleOwners = 1523 gParcelMgr->mCurrentParcelSelection->mSelectedMultipleOwners =
1567 (request_result == PARCEL_RESULT_MULTIPLE); 1524 (request_result == PARCEL_RESULT_MULTIPLE);
1568 1525
1569 // Select the whole parcel 1526 // Select the whole parcel
@@ -1583,7 +1540,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
1583 west_south.mV[VY], 1540 west_south.mV[VY],
1584 east_north.mV[VX], 1541 east_north.mV[VX],
1585 east_north.mV[VY] ); 1542 east_north.mV[VY] );
1586 gParcelMgr->mWholeParcelSelected = FALSE; 1543 gParcelMgr->mCurrentParcelSelection->mWholeParcelSelected = FALSE;
1587 } 1544 }
1588 else if (0 == local_id) 1545 else if (0 == local_id)
1589 { 1546 {
@@ -1597,7 +1554,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
1597 aabb_min.mV[VY], 1554 aabb_min.mV[VY],
1598 aabb_max.mV[VX], 1555 aabb_max.mV[VX],
1599 aabb_max.mV[VY] ); 1556 aabb_max.mV[VY] );
1600 gParcelMgr->mWholeParcelSelected = TRUE; 1557 gParcelMgr->mCurrentParcelSelection->mWholeParcelSelected = TRUE;
1601 } 1558 }
1602 else 1559 else
1603 { 1560 {
@@ -1614,10 +1571,10 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
1614 gParcelMgr->resetSegments(gParcelMgr->mHighlightSegments); 1571 gParcelMgr->resetSegments(gParcelMgr->mHighlightSegments);
1615 gParcelMgr->writeSegmentsFromBitmap( bitmap, gParcelMgr->mHighlightSegments ); 1572 gParcelMgr->writeSegmentsFromBitmap( bitmap, gParcelMgr->mHighlightSegments );
1616 1573
1617 delete bitmap; 1574 delete[] bitmap;
1618 bitmap = NULL; 1575 bitmap = NULL;
1619 1576
1620 gParcelMgr->mWholeParcelSelected = TRUE; 1577 gParcelMgr->mCurrentParcelSelection->mWholeParcelSelected = TRUE;
1621 } 1578 }
1622 1579
1623 // Request access list information for this land 1580 // Request access list information for this land
@@ -1666,7 +1623,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
1666 gParcelMgr->resetSegments(gParcelMgr->mCollisionSegments); 1623 gParcelMgr->resetSegments(gParcelMgr->mCollisionSegments);
1667 gParcelMgr->writeSegmentsFromBitmap( bitmap, gParcelMgr->mCollisionSegments ); 1624 gParcelMgr->writeSegmentsFromBitmap( bitmap, gParcelMgr->mCollisionSegments );
1668 1625
1669 delete bitmap; 1626 delete[] bitmap;
1670 bitmap = NULL; 1627 bitmap = NULL;
1671 1628
1672 } 1629 }
@@ -1815,10 +1772,10 @@ void optionally_start_music(const LLString& music_url)
1815{ 1772{
1816 if (gSavedSettings.getWarning("FirstStreamingMusic")) 1773 if (gSavedSettings.getWarning("FirstStreamingMusic"))
1817 { 1774 {
1818 void* data = (void*)strdup(music_url.c_str()); 1775 std::string* newstring = new std::string(music_url);
1819 gViewerWindow->alertXml("ParcelCanPlayMusic", 1776 gViewerWindow->alertXml("ParcelCanPlayMusic",
1820 callback_start_music, 1777 callback_start_music,
1821 (void*)data); 1778 (void*)newstring);
1822 1779
1823 } 1780 }
1824 else if (gSavedSettings.getBOOL("AudioStreamingMusic")) 1781 else if (gSavedSettings.getBOOL("AudioStreamingMusic"))
@@ -1841,7 +1798,7 @@ void optionally_start_music(const LLString& music_url)
1841 1798
1842void callback_start_music(S32 option, void* data) 1799void callback_start_music(S32 option, void* data)
1843{ 1800{
1844 const char* music_url = (const char*)data; 1801 std::string* music_url = (std::string*)data;
1845 1802
1846 if (0 == option) 1803 if (0 == option)
1847 { 1804 {
@@ -1849,7 +1806,7 @@ void callback_start_music(S32 option, void* data)
1849 llinfos << "Starting first parcel music " << music_url << llendl; 1806 llinfos << "Starting first parcel music " << music_url << llendl;
1850 if (gAudiop) 1807 if (gAudiop)
1851 { 1808 {
1852 gAudiop->startInternetStream(music_url); 1809 gAudiop->startInternetStream(music_url->c_str());
1853 LLMediaRemoteCtrl* ctrl = gOverlayBar->getMusicRemoteControl(); 1810 LLMediaRemoteCtrl* ctrl = gOverlayBar->getMusicRemoteControl();
1854 ctrl->setTransportState( LLMediaRemoteCtrl::Play, FALSE ); 1811 ctrl->setTransportState( LLMediaRemoteCtrl::Play, FALSE );
1855 } 1812 }
@@ -1861,7 +1818,7 @@ void callback_start_music(S32 option, void* data)
1861 1818
1862 gSavedSettings.setWarning("FirstStreamingMusic", FALSE); 1819 gSavedSettings.setWarning("FirstStreamingMusic", FALSE);
1863 1820
1864 delete [] music_url; 1821 delete music_url;
1865 music_url = NULL; 1822 music_url = NULL;
1866} 1823}
1867 1824
@@ -1962,7 +1919,7 @@ void LLViewerParcelMgr::processParcelAccessListReply(LLMessageSystem *msg, void
1962 msg->getU32Fast( _PREHASH_Data, _PREHASH_Flags, message_flags); 1919 msg->getU32Fast( _PREHASH_Data, _PREHASH_Flags, message_flags);
1963 msg->getS32Fast( _PREHASH_Data, _PREHASH_LocalID, parcel_id); 1920 msg->getS32Fast( _PREHASH_Data, _PREHASH_LocalID, parcel_id);
1964 1921
1965 LLParcel* parcel = gParcelMgr->mParcel; 1922 LLParcel* parcel = gParcelMgr->mCurrentParcel;
1966 if (!parcel) return; 1923 if (!parcel) return;
1967 1924
1968 if (parcel_id != parcel->getLocalID()) 1925 if (parcel_id != parcel->getLocalID())
@@ -2004,7 +1961,7 @@ void LLViewerParcelMgr::processParcelDwellReply(LLMessageSystem* msg, void**)
2004 F32 dwell; 1961 F32 dwell;
2005 msg->getF32("Data", "Dwell", dwell); 1962 msg->getF32("Data", "Dwell", dwell);
2006 1963
2007 if (local_id == gParcelMgr->mParcel->getLocalID()) 1964 if (local_id == gParcelMgr->mCurrentParcel->getLocalID())
2008 { 1965 {
2009 gParcelMgr->mSelectedDwell = dwell; 1966 gParcelMgr->mSelectedDwell = dwell;
2010 gParcelMgr->notifyObservers(); 1967 gParcelMgr->notifyObservers();
@@ -2028,7 +1985,7 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which)
2028 1985
2029 LLMessageSystem* msg = gMessageSystem; 1986 LLMessageSystem* msg = gMessageSystem;
2030 1987
2031 LLParcel* parcel = mParcel; 1988 LLParcel* parcel = mCurrentParcel;
2032 if (!parcel) return; 1989 if (!parcel) return;
2033 1990
2034 if (which & AL_ACCESS) 1991 if (which & AL_ACCESS)
@@ -2148,18 +2105,18 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which)
2148 2105
2149void LLViewerParcelMgr::deedLandToGroup() 2106void LLViewerParcelMgr::deedLandToGroup()
2150{ 2107{
2151 char group_name[MAX_STRING]; 2108 char group_name[MAX_STRING]; /* Flawfinder: ignore */
2152 gCacheName->getGroupName(mParcel->getGroupID(), group_name); 2109 gCacheName->getGroupName(mCurrentParcel->getGroupID(), group_name);
2153 LLString::format_map_t args; 2110 LLString::format_map_t args;
2154 args["[AREA]"] = llformat("%d", mParcel->getArea()); 2111 args["[AREA]"] = llformat("%d", mCurrentParcel->getArea());
2155 args["[GROUP_NAME]"] = group_name; 2112 args["[GROUP_NAME]"] = group_name;
2156 if(mParcel->getContributeWithDeed()) 2113 if(mCurrentParcel->getContributeWithDeed())
2157 { 2114 {
2158 char first_name[DB_FIRST_NAME_BUF_SIZE]; 2115 char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
2159 first_name[0] = '\0'; 2116 first_name[0] = '\0';
2160 char last_name[DB_FIRST_NAME_BUF_SIZE]; 2117 char last_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
2161 last_name[0] = '\0'; 2118 last_name[0] = '\0';
2162 gCacheName->getName(mParcel->getOwnerID(), first_name, last_name); 2119 gCacheName->getName(mCurrentParcel->getOwnerID(), first_name, last_name);
2163 args["[FIRST_NAME]"] = first_name; 2120 args["[FIRST_NAME]"] = first_name;
2164 args["[LAST_NAME]"] = last_name; 2121 args["[LAST_NAME]"] = last_name;
2165 gViewerWindow->alertXml("DeedLandToGroupWithContribution",args, deedAlertCB, NULL); 2122 gViewerWindow->alertXml("DeedLandToGroupWithContribution",args, deedAlertCB, NULL);
@@ -2175,7 +2132,7 @@ void LLViewerParcelMgr::deedAlertCB(S32 option, void*)
2175{ 2132{
2176 if (option == 0) 2133 if (option == 0)
2177 { 2134 {
2178 LLParcel* parcel = gParcelMgr->getSelectedParcel(); 2135 LLParcel* parcel = gParcelMgr->getParcelSelection()->getParcel();
2179 LLUUID group_id; 2136 LLUUID group_id;
2180 if(parcel) 2137 if(parcel)
2181 { 2138 {
@@ -2206,7 +2163,7 @@ void LLViewerParcelMgr::startReleaseLand()
2206 return; 2163 return;
2207 } 2164 }
2208 2165
2209 if (!isParcelOwnedByAgent(mParcel, GP_LAND_RELEASE) 2166 if (!isParcelOwnedByAgent(mCurrentParcel, GP_LAND_RELEASE)
2210 && !(gAgent.canManageEstate())) 2167 && !(gAgent.canManageEstate()))
2211 { 2168 {
2212 gViewerWindow->alertXml("CannotReleaseLandDontOwn"); 2169 gViewerWindow->alertXml("CannotReleaseLandDontOwn");
@@ -2231,7 +2188,7 @@ void LLViewerParcelMgr::startReleaseLand()
2231 } 2188 }
2232*/ 2189*/
2233 2190
2234 if (!mWholeParcelSelected) 2191 if (!mCurrentParcelSelection->mWholeParcelSelected)
2235 { 2192 {
2236 gViewerWindow->alertXml("CannotReleaseLandPartialSelection"); 2193 gViewerWindow->alertXml("CannotReleaseLandPartialSelection");
2237 return; 2194 return;
@@ -2239,7 +2196,7 @@ void LLViewerParcelMgr::startReleaseLand()
2239 2196
2240 // Compute claim price 2197 // Compute claim price
2241 LLStringBase<char>::format_map_t args; 2198 LLStringBase<char>::format_map_t args;
2242 args["[AREA]"] = llformat("%d",mParcel->getArea()); 2199 args["[AREA]"] = llformat("%d",mCurrentParcel->getArea());
2243 gViewerWindow->alertXml("ReleaseLandWarning", args, 2200 gViewerWindow->alertXml("ReleaseLandWarning", args,
2244 releaseAlertCB, this); 2201 releaseAlertCB, this);
2245} 2202}
@@ -2251,7 +2208,7 @@ bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const
2251 return false; 2208 return false;
2252 } 2209 }
2253 2210
2254 if (mSelected && parcel == mParcel) 2211 if (mSelected && parcel == mCurrentParcel)
2255 { 2212 {
2256 if (mRequestResult == PARCEL_RESULT_NO_DATA) 2213 if (mRequestResult == PARCEL_RESULT_NO_DATA)
2257 { 2214 {
@@ -2291,12 +2248,12 @@ bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const
2291 2248
2292void LLViewerParcelMgr::startBuyLand(BOOL is_for_group) 2249void LLViewerParcelMgr::startBuyLand(BOOL is_for_group)
2293{ 2250{
2294 LLFloaterBuyLand::buyLand(getSelectionRegion(), mParcel, is_for_group == TRUE); 2251 LLFloaterBuyLand::buyLand(getSelectionRegion(), mCurrentParcelSelection, is_for_group == TRUE);
2295} 2252}
2296 2253
2297void LLViewerParcelMgr::startSellLand() 2254void LLViewerParcelMgr::startSellLand()
2298{ 2255{
2299 LLFloaterSellLand::sellLand(getSelectionRegion(), mParcel); 2256 LLFloaterSellLand::sellLand(getSelectionRegion(), mCurrentParcelSelection);
2300} 2257}
2301 2258
2302void LLViewerParcelMgr::startDivideLand() 2259void LLViewerParcelMgr::startDivideLand()
@@ -2307,7 +2264,7 @@ void LLViewerParcelMgr::startDivideLand()
2307 return; 2264 return;
2308 } 2265 }
2309 2266
2310 if (mWholeParcelSelected) 2267 if (mCurrentParcelSelection->mWholeParcelSelected)
2311 { 2268 {
2312 gViewerWindow->alertXml("CannotDivideLandPartialSelection"); 2269 gViewerWindow->alertXml("CannotDivideLandPartialSelection");
2313 return; 2270 return;
@@ -2359,13 +2316,13 @@ void LLViewerParcelMgr::startJoinLand()
2359 return; 2316 return;
2360 } 2317 }
2361 2318
2362 if (mWholeParcelSelected) 2319 if (mCurrentParcelSelection->mWholeParcelSelected)
2363 { 2320 {
2364 gViewerWindow->alertXml("CannotJoinLandEntireParcelSelected"); 2321 gViewerWindow->alertXml("CannotJoinLandEntireParcelSelected");
2365 return; 2322 return;
2366 } 2323 }
2367 2324
2368 if (!mSelectedMultipleOwners) 2325 if (!mCurrentParcelSelection->mSelectedMultipleOwners)
2369 { 2326 {
2370 gViewerWindow->alertXml("CannotJoinLandSelection"); 2327 gViewerWindow->alertXml("CannotJoinLandSelection");
2371 return; 2328 return;
@@ -2411,7 +2368,7 @@ void LLViewerParcelMgr::callbackJoinLand(S32 option, void* data)
2411 2368
2412void LLViewerParcelMgr::startDeedLandToGroup() 2369void LLViewerParcelMgr::startDeedLandToGroup()
2413{ 2370{
2414 if (!mSelected || !mParcel) 2371 if (!mSelected || !mCurrentParcel)
2415 { 2372 {
2416 gViewerWindow->alertXml("CannotDeedLandNothingSelected"); 2373 gViewerWindow->alertXml("CannotDeedLandNothingSelected");
2417 return; 2374 return;
@@ -2441,7 +2398,7 @@ void LLViewerParcelMgr::startDeedLandToGroup()
2441 if(!gAgent.isGodlike()) 2398 if(!gAgent.isGodlike())
2442 { 2399 {
2443 if((region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) 2400 if((region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
2444 && (mParcel->getOwnerID() != region->getOwner())) 2401 && (mCurrentParcel->getOwnerID() != region->getOwner()))
2445 { 2402 {
2446 LLStringBase<char>::format_map_t args; 2403 LLStringBase<char>::format_map_t args;
2447 args["[REGION]"] = region->getName(); 2404 args["[REGION]"] = region->getName();
@@ -2455,7 +2412,7 @@ void LLViewerParcelMgr::startDeedLandToGroup()
2455} 2412}
2456void LLViewerParcelMgr::reclaimParcel() 2413void LLViewerParcelMgr::reclaimParcel()
2457{ 2414{
2458 LLParcel* parcel = gParcelMgr->getSelectedParcel(); 2415 LLParcel* parcel = gParcelMgr->getParcelSelection()->getParcel();
2459 LLViewerRegion* regionp = gParcelMgr->getSelectionRegion(); 2416 LLViewerRegion* regionp = gParcelMgr->getSelectionRegion();
2460 if(parcel && parcel->getOwnerID().notNull() 2417 if(parcel && parcel->getOwnerID().notNull()
2461 && (parcel->getOwnerID() != gAgent.getID()) 2418 && (parcel->getOwnerID() != gAgent.getID())
@@ -2484,7 +2441,7 @@ void LLViewerParcelMgr::releaseAlertCB(S32 option, void *)
2484 2441
2485void LLViewerParcelMgr::buyPass() 2442void LLViewerParcelMgr::buyPass()
2486{ 2443{
2487 LLParcel* parcel = getSelectedParcel(); 2444 LLParcel* parcel = getParcelSelection()->getParcel();
2488 if (!parcel) return; 2445 if (!parcel) return;
2489 2446
2490 LLViewerRegion* region = getSelectionRegion(); 2447 LLViewerRegion* region = getSelectionRegion();
@@ -2578,3 +2535,58 @@ void sanitize_corners(const LLVector3d &corner1,
2578 east_north_top.mdV[VZ] = llmax( corner1.mdV[VZ], corner2.mdV[VZ] ); 2535 east_north_top.mdV[VZ] = llmax( corner1.mdV[VZ], corner2.mdV[VZ] );
2579} 2536}
2580 2537
2538//
2539// LLParcelSelection
2540//
2541LLParcelSelection::LLParcelSelection() :
2542 mParcel(NULL),
2543 mSelectedMultipleOwners(FALSE),
2544 mWholeParcelSelected(FALSE),
2545 mSelectedSelfCount(0),
2546 mSelectedOtherCount(0),
2547 mSelectedPublicCount(0)
2548{
2549}
2550
2551LLParcelSelection::LLParcelSelection(LLParcel* parcel) :
2552 mParcel(parcel),
2553 mSelectedMultipleOwners(FALSE),
2554 mWholeParcelSelected(FALSE),
2555 mSelectedSelfCount(0),
2556 mSelectedOtherCount(0),
2557 mSelectedPublicCount(0)
2558{
2559}
2560
2561LLParcelSelection::~LLParcelSelection()
2562{
2563}
2564
2565BOOL LLParcelSelection::getMultipleOwners() const
2566{
2567 return mSelectedMultipleOwners;
2568}
2569
2570
2571BOOL LLParcelSelection::getWholeParcelSelected() const
2572{
2573 return mWholeParcelSelected;
2574}
2575
2576
2577S32 LLParcelSelection::getClaimableArea() const
2578{
2579 const S32 UNIT_AREA = S32( PARCEL_GRID_STEP_METERS * PARCEL_GRID_STEP_METERS );
2580 return mSelectedPublicCount * UNIT_AREA;
2581}
2582
2583bool LLParcelSelection::hasOthersSelected() const
2584{
2585 return mSelectedOtherCount != 0;
2586}
2587
2588LLParcelSelection* get_null_parcel_selection()
2589{
2590 static LLParcelSelectionHandle null_ptr = new LLParcelSelection();
2591 return null_ptr;
2592}