aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Land
diff options
context:
space:
mode:
authorUbitUmarov2015-09-01 14:54:35 +0100
committerUbitUmarov2015-09-01 14:54:35 +0100
commit371c9dd2af01a2e7422ec901ee1f80757284a78c (patch)
tree058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/CoreModules/World/Land
parentremove lixo (diff)
parentdont change camera on crossings (diff)
downloadopensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz
bad merge?
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs32
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs687
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs233
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs4
4 files changed, 805 insertions, 151 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
index 73c592d..378826d 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
@@ -40,23 +40,33 @@ namespace OpenSim.Region.CoreModules.World.Land
40 //Land types set with flags in ParcelOverlay. 40 //Land types set with flags in ParcelOverlay.
41 //Only one of these can be used. 41 //Only one of these can be used.
42 public const float BAN_LINE_SAFETY_HIEGHT = 100; 42 public const float BAN_LINE_SAFETY_HIEGHT = 100;
43 public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = 128; //Equals 10000000
44 public const byte LAND_FLAG_PROPERTY_BORDER_WEST = 64; //Equals 01000000
45 43
46 //RequestResults (I think these are right, they seem to work): 44 //RequestResults (I think these are right, they seem to work):
47 public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land 45 public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land
48 public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land 46 public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land
49 47
50 //ParcelSelectObjects 48 //ParcelSelectObjects
49 public const int LAND_SELECT_OBJECTS_OWNER = 2;
51 public const int LAND_SELECT_OBJECTS_GROUP = 4; 50 public const int LAND_SELECT_OBJECTS_GROUP = 4;
52 public const int LAND_SELECT_OBJECTS_OTHER = 8; 51 public const int LAND_SELECT_OBJECTS_OTHER = 8;
53 public const int LAND_SELECT_OBJECTS_OWNER = 2; 52
54 public const byte LAND_TYPE_IS_BEING_AUCTIONED = 5; //Equals 00000101 53
55 public const byte LAND_TYPE_IS_FOR_SALE = 4; //Equals 00000100 54 public const byte LAND_TYPE_PUBLIC = 0; //Equals 00000000
56 public const byte LAND_TYPE_OWNED_BY_GROUP = 2; //Equals 00000010 55 // types 1 to 7 are exclusive
57 public const byte LAND_TYPE_OWNED_BY_OTHER = 1; //Equals 00000001 56 public const byte LAND_TYPE_OWNED_BY_OTHER = 1; //Equals 00000001
57 public const byte LAND_TYPE_OWNED_BY_GROUP = 2; //Equals 00000010
58 public const byte LAND_TYPE_OWNED_BY_REQUESTER = 3; //Equals 00000011 58 public const byte LAND_TYPE_OWNED_BY_REQUESTER = 3; //Equals 00000011
59 public const byte LAND_TYPE_PUBLIC = 0; //Equals 00000000 59 public const byte LAND_TYPE_IS_FOR_SALE = 4; //Equals 00000100
60 public const byte LAND_TYPE_IS_BEING_AUCTIONED = 5; //Equals 00000101
61 public const byte LAND_TYPE_unused6 = 6;
62 public const byte LAND_TYPE_unused7 = 7;
63 // next are flags
64 public const byte LAND_FLAG_unused8 = 0x08; // this may become excluside in future
65 public const byte LAND_FLAG_HIDEAVATARS = 0x10;
66 public const byte LAND_FLAG_LOCALSOUND = 0x20;
67 public const byte LAND_FLAG_PROPERTY_BORDER_WEST = 0x40; //Equals 01000000
68 public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = 0x80; //Equals 10000000
69
60 70
61 //These are other constants. Yay! 71 //These are other constants. Yay!
62 public const int START_LAND_LOCAL_ID = 1; 72 public const int START_LAND_LOCAL_ID = 1;
@@ -203,7 +213,13 @@ namespace OpenSim.Region.CoreModules.World.Land
203 m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime); 213 m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
204 } 214 }
205 } 215 }
206 216 public void sendClientInitialLandInfo(IClientAPI remoteClient)
217 {
218 if (m_landManagementModule != null)
219 {
220 m_landManagementModule.sendClientInitialLandInfo(remoteClient);
221 }
222 }
207 #endregion 223 #endregion
208 } 224 }
209} 225}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 25e1454..8bd46f6 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -69,7 +69,11 @@ namespace OpenSim.Region.CoreModules.World.Land
69 /// <summary> 69 /// <summary>
70 /// Minimum land unit size in region co-ordinates. 70 /// Minimum land unit size in region co-ordinates.
71 /// </summary> 71 /// </summary>
72<<<<<<< HEAD
72 public const int LandUnit = 4; 73 public const int LandUnit = 4;
74=======
75 public const int landUnit = 4;
76>>>>>>> avn/ubitvar
73 77
74 private static readonly string remoteParcelRequestPath = "0009/"; 78 private static readonly string remoteParcelRequestPath = "0009/";
75 79
@@ -89,20 +93,30 @@ namespace OpenSim.Region.CoreModules.World.Land
89 /// <value> 93 /// <value>
90 /// Land objects keyed by local id 94 /// Land objects keyed by local id
91 /// </value> 95 /// </value>
92 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); 96// private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
97
98 //ubit: removed the readonly so i can move it around
99 private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
93 100
94 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 101 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
95 102
96 private bool m_allowedForcefulBans = true; 103 private bool m_allowedForcefulBans = true;
104 private UUID DefaultGodParcelGroup;
105 private string DefaultGodParcelName;
97 106
98 // caches ExtendedLandData 107 // caches ExtendedLandData
99 private Cache parcelInfoCache; 108 private Cache parcelInfoCache;
109<<<<<<< HEAD
100 110
101 111
102 /// <summary> 112 /// <summary>
103 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. 113 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
104 /// </summary> 114 /// </summary>
105 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); 115 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
116=======
117 private Dictionary<UUID, Vector3> forcedPosition =
118 new Dictionary<UUID, Vector3>();
119>>>>>>> avn/ubitvar
106 120
107 // Enables limiting parcel layer info transmission when doing simple updates 121 // Enables limiting parcel layer info transmission when doing simple updates
108 private bool shouldLimitParcelLayerInfoToViewDistance { get; set; } 122 private bool shouldLimitParcelLayerInfoToViewDistance { get; set; }
@@ -118,6 +132,7 @@ namespace OpenSim.Region.CoreModules.World.Land
118 132
119 public void Initialise(IConfigSource source) 133 public void Initialise(IConfigSource source)
120 { 134 {
135<<<<<<< HEAD
121 shouldLimitParcelLayerInfoToViewDistance = true; 136 shouldLimitParcelLayerInfoToViewDistance = true;
122 parcelLayerViewDistance = 128; 137 parcelLayerViewDistance = 128;
123 IConfig landManagementConfig = source.Configs["LandManagement"]; 138 IConfig landManagementConfig = source.Configs["LandManagement"];
@@ -125,13 +140,24 @@ namespace OpenSim.Region.CoreModules.World.Land
125 { 140 {
126 shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance); 141 shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance);
127 parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); 142 parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance);
143=======
144 IConfig cnf = source.Configs["LandManagement"];
145 if (cnf != null)
146 {
147 DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
148 DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel");
149>>>>>>> avn/ubitvar
128 } 150 }
129 } 151 }
130 152
131 public void AddRegion(Scene scene) 153 public void AddRegion(Scene scene)
132 { 154 {
133 m_scene = scene; 155 m_scene = scene;
156<<<<<<< HEAD
134 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; 157 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
158=======
159 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
160>>>>>>> avn/ubitvar
135 landChannel = new LandChannel(scene, this); 161 landChannel = new LandChannel(scene, this);
136 162
137 parcelInfoCache = new Cache(); 163 parcelInfoCache = new Cache();
@@ -154,7 +180,7 @@ namespace OpenSim.Region.CoreModules.World.Land
154 m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; 180 m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
155 m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; 181 m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;
156 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; 182 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
157 183
158 lock (m_scene) 184 lock (m_scene)
159 { 185 {
160 m_scene.LandChannel = (ILandChannel)landChannel; 186 m_scene.LandChannel = (ILandChannel)landChannel;
@@ -204,13 +230,14 @@ namespace OpenSim.Region.CoreModules.World.Land
204 client.OnParcelFreezeUser += ClientOnParcelFreezeUser; 230 client.OnParcelFreezeUser += ClientOnParcelFreezeUser;
205 client.OnSetStartLocationRequest += ClientOnSetHome; 231 client.OnSetStartLocationRequest += ClientOnSetHome;
206 232
207 233/* avatar is still a child here position is unknown
208 EntityBase presenceEntity; 234 EntityBase presenceEntity;
209 if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) 235 if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence)
210 { 236 {
211 SendLandUpdate((ScenePresence)presenceEntity, true); 237 SendLandUpdate((ScenePresence)presenceEntity, true);
212 SendParcelOverlay(client); 238 SendParcelOverlay(client);
213 } 239 }
240*/
214 } 241 }
215 242
216 public void EventMakeChildAgent(ScenePresence avatar) 243 public void EventMakeChildAgent(ScenePresence avatar)
@@ -220,48 +247,6 @@ namespace OpenSim.Region.CoreModules.World.Land
220 247
221 void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) 248 void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
222 { 249 {
223 //If we are forcing a position for them to go
224 if (forcedPosition.ContainsKey(remoteClient.AgentId))
225 {
226 ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId);
227
228 //Putting the user into flying, both keeps the avatar in fligth when it bumps into something and stopped from going another direction AND
229 //When the avatar walks into a ban line on the ground, it prevents getting stuck
230 agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
231
232 //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines
233 if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2)
234 {
235// m_log.DebugFormat(
236// "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}",
237// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
238
239 forcedPosition.Remove(remoteClient.AgentId);
240 }
241 //if we are far away, teleport
242 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3)
243 {
244 Vector3 forcePosition = forcedPosition[remoteClient.AgentId];
245// m_log.DebugFormat(
246// "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}",
247// clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition);
248
249 m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle,
250 forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect);
251
252 forcedPosition.Remove(remoteClient.AgentId);
253 }
254 else
255 {
256// m_log.DebugFormat(
257// "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}",
258// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
259
260 //Forces them toward the forced position we want if they aren't there yet
261 agentData.UseClientAgentPosition = true;
262 agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId];
263 }
264 }
265 } 250 }
266 251
267 public void Close() 252 public void Close()
@@ -314,7 +299,11 @@ namespace OpenSim.Region.CoreModules.World.Land
314 { 299 {
315 m_landList.Clear(); 300 m_landList.Clear();
316 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 301 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
302<<<<<<< HEAD
317 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; 303 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
304=======
305 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
306>>>>>>> avn/ubitvar
318 } 307 }
319 } 308 }
320 309
@@ -324,16 +313,22 @@ namespace OpenSim.Region.CoreModules.World.Land
324 /// <returns>The parcel created.</returns> 313 /// <returns>The parcel created.</returns>
325 protected ILandObject CreateDefaultParcel() 314 protected ILandObject CreateDefaultParcel()
326 { 315 {
316<<<<<<< HEAD
327 m_log.DebugFormat( 317 m_log.DebugFormat(
328 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); 318 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
329 319
330 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 320 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
321=======
322 m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName);
323
324 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
325>>>>>>> avn/ubitvar
331 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, 326 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
332 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); 327 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY));
333 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 328 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
334 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); 329 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
335 330
336 return AddLandObject(fullSimParcel); 331 return AddLandObject(fullSimParcel);
337 } 332 }
338 333
339 public List<ILandObject> AllParcels() 334 public List<ILandObject> AllParcels()
@@ -382,10 +377,17 @@ namespace OpenSim.Region.CoreModules.World.Land
382 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) 377 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
383 { 378 {
384 if (m_scene.Permissions.IsGod(avatar.UUID)) return; 379 if (m_scene.Permissions.IsGod(avatar.UUID)) return;
385 if (position.HasValue) 380
386 { 381 if (!position.HasValue)
387 forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; 382 return;
388 } 383
384// land should have no word on avatar physics
385// bool isFlying = avatar.PhysicsActor.Flying;
386// avatar.RemoveFromPhysicalScene();
387
388 avatar.AbsolutePosition = (Vector3)position;
389
390// avatar.AddToPhysicalScene(isFlying);
389 } 391 }
390 392
391 public void SendYouAreRestrictedNotice(ScenePresence avatar) 393 public void SendYouAreRestrictedNotice(ScenePresence avatar)
@@ -405,36 +407,14 @@ namespace OpenSim.Region.CoreModules.World.Land
405 } 407 }
406 408
407 if (parcelAvatarIsEntering != null) 409 if (parcelAvatarIsEntering != null)
408 { 410 EnforceBans(parcelAvatarIsEntering, avatar);
409 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT)
410 {
411 if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID))
412 {
413 SendYouAreBannedNotice(avatar);
414 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
415 }
416 else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID))
417 {
418 SendYouAreRestrictedNotice(avatar);
419 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
420 }
421 else
422 {
423 avatar.sentMessageAboutRestrictedParcelFlyingDown = true;
424 }
425 }
426 else
427 {
428 avatar.sentMessageAboutRestrictedParcelFlyingDown = true;
429 }
430 }
431 } 411 }
432 } 412 }
433 413
434 public void SendOutNearestBanLine(IClientAPI client) 414 public void SendOutNearestBanLine(IClientAPI client)
435 { 415 {
436 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 416 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
437 if (sp == null || sp.IsChildAgent) 417 if (sp == null)
438 return; 418 return;
439 419
440 List<ILandObject> checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition); 420 List<ILandObject> checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition);
@@ -454,32 +434,49 @@ namespace OpenSim.Region.CoreModules.World.Land
454 return; 434 return;
455 } 435 }
456 436
437 public void sendClientInitialLandInfo(IClientAPI remoteClient)
438 {
439 ScenePresence avatar;
440
441 if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar))
442 return;
443
444
445 if (!avatar.IsChildAgent)
446 {
447 ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
448 if (over == null)
449 return;
450
451 avatar.currentParcelUUID = over.LandData.GlobalID;
452 over.SendLandUpdateToClient(avatar.ControllingClient);
453 }
454 SendParcelOverlay(remoteClient);
455 }
456
457 public void SendLandUpdate(ScenePresence avatar, bool force) 457 public void SendLandUpdate(ScenePresence avatar, bool force)
458 { 458 {
459<<<<<<< HEAD
459 ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), 460 ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
460 (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); 461 (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
462=======
463 if (avatar.IsChildAgent)
464 return;
465
466 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
467>>>>>>> avn/ubitvar
461 468
462 if (over != null) 469 if (over != null)
463 { 470 {
464 if (force) 471 bool NotsameID = (avatar.currentParcelUUID != over.LandData.GlobalID);
472 if (force || NotsameID)
465 { 473 {
466 if (!avatar.IsChildAgent) 474 over.SendLandUpdateToClient(avatar.ControllingClient);
467 { 475// sl doesnt seem to send this now, as it used 2
468 over.SendLandUpdateToClient(avatar.ControllingClient); 476// SendParcelOverlay(avatar.ControllingClient);
469 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, 477 avatar.currentParcelUUID = over.LandData.GlobalID;
470 m_scene.RegionInfo.RegionID); 478 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
471 } 479 m_scene.RegionInfo.RegionID);
472 }
473
474 if (avatar.currentParcelUUID != over.LandData.GlobalID)
475 {
476 if (!avatar.IsChildAgent)
477 {
478 over.SendLandUpdateToClient(avatar.ControllingClient);
479 avatar.currentParcelUUID = over.LandData.GlobalID;
480 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
481 m_scene.RegionInfo.RegionID);
482 }
483 } 480 }
484 } 481 }
485 } 482 }
@@ -531,6 +528,7 @@ namespace OpenSim.Region.CoreModules.World.Land
531 //when we are finally in a safe place, lets release the forced position lock 528 //when we are finally in a safe place, lets release the forced position lock
532 forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); 529 forcedPosition.Remove(clientAvatar.ControllingClient.AgentId);
533 } 530 }
531 EnforceBans(parcel, clientAvatar);
534 } 532 }
535 } 533 }
536 534
@@ -589,7 +587,7 @@ namespace OpenSim.Region.CoreModules.World.Land
589 requiredPowers = GroupPowers.LandManageBanned; 587 requiredPowers = GroupPowers.LandManageBanned;
590 588
591 if (m_scene.Permissions.CanEditParcelProperties(agentID, 589 if (m_scene.Permissions.CanEditParcelProperties(agentID,
592 land, requiredPowers)) 590 land, requiredPowers, false))
593 { 591 {
594 land.UpdateAccessList(flags, transactionID, sequenceID, 592 land.UpdateAccessList(flags, transactionID, sequenceID,
595 sections, entries, remote_client); 593 sections, entries, remote_client);
@@ -623,20 +621,28 @@ namespace OpenSim.Region.CoreModules.World.Land
623 new_land.LandData.LocalID = newLandLocalID; 621 new_land.LandData.LocalID = newLandLocalID;
624 622
625 bool[,] landBitmap = new_land.GetLandBitmap(); 623 bool[,] landBitmap = new_land.GetLandBitmap();
624<<<<<<< HEAD
626 // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}", 625 // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}",
627 // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID); 626 // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID);
628 627
628=======
629>>>>>>> avn/ubitvar
629 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) 630 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1))
630 { 631 {
631 // Going to variable sized regions can cause mismatches 632 // Going to variable sized regions can cause mismatches
632 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", 633 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})",
634<<<<<<< HEAD
633 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) ); 635 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) );
636=======
637 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1));
638>>>>>>> avn/ubitvar
634 } 639 }
635 else 640 else
636 { 641 {
637 // If other land objects still believe that they occupy any parts of the same space, 642 // If other land objects still believe that they occupy any parts of the same space,
638 // then do not allow the add to proceed. 643 // then do not allow the add to proceed.
639 for (int x = 0; x < landBitmap.GetLength(0); x++) 644 for (int x = 0; x < landBitmap.GetLength(0); x++)
645<<<<<<< HEAD
640 { 646 {
641 for (int y = 0; y < landBitmap.GetLength(1); y++) 647 for (int y = 0; y < landBitmap.GetLength(1); y++)
642 { 648 {
@@ -663,15 +669,50 @@ namespace OpenSim.Region.CoreModules.World.Land
663 } 669 }
664 670
665 for (int x = 0; x < landBitmap.GetLength(0); x++) 671 for (int x = 0; x < landBitmap.GetLength(0); x++)
672=======
673>>>>>>> avn/ubitvar
666 { 674 {
667 for (int y = 0; y < landBitmap.GetLength(1); y++) 675 for (int y = 0; y < landBitmap.GetLength(1); y++)
668 { 676 {
669 if (landBitmap[x, y]) 677 if (landBitmap[x, y])
670 { 678 {
679<<<<<<< HEAD
671 // m_log.DebugFormat( 680 // m_log.DebugFormat(
672 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", 681 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
673 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); 682 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
674 683
684=======
685 int lastRecordedLandId = m_landIDList[x, y];
686
687 if (lastRecordedLandId > 0)
688 {
689 ILandObject lastRecordedLo = m_landList[lastRecordedLandId];
690
691 if (lastRecordedLo.LandBitmap[x, y])
692 {
693 m_log.ErrorFormat(
694 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}",
695 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y,
696 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name);
697
698 return null;
699 }
700 }
701 }
702 }
703 }
704
705 for (int x = 0; x < landBitmap.GetLength(0); x++)
706 {
707 for (int y = 0; y < landBitmap.GetLength(1); y++)
708 {
709 if (landBitmap[x, y])
710 {
711 // m_log.DebugFormat(
712 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
713 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
714
715>>>>>>> avn/ubitvar
675 m_landIDList[x, y] = newLandLocalID; 716 m_landIDList[x, y] = newLandLocalID;
676 } 717 }
677 } 718 }
@@ -723,27 +764,28 @@ namespace OpenSim.Region.CoreModules.World.Land
723 /// </summary> 764 /// </summary>
724 public void Clear(bool setupDefaultParcel) 765 public void Clear(bool setupDefaultParcel)
725 { 766 {
726 List<ILandObject> parcels; 767 Dictionary<int, ILandObject> landworkList;
768 // move to work pointer since we are deleting it all
727 lock (m_landList) 769 lock (m_landList)
728 { 770 {
729 parcels = new List<ILandObject>(m_landList.Values); 771 landworkList = m_landList;
772 m_landList = new Dictionary<int, ILandObject>();
730 } 773 }
731 774
732 foreach (ILandObject lo in parcels) 775 // this 2 methods have locks (now)
776 ResetSimLandObjects();
777
778 if (setupDefaultParcel)
779 CreateDefaultParcel();
780
781 // fire outside events unlocked
782 foreach (ILandObject lo in landworkList.Values)
733 { 783 {
734 //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); 784 //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID);
735 m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); 785 m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID);
736 } 786 }
787 landworkList.Clear();
737 788
738 lock (m_landList)
739 {
740 m_landList.Clear();
741
742 ResetSimLandObjects();
743 }
744
745 if (setupDefaultParcel)
746 CreateDefaultParcel();
747 } 789 }
748 790
749 private void performFinalLandJoin(ILandObject master, ILandObject slave) 791 private void performFinalLandJoin(ILandObject master, ILandObject slave)
@@ -787,6 +829,7 @@ namespace OpenSim.Region.CoreModules.World.Land
787 /// <returns>Land object at the point supplied</returns> 829 /// <returns>Land object at the point supplied</returns>
788 public ILandObject GetLandObject(float x_float, float y_float) 830 public ILandObject GetLandObject(float x_float, float y_float)
789 { 831 {
832<<<<<<< HEAD
790 return GetLandObject((int)x_float, (int)y_float, true /* returnNullIfLandObjectNotFound */); 833 return GetLandObject((int)x_float, (int)y_float, true /* returnNullIfLandObjectNotFound */);
791 /* 834 /*
792 int x; 835 int x;
@@ -812,9 +855,31 @@ namespace OpenSim.Region.CoreModules.World.Land
812 { 855 {
813 return null; 856 return null;
814 } 857 }
858=======
859 return GetLandObject((int)x_float, (int)y_float, true);
860 }
815 861
816 lock (m_landList) 862 // if x,y is off region this will return the parcel at cliped x,y
863 // as did code it replaces
864 public ILandObject GetLandObjectClipedXY(float x, float y)
865 {
866 //do clip inline
867 int avx = (int)x;
868 if (avx < 0)
869 avx = 0;
870 else if (avx >= m_scene.RegionInfo.RegionSizeX)
871 avx = (int)Constants.RegionSize - 1;
872
873 int avy = (int)y;
874 if (avy < 0)
875 avy = 0;
876 else if (avy >= m_scene.RegionInfo.RegionSizeY)
877 avy = (int)Constants.RegionSize - 1;
878>>>>>>> avn/ubitvar
879
880 lock (m_landIDList)
817 { 881 {
882<<<<<<< HEAD
818 // Corner case. If an autoreturn happens during sim startup 883 // Corner case. If an autoreturn happens during sim startup
819 // we will come here with the list uninitialized 884 // we will come here with the list uninitialized
820 // 885 //
@@ -837,6 +902,16 @@ namespace OpenSim.Region.CoreModules.World.Land
837 } 902 }
838 903
839 return null; 904 return null;
905=======
906 try
907 {
908 return m_landList[m_landIDList[avx / landUnit, avy / landUnit]];
909 }
910 catch (IndexOutOfRangeException)
911 {
912 return null;
913 }
914>>>>>>> avn/ubitvar
840 } 915 }
841 */ 916 */
842 } 917 }
@@ -848,6 +923,7 @@ namespace OpenSim.Region.CoreModules.World.Land
848 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */); 923 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */);
849 } 924 }
850 925
926<<<<<<< HEAD
851 /// <summary> 927 /// <summary>
852 /// Given a region position, return the parcel land object for that location 928 /// Given a region position, return the parcel land object for that location
853 /// </summary> 929 /// </summary>
@@ -862,16 +938,37 @@ namespace OpenSim.Region.CoreModules.World.Land
862 private ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) 938 private ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
863 { 939 {
864 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) 940 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
941=======
942 public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
943 {
944 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
945>>>>>>> avn/ubitvar
865 { 946 {
866 // These exceptions here will cause a lot of complaints from the users specifically because 947 // These exceptions here will cause a lot of complaints from the users specifically because
867 // they happen every time at border crossings 948 // they happen every time at border crossings
868 if (returnNullIfLandObjectOutsideBounds) 949 if (returnNullIfLandObjectOutsideBounds)
869 return null; 950 return null;
870 else 951 else
952<<<<<<< HEAD
871 throw new Exception( 953 throw new Exception(
872 String.Format("{0} GetLandObject for non-existent position. Region={1}, pos=<{2},{3}", 954 String.Format("{0} GetLandObject for non-existent position. Region={1}, pos=<{2},{3}",
873 LogHeader, m_scene.RegionInfo.RegionName, x, y) 955 LogHeader, m_scene.RegionInfo.RegionName, x, y)
874 ); 956 );
957=======
958 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
959 }
960
961 lock (m_landIDList)
962 {
963 try
964 {
965 return m_landList[m_landIDList[x / 4, y / 4]];
966 }
967 catch (IndexOutOfRangeException)
968 {
969 return null;
970 }
971>>>>>>> avn/ubitvar
875 } 972 }
876 973
877 return m_landList[m_landIDList[x / 4, y / 4]]; 974 return m_landList[m_landIDList[x / 4, y / 4]];
@@ -890,6 +987,19 @@ namespace OpenSim.Region.CoreModules.World.Land
890 return ret; 987 return ret;
891 } 988 }
892 989
990 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID
991 private bool[,] CreateBitmapForID(int landID)
992 {
993 bool[,] ret = new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)];
994
995 for (int xx = 0; xx < m_landIDList.GetLength(0); xx++)
996 for (int yy = 0; yy < m_landIDList.GetLength(0); yy++)
997 if (m_landIDList[xx, yy] == landID)
998 ret[xx, yy] = true;
999
1000 return ret;
1001 }
1002
893 #endregion 1003 #endregion
894 1004
895 #region Parcel Modification 1005 #region Parcel Modification
@@ -1033,7 +1143,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1033 1143
1034 //If we are still here, then they are subdividing within one piece of land 1144 //If we are still here, then they are subdividing within one piece of land
1035 //Check owner 1145 //Check owner
1036 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin)) 1146 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin, true))
1037 { 1147 {
1038 return; 1148 return;
1039 } 1149 }
@@ -1043,6 +1153,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1043 newLand.LandData.Name = newLand.LandData.Name; 1153 newLand.LandData.Name = newLand.LandData.Name;
1044 newLand.LandData.GlobalID = UUID.Random(); 1154 newLand.LandData.GlobalID = UUID.Random();
1045 newLand.LandData.Dwell = 0; 1155 newLand.LandData.Dwell = 0;
1156 // Clear "Show in search" on the cut out parcel to prevent double-charging
1157 newLand.LandData.Flags &= ~(uint)ParcelFlags.ShowDirectory;
1046 1158
1047 newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y)); 1159 newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y));
1048 1160
@@ -1057,12 +1169,19 @@ namespace OpenSim.Region.CoreModules.World.Land
1057 1169
1058 //Now add the new land object 1170 //Now add the new land object
1059 ILandObject result = AddLandObject(newLand); 1171 ILandObject result = AddLandObject(newLand);
1172<<<<<<< HEAD
1060 1173
1061 if (result != null) 1174 if (result != null)
1062 { 1175 {
1063 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); 1176 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
1064 result.SendLandUpdateToAvatarsOverMe(); 1177 result.SendLandUpdateToAvatarsOverMe();
1065 } 1178 }
1179=======
1180 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
1181 result.SendLandUpdateToAvatarsOverMe();
1182 startLandObject.SendLandUpdateToAvatarsOverMe();
1183 m_scene.ForEachClient(SendParcelOverlay);
1184>>>>>>> avn/ubitvar
1066 } 1185 }
1067 1186
1068 /// <summary> 1187 /// <summary>
@@ -1104,7 +1223,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1104 { 1223 {
1105 return; 1224 return;
1106 } 1225 }
1107 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin)) 1226 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin, true))
1108 { 1227 {
1109 return; 1228 return;
1110 } 1229 }
@@ -1127,6 +1246,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1127 } 1246 }
1128 1247
1129 masterLandObject.SendLandUpdateToAvatarsOverMe(); 1248 masterLandObject.SendLandUpdateToAvatarsOverMe();
1249 m_scene.ForEachClient(SendParcelOverlay);
1130 } 1250 }
1131 1251
1132 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) 1252 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
@@ -1143,11 +1263,14 @@ namespace OpenSim.Region.CoreModules.World.Land
1143 1263
1144 #region Parcel Updating 1264 #region Parcel Updating
1145 1265
1266<<<<<<< HEAD
1146 // Send parcel layer info for the whole region 1267 // Send parcel layer info for the whole region
1147 public void SendParcelOverlay(IClientAPI remote_client) 1268 public void SendParcelOverlay(IClientAPI remote_client)
1148 { 1269 {
1149 SendParcelOverlay(remote_client, 0, 0, (int)Constants.MaximumRegionSize); 1270 SendParcelOverlay(remote_client, 0, 0, (int)Constants.MaximumRegionSize);
1150 } 1271 }
1272=======
1273>>>>>>> avn/ubitvar
1151 1274
1152 /// <summary> 1275 /// <summary>
1153 /// Send the parcel overlay blocks to the client. We send the overlay packets 1276 /// Send the parcel overlay blocks to the client. We send the overlay packets
@@ -1164,11 +1287,15 @@ namespace OpenSim.Region.CoreModules.World.Land
1164 /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param> 1287 /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param>
1165 private void SendParcelOverlay(IClientAPI remote_client, int xPlace, int yPlace, int layerViewDistance) 1288 private void SendParcelOverlay(IClientAPI remote_client, int xPlace, int yPlace, int layerViewDistance)
1166 { 1289 {
1290 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc)
1291 return;
1292
1167 const int LAND_BLOCKS_PER_PACKET = 1024; 1293 const int LAND_BLOCKS_PER_PACKET = 1024;
1168 1294
1169 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; 1295 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1170 int byteArrayCount = 0; 1296 int byteArrayCount = 0;
1171 int sequenceID = 0; 1297 int sequenceID = 0;
1298<<<<<<< HEAD
1172 1299
1173 int xLow = 0; 1300 int xLow = 0;
1174 int xHigh = (int)m_scene.RegionInfo.RegionSizeX; 1301 int xHigh = (int)m_scene.RegionInfo.RegionSizeX;
@@ -1182,6 +1309,13 @@ namespace OpenSim.Region.CoreModules.World.Land
1182 int txHigh = xPlace + layerViewDistance; 1309 int txHigh = xPlace + layerViewDistance;
1183 // If the distance is outside the region area, move the view distance to ba all in the region 1310 // If the distance is outside the region area, move the view distance to ba all in the region
1184 if (txLow < xLow) 1311 if (txLow < xLow)
1312=======
1313
1314 // Layer data is in landUnit (4m) chunks
1315 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += landUnit)
1316 {
1317 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += landUnit)
1318>>>>>>> avn/ubitvar
1185 { 1319 {
1186 txLow = xLow; 1320 txLow = xLow;
1187 txHigh = Math.Min(yLow + (layerViewDistance * 2), xHigh); 1321 txHigh = Math.Min(yLow + (layerViewDistance * 2), xHigh);
@@ -1194,6 +1328,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1194 xLow = txLow; 1328 xLow = txLow;
1195 xHigh = txHigh; 1329 xHigh = txHigh;
1196 1330
1331<<<<<<< HEAD
1197 int tyLow = yPlace - layerViewDistance; 1332 int tyLow = yPlace - layerViewDistance;
1198 int tyHigh = yPlace + layerViewDistance; 1333 int tyHigh = yPlace + layerViewDistance;
1199 if (tyLow < yLow) 1334 if (tyLow < yLow)
@@ -1211,6 +1346,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1211 } 1346 }
1212 // m_log.DebugFormat("{0} SendParcelOverlay: place=<{1},{2}>, vDist={3}, xLH=<{4},{5}, yLH=<{6},{7}>", 1347 // m_log.DebugFormat("{0} SendParcelOverlay: place=<{1},{2}>, vDist={3}, xLH=<{4},{5}, yLH=<{6},{7}>",
1213 // LogHeader, xPlace, yPlace, layerViewDistance, xLow, xHigh, yLow, yHigh); 1348 // LogHeader, xPlace, yPlace, layerViewDistance, xLow, xHigh, yLow, yHigh);
1349=======
1350 ILandObject currentParcelBlock = GetLandObject(x, y);
1351>>>>>>> avn/ubitvar
1214 1352
1215 // Layer data is in landUnit (4m) chunks 1353 // Layer data is in landUnit (4m) chunks
1216 for (int y = yLow; y < yHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) 1354 for (int y = yLow; y < yHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
@@ -1221,6 +1359,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1221 byteArrayCount++; 1359 byteArrayCount++;
1222 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) 1360 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
1223 { 1361 {
1362<<<<<<< HEAD
1224 // m_log.DebugFormat("{0} SendParcelOverlay, sending packet, bytes={1}", LogHeader, byteArray.Length); 1363 // m_log.DebugFormat("{0} SendParcelOverlay, sending packet, bytes={1}", LogHeader, byteArray.Length);
1225 remote_client.SendLandParcelOverlay(byteArray, sequenceID); 1364 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1226 byteArrayCount = 0; 1365 byteArrayCount = 0;
@@ -1298,6 +1437,95 @@ namespace OpenSim.Region.CoreModules.World.Land
1298 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); 1437 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1299 } 1438 }
1300 1439
1440=======
1441 // types
1442 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
1443 {
1444 //Owner Flag
1445 tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_REQUESTER;
1446 }
1447 else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID))
1448 {
1449 tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_GROUP;
1450 }
1451 else if (currentParcelBlock.LandData.SalePrice > 0 &&
1452 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
1453 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
1454 {
1455 //Sale type
1456 tempByte = (byte)LandChannel.LAND_TYPE_IS_FOR_SALE;
1457 }
1458 else if (currentParcelBlock.LandData.OwnerID == UUID.Zero)
1459 {
1460 //Public type
1461 tempByte = (byte)LandChannel.LAND_TYPE_PUBLIC; // this does nothing, its zero
1462 }
1463 // LAND_TYPE_IS_BEING_AUCTIONED still unsuported
1464 else
1465 {
1466 //Other Flag
1467 tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_OTHER;
1468 }
1469
1470 // now flags
1471 // border control
1472
1473 ILandObject westParcel = null;
1474 ILandObject southParcel = null;
1475 if (x > 0)
1476 {
1477 westParcel = GetLandObject((x - 1), y);
1478 }
1479 if (y > 0)
1480 {
1481 southParcel = GetLandObject(x, (y - 1));
1482 }
1483
1484 if (x == 0)
1485 {
1486 tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST;
1487 }
1488 else if (westParcel != null && westParcel != currentParcelBlock)
1489 {
1490 tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST;
1491 }
1492
1493 if (y == 0)
1494 {
1495 tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH;
1496 }
1497 else if (southParcel != null && southParcel != currentParcelBlock)
1498 {
1499 tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH;
1500 }
1501
1502 // local sound
1503 if ((currentParcelBlock.LandData.Flags & (uint)ParcelFlags.SoundLocal) != 0)
1504 tempByte |= (byte)LandChannel.LAND_FLAG_LOCALSOUND;
1505
1506 // hide avatars
1507 if (!currentParcelBlock.LandData.SeeAVs)
1508 tempByte |= (byte)LandChannel.LAND_FLAG_HIDEAVATARS;
1509
1510
1511 byteArray[byteArrayCount] = tempByte;
1512 byteArrayCount++;
1513 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
1514 {
1515 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1516 byteArrayCount = 0;
1517 sequenceID++;
1518 byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1519 }
1520 }
1521 }
1522
1523 }
1524
1525 if (byteArrayCount > 0)
1526 {
1527 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1528>>>>>>> avn/ubitvar
1301 } 1529 }
1302 1530
1303 return tempByte; 1531 return tempByte;
@@ -1320,8 +1548,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1320 { 1548 {
1321 if (!temp.Contains(currentParcel)) 1549 if (!temp.Contains(currentParcel))
1322 { 1550 {
1323 currentParcel.ForceUpdateLandInfo(); 1551 if (!currentParcel.IsEitherBannedOrRestricted(remote_client.AgentId))
1324 temp.Add(currentParcel); 1552 {
1553 currentParcel.ForceUpdateLandInfo();
1554 temp.Add(currentParcel);
1555 }
1325 } 1556 }
1326 } 1557 }
1327 } 1558 }
@@ -1338,8 +1569,50 @@ namespace OpenSim.Region.CoreModules.World.Land
1338 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); 1569 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client);
1339 } 1570 }
1340 1571
1572<<<<<<< HEAD
1341 // Also send the layer data around the point of interest 1573 // Also send the layer data around the point of interest
1342 SendParcelOverlay(remote_client, (start_x + end_x) / 2, (start_y + end_y) / 2, parcelLayerViewDistance); 1574 SendParcelOverlay(remote_client, (start_x + end_x) / 2, (start_y + end_y) / 2, parcelLayerViewDistance);
1575=======
1576// SendParcelOverlay(remote_client);
1577 }
1578
1579 public void UpdateLandProperties(ILandObject land, LandUpdateArgs args, IClientAPI remote_client)
1580 {
1581 bool snap_selection = false;
1582 bool needOverlay = false;
1583 if (land.UpdateLandProperties(args, remote_client, out snap_selection, out needOverlay))
1584 {
1585 //the proprieties to who changed them
1586 ScenePresence av = m_scene.GetScenePresence(remote_client.AgentId);
1587 if(av.IsChildAgent || land != GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y))
1588 land.SendLandProperties(-10000, false, LandChannel.LAND_RESULT_SINGLE, remote_client);
1589 else
1590 land.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, remote_client);
1591
1592 UUID parcelID = land.LandData.GlobalID;
1593 m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
1594 {
1595 if (avatar.IsDeleted || avatar.isNPC)
1596 return;
1597
1598 IClientAPI client = avatar.ControllingClient;
1599 if (needOverlay)
1600 SendParcelOverlay(client);
1601
1602 if (avatar.IsChildAgent)
1603 return;
1604
1605 ILandObject aland = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
1606 if (aland != null)
1607 {
1608 if (client != remote_client && land == aland)
1609 aland.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, client);
1610 }
1611 if (avatar.currentParcelUUID == parcelID)
1612 avatar.currentParcelUUID = parcelID; // force parcel flags review
1613 });
1614 }
1615>>>>>>> avn/ubitvar
1343 } 1616 }
1344 1617
1345 public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) 1618 public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client)
@@ -1352,7 +1625,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1352 1625
1353 if (land != null) 1626 if (land != null)
1354 { 1627 {
1355 land.UpdateLandProperties(args, remote_client); 1628 UpdateLandProperties(land, args, remote_client);
1356 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client); 1629 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client);
1357 } 1630 }
1358 } 1631 }
@@ -1408,7 +1681,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1408 land.LandData.GroupID = UUID.Zero; 1681 land.LandData.GroupID = UUID.Zero;
1409 land.LandData.IsGroupOwned = false; 1682 land.LandData.IsGroupOwned = false;
1410 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 1683 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
1411
1412 m_scene.ForEachClient(SendParcelOverlay); 1684 m_scene.ForEachClient(SendParcelOverlay);
1413 land.SendLandUpdateToClient(true, remote_client); 1685 land.SendLandUpdateToClient(true, remote_client);
1414 UpdateLandObject(land.LandData.LocalID, land.LandData); 1686 UpdateLandObject(land.LandData.LocalID, land.LandData);
@@ -1459,7 +1731,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1459 land.LandData.SalePrice = 0; 1731 land.LandData.SalePrice = 0;
1460 land.LandData.AuthBuyerID = UUID.Zero; 1732 land.LandData.AuthBuyerID = UUID.Zero;
1461 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 1733 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
1462
1463 m_scene.ForEachClient(SendParcelOverlay); 1734 m_scene.ForEachClient(SendParcelOverlay);
1464 land.SendLandUpdateToClient(true, remote_client); 1735 land.SendLandUpdateToClient(true, remote_client);
1465 UpdateLandObject(land.LandData.LocalID, land.LandData); 1736 UpdateLandObject(land.LandData.LocalID, land.LandData);
@@ -1545,9 +1816,12 @@ namespace OpenSim.Region.CoreModules.World.Land
1545 1816
1546 private void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1817 private void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1547 { 1818 {
1548// m_log.DebugFormat( 1819 lock (m_landList)
1549// "[LAND MANAGMENT MODULE]: Processing {0} incoming parcels on {1}", data.Count, m_scene.Name); 1820 {
1821 for (int i = 0; i < data.Count; i++)
1822 IncomingLandObjectFromStorage(data[i]);
1550 1823
1824<<<<<<< HEAD
1551 // Prevent race conditions from any auto-creation of new parcels for varregions whilst we are still loading 1825 // Prevent race conditions from any auto-creation of new parcels for varregions whilst we are still loading
1552 // the existing parcels. 1826 // the existing parcels.
1553 lock (m_landList) 1827 lock (m_landList)
@@ -1559,13 +1833,23 @@ namespace OpenSim.Region.CoreModules.World.Land
1559 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) 1833 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
1560 { 1834 {
1561 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) 1835 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
1836=======
1837 // Layer data is in landUnit (4m) chunks
1838 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++)
1839 {
1840 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++)
1841>>>>>>> avn/ubitvar
1562 { 1842 {
1563 if (m_landIDList[x, y] == 0) 1843 if (m_landIDList[x, y] == 0)
1564 { 1844 {
1565 if (m_landList.Count == 1) 1845 if (m_landList.Count == 1)
1566 { 1846 {
1567 m_log.DebugFormat( 1847 m_log.DebugFormat(
1848<<<<<<< HEAD
1568 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", 1849 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
1850=======
1851 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
1852>>>>>>> avn/ubitvar
1569 LogHeader, x, y, m_scene.Name); 1853 LogHeader, x, y, m_scene.Name);
1570 1854
1571 int onlyParcelID = 0; 1855 int onlyParcelID = 0;
@@ -1588,11 +1872,19 @@ namespace OpenSim.Region.CoreModules.World.Land
1588 else if (m_landList.Count > 1) 1872 else if (m_landList.Count > 1)
1589 { 1873 {
1590 m_log.DebugFormat( 1874 m_log.DebugFormat(
1875<<<<<<< HEAD
1591 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", 1876 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
1592 LogHeader, x, y, m_scene.Name); 1877 LogHeader, x, y, m_scene.Name);
1593 1878
1594 // There are several other parcels so we must create a new one for the unassigned space 1879 // There are several other parcels so we must create a new one for the unassigned space
1595 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); 1880 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
1881=======
1882 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
1883 LogHeader, x, y, m_scene.Name);
1884
1885 // There are several other parcels so we must create a new one for the unassigned space
1886 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
1887>>>>>>> avn/ubitvar
1596 // Claim all the unclaimed "0" ids 1888 // Claim all the unclaimed "0" ids
1597 newLand.SetLandBitmap(CreateBitmapForID(0)); 1889 newLand.SetLandBitmap(CreateBitmapForID(0));
1598 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 1890 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -1603,7 +1895,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1603 { 1895 {
1604 // We should never reach this point as the separate code path when no land data exists should have fired instead. 1896 // We should never reach this point as the separate code path when no land data exists should have fired instead.
1605 m_log.WarnFormat( 1897 m_log.WarnFormat(
1898<<<<<<< HEAD
1606 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", 1899 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
1900=======
1901 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
1902>>>>>>> avn/ubitvar
1607 LogHeader, m_scene.Name); 1903 LogHeader, m_scene.Name);
1608 } 1904 }
1609 } 1905 }
@@ -1614,9 +1910,16 @@ namespace OpenSim.Region.CoreModules.World.Land
1614 1910
1615 private void IncomingLandObjectFromStorage(LandData data) 1911 private void IncomingLandObjectFromStorage(LandData data)
1616 { 1912 {
1913<<<<<<< HEAD
1617 ILandObject new_land = new LandObject(data, m_scene); 1914 ILandObject new_land = new LandObject(data, m_scene);
1915=======
1916
1917 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1918 new_land.LandData = data.Copy();
1919>>>>>>> avn/ubitvar
1618 new_land.SetLandBitmapFromByteArray(); 1920 new_land.SetLandBitmapFromByteArray();
1619 AddLandObject(new_land); 1921 AddLandObject(new_land);
1922// new_land.SendLandUpdateToAvatarsOverMe();
1620 } 1923 }
1621 1924
1622 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) 1925 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
@@ -1773,6 +2076,19 @@ namespace OpenSim.Region.CoreModules.World.Land
1773 land_update.ObscureMusic = properties.ObscureMusic; 2076 land_update.ObscureMusic = properties.ObscureMusic;
1774 land_update.ObscureMedia = properties.ObscureMedia; 2077 land_update.ObscureMedia = properties.ObscureMedia;
1775 2078
2079 if (args.ContainsKey("see_avs"))
2080 {
2081 land_update.SeeAVs = args["see_avs"].AsBoolean();
2082 land_update.AnyAVSounds = args["any_av_sounds"].AsBoolean();
2083 land_update.GroupAVSounds = args["group_av_sounds"].AsBoolean();
2084 }
2085 else
2086 {
2087 land_update.SeeAVs = true;
2088 land_update.AnyAVSounds = true;
2089 land_update.GroupAVSounds = true;
2090 }
2091
1776 ILandObject land; 2092 ILandObject land;
1777 lock (m_landList) 2093 lock (m_landList)
1778 { 2094 {
@@ -1781,13 +2097,14 @@ namespace OpenSim.Region.CoreModules.World.Land
1781 2097
1782 if (land != null) 2098 if (land != null)
1783 { 2099 {
1784 land.UpdateLandProperties(land_update, client); 2100 UpdateLandProperties(land,land_update, client);
1785 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); 2101 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
1786 } 2102 }
1787 else 2103 else
1788 { 2104 {
1789 m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID); 2105 m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID);
1790 } 2106 }
2107
1791 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); 2108 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1792 } 2109 }
1793 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the 2110 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
@@ -1940,14 +2257,93 @@ namespace OpenSim.Region.CoreModules.World.Land
1940 2257
1941 if (land == null) return; 2258 if (land == null) return;
1942 2259
1943 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions)) 2260 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions, false))
1944 return; 2261 return;
1945 2262
1946 land.LandData.OtherCleanTime = otherCleanTime; 2263 land.LandData.OtherCleanTime = otherCleanTime;
1947 2264
1948 UpdateLandObject(localID, land.LandData); 2265 UpdateLandObject(localID, land.LandData);
1949 } 2266 }
1950 2267
2268 public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID)
2269 {
2270 ILandObject land = null;
2271 List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels();
2272 foreach (ILandObject landObject in Land)
2273 {
2274 if (landObject.LandData.LocalID == landID)
2275 {
2276 land = landObject;
2277 }
2278 }
2279 land.DeedToGroup(DefaultGodParcelGroup);
2280 land.LandData.Name = DefaultGodParcelName;
2281 land.SendLandUpdateToAvatarsOverMe();
2282 }
2283
2284 private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID)
2285 {
2286 ScenePresence SP;
2287 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
2288 List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
2289 if (SP.UserLevel != 0)
2290 {
2291 if (flags == 0) //All parcels, scripted or not
2292 {
2293 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
2294 {
2295 if (e.OwnerID == targetID)
2296 {
2297 returns.Add(e);
2298 }
2299 }
2300 );
2301 }
2302 if (flags == 4) //All parcels, scripted object
2303 {
2304 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
2305 {
2306 if (e.OwnerID == targetID)
2307 {
2308 if (e.ContainsScripts())
2309 {
2310 returns.Add(e);
2311 }
2312 }
2313 }
2314 );
2315 }
2316 if (flags == 4) //not target parcel, scripted object
2317 {
2318 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
2319 {
2320 if (e.OwnerID == targetID)
2321 {
2322 ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y);
2323 if (landobject.LandData.OwnerID != e.OwnerID)
2324 {
2325 if (e.ContainsScripts())
2326 {
2327 returns.Add(e);
2328 }
2329 }
2330 }
2331 }
2332 );
2333 }
2334 foreach (SceneObjectGroup ol in returns)
2335 {
2336 ReturnObject(ol, client);
2337 }
2338 }
2339 }
2340 public void ReturnObject(SceneObjectGroup obj, IClientAPI client)
2341 {
2342 SceneObjectGroup[] objs = new SceneObjectGroup[1];
2343 objs[0] = obj;
2344 ((Scene)client.Scene).returnObjects(objs, client.AgentId);
2345 }
2346
1951 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); 2347 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
1952 2348
1953 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) 2349 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
@@ -1961,7 +2357,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1961 if (targetAvatar.UserLevel == 0) 2357 if (targetAvatar.UserLevel == 0)
1962 { 2358 {
1963 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); 2359 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1964 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) 2360 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true))
1965 return; 2361 return;
1966 if (flags == 0) 2362 if (flags == 0)
1967 { 2363 {
@@ -1983,7 +2379,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1983 } 2379 }
1984 } 2380 }
1985 } 2381 }
1986
1987 private void OnEndParcelFrozen(object avatar) 2382 private void OnEndParcelFrozen(object avatar)
1988 { 2383 {
1989 ScenePresence targetAvatar = (ScenePresence)avatar; 2384 ScenePresence targetAvatar = (ScenePresence)avatar;
@@ -1994,6 +2389,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1994 targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); 2389 targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false);
1995 } 2390 }
1996 2391
2392
1997 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) 2393 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1998 { 2394 {
1999 ScenePresence targetAvatar = null; 2395 ScenePresence targetAvatar = null;
@@ -2010,15 +2406,16 @@ namespace OpenSim.Region.CoreModules.World.Land
2010 2406
2011 // Check if you even have permission to do this 2407 // Check if you even have permission to do this
2012 ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); 2408 ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
2013 if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) && 2409 if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true) &&
2014 !m_scene.Permissions.IsAdministrator(client.AgentId)) 2410 !m_scene.Permissions.IsAdministrator(client.AgentId))
2015 return; 2411 return;
2412
2016 Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land); 2413 Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land);
2017 2414
2018 targetAvatar.TeleportWithMomentum(pos, null); 2415 targetAvatar.TeleportWithMomentum(pos, null);
2019 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); 2416 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
2020 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); 2417 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
2021 2418
2022 if ((flags & 1) != 0) // Ban TODO: Remove magic number 2419 if ((flags & 1) != 0) // Ban TODO: Remove magic number
2023 { 2420 {
2024 LandAccessEntry entry = new LandAccessEntry(); 2421 LandAccessEntry entry = new LandAccessEntry();
@@ -2171,6 +2568,7 @@ namespace OpenSim.Region.CoreModules.World.Land
2171 2568
2172 private void AppendParcelsSummaryReport(StringBuilder report) 2569 private void AppendParcelsSummaryReport(StringBuilder report)
2173 { 2570 {
2571<<<<<<< HEAD
2174 report.AppendFormat("Land information for {0}\n", m_scene.Name); 2572 report.AppendFormat("Land information for {0}\n", m_scene.Name);
2175 2573
2176 ConsoleDisplayTable cdt = new ConsoleDisplayTable(); 2574 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
@@ -2180,12 +2578,24 @@ namespace OpenSim.Region.CoreModules.World.Land
2180 cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize); 2578 cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize);
2181 cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize); 2579 cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize);
2182 cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize); 2580 cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize);
2581=======
2582 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName);
2583 report.AppendFormat(
2584 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
2585 "Parcel Name",
2586 "Local ID",
2587 "Area",
2588 "AABBMin",
2589 "AABBMax",
2590 "Owner");
2591>>>>>>> avn/ubitvar
2183 2592
2184 lock (m_landList) 2593 lock (m_landList)
2185 { 2594 {
2186 foreach (ILandObject lo in m_landList.Values) 2595 foreach (ILandObject lo in m_landList.Values)
2187 { 2596 {
2188 LandData ld = lo.LandData; 2597 LandData ld = lo.LandData;
2598<<<<<<< HEAD
2189 string ownerName; 2599 string ownerName;
2190 if (ld.IsGroupOwned) 2600 if (ld.IsGroupOwned)
2191 { 2601 {
@@ -2198,6 +2608,35 @@ namespace OpenSim.Region.CoreModules.World.Land
2198 } 2608 }
2199 cdt.AddRow( 2609 cdt.AddRow(
2200 ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, ownerName); 2610 ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, ownerName);
2611=======
2612
2613 report.AppendFormat(
2614 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
2615 ld.Name, ld.LocalID, ld.Area, ld.AABBMin, ld.AABBMax, m_userManager.GetUserName(ld.OwnerID));
2616 }
2617 }
2618
2619 }
2620
2621 public void EnforceBans(ILandObject land, ScenePresence avatar)
2622 {
2623 if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT)
2624 return;
2625
2626 if (land.IsEitherBannedOrRestricted(avatar.UUID))
2627 {
2628 if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y)))
2629 {
2630 Vector3? pos = m_scene.GetNearestAllowedPosition(avatar);
2631 if (pos == null)
2632 m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient);
2633 else
2634 ForceAvatarToPosition(avatar, (Vector3)pos);
2635 }
2636 else
2637 {
2638 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
2639>>>>>>> avn/ubitvar
2201 } 2640 }
2202 } 2641 }
2203 2642
@@ -2214,8 +2653,6 @@ namespace OpenSim.Region.CoreModules.World.Land
2214 cdl.AddRow("Description", ld.Description); 2653 cdl.AddRow("Description", ld.Description);
2215 cdl.AddRow("Snapshot ID", ld.SnapshotID); 2654 cdl.AddRow("Snapshot ID", ld.SnapshotID);
2216 cdl.AddRow("Area", ld.Area); 2655 cdl.AddRow("Area", ld.Area);
2217 cdl.AddRow("Starts", lo.StartPoint);
2218 cdl.AddRow("Ends", lo.EndPoint);
2219 cdl.AddRow("AABB Min", ld.AABBMin); 2656 cdl.AddRow("AABB Min", ld.AABBMin);
2220 cdl.AddRow("AABB Max", ld.AABBMax); 2657 cdl.AddRow("AABB Max", ld.AABBMax);
2221 string ownerName; 2658 string ownerName;
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index a0c1b9d..3b81d6b 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -46,11 +46,20 @@ namespace OpenSim.Region.CoreModules.World.Land
46 46
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 private static readonly string LogHeader = "[LAND OBJECT]"; 48 private static readonly string LogHeader = "[LAND OBJECT]";
49<<<<<<< HEAD
49 50
50 private readonly int landUnit = 4; 51 private readonly int landUnit = 4;
51 52
52 private int m_lastSeqId = 0; 53 private int m_lastSeqId = 0;
53 54
55=======
56
57 private readonly int landUnit = 4;
58
59 private int m_lastSeqId = 0;
60 private int m_expiryCounter = 0;
61
62>>>>>>> avn/ubitvar
54 protected Scene m_scene; 63 protected Scene m_scene;
55 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 64 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
56 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); 65 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
@@ -58,7 +67,16 @@ namespace OpenSim.Region.CoreModules.World.Land
58 protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); 67 protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>();
59 protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds 68 protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds
60 69
70<<<<<<< HEAD
61 public bool[,] LandBitmap { get; set; } 71 public bool[,] LandBitmap { get; set; }
72=======
73 private bool[,] m_landBitmap;
74 public bool[,] LandBitmap
75 {
76 get { return m_landBitmap; }
77 set { m_landBitmap = value; }
78 }
79>>>>>>> avn/ubitvar
62 80
63 #endregion 81 #endregion
64 82
@@ -69,7 +87,17 @@ namespace OpenSim.Region.CoreModules.World.Land
69 return free; 87 return free;
70 } 88 }
71 89
90<<<<<<< HEAD
72 public LandData LandData { get; set; } 91 public LandData LandData { get; set; }
92=======
93 protected LandData m_landData;
94 public LandData LandData
95 {
96 get { return m_landData; }
97
98 set { m_landData = value; }
99 }
100>>>>>>> avn/ubitvar
73 101
74 public IPrimCounts PrimCounts { get; set; } 102 public IPrimCounts PrimCounts { get; set; }
75 103
@@ -141,6 +169,8 @@ namespace OpenSim.Region.CoreModules.World.Land
141 else 169 else
142 LandData.GroupID = UUID.Zero; 170 LandData.GroupID = UUID.Zero;
143 LandData.IsGroupOwned = is_group_owned; 171 LandData.IsGroupOwned = is_group_owned;
172
173 m_scene.EventManager.OnFrame += OnFrame;
144 } 174 }
145 175
146 #endregion 176 #endregion
@@ -195,10 +225,34 @@ namespace OpenSim.Region.CoreModules.World.Land
195 else 225 else
196 { 226 {
197 // Normal Calculations 227 // Normal Calculations
228<<<<<<< HEAD
198 int parcelMax = (int)(((float)LandData.Area / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)) 229 int parcelMax = (int)(((float)LandData.Area / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY))
199 * (float)m_scene.RegionInfo.ObjectCapacity 230 * (float)m_scene.RegionInfo.ObjectCapacity
200 * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 231 * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
201 // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL! 232 // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL!
233=======
234 int parcelMax = (int)( (long)LandData.Area
235 * (long)m_scene.RegionInfo.ObjectCapacity
236 * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus
237 / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) );
238 //m_log.DebugFormat("Area: {0}, Capacity {1}, Bonus {2}, Parcel {3}", LandData.Area, m_scene.RegionInfo.ObjectCapacity, m_scene.RegionInfo.RegionSettings.ObjectBonus, parcelMax);
239 return parcelMax;
240 }
241 }
242
243 private int GetParcelBasePrimCount()
244 {
245 if (overrideParcelMaxPrimCount != null)
246 {
247 return overrideParcelMaxPrimCount(this);
248 }
249 else
250 {
251 // Normal Calculations
252 int parcelMax = (int)((long)LandData.Area
253 * (long)m_scene.RegionInfo.ObjectCapacity
254 / 65536L);
255>>>>>>> avn/ubitvar
202 return parcelMax; 256 return parcelMax;
203 } 257 }
204 } 258 }
@@ -212,8 +266,15 @@ namespace OpenSim.Region.CoreModules.World.Land
212 else 266 else
213 { 267 {
214 //Normal Calculations 268 //Normal Calculations
269<<<<<<< HEAD
215 int simMax = (int)(((float)LandData.SimwideArea / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)) 270 int simMax = (int)(((float)LandData.SimwideArea / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY))
216 * (float)m_scene.RegionInfo.ObjectCapacity); 271 * (float)m_scene.RegionInfo.ObjectCapacity);
272=======
273 int simMax = (int)( (long)LandData.SimwideArea
274 * (long)m_scene.RegionInfo.ObjectCapacity
275 / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) );
276 // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax);
277>>>>>>> avn/ubitvar
217 return simMax; 278 return simMax;
218 } 279 }
219 } 280 }
@@ -224,6 +285,9 @@ namespace OpenSim.Region.CoreModules.World.Land
224 285
225 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) 286 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
226 { 287 {
288 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc)
289 return;
290
227 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 291 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
228 // uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); 292 // uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome));
229 uint regionFlags = (uint)(RegionFlags.PublicAllowed 293 uint regionFlags = (uint)(RegionFlags.PublicAllowed
@@ -248,14 +312,15 @@ namespace OpenSim.Region.CoreModules.World.Land
248 remote_client.SendLandProperties(seq_id, 312 remote_client.SendLandProperties(seq_id,
249 snap_selection, request_result, this, 313 snap_selection, request_result, this,
250 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, 314 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
251 GetParcelMaxPrimCount(), 315 GetParcelBasePrimCount(),
252 GetSimulatorMaxPrimCount(), regionFlags); 316 GetSimulatorMaxPrimCount(), regionFlags);
253 } 317 }
254 318
255 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) 319 public bool UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client, out bool snap_selection, out bool needOverlay)
256 { 320 {
257 //Needs later group support 321 //Needs later group support
258 bool snap_selection = false; 322 snap_selection = false;
323 needOverlay = false;
259 LandData newData = LandData.Copy(); 324 LandData newData = LandData.Copy();
260 325
261 uint allowedDelta = 0; 326 uint allowedDelta = 0;
@@ -264,7 +329,7 @@ namespace OpenSim.Region.CoreModules.World.Land
264 // ParcelFlags.ForSaleObjects 329 // ParcelFlags.ForSaleObjects
265 // ParcelFlags.LindenHome 330 // ParcelFlags.LindenHome
266 331
267 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) 332 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, false))
268 { 333 {
269 allowedDelta |= (uint)(ParcelFlags.AllowLandmark | 334 allowedDelta |= (uint)(ParcelFlags.AllowLandmark |
270 ParcelFlags.AllowTerraform | 335 ParcelFlags.AllowTerraform |
@@ -277,9 +342,12 @@ namespace OpenSim.Region.CoreModules.World.Land
277 ParcelFlags.AllowAPrimitiveEntry | 342 ParcelFlags.AllowAPrimitiveEntry |
278 ParcelFlags.AllowGroupObjectEntry | 343 ParcelFlags.AllowGroupObjectEntry |
279 ParcelFlags.AllowFly); 344 ParcelFlags.AllowFly);
345 newData.SeeAVs = args.SeeAVs;
346 newData.AnyAVSounds = args.AnyAVSounds;
347 newData.GroupAVSounds = args.GroupAVSounds;
280 } 348 }
281 349
282 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale)) 350 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale, true))
283 { 351 {
284 if (args.AuthBuyerID != newData.AuthBuyerID || 352 if (args.AuthBuyerID != newData.AuthBuyerID ||
285 args.SalePrice != newData.SalePrice) 353 args.SalePrice != newData.SalePrice)
@@ -302,30 +370,30 @@ namespace OpenSim.Region.CoreModules.World.Land
302 allowedDelta |= (uint)ParcelFlags.ForSale; 370 allowedDelta |= (uint)ParcelFlags.ForSale;
303 } 371 }
304 372
305 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces)) 373 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces, false))
306 { 374 {
307 newData.Category = args.Category; 375 newData.Category = args.Category;
308 376
309 allowedDelta |= (uint)(ParcelFlags.ShowDirectory | 377 allowedDelta |= (uint)(ParcelFlags.ShowDirectory |
310 ParcelFlags.AllowPublish | 378 ParcelFlags.AllowPublish |
311 ParcelFlags.MaturePublish); 379 ParcelFlags.MaturePublish) | (uint)(1 << 23);
312 } 380 }
313 381
314 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) 382 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity, false))
315 { 383 {
316 newData.Description = args.Desc; 384 newData.Description = args.Desc;
317 newData.Name = args.Name; 385 newData.Name = args.Name;
318 newData.SnapshotID = args.SnapshotID; 386 newData.SnapshotID = args.SnapshotID;
319 } 387 }
320 388
321 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint)) 389 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint, false))
322 { 390 {
323 newData.LandingType = args.LandingType; 391 newData.LandingType = args.LandingType;
324 newData.UserLocation = args.UserLocation; 392 newData.UserLocation = args.UserLocation;
325 newData.UserLookAt = args.UserLookAt; 393 newData.UserLookAt = args.UserLookAt;
326 } 394 }
327 395
328 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia)) 396 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia, false))
329 { 397 {
330 newData.MediaAutoScale = args.MediaAutoScale; 398 newData.MediaAutoScale = args.MediaAutoScale;
331 newData.MediaID = args.MediaID; 399 newData.MediaID = args.MediaID;
@@ -346,7 +414,7 @@ namespace OpenSim.Region.CoreModules.World.Land
346 ParcelFlags.UseEstateVoiceChan); 414 ParcelFlags.UseEstateVoiceChan);
347 } 415 }
348 416
349 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses)) 417 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses, false))
350 { 418 {
351 newData.PassHours = args.PassHours; 419 newData.PassHours = args.PassHours;
352 newData.PassPrice = args.PassPrice; 420 newData.PassPrice = args.PassPrice;
@@ -354,13 +422,13 @@ namespace OpenSim.Region.CoreModules.World.Land
354 allowedDelta |= (uint)ParcelFlags.UsePassList; 422 allowedDelta |= (uint)ParcelFlags.UsePassList;
355 } 423 }
356 424
357 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed)) 425 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed, false))
358 { 426 {
359 allowedDelta |= (uint)(ParcelFlags.UseAccessGroup | 427 allowedDelta |= (uint)(ParcelFlags.UseAccessGroup |
360 ParcelFlags.UseAccessList); 428 ParcelFlags.UseAccessList);
361 } 429 }
362 430
363 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned)) 431 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned, false))
364 { 432 {
365 allowedDelta |= (uint)(ParcelFlags.UseBanList | 433 allowedDelta |= (uint)(ParcelFlags.UseBanList |
366 ParcelFlags.DenyAnonymous | 434 ParcelFlags.DenyAnonymous |
@@ -371,10 +439,24 @@ namespace OpenSim.Region.CoreModules.World.Land
371 { 439 {
372 uint preserve = LandData.Flags & ~allowedDelta; 440 uint preserve = LandData.Flags & ~allowedDelta;
373 newData.Flags = preserve | (args.ParcelFlags & allowedDelta); 441 newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
442<<<<<<< HEAD
374 443
375 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 444 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
376 SendLandUpdateToAvatarsOverMe(snap_selection); 445 SendLandUpdateToAvatarsOverMe(snap_selection);
377 } 446 }
447=======
448
449 uint curdelta = LandData.Flags ^ newData.Flags;
450 curdelta &= (uint)(ParcelFlags.SoundLocal);
451
452 if(curdelta != 0 || newData.SeeAVs != LandData.SeeAVs)
453 needOverlay = true;
454
455 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
456 return true;
457 }
458 return false;
459>>>>>>> avn/ubitvar
378 } 460 }
379 461
380 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 462 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
@@ -395,7 +477,7 @@ namespace OpenSim.Region.CoreModules.World.Land
395 UUID previousOwner = LandData.OwnerID; 477 UUID previousOwner = LandData.OwnerID;
396 478
397 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 479 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
398 m_scene.EventManager.TriggerParcelPrimCountUpdate(); 480// m_scene.EventManager.TriggerParcelPrimCountUpdate();
399 SendLandUpdateToAvatarsOverMe(true); 481 SendLandUpdateToAvatarsOverMe(true);
400 482
401 if (sellObjects) SellLandObjects(previousOwner); 483 if (sellObjects) SellLandObjects(previousOwner);
@@ -568,6 +650,7 @@ namespace OpenSim.Region.CoreModules.World.Land
568 650
569 public void SendLandUpdateToAvatarsOverMe(bool snap_selection) 651 public void SendLandUpdateToAvatarsOverMe(bool snap_selection)
570 { 652 {
653 m_scene.EventManager.TriggerParcelPrimCountUpdate();
571 m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar) 654 m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar)
572 { 655 {
573 ILandObject over = null; 656 ILandObject over = null;
@@ -594,6 +677,7 @@ namespace OpenSim.Region.CoreModules.World.Land
594 avatar.Invulnerable = true; 677 avatar.Invulnerable = true;
595 678
596 SendLandUpdateToClient(snap_selection, avatar.ControllingClient); 679 SendLandUpdateToClient(snap_selection, avatar.ControllingClient);
680 avatar.currentParcelUUID = LandData.GlobalID;
597 } 681 }
598 } 682 }
599 }); 683 });
@@ -722,10 +806,17 @@ namespace OpenSim.Region.CoreModules.World.Land
722 /// </summary> 806 /// </summary>
723 private void UpdateAABBAndAreaValues() 807 private void UpdateAABBAndAreaValues()
724 { 808 {
809<<<<<<< HEAD
725 int min_x = 10000; 810 int min_x = 10000;
726 int min_y = 10000; 811 int min_y = 10000;
727 int max_x = 0; 812 int max_x = 0;
728 int max_y = 0; 813 int max_y = 0;
814=======
815 int min_x = Int32.MaxValue;
816 int min_y = Int32.MaxValue;
817 int max_x = Int32.MinValue;
818 int max_y = Int32.MinValue;
819>>>>>>> avn/ubitvar
729 int tempArea = 0; 820 int tempArea = 0;
730 int x, y; 821 int x, y;
731 for (x = 0; x < LandBitmap.GetLength(0); x++) 822 for (x = 0; x < LandBitmap.GetLength(0); x++)
@@ -734,10 +825,21 @@ namespace OpenSim.Region.CoreModules.World.Land
734 { 825 {
735 if (LandBitmap[x, y] == true) 826 if (LandBitmap[x, y] == true)
736 { 827 {
828<<<<<<< HEAD
737 if (min_x > x) min_x = x; 829 if (min_x > x) min_x = x;
738 if (min_y > y) min_y = y; 830 if (min_y > y) min_y = y;
739 if (max_x < x) max_x = x; 831 if (max_x < x) max_x = x;
740 if (max_y < y) max_y = y; 832 if (max_y < y) max_y = y;
833=======
834 if (min_x > x)
835 min_x = x;
836 if (min_y > y)
837 min_y = y;
838 if (max_x < x)
839 max_x = x;
840 if (max_y < y)
841 max_y = y;
842>>>>>>> avn/ubitvar
741 tempArea += landUnit * landUnit; //16sqm peice of land 843 tempArea += landUnit * landUnit; //16sqm peice of land
742 } 844 }
743 } 845 }
@@ -745,6 +847,7 @@ namespace OpenSim.Region.CoreModules.World.Land
745 int tx = min_x * landUnit; 847 int tx = min_x * landUnit;
746 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1)) 848 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1))
747 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1); 849 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1);
850<<<<<<< HEAD
748 int ty = min_y * landUnit; 851 int ty = min_y * landUnit;
749 if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1)) 852 if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1))
750 ty = ((int)m_scene.RegionInfo.RegionSizeY - 1); 853 ty = ((int)m_scene.RegionInfo.RegionSizeY - 1);
@@ -763,6 +866,45 @@ namespace OpenSim.Region.CoreModules.World.Land
763 LandData.AABBMax 866 LandData.AABBMax
764 = new Vector3( 867 = new Vector3(
765 (float)(max_x * landUnit), (float)(max_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); 868 (float)(max_x * landUnit), (float)(max_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
869=======
870
871 int htx;
872 if (tx >= ((int)m_scene.RegionInfo.RegionSizeX))
873 htx = (int)m_scene.RegionInfo.RegionSizeX - 1;
874 else
875 htx = tx;
876
877 int ty = min_y * landUnit;
878 int hty;
879
880 if (ty >= ((int)m_scene.RegionInfo.RegionSizeY))
881 hty = (int)m_scene.RegionInfo.RegionSizeY - 1;
882 else
883 hty = ty;
884
885 LandData.AABBMin =
886 new Vector3(
887 (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0);
888
889 max_x++;
890 tx = max_x * landUnit;
891 if (tx >= ((int)m_scene.RegionInfo.RegionSizeX))
892 htx = (int)m_scene.RegionInfo.RegionSizeX - 1;
893 else
894 htx = tx;
895
896 max_y++;
897 ty = max_y * 4;
898
899 if (ty >= ((int)m_scene.RegionInfo.RegionSizeY))
900 hty = (int)m_scene.RegionInfo.RegionSizeY - 1;
901 else
902 hty = ty;
903
904 LandData.AABBMax
905 = new Vector3(
906 (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0);
907>>>>>>> avn/ubitvar
766 908
767 LandData.Area = tempArea; 909 LandData.Area = tempArea;
768 } 910 }
@@ -778,7 +920,10 @@ namespace OpenSim.Region.CoreModules.World.Land
778 public void SetLandBitmap(bool[,] bitmap) 920 public void SetLandBitmap(bool[,] bitmap)
779 { 921 {
780 LandBitmap = bitmap; 922 LandBitmap = bitmap;
923<<<<<<< HEAD
781 // m_log.DebugFormat("{0} SetLandBitmap. BitmapSize=<{1},{2}>", LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); 924 // m_log.DebugFormat("{0} SetLandBitmap. BitmapSize=<{1},{2}>", LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
925=======
926>>>>>>> avn/ubitvar
782 ForceUpdateLandInfo(); 927 ForceUpdateLandInfo();
783 } 928 }
784 929
@@ -879,13 +1024,37 @@ namespace OpenSim.Region.CoreModules.World.Land
879 private byte[] ConvertLandBitmapToBytes() 1024 private byte[] ConvertLandBitmapToBytes()
880 { 1025 {
881 byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8]; 1026 byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8];
1027<<<<<<< HEAD
882 byte tempByte = 0; 1028 byte tempByte = 0;
883 int byteNum = 0; 1029 int byteNum = 0;
884 int i = 0; 1030 int i = 0;
1031=======
1032 int tempByte = 0;
1033 int i, byteNum = 0;
1034 int mask = 1;
1035 i = 0;
1036>>>>>>> avn/ubitvar
885 for (int y = 0; y < LandBitmap.GetLength(1); y++) 1037 for (int y = 0; y < LandBitmap.GetLength(1); y++)
886 { 1038 {
887 for (int x = 0; x < LandBitmap.GetLength(0); x++) 1039 for (int x = 0; x < LandBitmap.GetLength(0); x++)
888 { 1040 {
1041 if (LandBitmap[x, y])
1042 tempByte |= mask;
1043 mask = mask << 1;
1044 if (mask == 0x100)
1045 {
1046 mask = 1;
1047 tempConvertArr[byteNum++] = (byte)tempByte;
1048 tempByte = 0;
1049 }
1050 }
1051 }
1052
1053 if(tempByte != 0 && byteNum < 512)
1054 tempConvertArr[byteNum] = (byte)tempByte;
1055
1056
1057/*
889 tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8)); 1058 tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8));
890 if (i % 8 == 0) 1059 if (i % 8 == 0)
891 { 1060 {
@@ -894,10 +1063,14 @@ namespace OpenSim.Region.CoreModules.World.Land
894 i = 0; 1063 i = 0;
895 byteNum++; 1064 byteNum++;
896 } 1065 }
1066<<<<<<< HEAD
897 } 1067 }
898 } 1068 }
899 // m_log.DebugFormat("{0} ConvertLandBitmapToBytes. BitmapSize=<{1},{2}>", 1069 // m_log.DebugFormat("{0} ConvertLandBitmapToBytes. BitmapSize=<{1},{2}>",
900 // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); 1070 // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
1071=======
1072 */
1073>>>>>>> avn/ubitvar
901 return tempConvertArr; 1074 return tempConvertArr;
902 } 1075 }
903 1076
@@ -951,7 +1124,7 @@ namespace OpenSim.Region.CoreModules.World.Land
951 1124
952 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) 1125 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
953 { 1126 {
954 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) 1127 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, true))
955 { 1128 {
956 List<uint> resultLocalIDs = new List<uint>(); 1129 List<uint> resultLocalIDs = new List<uint>();
957 try 1130 try
@@ -1001,7 +1174,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1001 /// </param> 1174 /// </param>
1002 public void SendLandObjectOwners(IClientAPI remote_client) 1175 public void SendLandObjectOwners(IClientAPI remote_client)
1003 { 1176 {
1004 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) 1177 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, true))
1005 { 1178 {
1006 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); 1179 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>();
1007 List<UUID> groups = new List<UUID>(); 1180 List<UUID> groups = new List<UUID>();
@@ -1233,6 +1406,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1233 public void SetMediaUrl(string url) 1406 public void SetMediaUrl(string url)
1234 { 1407 {
1235 LandData.MediaURL = url; 1408 LandData.MediaURL = url;
1409 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, LandData);
1236 SendLandUpdateToAvatarsOverMe(); 1410 SendLandUpdateToAvatarsOverMe();
1237 } 1411 }
1238 1412
@@ -1243,6 +1417,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1243 public void SetMusicUrl(string url) 1417 public void SetMusicUrl(string url)
1244 { 1418 {
1245 LandData.MusicURL = url; 1419 LandData.MusicURL = url;
1420 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, LandData);
1246 SendLandUpdateToAvatarsOverMe(); 1421 SendLandUpdateToAvatarsOverMe();
1247 } 1422 }
1248 1423
@@ -1257,6 +1432,17 @@ namespace OpenSim.Region.CoreModules.World.Land
1257 1432
1258 #endregion 1433 #endregion
1259 1434
1435 private void OnFrame()
1436 {
1437 m_expiryCounter++;
1438
1439 if (m_expiryCounter >= 50)
1440 {
1441 ExpireAccessList();
1442 m_expiryCounter = 0;
1443 }
1444 }
1445
1260 private void ExpireAccessList() 1446 private void ExpireAccessList()
1261 { 1447 {
1262 List<LandAccessEntry> delete = new List<LandAccessEntry>(); 1448 List<LandAccessEntry> delete = new List<LandAccessEntry>();
@@ -1267,7 +1453,22 @@ namespace OpenSim.Region.CoreModules.World.Land
1267 delete.Add(entry); 1453 delete.Add(entry);
1268 } 1454 }
1269 foreach (LandAccessEntry entry in delete) 1455 foreach (LandAccessEntry entry in delete)
1456 {
1270 LandData.ParcelAccessList.Remove(entry); 1457 LandData.ParcelAccessList.Remove(entry);
1458 ScenePresence presence;
1459
1460 if (m_scene.TryGetScenePresence(entry.AgentID, out presence) && (!presence.IsChildAgent))
1461 {
1462 ILandObject land = m_scene.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
1463 if (land.LandData.LocalID == LandData.LocalID)
1464 {
1465 Vector3 pos = m_scene.GetNearestAllowedPosition(presence, land);
1466 presence.TeleportWithMomentum(pos, null);
1467 presence.ControllingClient.SendAlertMessage("You have been ejected from this land");
1468 }
1469 }
1470 m_log.DebugFormat("[LAND]: Removing entry {0} because it has expired", entry.AgentID);
1471 }
1271 1472
1272 if (delete.Count > 0) 1473 if (delete.Count > 0)
1273 m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this); 1474 m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this);
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 9b51cc8..771fdd2 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.World.Land
207 if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) 207 if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
208 { 208 {
209 UUID landOwner = landData.OwnerID; 209 UUID landOwner = landData.OwnerID;
210 int partCount = obj.Parts.Length; 210 int partCount = obj.GetPartCount();
211 211
212 m_SimwideCounts[landOwner] += partCount; 212 m_SimwideCounts[landOwner] += partCount;
213 if (parcelCounts.Users.ContainsKey(obj.OwnerID)) 213 if (parcelCounts.Users.ContainsKey(obj.OwnerID))
@@ -597,4 +597,4 @@ namespace OpenSim.Region.CoreModules.World.Land
597 } 597 }
598 } 598 }
599 } 599 }
600} \ No newline at end of file 600}