Allow map searches for regions that contain the characters "!+|"

These characters are used as placeholders for other characters: ": /". But we should search first for the exact string the user entered, and only if that fails then replace the characters and search again.
bullet-2.82
Oren Hurvitz 2014-05-21 09:34:57 +03:00
parent 5b433e101d
commit a1b291c889
1 changed files with 25 additions and 21 deletions

View File

@ -143,8 +143,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
}
//m_log.DebugFormat("MAP NAME=({0})", mapName);
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
string mapNameOrig = mapName;
if (regionInfos.Count == 0)
{
// Hack to get around the fact that ll V3 now drops the port from the
// map name. See https://jira.secondlife.com/browse/VWR-28570
//
@ -153,7 +156,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// or url encode if possible.
// the hacks we do with this viewer...
//
string mapNameOrig = mapName;
if (mapName.Contains("|"))
mapName = mapName.Replace('|', ':');
if (mapName.Contains("+"))
@ -161,10 +163,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (mapName.Contains("!"))
mapName = mapName.Replace('!', '/');
// try to fetch from GridServer
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
if (mapName != mapNameOrig)
regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
}
m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags);
if (regionInfos.Count > 0)
{
foreach (GridRegion info in regionInfos)
@ -178,7 +182,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
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 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+"))
if (regionInfos.Count == 1 && (mapName != mapNameOrig))
data.Name = mapNameOrig;
else
data.Name = info.RegionName;