diff options
author | diva | 2009-04-26 23:57:18 +0000 |
---|---|---|
committer | diva | 2009-04-26 23:57:18 +0000 |
commit | 1ce362323ee45ae5b1d30e5f6227130448fdb992 (patch) | |
tree | c30bdf7e28b338c6f0a71ea0bc6caf4352411d75 /OpenSim | |
parent | Bug fix in initialization of RegionAssetServer/MXP. Sometimes the MXP section... (diff) | |
download | opensim-SC_OLD-1ce362323ee45ae5b1d30e5f6227130448fdb992.zip opensim-SC_OLD-1ce362323ee45ae5b1d30e5f6227130448fdb992.tar.gz opensim-SC_OLD-1ce362323ee45ae5b1d30e5f6227130448fdb992.tar.bz2 opensim-SC_OLD-1ce362323ee45ae5b1d30e5f6227130448fdb992.tar.xz |
HGWorldMap got a bit out of sync during the introduction of the new module system. Should work now. Fixes mantis #3533.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs | 103 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 12 |
2 files changed, 15 insertions, 100 deletions
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 | |||
51 | m_Enabled = true; | 51 | m_Enabled = true; |
52 | } | 52 | } |
53 | 53 | ||
54 | public override void AddRegion(Scene scene) | ||
55 | { | ||
56 | if (!m_Enabled) | ||
57 | return; | ||
58 | |||
59 | m_log.Info("[HGMap] Initializing..."); | ||
60 | lock (scene) | ||
61 | { | ||
62 | m_scene = scene; | ||
63 | |||
64 | m_scene.RegisterModuleInterface<IWorldMapModule>(this); | ||
65 | |||
66 | m_scene.AddCommand( | ||
67 | this, "export-map", | ||
68 | "export-map [<path>]", | ||
69 | "Save an image of the world map", HandleExportWorldMapConsoleCommand); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | public override void RemoveRegion(Scene scene) | ||
74 | { | ||
75 | if (!m_Enabled) | ||
76 | return; | ||
77 | |||
78 | lock (m_scene) | ||
79 | { | ||
80 | m_Enabled = false; | ||
81 | m_scene.UnregisterModuleInterface<IWorldMapModule>(this); | ||
82 | // TODO: m_scene.RemoveCommand(this, "export-map"); | ||
83 | m_scene = null; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | public override string Name | 54 | public override string Name |
88 | { | 55 | { |
89 | get { return "HGWorldMap"; } | 56 | get { return "HGWorldMap"; } |
@@ -91,74 +58,18 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
91 | 58 | ||
92 | #endregion | 59 | #endregion |
93 | 60 | ||
94 | /// <summary> | 61 | protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) |
95 | /// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates | ||
96 | /// </summary> | ||
97 | /// <param name="minX"></param> | ||
98 | /// <param name="minY"></param> | ||
99 | /// <param name="maxX"></param> | ||
100 | /// <param name="maxY"></param> | ||
101 | public override void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | ||
102 | { | 62 | { |
103 | // | 63 | List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); |
104 | // WARNING!!! COPY & PASTE FROM SUPERCLASS | ||
105 | // The only difference is at the very end | ||
106 | // | ||
107 | |||
108 | m_log.Info("[HGMap]: Request map blocks " + minX + "-" + maxX + " " + minY + "-" + maxY); | ||
109 | 64 | ||
110 | //m_scene.ForEachScenePresence(delegate (ScenePresence sp) { | 65 | // Different from super |
111 | // if (!sp.IsChildAgent && sp.UUID == remoteClient.AgentId) | 66 | FillInMap(mapBlocks, minX, minY, maxX, maxY); |
112 | // { | 67 | // |
113 | // m_log.Debug("XXX Root agent"); | ||
114 | // DoRequestMapBlocks(remoteClient, minX, minY, maxX, maxY, flag); | ||
115 | // } | ||
116 | //}; | ||
117 | |||
118 | List<MapBlockData> mapBlocks; | ||
119 | if ((flag & 0x10000) != 0) // user clicked on the map a tile that isn't visible | ||
120 | { | ||
121 | List<MapBlockData> response = new List<MapBlockData>(); | ||
122 | |||
123 | // this should return one mapblock at most. But make sure: Look whether the one we requested is in there | ||
124 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | ||
125 | if (mapBlocks != null) | ||
126 | { | ||
127 | foreach (MapBlockData block in mapBlocks) | ||
128 | { | ||
129 | if (block.X == minX && block.Y == minY) | ||
130 | { | ||
131 | // found it => add it to response | ||
132 | response.Add(block); | ||
133 | break; | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | |||
138 | if (response.Count == 0) | ||
139 | { | ||
140 | // response still empty => couldn't find the map-tile the user clicked on => tell the client | ||
141 | MapBlockData block = new MapBlockData(); | ||
142 | block.X = (ushort)minX; | ||
143 | block.Y = (ushort)minY; | ||
144 | block.Access = 254; // == not there | ||
145 | response.Add(block); | ||
146 | } | ||
147 | remoteClient.SendMapBlock(response, 0); | ||
148 | } | ||
149 | else | ||
150 | { | ||
151 | // normal mapblock request. Use the provided values | ||
152 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); | ||
153 | |||
154 | // Different from super | ||
155 | FillInMap(mapBlocks, minX, minY, maxX, maxY); | ||
156 | // | ||
157 | 68 | ||
158 | remoteClient.SendMapBlock(mapBlocks, flag); | 69 | remoteClient.SendMapBlock(mapBlocks, flag); |
159 | } | ||
160 | } | 70 | } |
161 | 71 | ||
72 | |||
162 | private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY) | 73 | private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY) |
163 | { | 74 | { |
164 | for (int x = minX; x <= maxX; x++) | 75 | for (int x = minX; x <= maxX; x++) |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 75b5a85..d4e7bb6 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -709,13 +709,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
709 | /// <param name="maxY"></param> | 709 | /// <param name="maxY"></param> |
710 | public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | 710 | public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) |
711 | { | 711 | { |
712 | List<MapBlockData> mapBlocks; | ||
713 | if ((flag & 0x10000) != 0) // user clicked on the map a tile that isn't visible | 712 | if ((flag & 0x10000) != 0) // user clicked on the map a tile that isn't visible |
714 | { | 713 | { |
715 | List<MapBlockData> response = new List<MapBlockData>(); | 714 | List<MapBlockData> response = new List<MapBlockData>(); |
716 | 715 | ||
717 | // this should return one mapblock at most. But make sure: Look whether the one we requested is in there | 716 | // this should return one mapblock at most. But make sure: Look whether the one we requested is in there |
718 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | 717 | List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); |
719 | if (mapBlocks != null) | 718 | if (mapBlocks != null) |
720 | { | 719 | { |
721 | foreach (MapBlockData block in mapBlocks) | 720 | foreach (MapBlockData block in mapBlocks) |
@@ -743,11 +742,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
743 | else | 742 | else |
744 | { | 743 | { |
745 | // normal mapblock request. Use the provided values | 744 | // normal mapblock request. Use the provided values |
746 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); | 745 | GetAndSendBlocks(remoteClient, minX, minY, maxX, maxY, flag); |
747 | remoteClient.SendMapBlock(mapBlocks, flag); | ||
748 | } | 746 | } |
749 | } | 747 | } |
750 | 748 | ||
749 | protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | ||
750 | { | ||
751 | List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); | ||
752 | remoteClient.SendMapBlock(mapBlocks, flag); | ||
753 | } | ||
754 | |||
751 | public Hashtable OnHTTPGetMapImage(Hashtable keysvals) | 755 | public Hashtable OnHTTPGetMapImage(Hashtable keysvals) |
752 | { | 756 | { |
753 | m_log.Debug("[WORLD MAP]: Sending map image jpeg"); | 757 | m_log.Debug("[WORLD MAP]: Sending map image jpeg"); |