From 1ce362323ee45ae5b1d30e5f6227130448fdb992 Mon Sep 17 00:00:00 2001 From: diva Date: Sun, 26 Apr 2009 23:57:18 +0000 Subject: HGWorldMap got a bit out of sync during the introduction of the new module system. Should work now. Fixes mantis #3533. --- .../CoreModules/Hypergrid/HGWorldMapModule.cs | 103 ++------------------- 1 file changed, 7 insertions(+), 96 deletions(-) (limited to 'OpenSim/Region/CoreModules/Hypergrid') diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index 6143c87..440765a 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs @@ -51,39 +51,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid m_Enabled = true; } - public override void AddRegion(Scene scene) - { - if (!m_Enabled) - return; - - m_log.Info("[HGMap] Initializing..."); - lock (scene) - { - m_scene = scene; - - m_scene.RegisterModuleInterface(this); - - m_scene.AddCommand( - this, "export-map", - "export-map []", - "Save an image of the world map", HandleExportWorldMapConsoleCommand); - } - } - - public override void RemoveRegion(Scene scene) - { - if (!m_Enabled) - return; - - lock (m_scene) - { - m_Enabled = false; - m_scene.UnregisterModuleInterface(this); - // TODO: m_scene.RemoveCommand(this, "export-map"); - m_scene = null; - } - } - public override string Name { get { return "HGWorldMap"; } @@ -91,74 +58,18 @@ namespace OpenSim.Region.CoreModules.Hypergrid #endregion - /// - /// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates - /// - /// - /// - /// - /// - public override void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) + protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) { - // - // WARNING!!! COPY & PASTE FROM SUPERCLASS - // The only difference is at the very end - // - - m_log.Info("[HGMap]: Request map blocks " + minX + "-" + maxX + " " + minY + "-" + maxY); + List mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); - //m_scene.ForEachScenePresence(delegate (ScenePresence sp) { - // if (!sp.IsChildAgent && sp.UUID == remoteClient.AgentId) - // { - // m_log.Debug("XXX Root agent"); - // DoRequestMapBlocks(remoteClient, minX, minY, maxX, maxY, flag); - // } - //}; - - List mapBlocks; - if ((flag & 0x10000) != 0) // user clicked on the map a tile that isn't visible - { - List response = new List(); - - // this should return one mapblock at most. But make sure: Look whether the one we requested is in there - mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); - if (mapBlocks != null) - { - foreach (MapBlockData block in mapBlocks) - { - if (block.X == minX && block.Y == minY) - { - // found it => add it to response - response.Add(block); - break; - } - } - } - - if (response.Count == 0) - { - // response still empty => couldn't find the map-tile the user clicked on => tell the client - MapBlockData block = new MapBlockData(); - block.X = (ushort)minX; - block.Y = (ushort)minY; - block.Access = 254; // == not there - response.Add(block); - } - remoteClient.SendMapBlock(response, 0); - } - else - { - // normal mapblock request. Use the provided values - mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); - - // Different from super - FillInMap(mapBlocks, minX, minY, maxX, maxY); - // + // Different from super + FillInMap(mapBlocks, minX, minY, maxX, maxY); + // - remoteClient.SendMapBlock(mapBlocks, flag); - } + remoteClient.SendMapBlock(mapBlocks, flag); } + private void FillInMap(List mapBlocks, int minX, int minY, int maxX, int maxY) { for (int x = minX; x <= maxX; x++) -- cgit v1.1