diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs | 82 |
1 files changed, 63 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs index 8091c59..d40574a 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs | |||
@@ -248,32 +248,76 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
248 | public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags, | 248 | public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags, |
249 | uint EstateID, bool godlike, uint itemtype, ulong regionhandle) | 249 | uint EstateID, bool godlike, uint itemtype, ulong regionhandle) |
250 | { | 250 | { |
251 | uint xstart = 0; | ||
252 | uint ystart = 0; | ||
253 | Helpers.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); | ||
251 | if (itemtype == 6) // we only sevice 6 right now (avatar green dots) | 254 | if (itemtype == 6) // we only sevice 6 right now (avatar green dots) |
252 | { | 255 | { |
253 | RegionInfo mreg = m_scene.SceneGridService.RequestNeighbouringRegionInfo(regionhandle); | 256 | if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) |
254 | if (mreg != null) | 257 | { |
255 | { | 258 | List<ScenePresence> avatars = m_scene.GetAvatars(); |
256 | string httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString(); | 259 | int tc = System.Environment.TickCount; |
257 | List<mapItemReply> returnitems = new List<mapItemReply>(); | 260 | List<mapItemReply> mapitems = new List<mapItemReply>(); |
258 | LLSDMap ramap = RequestMapItems(httpserver); | 261 | mapItemReply mapitem = new mapItemReply(); |
259 | if (ramap.ContainsKey(itemtype.ToString())) | 262 | if (avatars.Count == 0 || avatars.Count == 1) |
263 | { | ||
264 | mapitem = new mapItemReply(); | ||
265 | mapitem.x = (uint)(xstart + 1); | ||
266 | mapitem.y = (uint)(ystart + 1); | ||
267 | mapitem.id = UUID.Zero; | ||
268 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); | ||
269 | mapitem.Extra = 0; | ||
270 | mapitem.Extra2 = 0; | ||
271 | mapitems.Add(mapitem); | ||
272 | } | ||
273 | else | ||
260 | { | 274 | { |
261 | LLSDArray itemarray = (LLSDArray)ramap[itemtype.ToString()]; | 275 | |
262 | for (int i = 0; i < itemarray.Count; i++) | 276 | foreach (ScenePresence av in avatars) |
263 | { | 277 | { |
264 | LLSDMap mapitem = (LLSDMap)itemarray[i]; | 278 | // Don't send a green dot for yourself |
265 | mapItemReply mi = new mapItemReply(); | 279 | if (av.UUID != remoteClient.AgentId) |
266 | mi.x = (uint)mapitem["X"].AsInteger(); | 280 | { |
267 | mi.y = (uint)mapitem["Y"].AsInteger(); | 281 | mapitem = new mapItemReply(); |
268 | mi.id = mapitem["ID"].AsUUID(); | 282 | mapitem.x = (uint)(xstart + av.AbsolutePosition.X); |
269 | mi.Extra = mapitem["Extra"].AsInteger(); | 283 | mapitem.y = (uint)(ystart + av.AbsolutePosition.Y); |
270 | mi.Extra2 = mapitem["Extra2"].AsInteger(); | 284 | mapitem.id = UUID.Zero; |
271 | mi.name = mapitem["Name"].AsString(); | 285 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); |
272 | returnitems.Add(mi); | 286 | mapitem.Extra = 1; |
287 | mapitem.Extra2 = 0; | ||
288 | mapitems.Add(mapitem); | ||
289 | } | ||
273 | } | 290 | } |
291 | } | ||
292 | remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); | ||
293 | } | ||
294 | else | ||
295 | { | ||
296 | RegionInfo mreg = m_scene.SceneGridService.RequestNeighbouringRegionInfo(regionhandle); | ||
297 | if (mreg != null) | ||
298 | { | ||
299 | string httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString(); | ||
300 | List<mapItemReply> returnitems = new List<mapItemReply>(); | ||
301 | LLSDMap ramap = RequestMapItems(httpserver); | ||
302 | if (ramap.ContainsKey(itemtype.ToString())) | ||
303 | { | ||
304 | LLSDArray itemarray = (LLSDArray)ramap[itemtype.ToString()]; | ||
305 | for (int i = 0; i < itemarray.Count; i++) | ||
306 | { | ||
307 | LLSDMap mapitem = (LLSDMap)itemarray[i]; | ||
308 | mapItemReply mi = new mapItemReply(); | ||
309 | mi.x = (uint)mapitem["X"].AsInteger(); | ||
310 | mi.y = (uint)mapitem["Y"].AsInteger(); | ||
311 | mi.id = mapitem["ID"].AsUUID(); | ||
312 | mi.Extra = mapitem["Extra"].AsInteger(); | ||
313 | mi.Extra2 = mapitem["Extra2"].AsInteger(); | ||
314 | mi.name = mapitem["Name"].AsString(); | ||
315 | returnitems.Add(mi); | ||
316 | } | ||
274 | 317 | ||
318 | } | ||
319 | remoteClient.SendMapItemReply(returnitems.ToArray(), itemtype, flags); | ||
275 | } | 320 | } |
276 | remoteClient.SendMapItemReply(returnitems.ToArray(), itemtype, flags); | ||
277 | } | 321 | } |
278 | } | 322 | } |
279 | 323 | ||