diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 1437b1bb7b..de7ea6d79f 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; + 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.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; - 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 a3b0f39498..b98afbcb3d 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(); diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs index 65c57a6eb8..9c781e13d2 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs @@ -24,6 +24,9 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System.Collections.Generic; +using OpenSim.Framework; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.Framework.Interfaces { @@ -33,5 +36,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Generate a map tile for the scene. a terrain texture for this scene /// void GenerateMaptile(); + List Map2BlockFromGridRegion(GridRegion r, uint flag); + MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag); } }