From 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:50 -0500 Subject: Second Life viewer sources 1.14.0.0 --- linden/indra/newview/llmapresponders.cpp | 161 ++++++++++++++++--------------- 1 file changed, 82 insertions(+), 79 deletions(-) (limited to 'linden/indra/newview/llmapresponders.cpp') diff --git a/linden/indra/newview/llmapresponders.cpp b/linden/indra/newview/llmapresponders.cpp index 0bf8754..2863c0b 100644 --- a/linden/indra/newview/llmapresponders.cpp +++ b/linden/indra/newview/llmapresponders.cpp @@ -96,99 +96,102 @@ void LLMapLayerResponder::result(const LLSD& result) bool found_null_sim = false; adjust = FALSE; - const LLSD& map_blocks = result["MapBlocks"]; - for (iter = map_blocks.beginArray(); iter != map_blocks.endArray(); ++iter) + if (result.has("MapBlocks")) { - const LLSD& map_block = *iter; - - S32 x_regions = map_block["X"]; - S32 y_regions = map_block["Y"]; - std::string name = map_block["Name"]; - S32 access = map_block["Access"]; - S32 region_flags = map_block["RegionFlags"]; - S32 water_height = map_block["WaterHeight"]; - LLUUID image_id = map_block["MapImageID"]; - - U32 x_meters = x_regions * REGION_WIDTH_UNITS; - U32 y_meters = y_regions * REGION_WIDTH_UNITS; - - if (access == 255) + const LLSD& map_blocks = result["MapBlocks"]; + for (iter = map_blocks.beginArray(); iter != map_blocks.endArray(); ++iter) { - // This region doesn't exist - if (gWorldMap->mIsTrackingUnknownLocation && - gWorldMap->mUnknownLocation.mdV[0] >= x_meters && - gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && - gWorldMap->mUnknownLocation.mdV[1] >= y_meters && - gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) - { - // We were tracking this location, but it doesn't exist - gWorldMap->mInvalidLocation = TRUE; - } - - found_null_sim = true; - } - else - { - adjust = gWorldMap->extendAABB(x_meters, - y_meters, - x_meters+REGION_WIDTH_UNITS, - y_meters+REGION_WIDTH_UNITS) || adjust; - U64 handle = to_region_handle(x_meters, y_meters); - -// llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl; - - LLSimInfo* siminfo = new LLSimInfo(); - LLWorldMap::sim_info_map_t::iterator iter = gWorldMap->mSimInfoMap.find(handle); - if (iter != gWorldMap->mSimInfoMap.end()) + const LLSD& map_block = *iter; + + S32 x_regions = map_block["X"]; + S32 y_regions = map_block["Y"]; + std::string name = map_block["Name"]; + S32 access = map_block["Access"]; + S32 region_flags = map_block["RegionFlags"]; + S32 water_height = map_block["WaterHeight"]; + LLUUID image_id = map_block["MapImageID"]; + + U32 x_meters = x_regions * REGION_WIDTH_UNITS; + U32 y_meters = y_regions * REGION_WIDTH_UNITS; + + if (access == 255) { - LLSimInfo* oldinfo = iter->second; - for (S32 image=0; imagemIsTrackingUnknownLocation && + gWorldMap->mUnknownLocation.mdV[0] >= x_meters && + gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && + gWorldMap->mUnknownLocation.mdV[1] >= y_meters && + gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) { - siminfo->mMapImageID[image] = oldinfo->mMapImageID[image]; + // We were tracking this location, but it doesn't exist + gWorldMap->mInvalidLocation = TRUE; } - delete oldinfo; - } - gWorldMap->mSimInfoMap[handle] = siminfo; - - siminfo->mHandle = handle; - siminfo->mName.assign( name ); - siminfo->mAccess = access; - siminfo->mRegionFlags = region_flags; - siminfo->mWaterHeight = (F32) water_height; - siminfo->mMapImageID[agent_flags] = image_id; - siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[gWorldMap->mCurrentMap], MIPMAP_TRUE, FALSE); - siminfo->mCurrentImage->bindTexture(0); - siminfo->mCurrentImage->setClamp(TRUE, TRUE); - - if (siminfo->mMapImageID[2].notNull()) - { - siminfo->mOverlayImage = gImageList.getImage(siminfo->mMapImageID[2], MIPMAP_TRUE, FALSE); + + found_null_sim = true; } else { - siminfo->mOverlayImage = NULL; - } + adjust = gWorldMap->extendAABB(x_meters, + y_meters, + x_meters+REGION_WIDTH_UNITS, + y_meters+REGION_WIDTH_UNITS) || adjust; + U64 handle = to_region_handle(x_meters, y_meters); - if (gWorldMap->mIsTrackingUnknownLocation && - gWorldMap->mUnknownLocation.mdV[0] >= x_meters && - gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && - gWorldMap->mUnknownLocation.mdV[1] >= y_meters && - gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) - { - if (siminfo->mAccess == SIM_ACCESS_DOWN) + // llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl; + + LLSimInfo* siminfo = new LLSimInfo(); + LLWorldMap::sim_info_map_t::iterator iter = gWorldMap->mSimInfoMap.find(handle); + if (iter != gWorldMap->mSimInfoMap.end()) { - // We were tracking this location, but it doesn't exist - gWorldMap->mInvalidLocation = true; + LLSimInfo* oldinfo = iter->second; + for (S32 image=0; imagemMapImageID[image] = oldinfo->mMapImageID[image]; + } + delete oldinfo; + } + gWorldMap->mSimInfoMap[handle] = siminfo; + + siminfo->mHandle = handle; + siminfo->mName.assign( name ); + siminfo->mAccess = access; /*Flawfinder: ignore*/ + siminfo->mRegionFlags = region_flags; + siminfo->mWaterHeight = (F32) water_height; + siminfo->mMapImageID[agent_flags] = image_id; + siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[gWorldMap->mCurrentMap], MIPMAP_TRUE, FALSE); + siminfo->mCurrentImage->bindTexture(0); + siminfo->mCurrentImage->setClamp(TRUE, TRUE); + + if (siminfo->mMapImageID[2].notNull()) + { + siminfo->mOverlayImage = gImageList.getImage(siminfo->mMapImageID[2], MIPMAP_TRUE, FALSE); } else { - // We were tracking this location, and it does exist - bool is_tracking_dbl = gWorldMap->mIsTrackingDoubleClick == TRUE; - gFloaterWorldMap->trackLocation(gWorldMap->mUnknownLocation); - if (is_tracking_dbl) + siminfo->mOverlayImage = NULL; + } + + if (gWorldMap->mIsTrackingUnknownLocation && + gWorldMap->mUnknownLocation.mdV[0] >= x_meters && + gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && + gWorldMap->mUnknownLocation.mdV[1] >= y_meters && + gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) + { + if (siminfo->mAccess == SIM_ACCESS_DOWN) + { + // We were tracking this location, but it doesn't exist + gWorldMap->mInvalidLocation = true; + } + else { - LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); - gAgent.teleportViaLocation( pos_global ); + // We were tracking this location, and it does exist + bool is_tracking_dbl = gWorldMap->mIsTrackingDoubleClick == TRUE; + gFloaterWorldMap->trackLocation(gWorldMap->mUnknownLocation); + if (is_tracking_dbl) + { + LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); + gAgent.teleportViaLocation( pos_global ); + } } } } -- cgit v1.1