aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llworldmap.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llworldmap.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llworldmap.cpp')
-rw-r--r--linden/indra/newview/llworldmap.cpp119
1 files changed, 73 insertions, 46 deletions
diff --git a/linden/indra/newview/llworldmap.cpp b/linden/indra/newview/llworldmap.cpp
index 0a2b33e..28ae94a 100644
--- a/linden/indra/newview/llworldmap.cpp
+++ b/linden/indra/newview/llworldmap.cpp
@@ -46,8 +46,6 @@
46#include "llviewerregion.h" 46#include "llviewerregion.h"
47#include "llregionflags.h" 47#include "llregionflags.h"
48 48
49LLWorldMap* gWorldMap = NULL;
50
51const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // 10 minutes 49const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // 10 minutes
52 50
53LLItemInfo::LLItemInfo(F32 global_x, F32 global_y, 51LLItemInfo::LLItemInfo(F32 global_x, F32 global_y,
@@ -108,6 +106,7 @@ LLWorldMap::LLWorldMap() :
108 mNeighborMapWidth(0), 106 mNeighborMapWidth(0),
109 mNeighborMapHeight(0), 107 mNeighborMapHeight(0),
110 mSLURLRegionName(), 108 mSLURLRegionName(),
109 mSLURLRegionHandle(0),
111 mSLURL(), 110 mSLURL(),
112 mSLURLCallback(0), 111 mSLURLCallback(0),
113 mSLURLTeleport(false) 112 mSLURLTeleport(false)
@@ -344,6 +343,8 @@ void LLWorldMap::sendItemRequest(U32 type, U64 handle)
344// public 343// public
345void LLWorldMap::sendMapLayerRequest() 344void LLWorldMap::sendMapLayerRequest()
346{ 345{
346 if (!gAgent.getRegion()) return;
347
347 LLSD body; 348 LLSD body;
348 body["Flags"] = mCurrentMap; 349 body["Flags"] = mCurrentMap;
349 std::string url = gAgent.getRegion()->getCapability( 350 std::string url = gAgent.getRegion()->getCapability(
@@ -409,6 +410,7 @@ void LLWorldMap::sendNamedRegionRequest(std::string region_name,
409 bool teleport) // immediately teleport when result returned 410 bool teleport) // immediately teleport when result returned
410{ 411{
411 mSLURLRegionName = region_name; 412 mSLURLRegionName = region_name;
413 mSLURLRegionHandle = 0;
412 mSLURL = callback_url; 414 mSLURL = callback_url;
413 mSLURLCallback = callback; 415 mSLURLCallback = callback;
414 mSLURLTeleport = teleport; 416 mSLURLTeleport = teleport;
@@ -416,6 +418,26 @@ void LLWorldMap::sendNamedRegionRequest(std::string region_name,
416 sendNamedRegionRequest(region_name); 418 sendNamedRegionRequest(region_name);
417} 419}
418 420
421void LLWorldMap::sendHandleRegionRequest(U64 region_handle,
422 url_callback_t callback,
423 const std::string& callback_url,
424 bool teleport) // immediately teleport when result returned
425{
426 mSLURLRegionName.clear();
427 mSLURLRegionHandle = region_handle;
428 mSLURL = callback_url;
429 mSLURLCallback = callback;
430 mSLURLTeleport = teleport;
431
432 U32 global_x;
433 U32 global_y;
434 from_region_handle(region_handle, &global_x, &global_y);
435 U16 grid_x = (U16)(global_x / REGION_WIDTH_UNITS);
436 U16 grid_y = (U16)(global_y / REGION_WIDTH_UNITS);
437
438 sendMapBlockRequest(grid_x, grid_y, grid_x, grid_y, true);
439}
440
419// public 441// public
420void LLWorldMap::sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent) 442void LLWorldMap::sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent)
421{ 443{
@@ -463,7 +485,7 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**)
463 U32 agent_flags; 485 U32 agent_flags;
464 msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); 486 msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags);
465 487
466 if (agent_flags != (U32)gWorldMap->mCurrentMap) 488 if (agent_flags != (U32)LLWorldMap::getInstance()->mCurrentMap)
467 { 489 {
468 llwarns << "Invalid or out of date map image type returned!" << llendl; 490 llwarns << "Invalid or out of date map image type returned!" << llendl;
469 return; 491 return;
@@ -474,7 +496,7 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**)
474 496
475 S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_LayerData); 497 S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_LayerData);
476 498
477 gWorldMap->mMapLayers[agent_flags].clear(); 499 LLWorldMap::getInstance()->mMapLayers[agent_flags].clear();
478 500
479 BOOL adjust = FALSE; 501 BOOL adjust = FALSE;
480 for (S32 block=0; block<num_blocks; ++block) 502 for (S32 block=0; block<num_blocks; ++block)
@@ -499,14 +521,14 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**)
499 521
500 F32 x_meters = F32(left*REGION_WIDTH_UNITS); 522 F32 x_meters = F32(left*REGION_WIDTH_UNITS);
501 F32 y_meters = F32(bottom*REGION_WIDTH_UNITS); 523 F32 y_meters = F32(bottom*REGION_WIDTH_UNITS);
502 adjust = gWorldMap->extendAABB(U32(x_meters), U32(y_meters), 524 adjust = LLWorldMap::getInstance()->extendAABB(U32(x_meters), U32(y_meters),
503 U32(x_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getWidth()), 525 U32(x_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getWidth()),
504 U32(y_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getHeight())) || adjust; 526 U32(y_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getHeight())) || adjust;
505 527
506 gWorldMap->mMapLayers[agent_flags].push_back(new_layer); 528 LLWorldMap::getInstance()->mMapLayers[agent_flags].push_back(new_layer);
507 } 529 }
508 530
509 gWorldMap->mMapLoaded[agent_flags] = TRUE; 531 LLWorldMap::getInstance()->mMapLoaded[agent_flags] = TRUE;
510 if(adjust) gFloaterWorldMap->adjustZoomSliderBounds(); 532 if(adjust) gFloaterWorldMap->adjustZoomSliderBounds();
511} 533}
512 534
@@ -554,32 +576,21 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**)
554 if (access == 255) 576 if (access == 255)
555 { 577 {
556 // This region doesn't exist 578 // This region doesn't exist
557 if (gWorldMap->mIsTrackingUnknownLocation && 579 if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation &&
558 gWorldMap->mUnknownLocation.mdV[0] >= x_meters && 580 LLWorldMap::getInstance()->mUnknownLocation.mdV[0] >= x_meters &&
559 gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && 581 LLWorldMap::getInstance()->mUnknownLocation.mdV[0] < x_meters + 256 &&
560 gWorldMap->mUnknownLocation.mdV[1] >= y_meters && 582 LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters &&
561 gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) 583 LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256)
562 { 584 {
563 // We were tracking this location, but it doesn't exist 585 // We were tracking this location, but it doesn't exist
564 gWorldMap->mInvalidLocation = TRUE; 586 LLWorldMap::getInstance()->mInvalidLocation = TRUE;
565 } 587 }
566 588
567 found_null_sim = true; 589 found_null_sim = true;
568 } 590 }
569 else if(gWorldMap->mSLURLCallback != NULL)
570 {
571 // Server returns definitive capitalization, SLURL might
572 // not have that.
573 if (!stricmp(gWorldMap->mSLURLRegionName.c_str(), name))
574 {
575 gWorldMap->mSLURLCallback(handle, gWorldMap->mSLURL, image_id, gWorldMap->mSLURLTeleport);
576 gWorldMap->mSLURLCallback = NULL;
577 gWorldMap->mSLURLRegionName.clear();
578 }
579 }
580 else 591 else
581 { 592 {
582 adjust = gWorldMap->extendAABB(x_meters, 593 adjust = LLWorldMap::getInstance()->extendAABB(x_meters,
583 y_meters, 594 y_meters,
584 x_meters+REGION_WIDTH_UNITS, 595 x_meters+REGION_WIDTH_UNITS,
585 y_meters+REGION_WIDTH_UNITS) || adjust; 596 y_meters+REGION_WIDTH_UNITS) || adjust;
@@ -587,8 +598,8 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**)
587// llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl; 598// llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl;
588 599
589 LLSimInfo* siminfo = new LLSimInfo(); 600 LLSimInfo* siminfo = new LLSimInfo();
590 sim_info_map_t::iterator iter = gWorldMap->mSimInfoMap.find(handle); 601 sim_info_map_t::iterator iter = LLWorldMap::getInstance()->mSimInfoMap.find(handle);
591 if (iter != gWorldMap->mSimInfoMap.end()) 602 if (iter != LLWorldMap::getInstance()->mSimInfoMap.end())
592 { 603 {
593 LLSimInfo* oldinfo = iter->second; 604 LLSimInfo* oldinfo = iter->second;
594 for (S32 image=0; image<MAP_SIM_IMAGE_TYPES; ++image) 605 for (S32 image=0; image<MAP_SIM_IMAGE_TYPES; ++image)
@@ -597,7 +608,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**)
597 } 608 }
598 delete oldinfo; 609 delete oldinfo;
599 } 610 }
600 gWorldMap->mSimInfoMap[handle] = siminfo; 611 LLWorldMap::getInstance()->mSimInfoMap[handle] = siminfo;
601 612
602 siminfo->mHandle = handle; 613 siminfo->mHandle = handle;
603 siminfo->mName.assign( name ); 614 siminfo->mName.assign( name );
@@ -605,7 +616,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**)
605 siminfo->mRegionFlags = region_flags; 616 siminfo->mRegionFlags = region_flags;
606 siminfo->mWaterHeight = (F32) water_height; 617 siminfo->mWaterHeight = (F32) water_height;
607 siminfo->mMapImageID[agent_flags] = image_id; 618 siminfo->mMapImageID[agent_flags] = image_id;
608 siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[gWorldMap->mCurrentMap], MIPMAP_TRUE, FALSE); 619 siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE);
609 siminfo->mCurrentImage->bindTexture(0); 620 siminfo->mCurrentImage->bindTexture(0);
610 siminfo->mCurrentImage->setClamp(TRUE, TRUE); 621 siminfo->mCurrentImage->setClamp(TRUE, TRUE);
611 622
@@ -618,22 +629,22 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**)
618 siminfo->mOverlayImage = NULL; 629 siminfo->mOverlayImage = NULL;
619 } 630 }
620 631
621 if (gWorldMap->mIsTrackingUnknownLocation && 632 if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation &&
622 gWorldMap->mUnknownLocation.mdV[0] >= x_meters && 633 LLWorldMap::getInstance()->mUnknownLocation.mdV[0] >= x_meters &&
623 gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && 634 LLWorldMap::getInstance()->mUnknownLocation.mdV[0] < x_meters + 256 &&
624 gWorldMap->mUnknownLocation.mdV[1] >= y_meters && 635 LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters &&
625 gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) 636 LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256)
626 { 637 {
627 if (siminfo->mAccess == SIM_ACCESS_DOWN) 638 if (siminfo->mAccess == SIM_ACCESS_DOWN)
628 { 639 {
629 // We were tracking this location, but it doesn't exist 640 // We were tracking this location, but it doesn't exist
630 gWorldMap->mInvalidLocation = true; 641 LLWorldMap::getInstance()->mInvalidLocation = true;
631 } 642 }
632 else 643 else
633 { 644 {
634 // We were tracking this location, and it does exist 645 // We were tracking this location, and it does exist
635 bool is_tracking_dbl = gWorldMap->mIsTrackingDoubleClick == TRUE; 646 bool is_tracking_dbl = LLWorldMap::getInstance()->mIsTrackingDoubleClick == TRUE;
636 gFloaterWorldMap->trackLocation(gWorldMap->mUnknownLocation); 647 gFloaterWorldMap->trackLocation(LLWorldMap::getInstance()->mUnknownLocation);
637 if (is_tracking_dbl) 648 if (is_tracking_dbl)
638 { 649 {
639 LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); 650 LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
@@ -642,6 +653,22 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**)
642 } 653 }
643 } 654 }
644 } 655 }
656
657 if(LLWorldMap::getInstance()->mSLURLCallback != NULL)
658 {
659 // Server returns definitive capitalization, SLURL might
660 // not have that.
661 if (!stricmp(LLWorldMap::getInstance()->mSLURLRegionName.c_str(), name) || (LLWorldMap::getInstance()->mSLURLRegionHandle == handle))
662 {
663 url_callback_t callback = LLWorldMap::getInstance()->mSLURLCallback;
664
665 LLWorldMap::getInstance()->mSLURLCallback = NULL;
666 LLWorldMap::getInstance()->mSLURLRegionName.clear();
667 LLWorldMap::getInstance()->mSLURLRegionHandle = 0;
668
669 callback(handle, LLWorldMap::getInstance()->mSLURL, image_id, LLWorldMap::getInstance()->mSLURLTeleport);
670 }
671 }
645 } 672 }
646 673
647 if(adjust) gFloaterWorldMap->adjustZoomSliderBounds(); 674 if(adjust) gFloaterWorldMap->adjustZoomSliderBounds();
@@ -675,7 +702,7 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**)
675 Y /= REGION_WIDTH_UNITS; 702 Y /= REGION_WIDTH_UNITS;
676 703
677 LLItemInfo new_item(world_x, world_y, name, uuid, extra, extra2); 704 LLItemInfo new_item(world_x, world_y, name, uuid, extra, extra2);
678 LLSimInfo* siminfo = gWorldMap->simInfoFromHandle(new_item.mRegionHandle); 705 LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(new_item.mRegionHandle);
679 706
680 switch (type) 707 switch (type)
681 { 708 {
@@ -697,11 +724,11 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**)
697 // extra2 specifies whether this is an infohub or a telehub. 724 // extra2 specifies whether this is an infohub or a telehub.
698 if (extra2) 725 if (extra2)
699 { 726 {
700 gWorldMap->mInfohubs.push_back(new_item); 727 LLWorldMap::getInstance()->mInfohubs.push_back(new_item);
701 } 728 }
702 else 729 else
703 { 730 {
704 gWorldMap->mTelehubs.push_back(new_item); 731 LLWorldMap::getInstance()->mTelehubs.push_back(new_item);
705 } 732 }
706 733
707 break; 734 break;
@@ -728,31 +755,31 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**)
728 new_item.mPosGlobal.mdV[VZ] = (F64)extra2; 755 new_item.mPosGlobal.mdV[VZ] = (F64)extra2;
729 if (type == MAP_ITEM_PG_EVENT) 756 if (type == MAP_ITEM_PG_EVENT)
730 { 757 {
731 gWorldMap->mPGEvents.push_back(new_item); 758 LLWorldMap::getInstance()->mPGEvents.push_back(new_item);
732 } 759 }
733 else 760 else
734 { 761 {
735 gWorldMap->mMatureEvents.push_back(new_item); 762 LLWorldMap::getInstance()->mMatureEvents.push_back(new_item);
736 } 763 }
737 break; 764 break;
738 } 765 }
739 case MAP_ITEM_POPULAR: // popular 766 case MAP_ITEM_POPULAR: // popular
740 { 767 {
741 new_item.mPosGlobal.mdV[VZ] = (F64)extra2; 768 new_item.mPosGlobal.mdV[VZ] = (F64)extra2;
742 gWorldMap->mPopular.push_back(new_item); 769 LLWorldMap::getInstance()->mPopular.push_back(new_item);
743 break; 770 break;
744 } 771 }
745 case MAP_ITEM_LAND_FOR_SALE: // land for sale 772 case MAP_ITEM_LAND_FOR_SALE: // land for sale
746 { 773 {
747 new_item.mToolTip = llformat("%d sq. m. L$%d", new_item.mExtra, new_item.mExtra2); 774 new_item.mToolTip = llformat("%d sq. m. L$%d", new_item.mExtra, new_item.mExtra2);
748 gWorldMap->mLandForSale.push_back(new_item); 775 LLWorldMap::getInstance()->mLandForSale.push_back(new_item);
749 break; 776 break;
750 } 777 }
751 case MAP_ITEM_CLASSIFIED: // classifieds 778 case MAP_ITEM_CLASSIFIED: // classifieds
752 { 779 {
753 // HACK: Z-height is in Extra2 field. 780 // HACK: Z-height is in Extra2 field.
754 new_item.mPosGlobal.mdV[VZ] = (F64)extra2; 781 new_item.mPosGlobal.mdV[VZ] = (F64)extra2;
755 gWorldMap->mClassifieds.push_back(new_item); 782 LLWorldMap::getInstance()->mClassifieds.push_back(new_item);
756 break; 783 break;
757 } 784 }
758 case MAP_ITEM_AGENT_LOCATIONS: // agent locations 785 case MAP_ITEM_AGENT_LOCATIONS: // agent locations
@@ -764,7 +791,7 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**)
764 } 791 }
765// llinfos << "New Location " << new_item.mName << llendl; 792// llinfos << "New Location " << new_item.mName << llendl;
766 793
767 item_info_list_t& agentcounts = gWorldMap->mAgentLocationsMap[new_item.mRegionHandle]; 794 item_info_list_t& agentcounts = LLWorldMap::getInstance()->mAgentLocationsMap[new_item.mRegionHandle];
768 795
769 // Find the last item in the list with a different name and erase them 796 // Find the last item in the list with a different name and erase them
770 item_info_list_t::iterator lastiter; 797 item_info_list_t::iterator lastiter;