From e19c830a6cc3e9bf20bcd5208563628923689184 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 27 May 2014 10:13:24 -0700 Subject: Fixes a bug where map search results pertaining to varregions would only send the SW-most corner of the varregions; the other areas, when clicked, would result a blue circle, meaning that the viewer didn't know about those areas. This is still not quite right, as all the areas appear to be in the same coordinates, but it's good enough for now. --- .../CoreModules/World/WorldMap/MapSearchModule.cs | 44 +++++++++++++--------- .../CoreModules/World/WorldMap/WorldMapModule.cs | 4 +- 2 files changed, 28 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 1437b1b..de7ea6d 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -49,6 +49,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap List m_scenes = new List(); List m_Clients; + IWorldMapModule m_WorldMap; + IWorldMapModule WorldMap + { + get + { + if (m_WorldMap == null) + m_WorldMap = m_scene.RequestModuleInterface(); + return m_WorldMap; + } + + } + #region ISharedRegionModule Members public void Initialise(IConfigSource source) { @@ -64,6 +76,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scenes.Add(scene); scene.EventManager.OnNewClient += OnNewClient; m_Clients = new List(); + } public void RemoveRegion(Scene scene) @@ -129,7 +142,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) { List blocks = new List(); - MapBlockData data; if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) { // final block, closing the search result @@ -173,24 +185,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { foreach (GridRegion info in regionInfos) { - data = new MapBlockData(); - data.Agents = 0; - data.Access = info.Access; - if (flags == 2) // V2 sends this - data.MapImageId = UUID.Zero; - else - data.MapImageId = info.TerrainImage; - // ugh! V2-3 is very sensitive about the result being - // exactly the same as the requested name - if (regionInfos.Count == 1 && (mapName != mapNameOrig)) - data.Name = mapNameOrig; + if ((flags & 2) == 2) // V2 sends this + { + List datas = WorldMap.Map2BlockFromGridRegion(info, flags); + // ugh! V2-3 is very sensitive about the result being + // exactly the same as the requested name + if (regionInfos.Count == 1 && (mapName != mapNameOrig)) + datas.ForEach(d => d.Name = mapNameOrig); + + blocks.AddRange(datas); + } else - data.Name = info.RegionName; - data.RegionFlags = 0; // TODO not used? - data.WaterHeight = 0; // not used - data.X = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocX); - data.Y = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocY); - blocks.Add(data); + { + MapBlockData data = WorldMap.MapBlockFromGridRegion(info, flags); + } } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index a3b0f39..b98afbc 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1064,7 +1064,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } // Fill a passed MapBlockData from a GridRegion - protected MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag) + public MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag) { MapBlockData block = new MapBlockData(); @@ -1090,7 +1090,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap return block; } - protected List Map2BlockFromGridRegion(GridRegion r, uint flag) + public List Map2BlockFromGridRegion(GridRegion r, uint flag) { List blocks = new List(); MapBlockData block = new MapBlockData(); -- cgit v1.1