diff options
author | UbitUmarov | 2015-08-22 13:41:45 +0100 |
---|---|---|
committer | UbitUmarov | 2015-08-22 13:41:45 +0100 |
commit | d22d46ee96f7ba0e15e4bc96581ffd316f4797d5 (patch) | |
tree | 5058f8a244342bd486be49d593c97419574cf307 /OpenSim/Region | |
parent | fix worldMapModule (diff) | |
download | opensim-SC-d22d46ee96f7ba0e15e4bc96581ffd316f4797d5.zip opensim-SC-d22d46ee96f7ba0e15e4bc96581ffd316f4797d5.tar.gz opensim-SC-d22d46ee96f7ba0e15e4bc96581ffd316f4797d5.tar.bz2 opensim-SC-d22d46ee96f7ba0e15e4bc96581ffd316f4797d5.tar.xz |
update MapSearchModule
Diffstat (limited to 'OpenSim/Region')
3 files changed, 44 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 14deeb6..1e5af1b 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 | { |
@@ -130,9 +142,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
130 | { | 142 | { |
131 | Util.FireAndForget(x => | 143 | Util.FireAndForget(x => |
132 | { | 144 | { |
133 | if (mapName.Length < 2) | 145 | List<MapBlockData> blocks = new List<MapBlockData>(); |
146 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) | ||
134 | { | 147 | { |
135 | remoteClient.SendAlertMessage("Use a search string with at least 2 characters"); | 148 | // final block, closing the search result |
149 | AddFinalBlock(blocks); | ||
150 | |||
151 | // flags are agent flags sent from the viewer. | ||
152 | // they have different values depending on different viewers, apparently | ||
153 | remoteClient.SendMapBlock(blocks, flags); | ||
154 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); | ||
136 | return; | 155 | return; |
137 | } | 156 | } |
138 | 157 | ||
@@ -160,8 +179,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
160 | // remoteClient.SendAlertMessage("Hyperlink could not be established."); | 179 | // remoteClient.SendAlertMessage("Hyperlink could not be established."); |
161 | 180 | ||
162 | //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); | 181 | //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); |
163 | List<MapBlockData> blocks = new List<MapBlockData>(); | 182 | |
164 | |||
165 | MapBlockData data; | 183 | MapBlockData data; |
166 | if (regionInfos.Count > 0) | 184 | if (regionInfos.Count > 0) |
167 | { | 185 | { |
@@ -171,9 +189,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
171 | data.Agents = 0; | 189 | data.Agents = 0; |
172 | data.Access = info.Access; | 190 | data.Access = info.Access; |
173 | if (flags == 2) // V2 sends this | 191 | if (flags == 2) // V2 sends this |
174 | data.MapImageId = UUID.Zero; | 192 | { |
193 | List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags); | ||
194 | // ugh! V2-3 is very sensitive about the result being | ||
195 | // exactly the same as the requested name | ||
196 | |||
197 | if (regionInfos.Count == 1 && (mapName != mapNameOrig)) | ||
198 | datas.ForEach(d => d.Name = mapNameOrig); | ||
199 | |||
200 | blocks.AddRange(datas); | ||
201 | } | ||
175 | else | 202 | else |
176 | data.MapImageId = info.TerrainImage; | 203 | { |
204 | MapBlockData block = new MapBlockData(); | ||
205 | WorldMap.MapBlockFromGridRegion(block,info, flags); | ||
206 | blocks.Add(block); | ||
207 | } | ||
177 | // ugh! V2-3 is very sensitive about the result being | 208 | // ugh! V2-3 is very sensitive about the result being |
178 | // exactly the same as the requested name | 209 | // exactly the same as the requested name |
179 | if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+")) | 210 | if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+")) |
@@ -189,16 +220,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
189 | } | 220 | } |
190 | 221 | ||
191 | // final block, closing the search result | 222 | // final block, closing the search result |
192 | data = new MapBlockData(); | 223 | AddFinalBlock(blocks); |
193 | data.Agents = 0; | ||
194 | data.Access = 255; | ||
195 | data.MapImageId = UUID.Zero; | ||
196 | data.Name = mapName; | ||
197 | data.RegionFlags = 0; | ||
198 | data.WaterHeight = 0; // not used | ||
199 | data.X = 0; | ||
200 | data.Y = 0; | ||
201 | blocks.Add(data); | ||
202 | 224 | ||
203 | // flags are agent flags sent from the viewer. | 225 | // flags are agent flags sent from the viewer. |
204 | // they have different values depending on different viewers, apparently | 226 | // they have different values depending on different viewers, apparently |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 59529d8..31b1c35 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1143,7 +1143,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1143 | return allBlocks; | 1143 | return allBlocks; |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) | 1146 | public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) |
1147 | { | 1147 | { |
1148 | block.Access = r.Access; | 1148 | block.Access = r.Access; |
1149 | switch (flag & 0xffff) | 1149 | switch (flag & 0xffff) |
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs index 65c57a6..e9cf4ad 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs | |||
@@ -24,6 +24,9 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System.Collections.Generic; | ||
28 | using OpenSim.Framework; | ||
29 | using OpenSim.Services.Interfaces; | ||
27 | 30 | ||
28 | namespace OpenSim.Region.Framework.Interfaces | 31 | namespace OpenSim.Region.Framework.Interfaces |
29 | { | 32 | { |
@@ -33,5 +36,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
33 | /// Generate a map tile for the scene. a terrain texture for this scene | 36 | /// Generate a map tile for the scene. a terrain texture for this scene |
34 | /// </summary> | 37 | /// </summary> |
35 | void GenerateMaptile(); | 38 | void GenerateMaptile(); |
39 | List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag); | ||
40 | void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag); | ||
36 | } | 41 | } |
37 | } | 42 | } |