diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | 86 |
1 files changed, 49 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index c35f6b7..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 | |||
49 | List<Scene> m_scenes = new List<Scene>(); | 49 | List<Scene> m_scenes = new List<Scene>(); |
50 | List<UUID> m_Clients; | 50 | List<UUID> m_Clients; |
51 | 51 | ||
52 | IWorldMapModule m_WorldMap; | ||
53 | IWorldMapModule WorldMap | ||
54 | { | ||
55 | get | ||
56 | { | ||
57 | if (m_WorldMap == null) | ||
58 | m_WorldMap = m_scene.RequestModuleInterface<IWorldMapModule>(); | ||
59 | return m_WorldMap; | ||
60 | } | ||
61 | |||
62 | } | ||
63 | |||
52 | #region ISharedRegionModule Members | 64 | #region ISharedRegionModule Members |
53 | public void Initialise(IConfigSource source) | 65 | public void Initialise(IConfigSource source) |
54 | { | 66 | { |
@@ -64,6 +76,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
64 | m_scenes.Add(scene); | 76 | m_scenes.Add(scene); |
65 | scene.EventManager.OnNewClient += OnNewClient; | 77 | scene.EventManager.OnNewClient += OnNewClient; |
66 | m_Clients = new List<UUID>(); | 78 | m_Clients = new List<UUID>(); |
79 | |||
67 | } | 80 | } |
68 | 81 | ||
69 | public void RemoveRegion(Scene scene) | 82 | public void RemoveRegion(Scene scene) |
@@ -129,7 +142,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
129 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) | 142 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) |
130 | { | 143 | { |
131 | List<MapBlockData> blocks = new List<MapBlockData>(); | 144 | List<MapBlockData> blocks = new List<MapBlockData>(); |
132 | MapBlockData data; | ||
133 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) | 145 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) |
134 | { | 146 | { |
135 | // final block, closing the search result | 147 | // final block, closing the search result |
@@ -143,50 +155,50 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
143 | } | 155 | } |
144 | 156 | ||
145 | 157 | ||
146 | //m_log.DebugFormat("MAP NAME=({0})", mapName); | 158 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); |
147 | 159 | ||
148 | // Hack to get around the fact that ll V3 now drops the port from the | ||
149 | // map name. See https://jira.secondlife.com/browse/VWR-28570 | ||
150 | // | ||
151 | // Caller, use this magic form instead: | ||
152 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 | ||
153 | // or url encode if possible. | ||
154 | // the hacks we do with this viewer... | ||
155 | // | ||
156 | string mapNameOrig = mapName; | 160 | string mapNameOrig = mapName; |
157 | if (mapName.Contains("|")) | 161 | if (regionInfos.Count == 0) |
158 | mapName = mapName.Replace('|', ':'); | 162 | { |
159 | if (mapName.Contains("+")) | 163 | // Hack to get around the fact that ll V3 now drops the port from the |
160 | mapName = mapName.Replace('+', ' '); | 164 | // map name. See https://jira.secondlife.com/browse/VWR-28570 |
161 | if (mapName.Contains("!")) | 165 | // |
162 | mapName = mapName.Replace('!', '/'); | 166 | // Caller, use this magic form instead: |
167 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 | ||
168 | // or url encode if possible. | ||
169 | // the hacks we do with this viewer... | ||
170 | // | ||
171 | if (mapName.Contains("|")) | ||
172 | mapName = mapName.Replace('|', ':'); | ||
173 | if (mapName.Contains("+")) | ||
174 | mapName = mapName.Replace('+', ' '); | ||
175 | if (mapName.Contains("!")) | ||
176 | mapName = mapName.Replace('!', '/'); | ||
177 | |||
178 | if (mapName != mapNameOrig) | ||
179 | regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | ||
180 | } | ||
163 | 181 | ||
164 | // try to fetch from GridServer | ||
165 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | ||
166 | |||
167 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); | 182 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); |
183 | |||
168 | if (regionInfos.Count > 0) | 184 | if (regionInfos.Count > 0) |
169 | { | 185 | { |
170 | foreach (GridRegion info in regionInfos) | 186 | foreach (GridRegion info in regionInfos) |
171 | { | 187 | { |
172 | data = new MapBlockData(); | 188 | if ((flags & 2) == 2) // V2 sends this |
173 | data.Agents = 0; | 189 | { |
174 | data.Access = info.Access; | 190 | List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags); |
175 | if (flags == 2) // V2 sends this | 191 | // ugh! V2-3 is very sensitive about the result being |
176 | data.MapImageId = UUID.Zero; | 192 | // exactly the same as the requested name |
177 | else | 193 | if (regionInfos.Count == 1 && (mapName != mapNameOrig)) |
178 | data.MapImageId = info.TerrainImage; | 194 | datas.ForEach(d => d.Name = mapNameOrig); |
179 | // ugh! V2-3 is very sensitive about the result being | 195 | |
180 | // exactly the same as the requested name | 196 | blocks.AddRange(datas); |
181 | if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+")) | 197 | } |
182 | data.Name = mapNameOrig; | ||
183 | else | 198 | else |
184 | data.Name = info.RegionName; | 199 | { |
185 | data.RegionFlags = 0; // TODO not used? | 200 | MapBlockData data = WorldMap.MapBlockFromGridRegion(info, flags); |
186 | data.WaterHeight = 0; // not used | 201 | } |
187 | data.X = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocX); | ||
188 | data.Y = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocY); | ||
189 | blocks.Add(data); | ||
190 | } | 202 | } |
191 | } | 203 | } |
192 | 204 | ||