aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Land/LandObject.cs
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/LandObject.cs
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/LandObject.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs233
1 files changed, 217 insertions, 16 deletions
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);