aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World
diff options
context:
space:
mode:
authorJeff Ames2008-05-04 21:59:29 +0000
committerJeff Ames2008-05-04 21:59:29 +0000
commit0e31eb831409c7f2f9f1ba88dec13dfef4dd3ac1 (patch)
tree964fa5d80d3910c3aa51cdd62f03e2779791abe2 /OpenSim/Region/Environment/Modules/World
parent* Reformatted EstateManagementModule (diff)
downloadopensim-SC_OLD-0e31eb831409c7f2f9f1ba88dec13dfef4dd3ac1.zip
opensim-SC_OLD-0e31eb831409c7f2f9f1ba88dec13dfef4dd3ac1.tar.gz
opensim-SC_OLD-0e31eb831409c7f2f9f1ba88dec13dfef4dd3ac1.tar.bz2
opensim-SC_OLD-0e31eb831409c7f2f9f1ba88dec13dfef4dd3ac1.tar.xz
Update svn properties.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs772
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs332
2 files changed, 552 insertions, 552 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
index 3e466dc..403ab5b 100644
--- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
@@ -1,387 +1,387 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection; 29using System.Reflection;
30using libsecondlife; 30using libsecondlife;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
36 36
37namespace OpenSim.Region.Environment.Modules.World.Estate 37namespace OpenSim.Region.Environment.Modules.World.Estate
38{ 38{
39 public class EstateManagementModule : IRegionModule 39 public class EstateManagementModule : IRegionModule
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 private Scene m_scene; 43 private Scene m_scene;
44 44
45 #region Packet Data Responders 45 #region Packet Data Responders
46 46
47 private static void sendDetailedEstateData(IClientAPI remote_client, LLUUID invoice) 47 private static void sendDetailedEstateData(IClientAPI remote_client, LLUUID invoice)
48 { 48 {
49 remote_client.sendDetailedEstateData(invoice); 49 remote_client.sendDetailedEstateData(invoice);
50 remote_client.sendEstateManagersList(invoice); 50 remote_client.sendEstateManagersList(invoice);
51 } 51 }
52 52
53 private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, 53 private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor,
54 int matureLevel, bool restrictPushObject, bool allowParcelChanges) 54 int matureLevel, bool restrictPushObject, bool allowParcelChanges)
55 { 55 {
56 m_scene.RegionInfo.EstateSettings.regionFlags = Simulator.RegionFlags.None; 56 m_scene.RegionInfo.EstateSettings.regionFlags = Simulator.RegionFlags.None;
57 57
58 if (blockTerraform) 58 if (blockTerraform)
59 { 59 {
60 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 60 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
61 Simulator.RegionFlags.BlockTerraform; 61 Simulator.RegionFlags.BlockTerraform;
62 } 62 }
63 63
64 if (noFly) 64 if (noFly)
65 { 65 {
66 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 66 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
67 Simulator.RegionFlags.NoFly; 67 Simulator.RegionFlags.NoFly;
68 } 68 }
69 69
70 if (allowDamage) 70 if (allowDamage)
71 { 71 {
72 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 72 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
73 Simulator.RegionFlags.AllowDamage; 73 Simulator.RegionFlags.AllowDamage;
74 } 74 }
75 75
76 if (blockLandResell) 76 if (blockLandResell)
77 { 77 {
78 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 78 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
79 Simulator.RegionFlags.BlockLandResell; 79 Simulator.RegionFlags.BlockLandResell;
80 } 80 }
81 81
82 m_scene.RegionInfo.EstateSettings.maxAgents = (byte) maxAgents; 82 m_scene.RegionInfo.EstateSettings.maxAgents = (byte) maxAgents;
83 83
84 m_scene.RegionInfo.EstateSettings.objectBonusFactor = objectBonusFactor; 84 m_scene.RegionInfo.EstateSettings.objectBonusFactor = objectBonusFactor;
85 85
86 m_scene.RegionInfo.EstateSettings.simAccess = (Simulator.SimAccess) matureLevel; 86 m_scene.RegionInfo.EstateSettings.simAccess = (Simulator.SimAccess) matureLevel;
87 87
88 88
89 if (restrictPushObject) 89 if (restrictPushObject)
90 { 90 {
91 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 91 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
92 Simulator.RegionFlags.RestrictPushObject; 92 Simulator.RegionFlags.RestrictPushObject;
93 } 93 }
94 94
95 if (allowParcelChanges) 95 if (allowParcelChanges)
96 { 96 {
97 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 97 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
98 Simulator.RegionFlags.AllowParcelChanges; 98 Simulator.RegionFlags.AllowParcelChanges;
99 } 99 }
100 100
101 sendRegionInfoPacketToAll(); 101 sendRegionInfoPacketToAll();
102 } 102 }
103 103
104 public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, LLUUID texture) 104 public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, LLUUID texture)
105 { 105 {
106 switch (corner) 106 switch (corner)
107 { 107 {
108 case 0: 108 case 0:
109 m_scene.RegionInfo.EstateSettings.terrainBase0 = texture; 109 m_scene.RegionInfo.EstateSettings.terrainBase0 = texture;
110 break; 110 break;
111 case 1: 111 case 1:
112 m_scene.RegionInfo.EstateSettings.terrainBase1 = texture; 112 m_scene.RegionInfo.EstateSettings.terrainBase1 = texture;
113 break; 113 break;
114 case 2: 114 case 2:
115 m_scene.RegionInfo.EstateSettings.terrainBase2 = texture; 115 m_scene.RegionInfo.EstateSettings.terrainBase2 = texture;
116 break; 116 break;
117 case 3: 117 case 3:
118 m_scene.RegionInfo.EstateSettings.terrainBase3 = texture; 118 m_scene.RegionInfo.EstateSettings.terrainBase3 = texture;
119 break; 119 break;
120 } 120 }
121 } 121 }
122 122
123 public void setEstateTerrainDetailTexture(IClientAPI client, int corner, LLUUID textureUUID) 123 public void setEstateTerrainDetailTexture(IClientAPI client, int corner, LLUUID textureUUID)
124 { 124 {
125 switch (corner) 125 switch (corner)
126 { 126 {
127 case 0: 127 case 0:
128 m_scene.RegionInfo.EstateSettings.terrainDetail0 = textureUUID; 128 m_scene.RegionInfo.EstateSettings.terrainDetail0 = textureUUID;
129 break; 129 break;
130 case 1: 130 case 1:
131 m_scene.RegionInfo.EstateSettings.terrainDetail1 = textureUUID; 131 m_scene.RegionInfo.EstateSettings.terrainDetail1 = textureUUID;
132 break; 132 break;
133 case 2: 133 case 2:
134 m_scene.RegionInfo.EstateSettings.terrainDetail2 = textureUUID; 134 m_scene.RegionInfo.EstateSettings.terrainDetail2 = textureUUID;
135 break; 135 break;
136 case 3: 136 case 3:
137 m_scene.RegionInfo.EstateSettings.terrainDetail3 = textureUUID; 137 m_scene.RegionInfo.EstateSettings.terrainDetail3 = textureUUID;
138 break; 138 break;
139 } 139 }
140 } 140 }
141 141
142 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) 142 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue)
143 { 143 {
144 switch (corner) 144 switch (corner)
145 { 145 {
146 case 0: 146 case 0:
147 m_scene.RegionInfo.EstateSettings.terrainStartHeight0 = lowValue; 147 m_scene.RegionInfo.EstateSettings.terrainStartHeight0 = lowValue;
148 m_scene.RegionInfo.EstateSettings.terrainHeightRange0 = highValue; 148 m_scene.RegionInfo.EstateSettings.terrainHeightRange0 = highValue;
149 break; 149 break;
150 case 1: 150 case 1:
151 m_scene.RegionInfo.EstateSettings.terrainStartHeight1 = lowValue; 151 m_scene.RegionInfo.EstateSettings.terrainStartHeight1 = lowValue;
152 m_scene.RegionInfo.EstateSettings.terrainHeightRange1 = highValue; 152 m_scene.RegionInfo.EstateSettings.terrainHeightRange1 = highValue;
153 break; 153 break;
154 case 2: 154 case 2:
155 m_scene.RegionInfo.EstateSettings.terrainStartHeight2 = lowValue; 155 m_scene.RegionInfo.EstateSettings.terrainStartHeight2 = lowValue;
156 m_scene.RegionInfo.EstateSettings.terrainHeightRange2 = highValue; 156 m_scene.RegionInfo.EstateSettings.terrainHeightRange2 = highValue;
157 break; 157 break;
158 case 3: 158 case 3:
159 m_scene.RegionInfo.EstateSettings.terrainStartHeight3 = lowValue; 159 m_scene.RegionInfo.EstateSettings.terrainStartHeight3 = lowValue;
160 m_scene.RegionInfo.EstateSettings.terrainHeightRange3 = highValue; 160 m_scene.RegionInfo.EstateSettings.terrainHeightRange3 = highValue;
161 break; 161 break;
162 } 162 }
163 } 163 }
164 164
165 private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) 165 private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient)
166 { 166 {
167 sendRegionHandshakeToAll(); 167 sendRegionHandshakeToAll();
168 } 168 }
169 169
170 public void setRegionTerrainSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit, 170 public void setRegionTerrainSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit,
171 bool UseFixedSun, float SunHour) 171 bool UseFixedSun, float SunHour)
172 { 172 {
173 // Water Height 173 // Water Height
174 m_scene.RegionInfo.EstateSettings.waterHeight = WaterHeight; 174 m_scene.RegionInfo.EstateSettings.waterHeight = WaterHeight;
175 175
176 // Terraforming limits 176 // Terraforming limits
177 m_scene.RegionInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit; 177 m_scene.RegionInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit;
178 m_scene.RegionInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit; 178 m_scene.RegionInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit;
179 179
180 // Time of day / fixed sun 180 // Time of day / fixed sun
181 m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun; 181 m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun;
182 m_scene.RegionInfo.EstateSettings.sunHour = SunHour; 182 m_scene.RegionInfo.EstateSettings.sunHour = SunHour;
183 183
184 sendRegionInfoPacketToAll(); 184 sendRegionInfoPacketToAll();
185 } 185 }
186 186
187 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) 187 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
188 { 188 {
189 m_scene.Restart(timeInSeconds); 189 m_scene.Restart(timeInSeconds);
190 } 190 }
191 191
192 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, LLUUID estateCovenantID) 192 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, LLUUID estateCovenantID)
193 { 193 {
194 m_scene.RegionInfo.CovenantID = estateCovenantID; 194 m_scene.RegionInfo.CovenantID = estateCovenantID;
195 m_scene.RegionInfo.SaveEstatecovenantUUID(estateCovenantID); 195 m_scene.RegionInfo.SaveEstatecovenantUUID(estateCovenantID);
196 } 196 }
197 197
198 private void handleEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user) 198 private void handleEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user)
199 { 199 {
200 // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. 200 // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc.
201 201
202 switch (estateAccessType) 202 switch (estateAccessType)
203 { 203 {
204 case 256: 204 case 256:
205 205
206 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml 206 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
207 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates 207 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
208 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) 208 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
209 { 209 {
210 m_scene.RegionInfo.EstateSettings.AddEstateManager(user); 210 m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
211 remote_client.sendEstateManagersList(invoice); 211 remote_client.sendEstateManagersList(invoice);
212 } 212 }
213 else 213 else
214 { 214 {
215 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 215 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
216 } 216 }
217 217
218 break; 218 break;
219 case 512: 219 case 512:
220 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml 220 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
221 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates 221 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
222 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) 222 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
223 { 223 {
224 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); 224 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
225 remote_client.sendEstateManagersList(invoice); 225 remote_client.sendEstateManagersList(invoice);
226 } 226 }
227 else 227 else
228 { 228 {
229 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 229 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
230 } 230 }
231 break; 231 break;
232 232
233 default: 233 default:
234 234
235 m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta"); 235 m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta");
236 break; 236 break;
237 } 237 }
238 } 238 }
239 239
240 private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message) 240 private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message)
241 { 241 {
242 m_scene.SendRegionMessageFromEstateTools(senderID, sessionID, senderName, message); 242 m_scene.SendRegionMessageFromEstateTools(senderID, sessionID, senderName, message);
243 } 243 }
244 244
245 private void SendEstateBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message) 245 private void SendEstateBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message)
246 { 246 {
247 m_scene.SendEstateMessageFromEstateTools(senderID, sessionID, senderName, message); 247 m_scene.SendEstateMessageFromEstateTools(senderID, sessionID, senderName, message);
248 } 248 }
249 249
250 private void handleEstateDebugRegionRequest(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, bool scripted, bool collisionEvents, bool physics) 250 private void handleEstateDebugRegionRequest(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, bool scripted, bool collisionEvents, bool physics)
251 { 251 {
252 if (physics) 252 if (physics)
253 { 253 {
254 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipPhysics; 254 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipPhysics;
255 } 255 }
256 else 256 else
257 { 257 {
258 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipPhysics; 258 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipPhysics;
259 } 259 }
260 260
261 if (scripted) 261 if (scripted)
262 { 262 {
263 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipScripts; 263 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipScripts;
264 } 264 }
265 else 265 else
266 { 266 {
267 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipScripts; 267 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipScripts;
268 } 268 }
269 269
270 270
271 m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); 271 m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics);
272 } 272 }
273 273
274 private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, LLUUID invoice, LLUUID senderID, LLUUID prey) 274 private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, LLUUID invoice, LLUUID senderID, LLUUID prey)
275 { 275 {
276 if (prey != LLUUID.Zero) 276 if (prey != LLUUID.Zero)
277 { 277 {
278 ScenePresence s = m_scene.GetScenePresence(prey); 278 ScenePresence s = m_scene.GetScenePresence(prey);
279 if (s != null) 279 if (s != null)
280 { 280 {
281 m_scene.TeleportClientHome(prey, s.ControllingClient); 281 m_scene.TeleportClientHome(prey, s.ControllingClient);
282 } 282 }
283 } 283 }
284 } 284 }
285 285
286 private static void HandleRegionInfoRequest(IClientAPI remote_client) 286 private static void HandleRegionInfoRequest(IClientAPI remote_client)
287 { 287 {
288 remote_client.sendRegionInfoToEstateMenu(); 288 remote_client.sendRegionInfoToEstateMenu();
289 } 289 }
290 290
291 private static void HandleEstateCovenantRequest(IClientAPI remote_client) 291 private static void HandleEstateCovenantRequest(IClientAPI remote_client)
292 { 292 {
293 remote_client.sendEstateCovenantInformation(); 293 remote_client.sendEstateCovenantInformation();
294 } 294 }
295 295
296 #endregion 296 #endregion
297 297
298 #region Outgoing Packets 298 #region Outgoing Packets
299 299
300 public void sendRegionInfoPacketToAll() 300 public void sendRegionInfoPacketToAll()
301 { 301 {
302 List<ScenePresence> avatars = m_scene.GetAvatars(); 302 List<ScenePresence> avatars = m_scene.GetAvatars();
303 303
304 for (int i = 0; i < avatars.Count; i++) 304 for (int i = 0; i < avatars.Count; i++)
305 { 305 {
306 avatars[i].ControllingClient.sendRegionInfoToEstateMenu(); 306 avatars[i].ControllingClient.sendRegionInfoToEstateMenu();
307 } 307 }
308 } 308 }
309 309
310 public void sendRegionHandshake(IClientAPI remoteClient) 310 public void sendRegionHandshake(IClientAPI remoteClient)
311 { 311 {
312 remoteClient.SendRegionHandshake(m_scene.RegionInfo); 312 remoteClient.SendRegionHandshake(m_scene.RegionInfo);
313 } 313 }
314 314
315 public void sendRegionHandshakeToAll() 315 public void sendRegionHandshakeToAll()
316 { 316 {
317 m_scene.Broadcast( 317 m_scene.Broadcast(
318 sendRegionHandshake 318 sendRegionHandshake
319 ); 319 );
320 } 320 }
321 321
322 #endregion 322 #endregion
323 323
324 #region IRegionModule Members 324 #region IRegionModule Members
325 325
326 public void Initialise(Scene scene, IConfigSource source) 326 public void Initialise(Scene scene, IConfigSource source)
327 { 327 {
328 m_scene = scene; 328 m_scene = scene;
329 m_scene.EventManager.OnNewClient += EventManager_OnNewClient; 329 m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
330 m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; 330 m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
331 } 331 }
332 332
333 333
334 public void PostInitialise() 334 public void PostInitialise()
335 { 335 {
336 } 336 }
337 337
338 public void Close() 338 public void Close()
339 { 339 {
340 } 340 }
341 341
342 public string Name 342 public string Name
343 { 343 {
344 get { return "EstateManagementModule"; } 344 get { return "EstateManagementModule"; }
345 } 345 }
346 346
347 public bool IsSharedModule 347 public bool IsSharedModule
348 { 348 {
349 get { return false; } 349 get { return false; }
350 } 350 }
351 351
352 #endregion 352 #endregion
353 353
354 #region Other Functions 354 #region Other Functions
355 355
356 public void changeWaterHeight(float height) 356 public void changeWaterHeight(float height)
357 { 357 {
358 setRegionTerrainSettings(height, m_scene.RegionInfo.EstateSettings.terrainRaiseLimit, m_scene.RegionInfo.EstateSettings.terrainLowerLimit, 358 setRegionTerrainSettings(height, m_scene.RegionInfo.EstateSettings.terrainRaiseLimit, m_scene.RegionInfo.EstateSettings.terrainLowerLimit,
359 m_scene.RegionInfo.EstateSettings.useFixedSun, m_scene.RegionInfo.EstateSettings.sunHour); 359 m_scene.RegionInfo.EstateSettings.useFixedSun, m_scene.RegionInfo.EstateSettings.sunHour);
360 sendRegionInfoPacketToAll(); 360 sendRegionInfoPacketToAll();
361 } 361 }
362 362
363 #endregion 363 #endregion
364 364
365 private void EventManager_OnNewClient(IClientAPI client) 365 private void EventManager_OnNewClient(IClientAPI client)
366 { 366 {
367 client.OnDetailedEstateDataRequest += sendDetailedEstateData; 367 client.OnDetailedEstateDataRequest += sendDetailedEstateData;
368 client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; 368 client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler;
369 client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; 369 client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture;
370 client.OnSetEstateTerrainDetailTexture += setEstateTerrainDetailTexture; 370 client.OnSetEstateTerrainDetailTexture += setEstateTerrainDetailTexture;
371 client.OnSetEstateTerrainTextureHeights += setEstateTerrainTextureHeights; 371 client.OnSetEstateTerrainTextureHeights += setEstateTerrainTextureHeights;
372 client.OnCommitEstateTerrainTextureRequest += handleCommitEstateTerrainTextureRequest; 372 client.OnCommitEstateTerrainTextureRequest += handleCommitEstateTerrainTextureRequest;
373 client.OnSetRegionTerrainSettings += setRegionTerrainSettings; 373 client.OnSetRegionTerrainSettings += setRegionTerrainSettings;
374 client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; 374 client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
375 client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; 375 client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
376 client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; 376 client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
377 client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; 377 client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
378 client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; 378 client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;
379 client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest; 379 client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest;
380 client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest; 380 client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest;
381 381
382 client.OnRegionInfoRequest += HandleRegionInfoRequest; 382 client.OnRegionInfoRequest += HandleRegionInfoRequest;
383 client.OnEstateCovenantRequest += HandleEstateCovenantRequest; 383 client.OnEstateCovenantRequest += HandleEstateCovenantRequest;
384 sendRegionHandshake(client); 384 sendRegionHandshake(client);
385 } 385 }
386 } 386 }
387} \ No newline at end of file 387} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs
index 8ebe33e..68c8046 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs
@@ -1,167 +1,167 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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 27
28using System; 28using System;
29using System.Drawing; 29using System.Drawing;
30using Nini.Config; 30using Nini.Config;
31using OpenJPEGNet; 31using OpenJPEGNet;
32using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
34 34
35namespace OpenSim.Region.Environment.Modules.World.WorldMap 35namespace OpenSim.Region.Environment.Modules.World.WorldMap
36{ 36{
37 internal class MapImageModule : IMapImageGenerator, IRegionModule 37 internal class MapImageModule : IMapImageGenerator, IRegionModule
38 { 38 {
39 private Scene m_scene; 39 private Scene m_scene;
40 40
41 #region IMapImageGenerator Members 41 #region IMapImageGenerator Members
42 42
43 public byte[] WriteJpeg2000Image(string gradientmap) 43 public byte[] WriteJpeg2000Image(string gradientmap)
44 { 44 {
45 byte[] imageData = null; 45 byte[] imageData = null;
46 46
47 Bitmap bmp = TerrainToBitmap(gradientmap); 47 Bitmap bmp = TerrainToBitmap(gradientmap);
48 48
49 try 49 try
50 { 50 {
51 imageData = OpenJPEG.EncodeFromImage(bmp, true); 51 imageData = OpenJPEG.EncodeFromImage(bmp, true);
52 } 52 }
53 catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke 53 catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
54 { 54 {
55 Console.WriteLine("Failed generating terrain map: " + e); 55 Console.WriteLine("Failed generating terrain map: " + e);
56 } 56 }
57 57
58 return imageData; 58 return imageData;
59 } 59 }
60 60
61 #endregion 61 #endregion
62 62
63 #region IRegionModule Members 63 #region IRegionModule Members
64 64
65 public void Initialise(Scene scene, IConfigSource source) 65 public void Initialise(Scene scene, IConfigSource source)
66 { 66 {
67 m_scene = scene; 67 m_scene = scene;
68 m_scene.RegisterModuleInterface<IMapImageGenerator>(this); 68 m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
69 } 69 }
70 70
71 public void PostInitialise() 71 public void PostInitialise()
72 { 72 {
73 } 73 }
74 74
75 public void Close() 75 public void Close()
76 { 76 {
77 } 77 }
78 78
79 public string Name 79 public string Name
80 { 80 {
81 get { return "MapImageModule"; } 81 get { return "MapImageModule"; }
82 } 82 }
83 83
84 public bool IsSharedModule 84 public bool IsSharedModule
85 { 85 {
86 get { return false; } 86 get { return false; }
87 } 87 }
88 88
89 #endregion 89 #endregion
90 90
91 private void ShadeBuildings(Bitmap map) 91 private void ShadeBuildings(Bitmap map)
92 { 92 {
93 lock (map) 93 lock (map)
94 { 94 {
95 lock (m_scene.Entities) 95 lock (m_scene.Entities)
96 { 96 {
97 foreach (EntityBase entity in m_scene.Entities.Values) 97 foreach (EntityBase entity in m_scene.Entities.Values)
98 { 98 {
99 if (entity is SceneObjectGroup) 99 if (entity is SceneObjectGroup)
100 { 100 {
101 SceneObjectGroup sog = (SceneObjectGroup) entity; 101 SceneObjectGroup sog = (SceneObjectGroup) entity;
102 102
103 foreach (SceneObjectPart primitive in sog.Children.Values) 103 foreach (SceneObjectPart primitive in sog.Children.Values)
104 { 104 {
105 int x = (int) (primitive.AbsolutePosition.X - (primitive.Scale.X / 2)); 105 int x = (int) (primitive.AbsolutePosition.X - (primitive.Scale.X / 2));
106 int y = (int) (primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2)); 106 int y = (int) (primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2));
107 int w = (int) primitive.Scale.X; 107 int w = (int) primitive.Scale.X;
108 int h = (int) primitive.Scale.Y; 108 int h = (int) primitive.Scale.Y;
109 109
110 int dx; 110 int dx;
111 for (dx = x; dx < x + w; dx++) 111 for (dx = x; dx < x + w; dx++)
112 { 112 {
113 int dy; 113 int dy;
114 for (dy = y; dy < y + h; dy++) 114 for (dy = y; dy < y + h; dy++)
115 { 115 {
116 if (x < 0 || y < 0) 116 if (x < 0 || y < 0)
117 continue; 117 continue;
118 if (x >= map.Width || y >= map.Height) 118 if (x >= map.Width || y >= map.Height)
119 continue; 119 continue;
120 120
121 map.SetPixel(dx, dy, Color.DarkGray); 121 map.SetPixel(dx, dy, Color.DarkGray);
122 } 122 }
123 } 123 }
124 } 124 }
125 } 125 }
126 } 126 }
127 } 127 }
128 } 128 }
129 } 129 }
130 130
131 private Bitmap TerrainToBitmap(string gradientmap) 131 private Bitmap TerrainToBitmap(string gradientmap)
132 { 132 {
133 Bitmap gradientmapLd = new Bitmap(gradientmap); 133 Bitmap gradientmapLd = new Bitmap(gradientmap);
134 134
135 int pallete = gradientmapLd.Height; 135 int pallete = gradientmapLd.Height;
136 136
137 Bitmap bmp = new Bitmap(m_scene.Heightmap.Width, m_scene.Heightmap.Height); 137 Bitmap bmp = new Bitmap(m_scene.Heightmap.Width, m_scene.Heightmap.Height);
138 Color[] colours = new Color[pallete]; 138 Color[] colours = new Color[pallete];
139 139
140 for (int i = 0; i < pallete; i++) 140 for (int i = 0; i < pallete; i++)
141 { 141 {
142 colours[i] = gradientmapLd.GetPixel(0, i); 142 colours[i] = gradientmapLd.GetPixel(0, i);
143 } 143 }
144 144
145 lock (m_scene.Heightmap) 145 lock (m_scene.Heightmap)
146 { 146 {
147 ITerrainChannel copy = m_scene.Heightmap; 147 ITerrainChannel copy = m_scene.Heightmap;
148 for (int y = 0; y < copy.Height; y++) 148 for (int y = 0; y < copy.Height; y++)
149 { 149 {
150 for (int x = 0; x < copy.Width; x++) 150 for (int x = 0; x < copy.Width; x++)
151 { 151 {
152 // 512 is the largest possible height before colours clamp 152 // 512 is the largest possible height before colours clamp
153 int colorindex = (int) (Math.Max(Math.Min(1.0, copy[x, y] / 512.0), 0.0) * (pallete - 1)); 153 int colorindex = (int) (Math.Max(Math.Min(1.0, copy[x, y] / 512.0), 0.0) * (pallete - 1));
154 154
155 // Handle error conditions 155 // Handle error conditions
156 if (colorindex > pallete - 1 || colorindex < 0) 156 if (colorindex > pallete - 1 || colorindex < 0)
157 bmp.SetPixel(x, copy.Height - y - 1, Color.Red); 157 bmp.SetPixel(x, copy.Height - y - 1, Color.Red);
158 else 158 else
159 bmp.SetPixel(x, copy.Height - y - 1, colours[colorindex]); 159 bmp.SetPixel(x, copy.Height - y - 1, colours[colorindex]);
160 } 160 }
161 } 161 }
162 ShadeBuildings(bmp); 162 ShadeBuildings(bmp);
163 return bmp; 163 return bmp;
164 } 164 }
165 } 165 }
166 } 166 }
167} \ No newline at end of file 167} \ No newline at end of file