aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/MapBlockData.cs18
-rw-r--r--OpenSim/Framework/MapItemReplyStruct.cs33
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs31
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs217
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs3
6 files changed, 221 insertions, 83 deletions
diff --git a/OpenSim/Framework/MapBlockData.cs b/OpenSim/Framework/MapBlockData.cs
index 2298ac5..4bee499 100644
--- a/OpenSim/Framework/MapBlockData.cs
+++ b/OpenSim/Framework/MapBlockData.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using OpenMetaverse; 29using OpenMetaverse;
30using OpenMetaverse.StructuredData;
30 31
31namespace OpenSim.Framework 32namespace OpenSim.Framework
32{ 33{
@@ -40,9 +41,26 @@ namespace OpenSim.Framework
40 public byte WaterHeight; 41 public byte WaterHeight;
41 public ushort X; 42 public ushort X;
42 public ushort Y; 43 public ushort Y;
44 public ushort SizeX;
45 public ushort SizeY;
43 46
44 public MapBlockData() 47 public MapBlockData()
45 { 48 {
46 } 49 }
50
51 public OSDMap ToOSD()
52 {
53 OSDMap map = new OSDMap();
54 map["X"] = X;
55 map["Y"] = Y;
56 map["SizeX"] = SizeX;
57 map["SizeY"] = SizeY;
58 map["Name"] = Name;
59 map["Access"] = Access;
60 map["RegionFlags"] = RegionFlags;
61 map["WaterHeight"] = WaterHeight;
62 map["MapImageID"] = MapImageId;
63 return map;
64 }
47 } 65 }
48} 66}
diff --git a/OpenSim/Framework/MapItemReplyStruct.cs b/OpenSim/Framework/MapItemReplyStruct.cs
index 58011bd..c8693ae 100644
--- a/OpenSim/Framework/MapItemReplyStruct.cs
+++ b/OpenSim/Framework/MapItemReplyStruct.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenMetaverse.StructuredData;
29 30
30namespace OpenSim.Framework 31namespace OpenSim.Framework
31{ 32{
@@ -37,5 +38,37 @@ namespace OpenSim.Framework
37 public int Extra; 38 public int Extra;
38 public int Extra2; 39 public int Extra2;
39 public string name; 40 public string name;
41
42 public mapItemReply(uint pX, uint pY, UUID pId, string pName, int pExt1, int pExt2)
43 {
44 x = pX;
45 y = pY;
46 id = pId;
47 name = pName;
48 Extra = pExt1;
49 Extra2 = pExt2;
50 }
51
52 public OSDMap ToOSD()
53 {
54 OSDMap map = new OSDMap();
55 map["X"] = OSD.FromInteger((int)x);
56 map["Y"] = OSD.FromInteger((int)y);
57 map["ID"] = OSD.FromUUID(id);
58 map["Name"] = OSD.FromString(name);
59 map["Extra"] = OSD.FromInteger(Extra);
60 map["Extra2"] = OSD.FromInteger(Extra2);
61 return map;
62 }
63
64 public void FromOSD(OSDMap map)
65 {
66 x = (uint) map["X"].AsInteger();
67 y = (uint) map["Y"].AsInteger();
68 id = map["ID"].AsUUID();
69 Extra = map["Extra"].AsInteger();
70 Extra2 = map["Extra2"].AsInteger();
71 name = map["Name"].AsString();
72 }
40 } 73 }
41} 74}
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 85e8159..a038f73 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -523,9 +523,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
523 ScenePresence sp, ulong regionHandle, Vector3 position, 523 ScenePresence sp, ulong regionHandle, Vector3 position,
524 Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination) 524 Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination)
525 { 525 {
526 uint x = 0, y = 0; 526 // Get destination region taking into account that the address could be an offset
527 Util.RegionHandleToWorldLoc(regionHandle, out x, out y); 527 // region inside a varregion.
528 GridRegion reg = Scene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); 528 GridRegion reg = GetTeleportDestinationRegion(sp.Scene.GridService, sp.Scene.RegionInfo.ScopeID, regionHandle, ref position);
529 529
530 if (reg != null) 530 if (reg != null)
531 { 531 {
@@ -588,6 +588,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
588 } 588 }
589 } 589 }
590 590
591 // The teleport address could be an address in a subregion of a larger varregion.
592 // Find the real base region and adjust the teleport location to account for the
593 // larger region.
594 private GridRegion GetTeleportDestinationRegion(IGridService gridService, UUID scope, ulong regionHandle, ref Vector3 position)
595 {
596 uint x = 0, y = 0;
597 Util.RegionHandleToWorldLoc(regionHandle, out x, out y);
598
599 // Compute the world location we're teleporting to
600 double worldX = (double)x + position.X;
601 double worldY = (double)y + position.Y;
602
603 // Find the region that contains the position
604 GridRegion reg = GetRegionContainingWorldLocation(gridService, scope, worldX, worldY);
605
606 if (reg != null)
607 {
608 // modify the position for the offset into the actual region returned
609 position.X += x - reg.RegionLocX;
610 position.Y += y - reg.RegionLocY;
611 }
612
613 return reg;
614 }
615
591 // Nothing to validate here 616 // Nothing to validate here
592 protected virtual bool ValidateGenericConditions(ScenePresence sp, GridRegion reg, GridRegion finalDestination, uint teleportFlags, out string reason) 617 protected virtual bool ValidateGenericConditions(ScenePresence sp, GridRegion reg, GridRegion finalDestination, uint teleportFlags, out string reason)
593 { 618 {
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index 81d1a4a..1dad8ba 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -549,7 +549,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
549 z_localIDs.Add(part.LocalId); 549 z_localIDs.Add(part.LocalId);
550 z_sortheights.Add(pos.Z); 550 z_sortheights.Add(pos.Z);
551 551
552 for (int wx = mapdrawstartX; wx < mapdrawendX; wx++) 552 // for (int wx = mapdrawstartX; wx < mapdrawendX; wx++)
553 // { 553 // {
554 // for (wy = mapdrawstartY; wy < mapdrawendY; wy++) 554 // for (wy = mapdrawstartY; wy < mapdrawendY; wy++)
555 // { 555 // {
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index b472038..f57be83 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -59,8 +59,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
59 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldMapModule")] 59 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldMapModule")]
60 public class WorldMapModule : INonSharedRegionModule, IWorldMapModule 60 public class WorldMapModule : INonSharedRegionModule, IWorldMapModule
61 { 61 {
62 private static readonly ILog m_log = 62 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
63 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 63 private static string LogHeader = "[WORLD MAP]";
64 64
65 private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg"; 65 private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg";
66 private static readonly UUID STOP_UUID = UUID.Random(); 66 private static readonly UUID STOP_UUID = UUID.Random();
@@ -290,8 +290,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
290 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 8) ); 290 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 8) );
291 foreach (GridRegion r in regions) 291 foreach (GridRegion r in regions)
292 { 292 {
293 MapBlockData block = new MapBlockData(); 293 MapBlockData block = MapBlockFromGridRegion(r, 0);
294 MapBlockFromGridRegion(block, r, 0);
295 mapBlocks.Add(block); 294 mapBlocks.Add(block);
296 } 295 }
297 avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); 296 avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
@@ -412,23 +411,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
412 uint xstart = 0; 411 uint xstart = 0;
413 uint ystart = 0; 412 uint ystart = 0;
414 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); 413 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
415 if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) 414 if (itemtype == (int)GridItemType.AgentLocations)
416 { 415 {
417 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) 416 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
418 { 417 {
419 // Local Map Item Request 418 // Just requesting map info about the current, local region
420 int tc = Environment.TickCount; 419 int tc = Environment.TickCount;
421 List<mapItemReply> mapitems = new List<mapItemReply>(); 420 List<mapItemReply> mapitems = new List<mapItemReply>();
422 mapItemReply mapitem = new mapItemReply(); 421 mapItemReply mapitem = new mapItemReply();
423 if (m_scene.GetRootAgentCount() <= 1) 422 if (m_scene.GetRootAgentCount() <= 1)
424 { 423 {
425 mapitem = new mapItemReply(); 424 mapitem = new mapItemReply(
426 mapitem.x = (uint)(xstart + 1); 425 xstart + 1,
427 mapitem.y = (uint)(ystart + 1); 426 ystart + 1,
428 mapitem.id = UUID.Zero; 427 UUID.Zero,
429 mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); 428 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
430 mapitem.Extra = 0; 429 0, 0);
431 mapitem.Extra2 = 0;
432 mapitems.Add(mapitem); 430 mapitems.Add(mapitem);
433 } 431 }
434 else 432 else
@@ -438,13 +436,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
438 // Don't send a green dot for yourself 436 // Don't send a green dot for yourself
439 if (sp.UUID != remoteClient.AgentId) 437 if (sp.UUID != remoteClient.AgentId)
440 { 438 {
441 mapitem = new mapItemReply(); 439 mapitem = new mapItemReply(
442 mapitem.x = (uint)(xstart + sp.AbsolutePosition.X); 440 xstart + (uint)sp.AbsolutePosition.X,
443 mapitem.y = (uint)(ystart + sp.AbsolutePosition.Y); 441 ystart + (uint)sp.AbsolutePosition.Y,
444 mapitem.id = UUID.Zero; 442 UUID.Zero,
445 mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); 443 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
446 mapitem.Extra = 1; 444 1, 0);
447 mapitem.Extra2 = 0;
448 mapitems.Add(mapitem); 445 mapitems.Add(mapitem);
449 } 446 }
450 }); 447 });
@@ -459,7 +456,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
459 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle); 456 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
460 } 457 }
461 } 458 }
462 else if (itemtype == 7) // Service 7 (MAP_ITEM_LAND_FOR_SALE) 459 else if (itemtype == (int)GridItemType.LandForSale) // Service 7 (MAP_ITEM_LAND_FOR_SALE)
463 { 460 {
464 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) 461 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
465 { 462 {
@@ -489,14 +486,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
489 float x = (min.X+max.X)/2; 486 float x = (min.X+max.X)/2;
490 float y = (min.Y+max.Y)/2; 487 float y = (min.Y+max.Y)/2;
491 488
492 mapitem = new mapItemReply(); 489 mapitem = new mapItemReply(
493 mapitem.x = (uint)(xstart + x); 490 xstart + (uint)x,
494 mapitem.y = (uint)(ystart + y); 491 ystart + (uint)y,
495 // mapitem.z = (uint)m_scene.GetGroundHeight(x,y); 492 parcel.GlobalID,
496 mapitem.id = parcel.GlobalID; 493 parcel.Name,
497 mapitem.name = parcel.Name; 494 parcel.Area,
498 mapitem.Extra = parcel.Area; 495 parcel.SalePrice
499 mapitem.Extra2 = parcel.SalePrice; 496 );
500 mapitems.Add(mapitem); 497 mapitems.Add(mapitem);
501 } 498 }
502 } 499 }
@@ -511,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
511 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle); 508 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
512 } 509 }
513 } 510 }
514 else if (itemtype == 1) // Service 1 (MAP_ITEM_TELEHUB) 511 else if (itemtype == (int)GridItemType.Telehub) // Service 1 (MAP_ITEM_TELEHUB)
515 { 512 {
516 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) 513 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
517 { 514 {
@@ -521,13 +518,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
521 SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); 518 SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
522 if (sog != null) 519 if (sog != null)
523 { 520 {
524 mapitem = new mapItemReply(); 521 mapitem = new mapItemReply(
525 mapitem.x = (uint)(xstart + sog.AbsolutePosition.X); 522 xstart + (uint)sog.AbsolutePosition.X,
526 mapitem.y = (uint)(ystart + sog.AbsolutePosition.Y); 523 ystart + (uint)sog.AbsolutePosition.Y,
527 mapitem.id = UUID.Zero; 524 UUID.Zero,
528 mapitem.name = sog.Name; 525 sog.Name,
529 mapitem.Extra = 0; // color (not used) 526 0, // color (not used)
530 mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub 527 0 // 0 = telehub / 1 = infohub
528 );
531 mapitems.Add(mapitem); 529 mapitems.Add(mapitem);
532 530
533 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); 531 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
@@ -677,19 +675,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
677 { 675 {
678 OSDMap mapitem = (OSDMap)itemarray[i]; 676 OSDMap mapitem = (OSDMap)itemarray[i];
679 mapItemReply mi = new mapItemReply(); 677 mapItemReply mi = new mapItemReply();
680 mi.x = (uint)mapitem["X"].AsInteger(); 678 mi.FromOSD(mapitem);
681 mi.y = (uint)mapitem["Y"].AsInteger();
682 mi.id = mapitem["ID"].AsUUID();
683 mi.Extra = mapitem["Extra"].AsInteger();
684 mi.Extra2 = mapitem["Extra2"].AsInteger();
685 mi.name = mapitem["Name"].AsString();
686 returnitems.Add(mi); 679 returnitems.Add(mi);
687 } 680 }
688 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags); 681 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags);
689 } 682 }
690 683
691 // Service 7 (MAP_ITEM_LAND_FOR_SALE) 684 // Service 7 (MAP_ITEM_LAND_FOR_SALE)
692 uint itemtype = 7; 685 uint itemtype = (uint)GridItemType.LandForSale;
693 686
694 if (response.ContainsKey(itemtype.ToString())) 687 if (response.ContainsKey(itemtype.ToString()))
695 { 688 {
@@ -699,19 +692,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
699 { 692 {
700 OSDMap mapitem = (OSDMap)itemarray[i]; 693 OSDMap mapitem = (OSDMap)itemarray[i];
701 mapItemReply mi = new mapItemReply(); 694 mapItemReply mi = new mapItemReply();
702 mi.x = (uint)mapitem["X"].AsInteger(); 695 mi.FromOSD(mapitem);
703 mi.y = (uint)mapitem["Y"].AsInteger();
704 mi.id = mapitem["ID"].AsUUID();
705 mi.Extra = mapitem["Extra"].AsInteger();
706 mi.Extra2 = mapitem["Extra2"].AsInteger();
707 mi.name = mapitem["Name"].AsString();
708 returnitems.Add(mi); 696 returnitems.Add(mi);
709 } 697 }
710 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags); 698 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
711 } 699 }
712 700
713 // Service 1 (MAP_ITEM_TELEHUB) 701 // Service 1 (MAP_ITEM_TELEHUB)
714 itemtype = 1; 702 itemtype = (uint)GridItemType.Telehub;
715 703
716 if (response.ContainsKey(itemtype.ToString())) 704 if (response.ContainsKey(itemtype.ToString()))
717 { 705 {
@@ -721,12 +709,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
721 { 709 {
722 OSDMap mapitem = (OSDMap)itemarray[i]; 710 OSDMap mapitem = (OSDMap)itemarray[i];
723 mapItemReply mi = new mapItemReply(); 711 mapItemReply mi = new mapItemReply();
724 mi.x = (uint)mapitem["X"].AsInteger(); 712 mi.FromOSD(mapitem);
725 mi.y = (uint)mapitem["Y"].AsInteger();
726 mi.id = mapitem["ID"].AsUUID();
727 mi.Extra = mapitem["Extra"].AsInteger();
728 mi.Extra2 = mapitem["Extra2"].AsInteger();
729 mi.name = mapitem["Name"].AsString();
730 returnitems.Add(mi); 713 returnitems.Add(mi);
731 } 714 }
732 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags); 715 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
@@ -1008,7 +991,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1008 /// <param name="maxY"></param> 991 /// <param name="maxY"></param>
1009 public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 992 public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
1010 { 993 {
1011 //m_log.ErrorFormat("[YYY] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag);
1012 if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible 994 if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible
1013 { 995 {
1014 List<MapBlockData> response = new List<MapBlockData>(); 996 List<MapBlockData> response = new List<MapBlockData>();
@@ -1020,6 +1002,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1020 (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX), 1002 (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX),
1021 (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) ); 1003 (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) );
1022 1004
1005 m_log.DebugFormat("[WORLD MAP MODULE] RequestMapBlocks min=<{0},{1}>, max=<{2},{3}>, flag={4}, cntFound={5}",
1006 minX, minY, maxX, maxY, flag.ToString("X"), regions.Count);
1023 if (regions != null) 1007 if (regions != null)
1024 { 1008 {
1025 foreach (GridRegion r in regions) 1009 foreach (GridRegion r in regions)
@@ -1028,9 +1012,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1028 && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) ) 1012 && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) )
1029 { 1013 {
1030 // found it => add it to response 1014 // found it => add it to response
1031 MapBlockData block = new MapBlockData(); 1015 // Version 2 viewers can handle the larger regions
1032 MapBlockFromGridRegion(block, r, flag); 1016 if ((flag & 2) == 2)
1033 response.Add(block); 1017 response.AddRange(Map2BlockFromGridRegion(r, flag));
1018 else
1019 response.Add(MapBlockFromGridRegion(r, flag));
1034 break; 1020 break;
1035 } 1021 }
1036 } 1022 }
@@ -1042,7 +1028,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1042 MapBlockData block = new MapBlockData(); 1028 MapBlockData block = new MapBlockData();
1043 block.X = (ushort)minX; 1029 block.X = (ushort)minX;
1044 block.Y = (ushort)minY; 1030 block.Y = (ushort)minY;
1045 block.Access = 254; // means 'simulator is offline' 1031 block.Access = (byte)SimAccess.Down; // means 'simulator is offline'
1032 // block.Access = (byte)SimAccess.NonExistant;
1046 response.Add(block); 1033 response.Add(block);
1047 } 1034 }
1048 // The lower 16 bits are an unsigned int16 1035 // The lower 16 bits are an unsigned int16
@@ -1061,37 +1048,110 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1061 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1048 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1062 (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)), 1049 (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)),
1063 (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) ); 1050 (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) );
1051 m_log.DebugFormat("{0} GetAndSendBlocks. min=<{1},{2}>, max=<{3},{4}>, cntFound={5}",
1052 LogHeader, minX, minY, maxX, maxY, regions.Count);
1064 foreach (GridRegion r in regions) 1053 foreach (GridRegion r in regions)
1065 { 1054 {
1066 MapBlockData block = new MapBlockData(); 1055 // Version 2 viewers can handle the larger regions
1067 MapBlockFromGridRegion(block, r, flag); 1056 if ((flag & 2) == 2)
1068 mapBlocks.Add(block); 1057 mapBlocks.AddRange(Map2BlockFromGridRegion(r, flag));
1058 else
1059 mapBlocks.Add(MapBlockFromGridRegion(r, flag));
1069 } 1060 }
1070 remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); 1061 remoteClient.SendMapBlock(mapBlocks, flag & 0xffff);
1071 1062
1072 return mapBlocks; 1063 return mapBlocks;
1073 } 1064 }
1074 1065
1075 protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) 1066 // Fill a passed MapBlockData from a GridRegion
1067 protected MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag)
1076 { 1068 {
1069 MapBlockData block = new MapBlockData();
1070
1077 block.Access = r.Access; 1071 block.Access = r.Access;
1078 switch (flag & 0xffff) 1072 switch (flag & 0xffff)
1079 { 1073 {
1080 case 0: 1074 case 0:
1081 block.MapImageId = r.TerrainImage; 1075 block.MapImageId = r.TerrainImage;
1082 break; 1076 break;
1083 case 2: 1077 case 2:
1084 block.MapImageId = r.ParcelImage; 1078 block.MapImageId = r.ParcelImage;
1085 break; 1079 break;
1086 default: 1080 default:
1087 block.MapImageId = UUID.Zero; 1081 block.MapImageId = UUID.Zero;
1088 break; 1082 break;
1089 } 1083 }
1090 block.Name = r.RegionName; 1084 block.Name = r.RegionName;
1091 block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX); 1085 block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX);
1092 block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY); 1086 block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY);
1087 block.SizeX = (ushort) r.RegionSizeX;
1088 block.SizeY = (ushort) r.RegionSizeY;
1089
1090 return block;
1093 } 1091 }
1094 1092
1093 protected List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag)
1094 {
1095 List<MapBlockData> blocks = new List<MapBlockData>();
1096 MapBlockData block = new MapBlockData();
1097 if (r == null)
1098 {
1099 block.Access = (byte)SimAccess.Down;
1100 block.MapImageId = UUID.Zero;
1101 blocks.Add(block);
1102 }
1103 else
1104 {
1105 block.Access = r.Access;
1106 switch (flag & 0xffff)
1107 {
1108 case 0:
1109 block.MapImageId = r.TerrainImage;
1110 break;
1111 case 2:
1112 block.MapImageId = r.ParcelImage;
1113 break;
1114 default:
1115 block.MapImageId = UUID.Zero;
1116 break;
1117 }
1118 block.Name = r.RegionName;
1119 block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
1120 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
1121 block.SizeX = (ushort)r.RegionSizeX;
1122 block.SizeY = (ushort)r.RegionSizeY;
1123 blocks.Add(block);
1124 // If these are larger than legacy regions, create fake map entries for the covered
1125 // regions. The map system only does legacy sized regions so we have to fake map
1126 // entries for all the covered regions.
1127 if (r.RegionSizeX > Constants.RegionSize || r.RegionSizeY > Constants.RegionSize)
1128 {
1129 for (int x = 0; x < r.RegionSizeX / Constants.RegionSize; x++)
1130 {
1131 for (int y = 0; y < r.RegionSizeY / Constants.RegionSize; y++)
1132 {
1133 if (x == 0 && y == 0)
1134 continue;
1135 block = new MapBlockData
1136 {
1137 Access = r.Access,
1138 MapImageId = r.TerrainImage,
1139 Name = r.RegionName,
1140 X = (ushort)((r.RegionLocX / Constants.RegionSize) + x),
1141 Y = (ushort)((r.RegionLocY / Constants.RegionSize) + y),
1142 SizeX = (ushort)r.RegionSizeX,
1143 SizeY = (ushort)r.RegionSizeY
1144 };
1145 //Child piece, so ignore it
1146 blocks.Add(block);
1147 }
1148 }
1149 }
1150 }
1151 return blocks;
1152 }
1153
1154
1095 public Hashtable OnHTTPThrottled(Hashtable keysvals) 1155 public Hashtable OnHTTPThrottled(Hashtable keysvals)
1096 { 1156 {
1097 Hashtable reply = new Hashtable(); 1157 Hashtable reply = new Hashtable();
@@ -1229,8 +1289,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1229 1289
1230 foreach (GridRegion r in regions) 1290 foreach (GridRegion r in regions)
1231 { 1291 {
1232 MapBlockData mapBlock = new MapBlockData(); 1292 MapBlockData mapBlock = MapBlockFromGridRegion(r, 0);
1233 MapBlockFromGridRegion(mapBlock, r, 0);
1234 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); 1293 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
1235 1294
1236 if (texAsset != null) 1295 if (texAsset != null)
@@ -1291,7 +1350,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1291 uint xstart = 0; 1350 uint xstart = 0;
1292 uint ystart = 0; 1351 uint ystart = 0;
1293 1352
1294 Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); 1353 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle,out xstart,out ystart);
1354 // m_log.DebugFormat("{0} HandleRemoteMapItemRequest. loc=<{1},{2}>",
1355 // LogHeader, Util.WorldToRegionLoc(xstart), Util.WorldToRegionLoc(ystart));
1295 1356
1296 // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) 1357 // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots)
1297 1358
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index c63b409..16d9b7d 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -48,6 +48,7 @@ namespace OpenSim.Server.Handlers.Grid
48 public class GridServerPostHandler : BaseStreamHandler 48 public class GridServerPostHandler : BaseStreamHandler
49 { 49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private static string LogHeader = "[GRID HANDLER]";
51 52
52 private IGridService m_GridService; 53 private IGridService m_GridService;
53 54
@@ -281,8 +282,8 @@ namespace OpenSim.Server.Handlers.Grid
281 else 282 else
282 m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position"); 283 m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position");
283 284
285 // m_log.DebugFormat("{0} GetRegionByPosition: loc=<{1},{2}>", LogHeader, x, y);
284 GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y); 286 GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y);
285 //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
286 287
287 Dictionary<string, object> result = new Dictionary<string, object>(); 288 Dictionary<string, object> result = new Dictionary<string, object>();
288 if (rinfo == null) 289 if (rinfo == null)