aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmapresponders.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llmapresponders.cpp161
1 files changed, 82 insertions, 79 deletions
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)
96 bool found_null_sim = false; 96 bool found_null_sim = false;
97 97
98 adjust = FALSE; 98 adjust = FALSE;
99 const LLSD& map_blocks = result["MapBlocks"]; 99 if (result.has("MapBlocks"))
100 for (iter = map_blocks.beginArray(); iter != map_blocks.endArray(); ++iter)
101 { 100 {
102 const LLSD& map_block = *iter; 101 const LLSD& map_blocks = result["MapBlocks"];
103 102 for (iter = map_blocks.beginArray(); iter != map_blocks.endArray(); ++iter)
104 S32 x_regions = map_block["X"];
105 S32 y_regions = map_block["Y"];
106 std::string name = map_block["Name"];
107 S32 access = map_block["Access"];
108 S32 region_flags = map_block["RegionFlags"];
109 S32 water_height = map_block["WaterHeight"];
110 LLUUID image_id = map_block["MapImageID"];
111
112 U32 x_meters = x_regions * REGION_WIDTH_UNITS;
113 U32 y_meters = y_regions * REGION_WIDTH_UNITS;
114
115 if (access == 255)
116 { 103 {
117 // This region doesn't exist 104 const LLSD& map_block = *iter;
118 if (gWorldMap->mIsTrackingUnknownLocation && 105
119 gWorldMap->mUnknownLocation.mdV[0] >= x_meters && 106 S32 x_regions = map_block["X"];
120 gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && 107 S32 y_regions = map_block["Y"];
121 gWorldMap->mUnknownLocation.mdV[1] >= y_meters && 108 std::string name = map_block["Name"];
122 gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) 109 S32 access = map_block["Access"];
123 { 110 S32 region_flags = map_block["RegionFlags"];
124 // We were tracking this location, but it doesn't exist 111 S32 water_height = map_block["WaterHeight"];
125 gWorldMap->mInvalidLocation = TRUE; 112 LLUUID image_id = map_block["MapImageID"];
126 } 113
127 114 U32 x_meters = x_regions * REGION_WIDTH_UNITS;
128 found_null_sim = true; 115 U32 y_meters = y_regions * REGION_WIDTH_UNITS;
129 } 116
130 else 117 if (access == 255)
131 {
132 adjust = gWorldMap->extendAABB(x_meters,
133 y_meters,
134 x_meters+REGION_WIDTH_UNITS,
135 y_meters+REGION_WIDTH_UNITS) || adjust;
136 U64 handle = to_region_handle(x_meters, y_meters);
137
138// llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl;
139
140 LLSimInfo* siminfo = new LLSimInfo();
141 LLWorldMap::sim_info_map_t::iterator iter = gWorldMap->mSimInfoMap.find(handle);
142 if (iter != gWorldMap->mSimInfoMap.end())
143 { 118 {
144 LLSimInfo* oldinfo = iter->second; 119 // This region doesn't exist
145 for (S32 image=0; image<MAP_SIM_IMAGE_TYPES; ++image) 120 if (gWorldMap->mIsTrackingUnknownLocation &&
121 gWorldMap->mUnknownLocation.mdV[0] >= x_meters &&
122 gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 &&
123 gWorldMap->mUnknownLocation.mdV[1] >= y_meters &&
124 gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256)
146 { 125 {
147 siminfo->mMapImageID[image] = oldinfo->mMapImageID[image]; 126 // We were tracking this location, but it doesn't exist
127 gWorldMap->mInvalidLocation = TRUE;
148 } 128 }
149 delete oldinfo; 129
150 } 130 found_null_sim = true;
151 gWorldMap->mSimInfoMap[handle] = siminfo;
152
153 siminfo->mHandle = handle;
154 siminfo->mName.assign( name );
155 siminfo->mAccess = access;
156 siminfo->mRegionFlags = region_flags;
157 siminfo->mWaterHeight = (F32) water_height;
158 siminfo->mMapImageID[agent_flags] = image_id;
159 siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[gWorldMap->mCurrentMap], MIPMAP_TRUE, FALSE);
160 siminfo->mCurrentImage->bindTexture(0);
161 siminfo->mCurrentImage->setClamp(TRUE, TRUE);
162
163 if (siminfo->mMapImageID[2].notNull())
164 {
165 siminfo->mOverlayImage = gImageList.getImage(siminfo->mMapImageID[2], MIPMAP_TRUE, FALSE);
166 } 131 }
167 else 132 else
168 { 133 {
169 siminfo->mOverlayImage = NULL; 134 adjust = gWorldMap->extendAABB(x_meters,
170 } 135 y_meters,
136 x_meters+REGION_WIDTH_UNITS,
137 y_meters+REGION_WIDTH_UNITS) || adjust;
138 U64 handle = to_region_handle(x_meters, y_meters);
171 139
172 if (gWorldMap->mIsTrackingUnknownLocation && 140 // llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl;
173 gWorldMap->mUnknownLocation.mdV[0] >= x_meters && 141
174 gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && 142 LLSimInfo* siminfo = new LLSimInfo();
175 gWorldMap->mUnknownLocation.mdV[1] >= y_meters && 143 LLWorldMap::sim_info_map_t::iterator iter = gWorldMap->mSimInfoMap.find(handle);
176 gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) 144 if (iter != gWorldMap->mSimInfoMap.end())
177 {
178 if (siminfo->mAccess == SIM_ACCESS_DOWN)
179 { 145 {
180 // We were tracking this location, but it doesn't exist 146 LLSimInfo* oldinfo = iter->second;
181 gWorldMap->mInvalidLocation = true; 147 for (S32 image=0; image<MAP_SIM_IMAGE_TYPES; ++image)
148 {
149 siminfo->mMapImageID[image] = oldinfo->mMapImageID[image];
150 }
151 delete oldinfo;
152 }
153 gWorldMap->mSimInfoMap[handle] = siminfo;
154
155 siminfo->mHandle = handle;
156 siminfo->mName.assign( name );
157 siminfo->mAccess = access; /*Flawfinder: ignore*/
158 siminfo->mRegionFlags = region_flags;
159 siminfo->mWaterHeight = (F32) water_height;
160 siminfo->mMapImageID[agent_flags] = image_id;
161 siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[gWorldMap->mCurrentMap], MIPMAP_TRUE, FALSE);
162 siminfo->mCurrentImage->bindTexture(0);
163 siminfo->mCurrentImage->setClamp(TRUE, TRUE);
164
165 if (siminfo->mMapImageID[2].notNull())
166 {
167 siminfo->mOverlayImage = gImageList.getImage(siminfo->mMapImageID[2], MIPMAP_TRUE, FALSE);
182 } 168 }
183 else 169 else
184 { 170 {
185 // We were tracking this location, and it does exist 171 siminfo->mOverlayImage = NULL;
186 bool is_tracking_dbl = gWorldMap->mIsTrackingDoubleClick == TRUE; 172 }
187 gFloaterWorldMap->trackLocation(gWorldMap->mUnknownLocation); 173
188 if (is_tracking_dbl) 174 if (gWorldMap->mIsTrackingUnknownLocation &&
175 gWorldMap->mUnknownLocation.mdV[0] >= x_meters &&
176 gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 &&
177 gWorldMap->mUnknownLocation.mdV[1] >= y_meters &&
178 gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256)
179 {
180 if (siminfo->mAccess == SIM_ACCESS_DOWN)
181 {
182 // We were tracking this location, but it doesn't exist
183 gWorldMap->mInvalidLocation = true;
184 }
185 else
189 { 186 {
190 LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); 187 // We were tracking this location, and it does exist
191 gAgent.teleportViaLocation( pos_global ); 188 bool is_tracking_dbl = gWorldMap->mIsTrackingDoubleClick == TRUE;
189 gFloaterWorldMap->trackLocation(gWorldMap->mUnknownLocation);
190 if (is_tracking_dbl)
191 {
192 LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
193 gAgent.teleportViaLocation( pos_global );
194 }
192 } 195 }
193 } 196 }
194 } 197 }