diff options
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index e08bdc0..ab2e064 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -166,14 +166,26 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
166 | // or url encode if possible. | 166 | // or url encode if possible. |
167 | // the hacks we do with this viewer... | 167 | // the hacks we do with this viewer... |
168 | // | 168 | // |
169 | bool needOriginalName = false; | ||
169 | string mapNameOrig = mapName; | 170 | string mapNameOrig = mapName; |
170 | if (mapName.Contains("|")) | 171 | if (mapName.Contains("|")) |
172 | { | ||
171 | mapName = mapName.Replace('|', ':'); | 173 | mapName = mapName.Replace('|', ':'); |
174 | needOriginalName = true; | ||
175 | } | ||
172 | if (mapName.Contains("+")) | 176 | if (mapName.Contains("+")) |
177 | { | ||
173 | mapName = mapName.Replace('+', ' '); | 178 | mapName = mapName.Replace('+', ' '); |
179 | needOriginalName = true; | ||
180 | } | ||
174 | if (mapName.Contains("!")) | 181 | if (mapName.Contains("!")) |
182 | { | ||
175 | mapName = mapName.Replace('!', '/'); | 183 | mapName = mapName.Replace('!', '/'); |
176 | 184 | needOriginalName = true; | |
185 | } | ||
186 | if (mapName.Contains(".")) | ||
187 | needOriginalName = true; | ||
188 | |||
177 | // try to fetch from GridServer | 189 | // try to fetch from GridServer |
178 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | 190 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); |
179 | // if (regionInfos.Count == 0) | 191 | // if (regionInfos.Count == 0) |
@@ -195,7 +207,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
195 | // ugh! V2-3 is very sensitive about the result being | 207 | // ugh! V2-3 is very sensitive about the result being |
196 | // exactly the same as the requested name | 208 | // exactly the same as the requested name |
197 | 209 | ||
198 | if (regionInfos.Count == 1 && (mapName != mapNameOrig)) | 210 | if (regionInfos.Count == 1 && needOriginalName) |
199 | datas.ForEach(d => d.Name = mapNameOrig); | 211 | datas.ForEach(d => d.Name = mapNameOrig); |
200 | 212 | ||
201 | blocks.AddRange(datas); | 213 | blocks.AddRange(datas); |
@@ -206,22 +218,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
206 | WorldMap.MapBlockFromGridRegion(block,info, flags); | 218 | WorldMap.MapBlockFromGridRegion(block,info, flags); |
207 | blocks.Add(block); | 219 | blocks.Add(block); |
208 | } | 220 | } |
209 | // ugh! V2-3 is very sensitive about the result being | ||
210 | // exactly the same as the requested name | ||
211 | if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+")) | ||
212 | data.Name = mapNameOrig; | ||
213 | else | ||
214 | data.Name = info.RegionName; | ||
215 | data.RegionFlags = 0; // TODO not used? | ||
216 | data.WaterHeight = 0; // not used | ||
217 | data.X = (ushort)(info.RegionLocX / Constants.RegionSize); | ||
218 | data.Y = (ushort)(info.RegionLocY / Constants.RegionSize); | ||
219 | blocks.Add(data); | ||
220 | } | 221 | } |
221 | } | 222 | } |
222 | 223 | ||
223 | // final block, closing the search result | 224 | // final block, closing the search result |
224 | AddFinalBlock(blocks); | 225 | if(blocks.Count == 0) |
226 | AddFinalBlock(blocks); | ||
225 | 227 | ||
226 | // flags are agent flags sent from the viewer. | 228 | // flags are agent flags sent from the viewer. |
227 | // they have different values depending on different viewers, apparently | 229 | // they have different values depending on different viewers, apparently |