diff options
author | mingchen | 2008-03-22 23:10:22 +0000 |
---|---|---|
committer | mingchen | 2008-03-22 23:10:22 +0000 |
commit | 71ca162821ac0e5aae5f91c433b91549ae6d5419 (patch) | |
tree | fa2f13c2541075aba6807fcf95364466a785bd51 /OpenSim | |
parent | Implements llLoopSound(), llStopSound(), and llAdjustSoundVolume(). (diff) | |
download | opensim-SC_OLD-71ca162821ac0e5aae5f91c433b91549ae6d5419.zip opensim-SC_OLD-71ca162821ac0e5aae5f91c433b91549ae6d5419.tar.gz opensim-SC_OLD-71ca162821ac0e5aae5f91c433b91549ae6d5419.tar.bz2 opensim-SC_OLD-71ca162821ac0e5aae5f91c433b91549ae6d5419.tar.xz |
*Moved LandManagement into its own region module (spiffy!)
Diffstat (limited to 'OpenSim')
21 files changed, 2031 insertions, 1890 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLDataStore.cs b/OpenSim/Framework/Data.MSSQL/MSSQLDataStore.cs index 67ed0c0..c86cfb6 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLDataStore.cs | |||
@@ -35,7 +35,6 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Data; | 36 | using OpenSim.Framework.Data; |
37 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
38 | using OpenSim.Region.Environment.LandManagement; | ||
39 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
40 | using OpenSim.Framework.Data.MSSQL; | 39 | using OpenSim.Framework.Data.MSSQL; |
41 | 40 | ||
@@ -429,7 +428,7 @@ namespace OpenSim.Framework.Data.MSSQL | |||
429 | } | 428 | } |
430 | } | 429 | } |
431 | 430 | ||
432 | public void StoreLandObject(Land parcel, LLUUID regionUUID) | 431 | public void StoreLandObject(ILandObject parcel) |
433 | { | 432 | { |
434 | // Instance.StoreLandObject(parcel, regionUUID); | 433 | // Instance.StoreLandObject(parcel, regionUUID); |
435 | 434 | ||
@@ -446,12 +445,12 @@ namespace OpenSim.Framework.Data.MSSQL | |||
446 | if (landRow == null) | 445 | if (landRow == null) |
447 | { | 446 | { |
448 | landRow = land.NewRow(); | 447 | landRow = land.NewRow(); |
449 | fillLandRow(landRow, parcel.landData, regionUUID); | 448 | fillLandRow(landRow, parcel.landData, parcel.regionUUID); |
450 | land.Rows.Add(landRow); | 449 | land.Rows.Add(landRow); |
451 | } | 450 | } |
452 | else | 451 | else |
453 | { | 452 | { |
454 | fillLandRow(landRow, parcel.landData, regionUUID); | 453 | fillLandRow(landRow, parcel.landData, parcel.regionUUID); |
455 | } | 454 | } |
456 | 455 | ||
457 | using ( | 456 | using ( |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index f4c839e..b1ab42fd 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | |||
@@ -34,7 +34,6 @@ using libsecondlife; | |||
34 | using MySql.Data.MySqlClient; | 34 | using MySql.Data.MySqlClient; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.LandManagement; | ||
38 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
39 | 38 | ||
40 | namespace OpenSim.Framework.Data.MySQL | 39 | namespace OpenSim.Framework.Data.MySQL |
@@ -416,7 +415,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
416 | } | 415 | } |
417 | } | 416 | } |
418 | 417 | ||
419 | public void StoreLandObject(Land parcel, LLUUID regionUUID) | 418 | public void StoreLandObject(ILandObject parcel) |
420 | { | 419 | { |
421 | lock (m_dataSet) | 420 | lock (m_dataSet) |
422 | { | 421 | { |
@@ -427,12 +426,12 @@ namespace OpenSim.Framework.Data.MySQL | |||
427 | if (landRow == null) | 426 | if (landRow == null) |
428 | { | 427 | { |
429 | landRow = land.NewRow(); | 428 | landRow = land.NewRow(); |
430 | fillLandRow(landRow, parcel.landData, regionUUID); | 429 | fillLandRow(landRow, parcel.landData, parcel.regionUUID); |
431 | land.Rows.Add(landRow); | 430 | land.Rows.Add(landRow); |
432 | } | 431 | } |
433 | else | 432 | else |
434 | { | 433 | { |
435 | fillLandRow(landRow, parcel.landData, regionUUID); | 434 | fillLandRow(landRow, parcel.landData, parcel.regionUUID); |
436 | } | 435 | } |
437 | 436 | ||
438 | using ( | 437 | using ( |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs index dc3d388..77161a4 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs | |||
@@ -34,7 +34,6 @@ using Mono.Data.SqliteClient; | |||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.LandManagement; | ||
38 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
39 | 38 | ||
40 | namespace OpenSim.Framework.Data.SQLite | 39 | namespace OpenSim.Framework.Data.SQLite |
@@ -477,7 +476,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
477 | } | 476 | } |
478 | } | 477 | } |
479 | 478 | ||
480 | public void StoreLandObject(Land parcel, LLUUID regionUUID) | 479 | public void StoreLandObject(ILandObject parcel) |
481 | { | 480 | { |
482 | lock (ds) | 481 | lock (ds) |
483 | { | 482 | { |
@@ -488,12 +487,12 @@ namespace OpenSim.Framework.Data.SQLite | |||
488 | if (landRow == null) | 487 | if (landRow == null) |
489 | { | 488 | { |
490 | landRow = land.NewRow(); | 489 | landRow = land.NewRow(); |
491 | fillLandRow(landRow, parcel.landData, regionUUID); | 490 | fillLandRow(landRow, parcel.landData, parcel.regionUUID); |
492 | land.Rows.Add(landRow); | 491 | land.Rows.Add(landRow); |
493 | } | 492 | } |
494 | else | 493 | else |
495 | { | 494 | { |
496 | fillLandRow(landRow, parcel.landData, regionUUID); | 495 | fillLandRow(landRow, parcel.landData, parcel.regionUUID); |
497 | } | 496 | } |
498 | 497 | ||
499 | // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around | 498 | // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index e50187e..f96d474 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -502,7 +502,10 @@ namespace OpenSim | |||
502 | scene.PermissionsMngr.BypassPermissions = !m_permissions; | 502 | scene.PermissionsMngr.BypassPermissions = !m_permissions; |
503 | 503 | ||
504 | // We need to do this after we've initialized the scripting engines. | 504 | // We need to do this after we've initialized the scripting engines. |
505 | scene.StartScripts(); | 505 | scene.StartScripts(); |
506 | |||
507 | scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID); | ||
508 | scene.LandChannel.performParcelPrimCountUpdate(); | ||
506 | 509 | ||
507 | m_sceneManager.Add(scene); | 510 | m_sceneManager.Add(scene); |
508 | 511 | ||
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index a23bd6c..b6f0f12 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -155,8 +155,6 @@ namespace OpenSim.Region.ClientStack | |||
155 | } | 155 | } |
156 | 156 | ||
157 | scene.LoadPrimsFromStorage(m_permissions, regionInfo.originRegionID); | 157 | scene.LoadPrimsFromStorage(m_permissions, regionInfo.originRegionID); |
158 | scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID); | ||
159 | scene.performParcelPrimCountUpdate(); | ||
160 | scene.StartTimer(); | 158 | scene.StartTimer(); |
161 | return scene; | 159 | return scene; |
162 | } | 160 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs new file mode 100644 index 0000000..1e0493f --- /dev/null +++ b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs | |||
@@ -0,0 +1,52 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | using OpenSim.Region.Environment.Scenes; | ||
8 | using OpenSim.Framework; | ||
9 | |||
10 | namespace OpenSim.Region.Environment.Interfaces | ||
11 | { | ||
12 | public interface ILandChannel | ||
13 | { | ||
14 | bool allowedForcefulBans { get; set; } | ||
15 | void IncomingLandObjectsFromStorage(List<LandData> data); | ||
16 | void IncomingLandObjectFromStorage(LandData data); | ||
17 | |||
18 | void NoLandDataFromStorage(); | ||
19 | ILandObject getLandObject(int x, int y); | ||
20 | ILandObject getLandObject(float x, float y); | ||
21 | void setPrimsTainted(); | ||
22 | bool isLandPrimCountTainted(); | ||
23 | void sendLandUpdate(ScenePresence avatar, bool force); | ||
24 | void sendLandUpdate(ScenePresence avatar); | ||
25 | void resetAllLandPrimCounts(); | ||
26 | void addPrimToLandPrimCounts(SceneObjectGroup obj); | ||
27 | void removePrimFromLandPrimCounts(SceneObjectGroup obj); | ||
28 | void finalizeLandPrimCountUpdate(); | ||
29 | void updateLandPrimCounts(); | ||
30 | void performParcelPrimCountUpdate(); | ||
31 | void updateLandObject(int local_id, LandData newData); | ||
32 | |||
33 | void sendParcelOverlay(IClientAPI remote_client); | ||
34 | void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); | ||
35 | void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); | ||
36 | void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client); | ||
37 | void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client); | ||
38 | void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client); | ||
39 | void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client); | ||
40 | |||
41 | void resetSimLandObjects(); | ||
42 | List<ILandObject> parcelsNearPoint(LLVector3 position); | ||
43 | void sendYouAreBannedNotice(ScenePresence avatar); | ||
44 | void handleAvatarChangingParcel(ScenePresence avatar, int localLandID, LLUUID regionID); | ||
45 | void sendOutNearestBanLine(IClientAPI avatar); | ||
46 | void handleSignificantClientMovement(IClientAPI remote_client); | ||
47 | void handleAnyClientMovement(ScenePresence avatar); | ||
48 | void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client); | ||
49 | void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client); | ||
50 | |||
51 | } | ||
52 | } | ||
diff --git a/OpenSim/Region/Environment/Interfaces/ILandObject.cs b/OpenSim/Region/Environment/Interfaces/ILandObject.cs new file mode 100644 index 0000000..f68fb82 --- /dev/null +++ b/OpenSim/Region/Environment/Interfaces/ILandObject.cs | |||
@@ -0,0 +1,54 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | using OpenSim.Region.Environment.Scenes; | ||
8 | |||
9 | using OpenSim.Framework; | ||
10 | |||
11 | namespace OpenSim.Region.Environment.Interfaces | ||
12 | { | ||
13 | public interface ILandObject | ||
14 | { | ||
15 | |||
16 | LandData landData { get; set; } | ||
17 | bool[,] landBitmap { get; set; } | ||
18 | LLUUID regionUUID { get; } | ||
19 | bool containsPoint(int x, int y); | ||
20 | ILandObject Copy(); | ||
21 | |||
22 | |||
23 | void sendLandUpdateToAvatarsOverMe(); | ||
24 | |||
25 | void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client); | ||
26 | void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); | ||
27 | bool isEitherBannedOrRestricted(LLUUID avatar); | ||
28 | bool isBannedFromLand(LLUUID avatar); | ||
29 | bool isRestrictedFromLand(LLUUID avatar); | ||
30 | void sendLandUpdateToClient(IClientAPI remote_client); | ||
31 | ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag); | ||
32 | void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); | ||
33 | void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client); | ||
34 | void updateLandBitmapByteArray(); | ||
35 | void setLandBitmapFromByteArray(); | ||
36 | bool[,] getLandBitmap(); | ||
37 | void forceUpdateLandInfo(); | ||
38 | void setLandBitmap(bool[,] bitmap); | ||
39 | |||
40 | bool[,] basicFullRegionLandBitmap(); | ||
41 | bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y); | ||
42 | bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value); | ||
43 | bool[,] mergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add); | ||
44 | void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client); | ||
45 | void sendLandObjectOwners(IClientAPI remote_client); | ||
46 | void returnObject(SceneObjectGroup obj); | ||
47 | void returnLandObjects(int type, LLUUID owner); | ||
48 | void resetLandPrimCounts(); | ||
49 | void addPrimToCount(SceneObjectGroup obj); | ||
50 | void removePrimFromCount(SceneObjectGroup obj); | ||
51 | |||
52 | |||
53 | } | ||
54 | } | ||
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs index 473897f..c757461 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Region.Environment.LandManagement; | ||
32 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
33 | 32 | ||
34 | namespace OpenSim.Region.Environment.Interfaces | 33 | namespace OpenSim.Region.Environment.Interfaces |
@@ -69,7 +68,7 @@ namespace OpenSim.Region.Environment.Interfaces | |||
69 | void StoreTerrain(double[,] terrain, LLUUID regionID); | 68 | void StoreTerrain(double[,] terrain, LLUUID regionID); |
70 | double[,] LoadTerrain(LLUUID regionID); | 69 | double[,] LoadTerrain(LLUUID regionID); |
71 | 70 | ||
72 | void StoreLandObject(Land Parcel, LLUUID regionUUID); | 71 | void StoreLandObject(ILandObject Parcel); |
73 | void RemoveLandObject(LLUUID globalID); | 72 | void RemoveLandObject(LLUUID globalID); |
74 | List<LandData> LoadLandObjects(LLUUID regionUUID); | 73 | List<LandData> LoadLandObjects(LLUUID regionUUID); |
75 | 74 | ||
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs index 0b3c5de..ba0c550 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs | |||
@@ -1,942 +1,916 @@ | |||
1 | /* | 1 | using System; |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | using System.Collections.Generic; |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | using System.Text; |
4 | * | 4 | |
5 | * Redistribution and use in source and binary forms, with or without | 5 | using Axiom.Math; |
6 | * modification, are permitted provided that the following conditions are met: | 6 | using libsecondlife; |
7 | * * Redistributions of source code must retain the above copyright | 7 | using libsecondlife.Packets; |
8 | * notice, this list of conditions and the following disclaimer. | 8 | using OpenSim.Framework; |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | using OpenSim.Framework.Console; |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | using OpenSim.Region.Environment.Scenes; |
11 | * documentation and/or other materials provided with the distribution. | 11 | using OpenSim.Region.Environment.Interfaces; |
12 | * * Neither the name of the OpenSim Project nor the | 12 | using OpenSim.Region.Physics.Manager; |
13 | * names of its contributors may be used to endorse or promote products | 13 | |
14 | * derived from this software without specific prior written permission. | 14 | namespace OpenSim.Region.Environment.Modules.LandManagement |
15 | * | 15 | { |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | public class LandChannel : ILandChannel |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | { |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | #region Constants |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | //Land types set with flags in ParcelOverlay. |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | //Only one of these can be used. |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | public const byte LAND_TYPE_PUBLIC = (byte)0; //Equals 00000000 |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | public const byte LAND_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | public const byte LAND_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 |
26 | */ | 26 | public const byte LAND_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 |
27 | 27 | public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 | |
28 | using System; | 28 | |
29 | using System.Collections.Generic; | 29 | //Flags that when set, a border on the given side will be placed |
30 | using Axiom.Math; | 30 | //NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc) |
31 | using libsecondlife; | 31 | //This took forever to figure out -- jeesh. /blame LL for even having to send these |
32 | using libsecondlife.Packets; | 32 | public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 |
33 | using OpenSim.Framework; | 33 | public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 |
34 | using OpenSim.Framework.Console; | 34 | |
35 | using OpenSim.Region.Environment.Scenes; | 35 | //RequestResults (I think these are right, they seem to work): |
36 | using OpenSim.Region.Environment.Interfaces; | 36 | public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land |
37 | using OpenSim.Region.Physics.Manager; | 37 | public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land |
38 | 38 | ||
39 | namespace OpenSim.Region.Environment.LandManagement | 39 | //ParcelSelectObjects |
40 | { | 40 | public const int LAND_SELECT_OBJECTS_OWNER = 2; |
41 | #region LandManager Class | 41 | public const int LAND_SELECT_OBJECTS_GROUP = 4; |
42 | 42 | public const int LAND_SELECT_OBJECTS_OTHER = 8; | |
43 | /// <summary> | 43 | |
44 | /// Handles Land objects and operations requiring information from other Land objects (divide, join, etc) | 44 | //These are other constants. Yay! |
45 | /// </summary> | 45 | public const int START_LAND_LOCAL_ID = 1; |
46 | public class LandManager | 46 | |
47 | { | 47 | public const float BAN_LINE_SAFETY_HIEGHT = 100; |
48 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 48 | |
49 | 49 | #endregion | |
50 | #region Constants | 50 | |
51 | 51 | private Scene m_scene; | |
52 | //Land types set with flags in ParcelOverlay. | 52 | |
53 | //Only one of these can be used. | 53 | private Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>(); |
54 | public const byte LAND_TYPE_PUBLIC = (byte) 0; //Equals 00000000 | 54 | private int lastLandLocalID = START_LAND_LOCAL_ID - 1; |
55 | public const byte LAND_TYPE_OWNED_BY_OTHER = (byte) 1; //Equals 00000001 | 55 | private int[,] landIDList = new int[64, 64]; |
56 | public const byte LAND_TYPE_OWNED_BY_GROUP = (byte) 2; //Equals 00000010 | 56 | |
57 | public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte) 3; //Equals 00000011 | 57 | private bool landPrimCountTainted = false; |
58 | public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100 | 58 | |
59 | public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101 | 59 | private bool m_allowedForcefulBans = true; |
60 | 60 | public bool allowedForcefulBans | |
61 | //Flags that when set, a border on the given side will be placed | 61 | { |
62 | //NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc) | 62 | get |
63 | //This took forever to figure out -- jeesh. /blame LL for even having to send these | 63 | { |
64 | public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000 | 64 | return m_allowedForcefulBans; |
65 | public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000 | 65 | } |
66 | 66 | set | |
67 | //RequestResults (I think these are right, they seem to work): | 67 | { |
68 | public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land | 68 | m_allowedForcefulBans = value; |
69 | public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land | 69 | } |
70 | 70 | } | |
71 | //ParcelSelectObjects | 71 | |
72 | public const int LAND_SELECT_OBJECTS_OWNER = 2; | 72 | public LandChannel(Scene scene) |
73 | public const int LAND_SELECT_OBJECTS_GROUP = 4; | 73 | { |
74 | public const int LAND_SELECT_OBJECTS_OTHER = 8; | 74 | m_scene = scene; |
75 | 75 | landIDList.Initialize(); | |
76 | //These are other constants. Yay! | 76 | } |
77 | public const int START_LAND_LOCAL_ID = 1; | 77 | #region Land Object From Storage Functions |
78 | 78 | ||
79 | public const float BAN_LINE_SAFETY_HIEGHT = 100; | 79 | public void IncomingLandObjectsFromStorage(List<LandData> data) |
80 | 80 | { | |
81 | #endregion | 81 | for (int i = 0; i < data.Count; i++) |
82 | 82 | { | |
83 | #region Member Variables | 83 | //try |
84 | 84 | //{ | |
85 | public Dictionary<int, Land> landList = new Dictionary<int, Land>(); | 85 | IncomingLandObjectFromStorage(data[i]); |
86 | private int lastLandLocalID = START_LAND_LOCAL_ID - 1; | 86 | //} |
87 | private int[,] landIDList = new int[64,64]; | 87 | //catch (Exception ex) |
88 | 88 | //{ | |
89 | /// <summary> | 89 | //m_log.Error("[LandManager]: IncomingLandObjectsFromStorage: Exception: " + ex.ToString()); |
90 | /// Set to true when a prim is moved, created, added. Performs a prim count update | 90 | //throw ex; |
91 | /// </summary> | 91 | //} |
92 | public bool landPrimCountTainted = false; | 92 | } |
93 | 93 | //foreach (LandData parcel in data) | |
94 | private readonly Scene m_scene; | 94 | //{ |
95 | private readonly RegionInfo m_regInfo; | 95 | // IncomingLandObjectFromStorage(parcel); |
96 | 96 | //} | |
97 | public bool allowedForcefulBans = true; | 97 | } |
98 | 98 | ||
99 | #endregion | 99 | public void IncomingLandObjectFromStorage(LandData data) |
100 | 100 | { | |
101 | #region Constructors | 101 | ILandObject new_land = new LandObject(data.ownerID, data.isGroupOwned, m_scene); |
102 | 102 | new_land.landData = data.Copy(); | |
103 | public LandManager(Scene scene, RegionInfo reginfo) | 103 | new_land.setLandBitmapFromByteArray(); |
104 | { | 104 | addLandObject(new_land); |
105 | m_scene = scene; | 105 | } |
106 | m_regInfo = reginfo; | 106 | |
107 | landIDList.Initialize(); | 107 | public void NoLandDataFromStorage() |
108 | scene.EventManager.OnAvatarEnteringNewParcel += | 108 | { |
109 | new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel); | 109 | resetSimLandObjects(); |
110 | scene.EventManager.OnClientMovement += new EventManager.ClientMovement(handleAnyClientMovement); | 110 | } |
111 | } | 111 | |
112 | 112 | #endregion | |
113 | #endregion | 113 | |
114 | 114 | #region Parcel Add/Remove/Get/Create | |
115 | #region Member Functions | 115 | |
116 | 116 | /// <summary> | |
117 | #region Land Object From Storage Functions | 117 | /// Creates a basic Parcel object without an owner (a zeroed key) |
118 | 118 | /// </summary> | |
119 | public void IncomingLandObjectsFromStorage(List<LandData> data) | 119 | /// <returns></returns> |
120 | { | 120 | public ILandObject createBaseLand() |
121 | for (int i = 0; i < data.Count; i++) | 121 | { |
122 | { | 122 | return new LandObject(LLUUID.Zero, false, m_scene); |
123 | //try | 123 | } |
124 | //{ | 124 | |
125 | IncomingLandObjectFromStorage(data[i]); | 125 | /// <summary> |
126 | //} | 126 | /// Adds a land object to the stored list and adds them to the landIDList to what they own |
127 | //catch (Exception ex) | 127 | /// </summary> |
128 | //{ | 128 | /// <param name="new_land">The land object being added</param> |
129 | //m_log.Error("[LandManager]: IncomingLandObjectsFromStorage: Exception: " + ex.ToString()); | 129 | public ILandObject addLandObject(ILandObject new_land) |
130 | //throw ex; | 130 | { |
131 | //} | 131 | lastLandLocalID++; |
132 | } | 132 | new_land.landData.localID = lastLandLocalID; |
133 | //foreach (LandData parcel in data) | 133 | landList.Add(lastLandLocalID, (LandObject)new_land.Copy()); |
134 | //{ | 134 | |
135 | // IncomingLandObjectFromStorage(parcel); | 135 | |
136 | //} | 136 | bool[,] landBitmap = new_land.getLandBitmap(); |
137 | } | 137 | int x, y; |
138 | 138 | for (x = 0; x < 64; x++) | |
139 | public void IncomingLandObjectFromStorage(LandData data) | 139 | { |
140 | { | 140 | for (y = 0; y < 64; y++) |
141 | Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene); | 141 | { |
142 | new_land.landData = data.Copy(); | 142 | if (landBitmap[x, y]) |
143 | new_land.setLandBitmapFromByteArray(); | 143 | { |
144 | addLandObject(new_land); | 144 | landIDList[x, y] = lastLandLocalID; |
145 | } | 145 | } |
146 | 146 | } | |
147 | public void NoLandDataFromStorage() | 147 | } |
148 | { | 148 | landList[lastLandLocalID].forceUpdateLandInfo(); |
149 | Console.WriteLine("No LandData in storage! Loading a single, flat parcel instead"); | 149 | m_scene.EventManager.TriggerLandObjectAdded(new_land); |
150 | resetSimLandObjects(); | 150 | return new_land; |
151 | } | 151 | } |
152 | 152 | ||
153 | #endregion | 153 | /// <summary> |
154 | 154 | /// Removes a land object from the list. Will not remove if local_id is still owning an area in landIDList | |
155 | #region Parcel Add/Remove/Get/Create | 155 | /// </summary> |
156 | 156 | /// <param name="local_id">Land.localID of the peice of land to remove.</param> | |
157 | /// <summary> | 157 | public void removeLandObject(int local_id) |
158 | /// Creates a basic Parcel object without an owner (a zeroed key) | 158 | { |
159 | /// </summary> | 159 | int x, y; |
160 | /// <returns></returns> | 160 | for (x = 0; x < 64; x++) |
161 | public Land createBaseLand() | 161 | { |
162 | { | 162 | for (y = 0; y < 64; y++) |
163 | return new Land(LLUUID.Zero, false, m_scene); | 163 | { |
164 | } | 164 | if (landIDList[x, y] == local_id) |
165 | 165 | { | |
166 | /// <summary> | 166 | return; |
167 | /// Adds a land object to the stored list and adds them to the landIDList to what they own | 167 | //throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); |
168 | /// </summary> | 168 | } |
169 | /// <param name="new_land">The land object being added</param> | 169 | } |
170 | public Land addLandObject(Land new_land) | 170 | } |
171 | { | 171 | |
172 | lastLandLocalID++; | 172 | m_scene.EventManager.TriggerLandObjectRemoved(landList[local_id].landData.globalID); |
173 | new_land.landData.localID = lastLandLocalID; | 173 | landList.Remove(local_id); |
174 | landList.Add(lastLandLocalID, new_land.Copy()); | 174 | } |
175 | 175 | ||
176 | 176 | public void updateLandObject(int local_id, LandData newData) | |
177 | bool[,] landBitmap = new_land.getLandBitmap(); | 177 | { |
178 | int x, y; | 178 | if (landList.ContainsKey(local_id)) |
179 | for (x = 0; x < 64; x++) | 179 | { |
180 | { | 180 | landList[local_id].landData = newData.Copy(); |
181 | for (y = 0; y < 64; y++) | 181 | m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landList[local_id]); |
182 | { | 182 | } |
183 | if (landBitmap[x, y]) | 183 | } |
184 | { | 184 | |
185 | landIDList[x, y] = lastLandLocalID; | 185 | private void performFinalLandJoin(ILandObject master, ILandObject slave) |
186 | } | 186 | { |
187 | } | 187 | int x, y; |
188 | } | 188 | bool[,] landBitmapSlave = slave.getLandBitmap(); |
189 | landList[lastLandLocalID].forceUpdateLandInfo(); | 189 | for (x = 0; x < 64; x++) |
190 | m_scene.EventManager.TriggerLandObjectAdded(new_land, m_scene.RegionInfo.RegionID); | 190 | { |
191 | return new_land; | 191 | for (y = 0; y < 64; y++) |
192 | } | 192 | { |
193 | 193 | if (landBitmapSlave[x, y]) | |
194 | /// <summary> | 194 | { |
195 | /// Removes a land object from the list. Will not remove if local_id is still owning an area in landIDList | 195 | landIDList[x, y] = master.landData.localID; |
196 | /// </summary> | 196 | } |
197 | /// <param name="local_id">Land.localID of the peice of land to remove.</param> | 197 | } |
198 | public void removeLandObject(int local_id) | 198 | } |
199 | { | 199 | |
200 | int x, y; | 200 | removeLandObject(slave.landData.localID); |
201 | for (x = 0; x < 64; x++) | 201 | updateLandObject(master.landData.localID, master.landData); |
202 | { | 202 | } |
203 | for (y = 0; y < 64; y++) | 203 | |
204 | { | 204 | /// <summary> |
205 | if (landIDList[x, y] == local_id) | 205 | /// Get the land object at the specified point |
206 | { | 206 | /// </summary> |
207 | return; | 207 | /// <param name="x">Value between 0 - 256 on the x axis of the point</param> |
208 | //throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); | 208 | /// <param name="y">Value between 0 - 256 on the y axis of the point</param> |
209 | } | 209 | /// <returns>Land object at the point supplied</returns> |
210 | } | 210 | public ILandObject getLandObject(float x_float, float y_float) |
211 | } | 211 | { |
212 | 212 | int x; | |
213 | m_scene.EventManager.TriggerLandObjectRemoved(landList[local_id].landData.globalID); | 213 | int y; |
214 | landList.Remove(local_id); | 214 | |
215 | } | 215 | try |
216 | 216 | { | |
217 | public void updateLandObject(int local_id, LandData newData) | 217 | x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / Convert.ToDouble(4.0))); |
218 | { | 218 | y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / Convert.ToDouble(4.0))); |
219 | if (landList.ContainsKey(local_id)) | 219 | } |
220 | { | 220 | catch (System.OverflowException) |
221 | landList[local_id].landData = newData.Copy(); | 221 | { |
222 | m_scene.EventManager.TriggerLandObjectUpdated((uint) local_id, landList[local_id]); | 222 | return null; |
223 | } | 223 | } |
224 | else | 224 | |
225 | { | 225 | if (x >= 64 || y >= 64 || x < 0 || y < 0) |
226 | //throw new Exception("Could not update land object. Local ID '" + local_id + "' does not exist"); | 226 | { |
227 | } | 227 | return null; |
228 | } | 228 | } |
229 | 229 | else | |
230 | private void performFinalLandJoin(Land master, Land slave) | 230 | { |
231 | { | 231 | return landList[landIDList[x, y]]; |
232 | int x, y; | 232 | } |
233 | bool[,] landBitmapSlave = slave.getLandBitmap(); | 233 | } |
234 | for (x = 0; x < 64; x++) | 234 | |
235 | { | 235 | public ILandObject getLandObject(int x, int y) |
236 | for (y = 0; y < 64; y++) | 236 | { |
237 | { | 237 | if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) |
238 | if (landBitmapSlave[x, y]) | 238 | { |
239 | { | 239 | // These exceptions here will cause a lot of complaints from the users specifically because |
240 | landIDList[x, y] = master.landData.localID; | 240 | // they happen every time at border crossings |
241 | } | 241 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); |
242 | } | 242 | } |
243 | } | 243 | else |
244 | 244 | { | |
245 | removeLandObject(slave.landData.localID); | 245 | return landList[landIDList[x / 4, y / 4]]; |
246 | updateLandObject(master.landData.localID, master.landData); | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | /// <summary> | 249 | #endregion |
250 | /// Get the land object at the specified point | 250 | |
251 | /// </summary> | 251 | #region Parcel Modification |
252 | /// <param name="x">Value between 0 - 256 on the x axis of the point</param> | 252 | |
253 | /// <param name="y">Value between 0 - 256 on the y axis of the point</param> | 253 | /// <summary> |
254 | /// <returns>Land object at the point supplied</returns> | 254 | /// Subdivides a piece of land |
255 | public Land getLandObject(float x_float, float y_float) | 255 | /// </summary> |
256 | { | 256 | /// <param name="start_x">West Point</param> |
257 | int x; | 257 | /// <param name="start_y">South Point</param> |
258 | int y; | 258 | /// <param name="end_x">East Point</param> |
259 | 259 | /// <param name="end_y">North Point</param> | |
260 | try | 260 | /// <param name="attempting_user_id">LLUUID of user who is trying to subdivide</param> |
261 | { | 261 | /// <returns>Returns true if successful</returns> |
262 | x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / Convert.ToDouble(4.0))); | 262 | private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) |
263 | y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / Convert.ToDouble(4.0))); | 263 | { |
264 | } | 264 | //First, lets loop through the points and make sure they are all in the same peice of land |
265 | catch (System.OverflowException) | 265 | //Get the land object at start |
266 | { | 266 | ILandObject startLandObject = null; |
267 | return null; | 267 | try |
268 | } | 268 | { |
269 | 269 | startLandObject = getLandObject(start_x, start_y); | |
270 | if (x >= 64 || y >= 64 || x < 0 || y < 0) | 270 | } |
271 | { | 271 | catch (Exception) |
272 | return null; | 272 | { |
273 | } | 273 | //m_log.Error("[LAND]: " + "Unable to get land object for subdivision at x: " + start_x + " y:" + start_y); |
274 | else | 274 | } |
275 | { | 275 | if (startLandObject == null) return false; //No such land object at the beginning |
276 | // Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")"); | 276 | |
277 | return landList[landIDList[x, y]]; | 277 | //Loop through the points |
278 | } | 278 | try |
279 | } | 279 | { |
280 | 280 | int totalX = end_x - start_x; | |
281 | public Land getLandObject(int x, int y) | 281 | int totalY = end_y - start_y; |
282 | { | 282 | int x, y; |
283 | if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) | 283 | for (y = 0; y < totalY; y++) |
284 | { | 284 | { |
285 | // These exceptions here will cause a lot of complaints from the users specifically because | 285 | for (x = 0; x < totalX; x++) |
286 | // they happen every time at border crossings | 286 | { |
287 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); | 287 | ILandObject tempLandObject = getLandObject(start_x + x, start_y + y); |
288 | } | 288 | if (tempLandObject == null) return false; //No such land object at that point |
289 | else | 289 | if (tempLandObject != startLandObject) return false; //Subdividing over 2 land objects; no-no |
290 | { | 290 | } |
291 | return landList[landIDList[x/4, y/4]]; | 291 | } |
292 | } | 292 | } |
293 | } | 293 | catch (Exception) |
294 | 294 | { | |
295 | #endregion | 295 | return false; //Exception. For now, lets skip subdivision |
296 | 296 | } | |
297 | #region Parcel Modification | 297 | |
298 | 298 | //If we are still here, then they are subdividing within one piece of land | |
299 | /// <summary> | 299 | //Check owner |
300 | /// Subdivides a piece of land | 300 | if (startLandObject.landData.ownerID != attempting_user_id) |
301 | /// </summary> | 301 | { |
302 | /// <param name="start_x">West Point</param> | 302 | return false; //They cant do this! |
303 | /// <param name="start_y">South Point</param> | 303 | } |
304 | /// <param name="end_x">East Point</param> | 304 | |
305 | /// <param name="end_y">North Point</param> | 305 | //Lets create a new land object with bitmap activated at that point (keeping the old land objects info) |
306 | /// <param name="attempting_user_id">LLUUID of user who is trying to subdivide</param> | 306 | ILandObject newLand = startLandObject.Copy(); |
307 | /// <returns>Returns true if successful</returns> | 307 | newLand.landData.landName = "Subdivision of " + newLand.landData.landName; |
308 | private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) | 308 | newLand.landData.globalID = LLUUID.Random(); |
309 | { | 309 | |
310 | //First, lets loop through the points and make sure they are all in the same peice of land | 310 | newLand.setLandBitmap(newLand.getSquareLandBitmap(start_x, start_y, end_x, end_y)); |
311 | //Get the land object at start | 311 | |
312 | Land startLandObject = null; | 312 | //Now, lets set the subdivision area of the original to false |
313 | try | 313 | int startLandObjectIndex = startLandObject.landData.localID; |
314 | { | 314 | landList[startLandObjectIndex].setLandBitmap( |
315 | startLandObject = getLandObject(start_x, start_y); | 315 | newLand.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false)); |
316 | } | 316 | landList[startLandObjectIndex].forceUpdateLandInfo(); |
317 | catch (Exception) | 317 | |
318 | { | 318 | setPrimsTainted(); |
319 | m_log.Error("[LAND]: " + "Unable to get land object for subdivision at x: " + start_x + " y:" + start_y); | 319 | |
320 | } | 320 | //Now add the new land object |
321 | if (startLandObject == null) return false; //No such land object at the beginning | 321 | ILandObject result = addLandObject(newLand); |
322 | 322 | updateLandObject(startLandObject.landData.localID, startLandObject.landData); | |
323 | //Loop through the points | 323 | result.sendLandUpdateToAvatarsOverMe(); |
324 | try | 324 | |
325 | { | 325 | |
326 | int totalX = end_x - start_x; | 326 | return true; |
327 | int totalY = end_y - start_y; | 327 | } |
328 | int x, y; | 328 | |
329 | for (y = 0; y < totalY; y++) | 329 | /// <summary> |
330 | { | 330 | /// Join 2 land objects together |
331 | for (x = 0; x < totalX; x++) | 331 | /// </summary> |
332 | { | 332 | /// <param name="start_x">x value in first piece of land</param> |
333 | Land tempLandObject = getLandObject(start_x + x, start_y + y); | 333 | /// <param name="start_y">y value in first piece of land</param> |
334 | if (tempLandObject == null) return false; //No such land object at that point | 334 | /// <param name="end_x">x value in second peice of land</param> |
335 | if (tempLandObject != startLandObject) return false; //Subdividing over 2 land objects; no-no | 335 | /// <param name="end_y">y value in second peice of land</param> |
336 | } | 336 | /// <param name="attempting_user_id">LLUUID of the avatar trying to join the land objects</param> |
337 | } | 337 | /// <returns>Returns true if successful</returns> |
338 | } | 338 | private bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) |
339 | catch (Exception) | 339 | { |
340 | { | 340 | end_x -= 4; |
341 | return false; //Exception. For now, lets skip subdivision | 341 | end_y -= 4; |
342 | } | 342 | |
343 | 343 | List<ILandObject> selectedLandObjects = new List<ILandObject>(); | |
344 | //If we are still here, then they are subdividing within one piece of land | 344 | int stepXSelected = 0; |
345 | //Check owner | 345 | int stepYSelected = 0; |
346 | if (startLandObject.landData.ownerID != attempting_user_id) | 346 | for (stepYSelected = start_y; stepYSelected <= end_y; stepYSelected += 4) |
347 | { | 347 | { |
348 | return false; //They cant do this! | 348 | for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) |
349 | } | 349 | { |
350 | 350 | ILandObject p = null; | |
351 | //Lets create a new land object with bitmap activated at that point (keeping the old land objects info) | 351 | try |
352 | Land newLand = startLandObject.Copy(); | 352 | { |
353 | newLand.landData.landName = "Subdivision of " + newLand.landData.landName; | 353 | p = getLandObject(stepXSelected, stepYSelected); |
354 | newLand.landData.globalID = LLUUID.Random(); | 354 | } |
355 | 355 | catch (Exception) | |
356 | newLand.setLandBitmap(Land.getSquareLandBitmap(start_x, start_y, end_x, end_y)); | 356 | { |
357 | 357 | //m_log.Error("[LAND]: " + "Unable to get land object for subdivision at x: " + stepXSelected + " y:" + stepYSelected); | |
358 | //Now, lets set the subdivision area of the original to false | 358 | } |
359 | int startLandObjectIndex = startLandObject.landData.localID; | 359 | if (p != null) |
360 | landList[startLandObjectIndex].setLandBitmap( | 360 | { |
361 | Land.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false)); | 361 | if (!selectedLandObjects.Contains(p)) |
362 | landList[startLandObjectIndex].forceUpdateLandInfo(); | 362 | { |
363 | 363 | selectedLandObjects.Add(p); | |
364 | setPrimsTainted(); | 364 | } |
365 | 365 | } | |
366 | //Now add the new land object | 366 | } |
367 | Land result = addLandObject(newLand); | 367 | } |
368 | updateLandObject(startLandObject.landData.localID, startLandObject.landData); | 368 | ILandObject masterLandObject = selectedLandObjects[0]; |
369 | result.sendLandUpdateToAvatarsOverMe(); | 369 | selectedLandObjects.RemoveAt(0); |
370 | 370 | ||
371 | 371 | ||
372 | return true; | 372 | if (selectedLandObjects.Count < 1) |
373 | } | 373 | { |
374 | 374 | return false; //Only one piece of land selected | |
375 | /// <summary> | 375 | } |
376 | /// Join 2 land objects together | 376 | if (masterLandObject.landData.ownerID != attempting_user_id) |
377 | /// </summary> | 377 | { |
378 | /// <param name="start_x">x value in first piece of land</param> | 378 | return false; //Not the same owner |
379 | /// <param name="start_y">y value in first piece of land</param> | 379 | } |
380 | /// <param name="end_x">x value in second peice of land</param> | 380 | foreach (ILandObject p in selectedLandObjects) |
381 | /// <param name="end_y">y value in second peice of land</param> | 381 | { |
382 | /// <param name="attempting_user_id">LLUUID of the avatar trying to join the land objects</param> | 382 | if (p.landData.ownerID != masterLandObject.landData.ownerID) |
383 | /// <returns>Returns true if successful</returns> | 383 | { |
384 | private bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) | 384 | return false; //Over multiple users. TODO: make this just ignore this piece of land? |
385 | { | 385 | } |
386 | end_x -= 4; | 386 | } |
387 | end_y -= 4; | 387 | foreach (ILandObject slaveLandObject in selectedLandObjects) |
388 | 388 | { | |
389 | List<Land> selectedLandObjects = new List<Land>(); | 389 | landList[masterLandObject.landData.localID].setLandBitmap( |
390 | int stepXSelected = 0; | 390 | slaveLandObject.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap())); |
391 | int stepYSelected = 0; | 391 | performFinalLandJoin(masterLandObject, slaveLandObject); |
392 | for (stepYSelected = start_y; stepYSelected <= end_y; stepYSelected += 4) | 392 | } |
393 | { | 393 | |
394 | for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) | 394 | |
395 | { | 395 | setPrimsTainted(); |
396 | Land p = null; | 396 | |
397 | try | 397 | masterLandObject.sendLandUpdateToAvatarsOverMe(); |
398 | { | 398 | |
399 | p = getLandObject(stepXSelected, stepYSelected); | 399 | return true; |
400 | } | 400 | } |
401 | catch (Exception) | 401 | |
402 | { | 402 | public void resetAllLandPrimCounts() |
403 | m_log.Error("[LAND]: " + "Unable to get land object for subdivision at x: " + stepXSelected + " y:" + stepYSelected); | 403 | { |
404 | } | 404 | foreach (LandObject p in landList.Values) |
405 | if (p != null) | 405 | { |
406 | { | 406 | p.resetLandPrimCounts(); |
407 | if (!selectedLandObjects.Contains(p)) | 407 | } |
408 | { | 408 | } |
409 | selectedLandObjects.Add(p); | 409 | |
410 | } | 410 | public void setPrimsTainted() |
411 | } | 411 | { |
412 | } | 412 | landPrimCountTainted = true; |
413 | } | 413 | } |
414 | Land masterLandObject = selectedLandObjects[0]; | 414 | |
415 | selectedLandObjects.RemoveAt(0); | 415 | public bool isLandPrimCountTainted() |
416 | 416 | { | |
417 | 417 | return landPrimCountTainted; | |
418 | if (selectedLandObjects.Count < 1) | 418 | } |
419 | { | 419 | |
420 | return false; //Only one piece of land selected | 420 | public void addPrimToLandPrimCounts(SceneObjectGroup obj) |
421 | } | 421 | { |
422 | if (masterLandObject.landData.ownerID != attempting_user_id) | 422 | LLVector3 position = obj.AbsolutePosition; |
423 | { | 423 | ILandObject landUnderPrim = getLandObject(position.X, position.Y); |
424 | return false; //Not the same owner | 424 | if (landUnderPrim != null) |
425 | } | 425 | { |
426 | foreach (Land p in selectedLandObjects) | 426 | landUnderPrim.addPrimToCount(obj); |
427 | { | 427 | } |
428 | if (p.landData.ownerID != masterLandObject.landData.ownerID) | 428 | } |
429 | { | 429 | |
430 | return false; //Over multiple users. TODO: make this just ignore this piece of land? | 430 | public void removePrimFromLandPrimCounts(SceneObjectGroup obj) |
431 | } | 431 | { |
432 | } | 432 | foreach (LandObject p in landList.Values) |
433 | foreach (Land slaveLandObject in selectedLandObjects) | 433 | { |
434 | { | 434 | p.removePrimFromCount(obj); |
435 | landList[masterLandObject.landData.localID].setLandBitmap( | 435 | } |
436 | Land.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap())); | 436 | } |
437 | performFinalLandJoin(masterLandObject, slaveLandObject); | 437 | |
438 | } | 438 | public void finalizeLandPrimCountUpdate() |
439 | 439 | { | |
440 | 440 | //Get Simwide prim count for owner | |
441 | setPrimsTainted(); | 441 | Dictionary<LLUUID, List<LandObject>> landOwnersAndParcels = new Dictionary<LLUUID, List<LandObject>>(); |
442 | 442 | foreach (LandObject p in landList.Values) | |
443 | masterLandObject.sendLandUpdateToAvatarsOverMe(); | 443 | { |
444 | 444 | if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID)) | |
445 | return true; | 445 | { |
446 | } | 446 | List<LandObject> tempList = new List<LandObject>(); |
447 | 447 | tempList.Add(p); | |
448 | #endregion | 448 | landOwnersAndParcels.Add(p.landData.ownerID, tempList); |
449 | 449 | } | |
450 | #region Parcel Updating | 450 | else |
451 | 451 | { | |
452 | /// <summary> | 452 | landOwnersAndParcels[p.landData.ownerID].Add(p); |
453 | /// Where we send the ParcelOverlay packet to the client | 453 | } |
454 | /// </summary> | 454 | } |
455 | /// <param name="remote_client">The object representing the client</param> | 455 | |
456 | public void sendParcelOverlay(IClientAPI remote_client) | 456 | foreach (LLUUID owner in landOwnersAndParcels.Keys) |
457 | { | 457 | { |
458 | const int LAND_BLOCKS_PER_PACKET = 1024; | 458 | int simArea = 0; |
459 | int x, y = 0; | 459 | int simPrims = 0; |
460 | byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | 460 | foreach (LandObject p in landOwnersAndParcels[owner]) |
461 | int byteArrayCount = 0; | 461 | { |
462 | int sequenceID = 0; | 462 | simArea += p.landData.area; |
463 | ParcelOverlayPacket packet; | 463 | simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims + |
464 | 464 | p.landData.selectedPrims; | |
465 | for (y = 0; y < 64; y++) | 465 | } |
466 | { | 466 | |
467 | for (x = 0; x < 64; x++) | 467 | foreach (LandObject p in landOwnersAndParcels[owner]) |
468 | { | 468 | { |
469 | byte tempByte = (byte) 0; //This represents the byte for the current 4x4 | 469 | p.landData.simwideArea = simArea; |
470 | Land currentParcelBlock = null; | 470 | p.landData.simwidePrims = simPrims; |
471 | 471 | } | |
472 | try | 472 | } |
473 | { | 473 | } |
474 | currentParcelBlock = getLandObject(x * 4, y * 4); | 474 | |
475 | } | 475 | public void updateLandPrimCounts() |
476 | catch (Exception) | 476 | { |
477 | { | 477 | foreach (EntityBase obj in m_scene.Entities.Values) |
478 | m_log.Warn("[LAND]: " + "unable to get land at x: " + (x * 4) + " y: " + (y * 4)); | 478 | { |
479 | } | 479 | if (obj is SceneObjectGroup) |
480 | 480 | { | |
481 | 481 | m_scene.EventManager.TriggerParcelPrimCountAdd((SceneObjectGroup)obj); | |
482 | if (currentParcelBlock != null) | 482 | } |
483 | { | 483 | } |
484 | if (currentParcelBlock.landData.ownerID == remote_client.AgentId) | 484 | } |
485 | { | 485 | |
486 | //Owner Flag | 486 | public void performParcelPrimCountUpdate() |
487 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER); | 487 | { |
488 | } | 488 | resetAllLandPrimCounts(); |
489 | else if (currentParcelBlock.landData.salePrice > 0 && | 489 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
490 | (currentParcelBlock.landData.authBuyerID == LLUUID.Zero || | 490 | finalizeLandPrimCountUpdate(); |
491 | currentParcelBlock.landData.authBuyerID == remote_client.AgentId)) | 491 | landPrimCountTainted = false; |
492 | { | 492 | } |
493 | //Sale Flag | 493 | #endregion |
494 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE); | 494 | |
495 | } | 495 | #region Parcel Updating |
496 | else if (currentParcelBlock.landData.ownerID == LLUUID.Zero) | 496 | |
497 | { | 497 | /// <summary> |
498 | //Public Flag | 498 | /// Where we send the ParcelOverlay packet to the client |
499 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_PUBLIC); | 499 | /// </summary> |
500 | } | 500 | /// <param name="remote_client">The object representing the client</param> |
501 | else | 501 | public void sendParcelOverlay(IClientAPI remote_client) |
502 | { | 502 | { |
503 | //Other Flag | 503 | const int LAND_BLOCKS_PER_PACKET = 1024; |
504 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_OTHER); | 504 | int x, y = 0; |
505 | } | 505 | byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; |
506 | 506 | int byteArrayCount = 0; | |
507 | 507 | int sequenceID = 0; | |
508 | //Now for border control | 508 | ParcelOverlayPacket packet; |
509 | try | 509 | |
510 | { | 510 | for (y = 0; y < 64; y++) |
511 | Land westParcel = null; | 511 | { |
512 | Land southParcel = null; | 512 | for (x = 0; x < 64; x++) |
513 | if (x > 0) | 513 | { |
514 | { | 514 | byte tempByte = (byte)0; //This represents the byte for the current 4x4 |
515 | westParcel = getLandObject((x - 1)*4, y*4); | 515 | ILandObject currentParcelBlock = null; |
516 | } | 516 | |
517 | if (y > 0) | 517 | try |
518 | { | 518 | { |
519 | southParcel = getLandObject(x*4, (y - 1)*4); | 519 | currentParcelBlock = getLandObject(x * 4, y * 4); |
520 | } | 520 | } |
521 | 521 | catch (Exception) | |
522 | if (x == 0) | 522 | { |
523 | { | 523 | //m_log.Warn("[LAND]: " + "unable to get land at x: " + (x * 4) + " y: " + (y * 4)); |
524 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); | 524 | } |
525 | } | 525 | |
526 | else if (westParcel != null && westParcel != currentParcelBlock) | 526 | |
527 | { | 527 | if (currentParcelBlock != null) |
528 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); | 528 | { |
529 | } | 529 | if (currentParcelBlock.landData.ownerID == remote_client.AgentId) |
530 | 530 | { | |
531 | if (y == 0) | 531 | //Owner Flag |
532 | { | 532 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER); |
533 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); | 533 | } |
534 | } | 534 | else if (currentParcelBlock.landData.salePrice > 0 && |
535 | else if (southParcel != null && southParcel != currentParcelBlock) | 535 | (currentParcelBlock.landData.authBuyerID == LLUUID.Zero || |
536 | { | 536 | currentParcelBlock.landData.authBuyerID == remote_client.AgentId)) |
537 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); | 537 | { |
538 | } | 538 | //Sale Flag |
539 | 539 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE); | |
540 | byteArray[byteArrayCount] = tempByte; | 540 | } |
541 | byteArrayCount++; | 541 | else if (currentParcelBlock.landData.ownerID == LLUUID.Zero) |
542 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) | 542 | { |
543 | { | 543 | //Public Flag |
544 | byteArrayCount = 0; | 544 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_PUBLIC); |
545 | packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay); | 545 | } |
546 | packet.ParcelData.Data = byteArray; | 546 | else |
547 | packet.ParcelData.SequenceID = sequenceID; | 547 | { |
548 | remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task); | 548 | //Other Flag |
549 | sequenceID++; | 549 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_OTHER); |
550 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | 550 | } |
551 | } | 551 | |
552 | } | 552 | |
553 | catch (Exception e) | 553 | //Now for border control |
554 | { | 554 | try |
555 | m_log.Debug("[LAND]: Skipped Land checks because avatar is out of bounds: " + e.Message); | 555 | { |
556 | } | 556 | ILandObject westParcel = null; |
557 | } | 557 | ILandObject southParcel = null; |
558 | } | 558 | if (x > 0) |
559 | } | 559 | { |
560 | } | 560 | westParcel = getLandObject((x - 1) * 4, y * 4); |
561 | 561 | } | |
562 | public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, | 562 | if (y > 0) |
563 | bool snap_selection, IClientAPI remote_client) | 563 | { |
564 | { | 564 | southParcel = getLandObject(x * 4, (y - 1) * 4); |
565 | //Get the land objects within the bounds | 565 | } |
566 | List<Land> temp = new List<Land>(); | 566 | |
567 | int x, y, i; | 567 | if (x == 0) |
568 | int inc_x = end_x - start_x; | 568 | { |
569 | int inc_y = end_y - start_y; | 569 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); |
570 | for (x = 0; x < inc_x; x++) | 570 | } |
571 | { | 571 | else if (westParcel != null && westParcel != currentParcelBlock) |
572 | for (y = 0; y < inc_y; y++) | 572 | { |
573 | { | 573 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); |
574 | 574 | } | |
575 | Land currentParcel = null; | 575 | |
576 | try | 576 | if (y == 0) |
577 | { | 577 | { |
578 | currentParcel = getLandObject(start_x + x, start_y + y); | 578 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); |
579 | } | 579 | } |
580 | catch (Exception) | 580 | else if (southParcel != null && southParcel != currentParcelBlock) |
581 | { | 581 | { |
582 | m_log.Warn("[LAND]: " + "unable to get land at x: " + (start_x + x) + " y: " + (start_y + y)); | 582 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); |
583 | } | 583 | } |
584 | if (currentParcel != null) | 584 | |
585 | { | 585 | byteArray[byteArrayCount] = tempByte; |
586 | if (!temp.Contains(currentParcel)) | 586 | byteArrayCount++; |
587 | { | 587 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) |
588 | currentParcel.forceUpdateLandInfo(); | 588 | { |
589 | temp.Add(currentParcel); | 589 | byteArrayCount = 0; |
590 | } | 590 | packet = (ParcelOverlayPacket)PacketPool.Instance.GetPacket(PacketType.ParcelOverlay); |
591 | } | 591 | packet.ParcelData.Data = byteArray; |
592 | } | 592 | packet.ParcelData.SequenceID = sequenceID; |
593 | } | 593 | remote_client.OutPacket((Packet)packet, ThrottleOutPacketType.Task); |
594 | 594 | sequenceID++; | |
595 | int requestResult = LAND_RESULT_SINGLE; | 595 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; |
596 | if (temp.Count > 1) | 596 | } |
597 | { | 597 | } |
598 | requestResult = LAND_RESULT_MULTIPLE; | 598 | catch (Exception e) |
599 | } | 599 | { |
600 | 600 | //m_log.Debug("[LAND]: Skipped Land checks because avatar is out of bounds: " + e.Message); | |
601 | for (i = 0; i < temp.Count; i++) | 601 | } |
602 | { | 602 | } |
603 | temp[i].sendLandProperties(sequence_id, snap_selection, requestResult, remote_client); | 603 | } |
604 | } | 604 | } |
605 | 605 | } | |
606 | 606 | ||
607 | sendParcelOverlay(remote_client); | 607 | public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, |
608 | } | 608 | bool snap_selection, IClientAPI remote_client) |
609 | 609 | { | |
610 | public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) | 610 | //Get the land objects within the bounds |
611 | { | 611 | List<ILandObject> temp = new List<ILandObject>(); |
612 | if (landList.ContainsKey(packet.ParcelData.LocalID)) | 612 | int x, y, i; |
613 | { | 613 | int inc_x = end_x - start_x; |
614 | landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); | 614 | int inc_y = end_y - start_y; |
615 | } | 615 | for (x = 0; x < inc_x; x++) |
616 | } | 616 | { |
617 | 617 | for (y = 0; y < inc_y; y++) | |
618 | public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) | 618 | { |
619 | { | 619 | |
620 | subdivide(west, south, east, north, remote_client.AgentId); | 620 | ILandObject currentParcel = null; |
621 | } | 621 | try |
622 | 622 | { | |
623 | public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) | 623 | currentParcel = getLandObject(start_x + x, start_y + y); |
624 | { | 624 | } |
625 | join(west, south, east, north, remote_client.AgentId); | 625 | catch (Exception) |
626 | } | 626 | { |
627 | 627 | //m_log.Warn("[LAND]: " + "unable to get land at x: " + (start_x + x) + " y: " + (start_y + y)); | |
628 | public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) | 628 | } |
629 | { | 629 | if (currentParcel != null) |
630 | landList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); | 630 | { |
631 | } | 631 | if (!temp.Contains(currentParcel)) |
632 | 632 | { | |
633 | public void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client) | 633 | currentParcel.forceUpdateLandInfo(); |
634 | { | 634 | temp.Add(currentParcel); |
635 | landList[local_id].sendLandObjectOwners(remote_client); | 635 | } |
636 | } | 636 | } |
637 | 637 | } | |
638 | #endregion | 638 | } |
639 | 639 | ||
640 | /// <summary> | 640 | int requestResult = LAND_RESULT_SINGLE; |
641 | /// Resets the sim to the default land object (full sim piece of land owned by the default user) | 641 | if (temp.Count > 1) |
642 | /// </summary> | 642 | { |
643 | public void resetSimLandObjects() | 643 | requestResult = LAND_RESULT_MULTIPLE; |
644 | { | 644 | } |
645 | //Remove all the land objects in the sim and add a blank, full sim land object set to public | 645 | |
646 | landList.Clear(); | 646 | for (i = 0; i < temp.Count; i++) |
647 | lastLandLocalID = START_LAND_LOCAL_ID - 1; | 647 | { |
648 | landIDList.Initialize(); | 648 | temp[i].sendLandProperties(sequence_id, snap_selection, requestResult, remote_client); |
649 | 649 | } | |
650 | Land fullSimParcel = new Land(LLUUID.Zero, false, m_scene); | 650 | |
651 | 651 | ||
652 | fullSimParcel.setLandBitmap(Land.getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | 652 | sendParcelOverlay(remote_client); |
653 | fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID; | 653 | } |
654 | 654 | ||
655 | addLandObject(fullSimParcel); | 655 | public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) |
656 | } | 656 | { |
657 | 657 | if (landList.ContainsKey(packet.ParcelData.LocalID)) | |
658 | public List<Land> parcelsNearPoint(LLVector3 position) | 658 | { |
659 | { | 659 | landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); |
660 | List<Land> parcelsNear = new List<Land>(); | 660 | } |
661 | int x, y; | 661 | } |
662 | for (x = -4; x <= 4; x += 4) | 662 | |
663 | { | 663 | public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) |
664 | for (y = -4; y <= 4; y += 4) | 664 | { |
665 | { | 665 | subdivide(west, south, east, north, remote_client.AgentId); |
666 | Land check = getLandObject(position.X + x, position.Y + y); | 666 | } |
667 | if (check != null) | 667 | |
668 | { | 668 | public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) |
669 | if (!parcelsNear.Contains(check)) | 669 | { |
670 | { | 670 | join(west, south, east, north, remote_client.AgentId); |
671 | parcelsNear.Add(check); | 671 | } |
672 | } | 672 | |
673 | } | 673 | public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) |
674 | } | 674 | { |
675 | } | 675 | landList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); |
676 | 676 | } | |
677 | return parcelsNear; | 677 | |
678 | } | 678 | public void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client) |
679 | 679 | { | |
680 | public void sendYouAreBannedNotice(ScenePresence avatar) | 680 | landList[local_id].sendLandObjectOwners(remote_client); |
681 | { | 681 | } |
682 | if (allowedForcefulBans) | 682 | |
683 | { | 683 | #endregion |
684 | avatar.ControllingClient.SendAlertMessage( | 684 | |
685 | "You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers"); | 685 | /// <summary> |
686 | 686 | /// Resets the sim to the default land object (full sim piece of land owned by the default user) | |
687 | avatar.PhysicsActor.Position = | 687 | /// </summary> |
688 | new PhysicsVector(avatar.lastKnownAllowedPosition.x, avatar.lastKnownAllowedPosition.y, | 688 | public void resetSimLandObjects() |
689 | avatar.lastKnownAllowedPosition.z); | 689 | { |
690 | avatar.PhysicsActor.Velocity = new PhysicsVector(0, 0, 0); | 690 | //Remove all the land objects in the sim and add a blank, full sim land object set to public |
691 | } | 691 | landList.Clear(); |
692 | else | 692 | lastLandLocalID = START_LAND_LOCAL_ID - 1; |
693 | { | 693 | landIDList.Initialize(); |
694 | avatar.ControllingClient.SendAlertMessage( | 694 | |
695 | "You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim! <3 OpenSim Developers"); | 695 | ILandObject fullSimParcel = new LandObject(LLUUID.Zero, false, m_scene); |
696 | } | 696 | |
697 | } | 697 | fullSimParcel.setLandBitmap(fullSimParcel.getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); |
698 | 698 | fullSimParcel.landData.ownerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; | |
699 | public void handleAvatarChangingParcel(ScenePresence avatar, int localLandID, LLUUID regionID) | 699 | |
700 | { | 700 | addLandObject(fullSimParcel); |
701 | if (m_scene.RegionInfo.RegionID == regionID) | 701 | } |
702 | { | 702 | |
703 | if (landList[localLandID] != null) | 703 | public List<ILandObject> parcelsNearPoint(LLVector3 position) |
704 | { | 704 | { |
705 | Land parcelAvatarIsEntering = landList[localLandID]; | 705 | List<ILandObject> parcelsNear = new List<ILandObject>(); |
706 | if (avatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT) | 706 | int x, y; |
707 | { | 707 | for (x = -4; x <= 4; x += 4) |
708 | if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID)) | 708 | { |
709 | { | 709 | for (y = -4; y <= 4; y += 4) |
710 | sendYouAreBannedNotice(avatar); | 710 | { |
711 | } | 711 | ILandObject check = getLandObject(position.X + x, position.Y + y); |
712 | else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID)) | 712 | if (check != null) |
713 | { | 713 | { |
714 | avatar.ControllingClient.SendAlertMessage( | 714 | if (!parcelsNear.Contains(check)) |
715 | "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!). <3 OpenSim Developers"); | 715 | { |
716 | } | 716 | parcelsNear.Add(check); |
717 | else | 717 | } |
718 | { | 718 | } |
719 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | 719 | } |
720 | } | 720 | } |
721 | } | 721 | |
722 | else | 722 | return parcelsNear; |
723 | { | 723 | } |
724 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | 724 | |
725 | } | 725 | public void sendYouAreBannedNotice(ScenePresence avatar) |
726 | } | 726 | { |
727 | } | 727 | if (allowedForcefulBans) |
728 | } | 728 | { |
729 | 729 | avatar.ControllingClient.SendAlertMessage( | |
730 | public void sendOutNearestBanLine(IClientAPI avatar) | 730 | "You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers"); |
731 | { | 731 | |
732 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 732 | avatar.PhysicsActor.Position = |
733 | foreach (ScenePresence presence in avatars) | 733 | new PhysicsVector(avatar.lastKnownAllowedPosition.x, avatar.lastKnownAllowedPosition.y, |
734 | { | 734 | avatar.lastKnownAllowedPosition.z); |
735 | if (presence.UUID == avatar.AgentId) | 735 | avatar.PhysicsActor.Velocity = new PhysicsVector(0, 0, 0); |
736 | { | 736 | } |
737 | 737 | else | |
738 | List<Land> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition); | 738 | { |
739 | foreach (Land checkBan in checkLandParcels) | 739 | avatar.ControllingClient.SendAlertMessage( |
740 | { | 740 | "You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim! <3 OpenSim Developers"); |
741 | if (checkBan.isBannedFromLand(avatar.AgentId)) | 741 | } |
742 | { | 742 | } |
743 | checkBan.sendLandProperties(-30000, false, (int) ParcelManager.ParcelResult.Single, avatar); | 743 | |
744 | return; //Only send one | 744 | public void handleAvatarChangingParcel(ScenePresence avatar, int localLandID, LLUUID regionID) |
745 | } | 745 | { |
746 | else if (checkBan.isRestrictedFromLand(avatar.AgentId)) | 746 | if (m_scene.RegionInfo.RegionID == regionID) |
747 | { | 747 | { |
748 | checkBan.sendLandProperties(-40000, false, (int) ParcelManager.ParcelResult.Single, avatar); | 748 | if (landList[localLandID] != null) |
749 | return; //Only send one | 749 | { |
750 | } | 750 | ILandObject parcelAvatarIsEntering = landList[localLandID]; |
751 | } | 751 | if (avatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT) |
752 | return; | 752 | { |
753 | } | 753 | if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID)) |
754 | } | 754 | { |
755 | } | 755 | sendYouAreBannedNotice(avatar); |
756 | 756 | } | |
757 | public void sendLandUpdate(ScenePresence avatar, bool force) | 757 | else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID)) |
758 | { | 758 | { |
759 | Land over = null; | 759 | avatar.ControllingClient.SendAlertMessage( |
760 | try | 760 | "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!). <3 OpenSim Developers"); |
761 | { | 761 | } |
762 | over = getLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), | 762 | else |
763 | (int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); | 763 | { |
764 | } | 764 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; |
765 | catch (Exception) | 765 | } |
766 | { | 766 | } |
767 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + Math.Round(avatar.AbsolutePosition.Y)); | 767 | else |
768 | } | 768 | { |
769 | 769 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | |
770 | if (over != null) | 770 | } |
771 | { | 771 | } |
772 | if (force) | 772 | } |
773 | { | 773 | } |
774 | if (!avatar.IsChildAgent) | 774 | |
775 | { | 775 | public void sendOutNearestBanLine(IClientAPI avatar) |
776 | over.sendLandUpdateToClient(avatar.ControllingClient); | 776 | { |
777 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, | 777 | List<ScenePresence> avatars = m_scene.GetAvatars(); |
778 | m_scene.RegionInfo.RegionID); | 778 | foreach (ScenePresence presence in avatars) |
779 | } | 779 | { |
780 | } | 780 | if (presence.UUID == avatar.AgentId) |
781 | 781 | { | |
782 | if (avatar.currentParcelUUID != over.landData.globalID) | 782 | |
783 | { | 783 | List<ILandObject> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition); |
784 | if (!avatar.IsChildAgent) | 784 | foreach (ILandObject checkBan in checkLandParcels) |
785 | { | 785 | { |
786 | over.sendLandUpdateToClient(avatar.ControllingClient); | 786 | if (checkBan.isBannedFromLand(avatar.AgentId)) |
787 | avatar.currentParcelUUID = over.landData.globalID; | 787 | { |
788 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, | 788 | checkBan.sendLandProperties(-30000, false, (int)ParcelManager.ParcelResult.Single, avatar); |
789 | m_scene.RegionInfo.RegionID); | 789 | return; //Only send one |
790 | } | 790 | } |
791 | } | 791 | else if (checkBan.isRestrictedFromLand(avatar.AgentId)) |
792 | } | 792 | { |
793 | } | 793 | checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar); |
794 | public void sendLandUpdate(ScenePresence avatar) | 794 | return; //Only send one |
795 | { | 795 | } |
796 | sendLandUpdate(avatar, false); | 796 | } |
797 | 797 | return; | |
798 | } | 798 | } |
799 | public void handleSignificantClientMovement(IClientAPI remote_client) | 799 | } |
800 | { | 800 | } |
801 | ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId); | 801 | |
802 | 802 | public void sendLandUpdate(ScenePresence avatar, bool force) | |
803 | if (clientAvatar != null) | 803 | { |
804 | { | 804 | ILandObject over = null; |
805 | sendLandUpdate(clientAvatar); | 805 | try |
806 | sendOutNearestBanLine(remote_client); | 806 | { |
807 | Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); | 807 | over = getLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), |
808 | if (parcel != null) | 808 | (int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); |
809 | { | 809 | } |
810 | if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && | 810 | catch (Exception) |
811 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) | 811 | { |
812 | { | 812 | //m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + Math.Round(avatar.AbsolutePosition.Y)); |
813 | handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID); | 813 | } |
814 | //They are going below the safety line! | 814 | |
815 | if (!parcel.isBannedFromLand(clientAvatar.UUID)) | 815 | if (over != null) |
816 | { | 816 | { |
817 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; | 817 | if (force) |
818 | } | 818 | { |
819 | } | 819 | if (!avatar.IsChildAgent) |
820 | else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && | 820 | { |
821 | parcel.isBannedFromLand(clientAvatar.UUID)) | 821 | over.sendLandUpdateToClient(avatar.ControllingClient); |
822 | { | 822 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, |
823 | sendYouAreBannedNotice(clientAvatar); | 823 | m_scene.RegionInfo.RegionID); |
824 | } | 824 | } |
825 | } | 825 | } |
826 | } | 826 | |
827 | } | 827 | if (avatar.currentParcelUUID != over.landData.globalID) |
828 | 828 | { | |
829 | public void handleAnyClientMovement(ScenePresence avatar) | 829 | if (!avatar.IsChildAgent) |
830 | //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance. | 830 | { |
831 | { | 831 | over.sendLandUpdateToClient(avatar.ControllingClient); |
832 | Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 832 | avatar.currentParcelUUID = over.landData.globalID; |
833 | if (over != null) | 833 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, |
834 | { | 834 | m_scene.RegionInfo.RegionID); |
835 | if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT) | 835 | } |
836 | { | 836 | } |
837 | avatar.lastKnownAllowedPosition = | 837 | } |
838 | new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); | 838 | } |
839 | } | 839 | public void sendLandUpdate(ScenePresence avatar) |
840 | } | 840 | { |
841 | } | 841 | sendLandUpdate(avatar, false); |
842 | 842 | ||
843 | 843 | } | |
844 | public void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, | 844 | public void handleSignificantClientMovement(IClientAPI remote_client) |
845 | int landLocalID, IClientAPI remote_client) | 845 | { |
846 | { | 846 | ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId); |
847 | if (landList.ContainsKey(landLocalID)) | 847 | |
848 | { | 848 | if (clientAvatar != null) |
849 | landList[landLocalID].sendAccessList(agentID, sessionID, flags, sequenceID, remote_client); | 849 | { |
850 | } | 850 | sendLandUpdate(clientAvatar); |
851 | } | 851 | sendOutNearestBanLine(remote_client); |
852 | 852 | ILandObject parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); | |
853 | public void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID, | 853 | if (parcel != null) |
854 | List<ParcelManager.ParcelAccessEntry> entries, | 854 | { |
855 | IClientAPI remote_client) | 855 | if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && |
856 | { | 856 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) |
857 | if (landList.ContainsKey(landLocalID)) | 857 | { |
858 | { | 858 | handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID); |
859 | if (agentID == landList[landLocalID].landData.ownerID) | 859 | //They are going below the safety line! |
860 | { | 860 | if (!parcel.isBannedFromLand(clientAvatar.UUID)) |
861 | landList[landLocalID].updateAccessList(flags, entries, remote_client); | 861 | { |
862 | } | 862 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; |
863 | } | 863 | } |
864 | else | 864 | } |
865 | { | 865 | else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && |
866 | Console.WriteLine("INVALID LOCAL LAND ID"); | 866 | parcel.isBannedFromLand(clientAvatar.UUID)) |
867 | } | 867 | { |
868 | } | 868 | sendYouAreBannedNotice(clientAvatar); |
869 | 869 | } | |
870 | public void resetAllLandPrimCounts() | 870 | } |
871 | { | 871 | } |
872 | foreach (Land p in landList.Values) | 872 | } |
873 | { | 873 | |
874 | p.resetLandPrimCounts(); | 874 | public void handleAnyClientMovement(ScenePresence avatar) |
875 | } | 875 | //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance. |
876 | } | 876 | { |
877 | 877 | ILandObject over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | |
878 | public void setPrimsTainted() | 878 | if (over != null) |
879 | { | 879 | { |
880 | landPrimCountTainted = true; | 880 | if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT) |
881 | } | 881 | { |
882 | 882 | avatar.lastKnownAllowedPosition = | |
883 | public void addPrimToLandPrimCounts(SceneObjectGroup obj) | 883 | new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); |
884 | { | 884 | } |
885 | LLVector3 position = obj.AbsolutePosition; | 885 | } |
886 | Land landUnderPrim = getLandObject(position.X, position.Y); | 886 | } |
887 | if (landUnderPrim != null) | 887 | |
888 | { | 888 | |
889 | landUnderPrim.addPrimToCount(obj); | 889 | public void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, |
890 | } | 890 | int landLocalID, IClientAPI remote_client) |
891 | } | 891 | { |
892 | 892 | if (landList.ContainsKey(landLocalID)) | |
893 | public void removePrimFromLandPrimCounts(SceneObjectGroup obj) | 893 | { |
894 | { | 894 | landList[landLocalID].sendAccessList(agentID, sessionID, flags, sequenceID, remote_client); |
895 | foreach (Land p in landList.Values) | 895 | } |
896 | { | 896 | } |
897 | p.removePrimFromCount(obj); | 897 | |
898 | } | 898 | public void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID, |
899 | } | 899 | List<ParcelManager.ParcelAccessEntry> entries, |
900 | 900 | IClientAPI remote_client) | |
901 | public void finalizeLandPrimCountUpdate() | 901 | { |
902 | { | 902 | if (landList.ContainsKey(landLocalID)) |
903 | //Get Simwide prim count for owner | 903 | { |
904 | Dictionary<LLUUID, List<Land>> landOwnersAndParcels = new Dictionary<LLUUID, List<Land>>(); | 904 | if (agentID == landList[landLocalID].landData.ownerID) |
905 | foreach (Land p in landList.Values) | 905 | { |
906 | { | 906 | landList[landLocalID].updateAccessList(flags, entries, remote_client); |
907 | if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID)) | 907 | } |
908 | { | 908 | } |
909 | List<Land> tempList = new List<Land>(); | 909 | else |
910 | tempList.Add(p); | 910 | { |
911 | landOwnersAndParcels.Add(p.landData.ownerID, tempList); | 911 | Console.WriteLine("INVALID LOCAL LAND ID"); |
912 | } | 912 | } |
913 | else | 913 | } |
914 | { | 914 | |
915 | landOwnersAndParcels[p.landData.ownerID].Add(p); | 915 | } |
916 | } | 916 | } |
917 | } | ||
918 | |||
919 | foreach (LLUUID owner in landOwnersAndParcels.Keys) | ||
920 | { | ||
921 | int simArea = 0; | ||
922 | int simPrims = 0; | ||
923 | foreach (Land p in landOwnersAndParcels[owner]) | ||
924 | { | ||
925 | simArea += p.landData.area; | ||
926 | simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims + | ||
927 | p.landData.selectedPrims; | ||
928 | } | ||
929 | |||
930 | foreach (Land p in landOwnersAndParcels[owner]) | ||
931 | { | ||
932 | p.landData.simwideArea = simArea; | ||
933 | p.landData.simwidePrims = simPrims; | ||
934 | } | ||
935 | } | ||
936 | } | ||
937 | |||
938 | #endregion | ||
939 | } | ||
940 | |||
941 | #endregion | ||
942 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs new file mode 100644 index 0000000..ac8c1a8 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs | |||
@@ -0,0 +1,62 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using libsecondlife; | ||
4 | using libsecondlife.Packets; | ||
5 | using OpenSim.Framework; | ||
6 | using OpenSim.Framework.Console; | ||
7 | using OpenSim.Region.Environment.Scenes; | ||
8 | using OpenSim.Region.Environment.Interfaces; | ||
9 | using Nini.Config; | ||
10 | |||
11 | namespace OpenSim.Region.Environment.Modules.LandManagement | ||
12 | { | ||
13 | public class LandManagementModule : IRegionModule | ||
14 | { | ||
15 | private LandChannel landChannel; | ||
16 | private Scene m_scene; | ||
17 | |||
18 | #region IRegionModule Members | ||
19 | |||
20 | public void Initialise(Scene scene, IConfigSource source) | ||
21 | { | ||
22 | m_scene = scene; | ||
23 | landChannel = new LandChannel(scene); | ||
24 | |||
25 | m_scene.EventManager.OnParcelPrimCountAdd += landChannel.addPrimToLandPrimCounts; | ||
26 | m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; | ||
27 | m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel); | ||
28 | m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement); | ||
29 | |||
30 | lock (m_scene) | ||
31 | { | ||
32 | m_scene.LandChannel = (ILandChannel)landChannel; | ||
33 | } | ||
34 | } | ||
35 | |||
36 | public void PostInitialise() | ||
37 | { | ||
38 | |||
39 | } | ||
40 | |||
41 | public void Close() | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | public string Name | ||
47 | { | ||
48 | get { return "LandManagementModule"; } | ||
49 | } | ||
50 | |||
51 | public bool IsSharedModule | ||
52 | { | ||
53 | get { return false; } | ||
54 | } | ||
55 | |||
56 | |||
57 | |||
58 | |||
59 | |||
60 | #endregion | ||
61 | } | ||
62 | } | ||
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs index 5b84103..4e2fbd3 100644 --- a/OpenSim/Region/Environment/LandManagement/Land.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs | |||
@@ -1,842 +1,879 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
34 | using OpenSim.Region.Environment.Scenes; | 34 | using OpenSim.Region.Environment.Scenes; |
35 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
36 | 36 | ||
37 | namespace OpenSim.Region.Environment.LandManagement | 37 | namespace OpenSim.Region.Environment.Modules.LandManagement |
38 | { | 38 | { |
39 | 39 | ||
40 | #region Parcel Class | 40 | #region LandObject Class |
41 | 41 | ||
42 | /// <summary> | 42 | /// <summary> |
43 | /// Keeps track of a specific piece of land's information | 43 | /// Keeps track of a specific piece of land's information |
44 | /// </summary> | 44 | /// </summary> |
45 | public class Land | 45 | public class LandObject : ILandObject |
46 | { | 46 | { |
47 | #region Member Variables | 47 | #region Member Variables |
48 | 48 | ||
49 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | public LandData landData = new LandData(); | 51 | protected LandData m_landData = new LandData(); |
52 | public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 52 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
53 | public Scene m_scene; | 53 | protected Scene m_scene; |
54 | 54 | ||
55 | private bool[,] landBitmap = new bool[64,64]; | 55 | private bool[,] m_landBitmap = new bool[64,64]; |
56 | 56 | ||
57 | #endregion | 57 | public bool[,] landBitmap |
58 | 58 | { | |
59 | #region Constructors | 59 | get |
60 | 60 | { | |
61 | public Land(LLUUID owner_id, bool is_group_owned, Scene scene) | 61 | return m_landBitmap; |
62 | { | 62 | } |
63 | m_scene = scene; | 63 | set |
64 | landData.ownerID = owner_id; | 64 | { |
65 | landData.isGroupOwned = is_group_owned; | 65 | m_landBitmap = value; |
66 | } | 66 | } |
67 | 67 | } | |
68 | #endregion | 68 | |
69 | 69 | #endregion | |
70 | #region Member Functions | 70 | |
71 | 71 | #region ILandObject Members | |
72 | #region General Functions | 72 | |
73 | 73 | public LandData landData | |
74 | /// <summary> | 74 | { |
75 | /// Checks to see if this land object contains a point | 75 | get |
76 | /// </summary> | 76 | { |
77 | /// <param name="x"></param> | 77 | return m_landData; |
78 | /// <param name="y"></param> | 78 | } |
79 | /// <returns>Returns true if the piece of land contains the specified point</returns> | 79 | |
80 | public bool containsPoint(int x, int y) | 80 | set |
81 | { | 81 | { |
82 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize) | 82 | m_landData = value; |
83 | { | 83 | } |
84 | return (landBitmap[x/4, y/4] == true); | 84 | } |
85 | } | 85 | |
86 | else | 86 | public LLUUID regionUUID |
87 | { | 87 | { |
88 | return false; | 88 | get { return m_scene.RegionInfo.RegionID; } |
89 | } | 89 | } |
90 | } | 90 | |
91 | 91 | #endregion | |
92 | public Land Copy() | 92 | |
93 | { | 93 | |
94 | Land newLand = new Land(landData.ownerID, landData.isGroupOwned, m_scene); | 94 | #region Constructors |
95 | 95 | ||
96 | //Place all new variables here! | 96 | public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene) |
97 | newLand.landBitmap = (bool[,]) (landBitmap.Clone()); | 97 | { |
98 | newLand.landData = landData.Copy(); | 98 | m_scene = scene; |
99 | 99 | landData.ownerID = owner_id; | |
100 | return newLand; | 100 | landData.isGroupOwned = is_group_owned; |
101 | } | 101 | } |
102 | 102 | ||
103 | #endregion | 103 | #endregion |
104 | 104 | ||
105 | #region Packet Request Handling | 105 | #region Member Functions |
106 | 106 | ||
107 | /// <summary> | 107 | #region General Functions |
108 | /// Sends land properties as requested | 108 | |
109 | /// </summary> | 109 | /// <summary> |
110 | /// <param name="sequence_id">ID sent by client for them to keep track of</param> | 110 | /// Checks to see if this land object contains a point |
111 | /// <param name="snap_selection">Bool sent by client for them to use</param> | 111 | /// </summary> |
112 | /// <param name="remote_client">Object representing the client</param> | 112 | /// <param name="x"></param> |
113 | public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, | 113 | /// <param name="y"></param> |
114 | IClientAPI remote_client) | 114 | /// <returns>Returns true if the piece of land contains the specified point</returns> |
115 | { | 115 | public bool containsPoint(int x, int y) |
116 | ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); | 116 | { |
117 | // TODO: don't create new blocks if recycling an old packet | 117 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize) |
118 | 118 | { | |
119 | updatePacket.ParcelData.AABBMax = landData.AABBMax; | 119 | return (landBitmap[x/4, y/4] == true); |
120 | updatePacket.ParcelData.AABBMin = landData.AABBMin; | 120 | } |
121 | updatePacket.ParcelData.Area = landData.area; | 121 | else |
122 | updatePacket.ParcelData.AuctionID = landData.auctionID; | 122 | { |
123 | updatePacket.ParcelData.AuthBuyerID = landData.authBuyerID; //unemplemented | 123 | return false; |
124 | 124 | } | |
125 | updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray; | 125 | } |
126 | 126 | ||
127 | updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc); | 127 | public ILandObject Copy() |
128 | updatePacket.ParcelData.Category = (byte) landData.category; | 128 | { |
129 | updatePacket.ParcelData.ClaimDate = landData.claimDate; | 129 | ILandObject newLand = new LandObject(landData.ownerID, landData.isGroupOwned, m_scene); |
130 | updatePacket.ParcelData.ClaimPrice = landData.claimPrice; | 130 | |
131 | updatePacket.ParcelData.GroupID = landData.groupID; | 131 | //Place all new variables here! |
132 | updatePacket.ParcelData.GroupPrims = landData.groupPrims; | 132 | newLand.landBitmap = (bool[,]) (landBitmap.Clone()); |
133 | updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned; | 133 | newLand.landData = landData.Copy(); |
134 | updatePacket.ParcelData.LandingType = (byte) landData.landingType; | 134 | |
135 | updatePacket.ParcelData.LocalID = landData.localID; | 135 | return newLand; |
136 | if (landData.area > 0) | 136 | } |
137 | { | 137 | |
138 | updatePacket.ParcelData.MaxPrims = | 138 | #endregion |
139 | Convert.ToInt32( | 139 | |
140 | Math.Round((Convert.ToDecimal(landData.area)/Convert.ToDecimal(65536))*15000* | 140 | #region Packet Request Handling |
141 | Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); | 141 | |
142 | } | 142 | /// <summary> |
143 | else | 143 | /// Sends land properties as requested |
144 | { | 144 | /// </summary> |
145 | updatePacket.ParcelData.MaxPrims = 0; | 145 | /// <param name="sequence_id">ID sent by client for them to keep track of</param> |
146 | } | 146 | /// <param name="snap_selection">Bool sent by client for them to use</param> |
147 | updatePacket.ParcelData.MediaAutoScale = landData.mediaAutoScale; | 147 | /// <param name="remote_client">Object representing the client</param> |
148 | updatePacket.ParcelData.MediaID = landData.mediaID; | 148 | public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, |
149 | updatePacket.ParcelData.MediaURL = Helpers.StringToField(landData.mediaURL); | 149 | IClientAPI remote_client) |
150 | updatePacket.ParcelData.MusicURL = Helpers.StringToField(landData.musicURL); | 150 | { |
151 | updatePacket.ParcelData.Name = Helpers.StringToField(landData.landName); | 151 | ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); |
152 | updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented | 152 | // TODO: don't create new blocks if recycling an old packet |
153 | updatePacket.ParcelData.OtherCount = 0; //unemplemented | 153 | |
154 | updatePacket.ParcelData.OtherPrims = landData.otherPrims; | 154 | updatePacket.ParcelData.AABBMax = landData.AABBMax; |
155 | updatePacket.ParcelData.OwnerID = landData.ownerID; | 155 | updatePacket.ParcelData.AABBMin = landData.AABBMin; |
156 | updatePacket.ParcelData.OwnerPrims = landData.ownerPrims; | 156 | updatePacket.ParcelData.Area = landData.area; |
157 | updatePacket.ParcelData.ParcelFlags = landData.landFlags; | 157 | updatePacket.ParcelData.AuctionID = landData.auctionID; |
158 | updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.EstateSettings.objectBonusFactor; | 158 | updatePacket.ParcelData.AuthBuyerID = landData.authBuyerID; //unemplemented |
159 | updatePacket.ParcelData.PassHours = landData.passHours; | 159 | |
160 | updatePacket.ParcelData.PassPrice = landData.passPrice; | 160 | updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray; |
161 | updatePacket.ParcelData.PublicCount = 0; //unemplemented | 161 | |
162 | 162 | updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc); | |
163 | uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags; | 163 | updatePacket.ParcelData.Category = (byte) landData.category; |
164 | updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) > | 164 | updatePacket.ParcelData.ClaimDate = landData.claimDate; |
165 | 0); | 165 | updatePacket.ParcelData.ClaimPrice = landData.claimPrice; |
166 | updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) > | 166 | updatePacket.ParcelData.GroupID = landData.groupID; |
167 | 0); | 167 | updatePacket.ParcelData.GroupPrims = landData.groupPrims; |
168 | updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) > | 168 | updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned; |
169 | 0); | 169 | updatePacket.ParcelData.LandingType = (byte) landData.landingType; |
170 | updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) > | 170 | updatePacket.ParcelData.LocalID = landData.localID; |
171 | 0); | 171 | if (landData.area > 0) |
172 | 172 | { | |
173 | updatePacket.ParcelData.RentPrice = 0; | 173 | updatePacket.ParcelData.MaxPrims = |
174 | updatePacket.ParcelData.RequestResult = request_result; | 174 | Convert.ToInt32( |
175 | updatePacket.ParcelData.SalePrice = landData.salePrice; | 175 | Math.Round((Convert.ToDecimal(landData.area)/Convert.ToDecimal(65536))*15000* |
176 | updatePacket.ParcelData.SelectedPrims = landData.selectedPrims; | 176 | Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); |
177 | updatePacket.ParcelData.SelfCount = 0; //unemplemented | 177 | } |
178 | updatePacket.ParcelData.SequenceID = sequence_id; | 178 | else |
179 | if (landData.simwideArea > 0) | 179 | { |
180 | { | 180 | updatePacket.ParcelData.MaxPrims = 0; |
181 | updatePacket.ParcelData.SimWideMaxPrims = | 181 | } |
182 | Convert.ToInt32( | 182 | updatePacket.ParcelData.MediaAutoScale = landData.mediaAutoScale; |
183 | Math.Round((Convert.ToDecimal(landData.simwideArea)/Convert.ToDecimal(65536))*15000* | 183 | updatePacket.ParcelData.MediaID = landData.mediaID; |
184 | Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); | 184 | updatePacket.ParcelData.MediaURL = Helpers.StringToField(landData.mediaURL); |
185 | } | 185 | updatePacket.ParcelData.MusicURL = Helpers.StringToField(landData.musicURL); |
186 | else | 186 | updatePacket.ParcelData.Name = Helpers.StringToField(landData.landName); |
187 | { | 187 | updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented |
188 | updatePacket.ParcelData.SimWideMaxPrims = 0; | 188 | updatePacket.ParcelData.OtherCount = 0; //unemplemented |
189 | } | 189 | updatePacket.ParcelData.OtherPrims = landData.otherPrims; |
190 | updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims; | 190 | updatePacket.ParcelData.OwnerID = landData.ownerID; |
191 | updatePacket.ParcelData.SnapSelection = snap_selection; | 191 | updatePacket.ParcelData.OwnerPrims = landData.ownerPrims; |
192 | updatePacket.ParcelData.SnapshotID = landData.snapshotID; | 192 | updatePacket.ParcelData.ParcelFlags = landData.landFlags; |
193 | updatePacket.ParcelData.Status = (byte) landData.landStatus; | 193 | updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.EstateSettings.objectBonusFactor; |
194 | updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims + | 194 | updatePacket.ParcelData.PassHours = landData.passHours; |
195 | landData.selectedPrims; | 195 | updatePacket.ParcelData.PassPrice = landData.passPrice; |
196 | updatePacket.ParcelData.UserLocation = landData.userLocation; | 196 | updatePacket.ParcelData.PublicCount = 0; //unemplemented |
197 | updatePacket.ParcelData.UserLookAt = landData.userLookAt; | 197 | |
198 | remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task); | 198 | uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags; |
199 | } | 199 | updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) > |
200 | 200 | 0); | |
201 | public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) | 201 | updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) > |
202 | { | 202 | 0); |
203 | if (remote_client.AgentId == landData.ownerID) | 203 | updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) > |
204 | { | 204 | 0); |
205 | //Needs later group support | 205 | updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) > |
206 | LandData newData = landData.Copy(); | 206 | 0); |
207 | newData.authBuyerID = packet.ParcelData.AuthBuyerID; | 207 | |
208 | newData.category = (Parcel.ParcelCategory) packet.ParcelData.Category; | 208 | updatePacket.ParcelData.RentPrice = 0; |
209 | newData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); | 209 | updatePacket.ParcelData.RequestResult = request_result; |
210 | newData.groupID = packet.ParcelData.GroupID; | 210 | updatePacket.ParcelData.SalePrice = landData.salePrice; |
211 | newData.landingType = packet.ParcelData.LandingType; | 211 | updatePacket.ParcelData.SelectedPrims = landData.selectedPrims; |
212 | newData.mediaAutoScale = packet.ParcelData.MediaAutoScale; | 212 | updatePacket.ParcelData.SelfCount = 0; //unemplemented |
213 | newData.mediaID = packet.ParcelData.MediaID; | 213 | updatePacket.ParcelData.SequenceID = sequence_id; |
214 | newData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); | 214 | if (landData.simwideArea > 0) |
215 | newData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); | 215 | { |
216 | newData.landName = Helpers.FieldToUTF8String(packet.ParcelData.Name); | 216 | updatePacket.ParcelData.SimWideMaxPrims = |
217 | newData.landFlags = packet.ParcelData.ParcelFlags; | 217 | Convert.ToInt32( |
218 | newData.passHours = packet.ParcelData.PassHours; | 218 | Math.Round((Convert.ToDecimal(landData.simwideArea)/Convert.ToDecimal(65536))*15000* |
219 | newData.passPrice = packet.ParcelData.PassPrice; | 219 | Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); |
220 | newData.salePrice = packet.ParcelData.SalePrice; | 220 | } |
221 | newData.snapshotID = packet.ParcelData.SnapshotID; | 221 | else |
222 | newData.userLocation = packet.ParcelData.UserLocation; | 222 | { |
223 | newData.userLookAt = packet.ParcelData.UserLookAt; | 223 | updatePacket.ParcelData.SimWideMaxPrims = 0; |
224 | 224 | } | |
225 | m_scene.LandManager.updateLandObject(landData.localID, newData); | 225 | updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims; |
226 | 226 | updatePacket.ParcelData.SnapSelection = snap_selection; | |
227 | sendLandUpdateToAvatarsOverMe(); | 227 | updatePacket.ParcelData.SnapshotID = landData.snapshotID; |
228 | } | 228 | updatePacket.ParcelData.Status = (byte) landData.landStatus; |
229 | } | 229 | updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims + |
230 | 230 | landData.selectedPrims; | |
231 | public bool isEitherBannedOrRestricted(LLUUID avatar) | 231 | updatePacket.ParcelData.UserLocation = landData.userLocation; |
232 | { | 232 | updatePacket.ParcelData.UserLookAt = landData.userLookAt; |
233 | if (isBannedFromLand(avatar)) | 233 | remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task); |
234 | { | 234 | } |
235 | return true; | 235 | |
236 | } | 236 | public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) |
237 | else if (isRestrictedFromLand(avatar)) | 237 | { |
238 | { | 238 | if (remote_client.AgentId == landData.ownerID) |
239 | return true; | 239 | { |
240 | } | 240 | //Needs later group support |
241 | return false; | 241 | LandData newData = landData.Copy(); |
242 | } | 242 | newData.authBuyerID = packet.ParcelData.AuthBuyerID; |
243 | 243 | newData.category = (Parcel.ParcelCategory) packet.ParcelData.Category; | |
244 | public bool isBannedFromLand(LLUUID avatar) | 244 | newData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); |
245 | { | 245 | newData.groupID = packet.ParcelData.GroupID; |
246 | if ((landData.landFlags & (uint) Parcel.ParcelFlags.UseBanList) > 0) | 246 | newData.landingType = packet.ParcelData.LandingType; |
247 | { | 247 | newData.mediaAutoScale = packet.ParcelData.MediaAutoScale; |
248 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 248 | newData.mediaID = packet.ParcelData.MediaID; |
249 | entry.AgentID = avatar; | 249 | newData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); |
250 | entry.Flags = ParcelManager.AccessList.Ban; | 250 | newData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); |
251 | entry.Time = new DateTime(); | 251 | newData.landName = Helpers.FieldToUTF8String(packet.ParcelData.Name); |
252 | if (landData.parcelAccessList.Contains(entry)) | 252 | newData.landFlags = packet.ParcelData.ParcelFlags; |
253 | { | 253 | newData.passHours = packet.ParcelData.PassHours; |
254 | //They are banned, so lets send them a notice about this parcel | 254 | newData.passPrice = packet.ParcelData.PassPrice; |
255 | return true; | 255 | newData.salePrice = packet.ParcelData.SalePrice; |
256 | } | 256 | newData.snapshotID = packet.ParcelData.SnapshotID; |
257 | } | 257 | newData.userLocation = packet.ParcelData.UserLocation; |
258 | return false; | 258 | newData.userLookAt = packet.ParcelData.UserLookAt; |
259 | } | 259 | |
260 | 260 | m_scene.LandChannel.updateLandObject(landData.localID, newData); | |
261 | public bool isRestrictedFromLand(LLUUID avatar) | 261 | |
262 | { | 262 | sendLandUpdateToAvatarsOverMe(); |
263 | if ((landData.landFlags & (uint) Parcel.ParcelFlags.UseAccessList) > 0) | 263 | } |
264 | { | 264 | } |
265 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 265 | |
266 | entry.AgentID = avatar; | 266 | public bool isEitherBannedOrRestricted(LLUUID avatar) |
267 | entry.Flags = ParcelManager.AccessList.Access; | 267 | { |
268 | entry.Time = new DateTime(); | 268 | if (isBannedFromLand(avatar)) |
269 | if (!landData.parcelAccessList.Contains(entry)) | 269 | { |
270 | { | 270 | return true; |
271 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel | 271 | } |
272 | return true; | 272 | else if (isRestrictedFromLand(avatar)) |
273 | } | 273 | { |
274 | } | 274 | return true; |
275 | return false; | 275 | } |
276 | } | 276 | return false; |
277 | 277 | } | |
278 | public void sendLandUpdateToClient(IClientAPI remote_client) | 278 | |
279 | { | 279 | public bool isBannedFromLand(LLUUID avatar) |
280 | sendLandProperties(0, false, 0, remote_client); | 280 | { |
281 | } | 281 | if ((landData.landFlags & (uint) Parcel.ParcelFlags.UseBanList) > 0) |
282 | 282 | { | |
283 | public void sendLandUpdateToAvatarsOverMe() | 283 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
284 | { | 284 | entry.AgentID = avatar; |
285 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 285 | entry.Flags = ParcelManager.AccessList.Ban; |
286 | Land over = null; | 286 | entry.Time = new DateTime(); |
287 | for (int i = 0; i < avatars.Count; i++) | 287 | if (landData.parcelAccessList.Contains(entry)) |
288 | { | 288 | { |
289 | try | 289 | //They are banned, so lets send them a notice about this parcel |
290 | { | 290 | return true; |
291 | over = | 291 | } |
292 | m_scene.LandManager.getLandObject((int)Math.Max(255,Math.Min(0,Math.Round(avatars[i].AbsolutePosition.X))), | 292 | } |
293 | (int)Math.Max(255,Math.Min(0,Math.Round(avatars[i].AbsolutePosition.Y)))); | 293 | return false; |
294 | } | 294 | } |
295 | catch (Exception) | 295 | |
296 | { | 296 | public bool isRestrictedFromLand(LLUUID avatar) |
297 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + Math.Round(avatars[i].AbsolutePosition.Y)); | 297 | { |
298 | } | 298 | if ((landData.landFlags & (uint) Parcel.ParcelFlags.UseAccessList) > 0) |
299 | 299 | { | |
300 | if (over != null) | 300 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
301 | { | 301 | entry.AgentID = avatar; |
302 | if (over.landData.localID == landData.localID) | 302 | entry.Flags = ParcelManager.AccessList.Access; |
303 | { | 303 | entry.Time = new DateTime(); |
304 | sendLandUpdateToClient(avatars[i].ControllingClient); | 304 | if (!landData.parcelAccessList.Contains(entry)) |
305 | } | 305 | { |
306 | } | 306 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel |
307 | } | 307 | return true; |
308 | } | 308 | } |
309 | 309 | } | |
310 | #endregion | 310 | return false; |
311 | 311 | } | |
312 | #region AccessList Functions | 312 | |
313 | 313 | public void sendLandUpdateToClient(IClientAPI remote_client) | |
314 | public ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag) | 314 | { |
315 | { | 315 | sendLandProperties(0, false, 0, remote_client); |
316 | List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); | 316 | } |
317 | foreach (ParcelManager.ParcelAccessEntry entry in landData.parcelAccessList) | 317 | |
318 | { | 318 | public void sendLandUpdateToAvatarsOverMe() |
319 | if (entry.Flags == flag) | 319 | { |
320 | { | 320 | List<ScenePresence> avatars = m_scene.GetAvatars(); |
321 | ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); | 321 | ILandObject over = null; |
322 | 322 | for (int i = 0; i < avatars.Count; i++) | |
323 | listBlock.Flags = (uint) 0; | 323 | { |
324 | listBlock.ID = entry.AgentID; | 324 | try |
325 | listBlock.Time = 0; | 325 | { |
326 | 326 | over = | |
327 | list.Add(listBlock); | 327 | m_scene.LandChannel.getLandObject((int)Math.Max(255,Math.Min(0,Math.Round(avatars[i].AbsolutePosition.X))), |
328 | } | 328 | (int)Math.Max(255,Math.Min(0,Math.Round(avatars[i].AbsolutePosition.Y)))); |
329 | } | 329 | } |
330 | 330 | catch (Exception) | |
331 | if (list.Count == 0) | 331 | { |
332 | { | 332 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + Math.Round(avatars[i].AbsolutePosition.Y)); |
333 | ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); | 333 | } |
334 | 334 | ||
335 | listBlock.Flags = (uint) 0; | 335 | if (over != null) |
336 | listBlock.ID = LLUUID.Zero; | 336 | { |
337 | listBlock.Time = 0; | 337 | if (over.landData.localID == landData.localID) |
338 | 338 | { | |
339 | list.Add(listBlock); | 339 | sendLandUpdateToClient(avatars[i].ControllingClient); |
340 | } | 340 | } |
341 | return list.ToArray(); | 341 | } |
342 | } | 342 | } |
343 | 343 | } | |
344 | public void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, | 344 | |
345 | IClientAPI remote_client) | 345 | #endregion |
346 | { | 346 | |
347 | ParcelAccessListReplyPacket replyPacket; | 347 | #region AccessList Functions |
348 | 348 | ||
349 | if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) | 349 | public ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag) |
350 | { | 350 | { |
351 | replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); | 351 | List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); |
352 | replyPacket.Data.AgentID = agentID; | 352 | foreach (ParcelManager.ParcelAccessEntry entry in landData.parcelAccessList) |
353 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; | 353 | { |
354 | replyPacket.Data.LocalID = landData.localID; | 354 | if (entry.Flags == flag) |
355 | replyPacket.Data.SequenceID = 0; | 355 | { |
356 | 356 | ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); | |
357 | replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access); | 357 | |
358 | remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task); | 358 | listBlock.Flags = (uint) 0; |
359 | } | 359 | listBlock.ID = entry.AgentID; |
360 | 360 | listBlock.Time = 0; | |
361 | if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) | 361 | |
362 | { | 362 | list.Add(listBlock); |
363 | replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); | 363 | } |
364 | replyPacket.Data.AgentID = agentID; | 364 | } |
365 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; | 365 | |
366 | replyPacket.Data.LocalID = landData.localID; | 366 | if (list.Count == 0) |
367 | replyPacket.Data.SequenceID = 0; | 367 | { |
368 | 368 | ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); | |
369 | replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban); | 369 | |
370 | remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task); | 370 | listBlock.Flags = (uint) 0; |
371 | } | 371 | listBlock.ID = LLUUID.Zero; |
372 | } | 372 | listBlock.Time = 0; |
373 | 373 | ||
374 | public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) | 374 | list.Add(listBlock); |
375 | { | 375 | } |
376 | LandData newData = landData.Copy(); | 376 | return list.ToArray(); |
377 | 377 | } | |
378 | if (entries.Count == 1 && entries[0].AgentID == LLUUID.Zero) | 378 | |
379 | { | 379 | public void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, |
380 | entries.Clear(); | 380 | IClientAPI remote_client) |
381 | } | 381 | { |
382 | 382 | ParcelAccessListReplyPacket replyPacket; | |
383 | List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); | 383 | |
384 | foreach (ParcelManager.ParcelAccessEntry entry in newData.parcelAccessList) | 384 | if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) |
385 | { | 385 | { |
386 | if (entry.Flags == (ParcelManager.AccessList) flags) | 386 | replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); |
387 | { | 387 | replyPacket.Data.AgentID = agentID; |
388 | toRemove.Add(entry); | 388 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; |
389 | } | 389 | replyPacket.Data.LocalID = landData.localID; |
390 | } | 390 | replyPacket.Data.SequenceID = 0; |
391 | 391 | ||
392 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) | 392 | replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access); |
393 | { | 393 | remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task); |
394 | newData.parcelAccessList.Remove(entry); | 394 | } |
395 | } | 395 | |
396 | foreach (ParcelManager.ParcelAccessEntry entry in entries) | 396 | if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) |
397 | { | 397 | { |
398 | ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); | 398 | replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); |
399 | temp.AgentID = entry.AgentID; | 399 | replyPacket.Data.AgentID = agentID; |
400 | temp.Time = new DateTime(); //Pointless? Yes. | 400 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; |
401 | temp.Flags = (ParcelManager.AccessList) flags; | 401 | replyPacket.Data.LocalID = landData.localID; |
402 | 402 | replyPacket.Data.SequenceID = 0; | |
403 | if (!newData.parcelAccessList.Contains(temp)) | 403 | |
404 | { | 404 | replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban); |
405 | newData.parcelAccessList.Add(temp); | 405 | remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task); |
406 | } | 406 | } |
407 | } | 407 | } |
408 | 408 | ||
409 | m_scene.LandManager.updateLandObject(landData.localID, newData); | 409 | public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) |
410 | } | 410 | { |
411 | 411 | LandData newData = landData.Copy(); | |
412 | #endregion | 412 | |
413 | 413 | if (entries.Count == 1 && entries[0].AgentID == LLUUID.Zero) | |
414 | #region Update Functions | 414 | { |
415 | 415 | entries.Clear(); | |
416 | /// <summary> | 416 | } |
417 | /// Updates the AABBMin and AABBMax values after area/shape modification of the land object | 417 | |
418 | /// </summary> | 418 | List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); |
419 | private void updateAABBAndAreaValues() | 419 | foreach (ParcelManager.ParcelAccessEntry entry in newData.parcelAccessList) |
420 | { | 420 | { |
421 | int min_x = 64; | 421 | if (entry.Flags == (ParcelManager.AccessList) flags) |
422 | int min_y = 64; | 422 | { |
423 | int max_x = 0; | 423 | toRemove.Add(entry); |
424 | int max_y = 0; | 424 | } |
425 | int tempArea = 0; | 425 | } |
426 | int x, y; | 426 | |
427 | for (x = 0; x < 64; x++) | 427 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) |
428 | { | 428 | { |
429 | for (y = 0; y < 64; y++) | 429 | newData.parcelAccessList.Remove(entry); |
430 | { | 430 | } |
431 | if (landBitmap[x, y] == true) | 431 | foreach (ParcelManager.ParcelAccessEntry entry in entries) |
432 | { | 432 | { |
433 | if (min_x > x) min_x = x; | 433 | ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); |
434 | if (min_y > y) min_y = y; | 434 | temp.AgentID = entry.AgentID; |
435 | if (max_x < x) max_x = x; | 435 | temp.Time = new DateTime(); //Pointless? Yes. |
436 | if (max_y < y) max_y = y; | 436 | temp.Flags = (ParcelManager.AccessList) flags; |
437 | tempArea += 16; //16sqm peice of land | 437 | |
438 | } | 438 | if (!newData.parcelAccessList.Contains(temp)) |
439 | } | 439 | { |
440 | } | 440 | newData.parcelAccessList.Add(temp); |
441 | int tx = min_x * 4; | 441 | } |
442 | if (tx > 255) | 442 | } |
443 | tx = 255; | 443 | |
444 | int ty = min_y * 4; | 444 | m_scene.LandChannel.updateLandObject(landData.localID, newData); |
445 | if (ty > 255) | 445 | } |
446 | ty = 255; | 446 | |
447 | landData.AABBMin = | 447 | #endregion |
448 | new LLVector3((float)(min_x * 4), (float)(min_y * 4), | 448 | |
449 | (float)m_scene.Heightmap[tx, ty]); | 449 | #region Update Functions |
450 | 450 | ||
451 | tx = max_x * 4; | 451 | /// <summary> |
452 | if (tx > 255) | 452 | /// Updates the AABBMin and AABBMax values after area/shape modification of the land object |
453 | tx = 255; | 453 | /// </summary> |
454 | ty = max_y * 4; | 454 | private void updateAABBAndAreaValues() |
455 | if (ty > 255) | 455 | { |
456 | ty = 255; | 456 | int min_x = 64; |
457 | landData.AABBMax = | 457 | int min_y = 64; |
458 | new LLVector3((float)(max_x * 4), (float)(max_y * 4), | 458 | int max_x = 0; |
459 | (float)m_scene.Heightmap[tx, ty]); | 459 | int max_y = 0; |
460 | landData.area = tempArea; | 460 | int tempArea = 0; |
461 | } | 461 | int x, y; |
462 | 462 | for (x = 0; x < 64; x++) | |
463 | public void updateLandBitmapByteArray() | 463 | { |
464 | { | 464 | for (y = 0; y < 64; y++) |
465 | landData.landBitmapByteArray = convertLandBitmapToBytes(); | 465 | { |
466 | } | 466 | if (landBitmap[x, y] == true) |
467 | 467 | { | |
468 | /// <summary> | 468 | if (min_x > x) min_x = x; |
469 | /// Update all settings in land such as area, bitmap byte array, etc | 469 | if (min_y > y) min_y = y; |
470 | /// </summary> | 470 | if (max_x < x) max_x = x; |
471 | public void forceUpdateLandInfo() | 471 | if (max_y < y) max_y = y; |
472 | { | 472 | tempArea += 16; //16sqm peice of land |
473 | updateAABBAndAreaValues(); | 473 | } |
474 | updateLandBitmapByteArray(); | 474 | } |
475 | } | 475 | } |
476 | 476 | int tx = min_x * 4; | |
477 | public void setLandBitmapFromByteArray() | 477 | if (tx > 255) |
478 | { | 478 | tx = 255; |
479 | landBitmap = convertBytesToLandBitmap(); | 479 | int ty = min_y * 4; |
480 | } | 480 | if (ty > 255) |
481 | 481 | ty = 255; | |
482 | #endregion | 482 | landData.AABBMin = |
483 | 483 | new LLVector3((float)(min_x * 4), (float)(min_y * 4), | |
484 | #region Land Bitmap Functions | 484 | (float)m_scene.Heightmap[tx, ty]); |
485 | 485 | ||
486 | /// <summary> | 486 | tx = max_x * 4; |
487 | /// Sets the land's bitmap manually | 487 | if (tx > 255) |
488 | /// </summary> | 488 | tx = 255; |
489 | /// <param name="bitmap">64x64 block representing where this land is on a map</param> | 489 | ty = max_y * 4; |
490 | public void setLandBitmap(bool[,] bitmap) | 490 | if (ty > 255) |
491 | { | 491 | ty = 255; |
492 | if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) | 492 | landData.AABBMax = |
493 | { | 493 | new LLVector3((float)(max_x * 4), (float)(max_y * 4), |
494 | //Throw an exception - The bitmap is not 64x64 | 494 | (float)m_scene.Heightmap[tx, ty]); |
495 | //throw new Exception("Error: Invalid Parcel Bitmap"); | 495 | landData.area = tempArea; |
496 | } | 496 | } |
497 | else | 497 | |
498 | { | 498 | public void updateLandBitmapByteArray() |
499 | //Valid: Lets set it | 499 | { |
500 | landBitmap = bitmap; | 500 | landData.landBitmapByteArray = convertLandBitmapToBytes(); |
501 | forceUpdateLandInfo(); | 501 | } |
502 | } | 502 | |
503 | } | 503 | /// <summary> |
504 | 504 | /// Update all settings in land such as area, bitmap byte array, etc | |
505 | /// <summary> | 505 | /// </summary> |
506 | /// Gets the land's bitmap manually | 506 | public void forceUpdateLandInfo() |
507 | /// </summary> | 507 | { |
508 | /// <returns></returns> | 508 | updateAABBAndAreaValues(); |
509 | public bool[,] getLandBitmap() | 509 | updateLandBitmapByteArray(); |
510 | { | 510 | } |
511 | return landBitmap; | 511 | |
512 | } | 512 | public void setLandBitmapFromByteArray() |
513 | 513 | { | |
514 | /// <summary> | 514 | landBitmap = convertBytesToLandBitmap(); |
515 | /// Converts the land bitmap to a packet friendly byte array | 515 | } |
516 | /// </summary> | 516 | |
517 | /// <returns></returns> | 517 | #endregion |
518 | private byte[] convertLandBitmapToBytes() | 518 | |
519 | { | 519 | #region Land Bitmap Functions |
520 | byte[] tempConvertArr = new byte[512]; | 520 | |
521 | byte tempByte = 0; | 521 | /// <summary> |
522 | int x, y, i, byteNum = 0; | 522 | /// Sets the land's bitmap manually |
523 | i = 0; | 523 | /// </summary> |
524 | for (y = 0; y < 64; y++) | 524 | /// <param name="bitmap">64x64 block representing where this land is on a map</param> |
525 | { | 525 | public void setLandBitmap(bool[,] bitmap) |
526 | for (x = 0; x < 64; x++) | 526 | { |
527 | { | 527 | if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) |
528 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++%8)); | 528 | { |
529 | if (i%8 == 0) | 529 | //Throw an exception - The bitmap is not 64x64 |
530 | { | 530 | //throw new Exception("Error: Invalid Parcel Bitmap"); |
531 | tempConvertArr[byteNum] = tempByte; | 531 | } |
532 | tempByte = (byte) 0; | 532 | else |
533 | i = 0; | 533 | { |
534 | byteNum++; | 534 | //Valid: Lets set it |
535 | } | 535 | landBitmap = bitmap; |
536 | } | 536 | forceUpdateLandInfo(); |
537 | } | 537 | } |
538 | return tempConvertArr; | 538 | } |
539 | } | 539 | |
540 | 540 | /// <summary> | |
541 | private bool[,] convertBytesToLandBitmap() | 541 | /// Gets the land's bitmap manually |
542 | { | 542 | /// </summary> |
543 | bool[,] tempConvertMap = new bool[64,64]; | 543 | /// <returns></returns> |
544 | tempConvertMap.Initialize(); | 544 | public bool[,] getLandBitmap() |
545 | byte tempByte = 0; | 545 | { |
546 | int x = 0, y = 0, i = 0, bitNum = 0; | 546 | return landBitmap; |
547 | for (i = 0; i < 512; i++) | 547 | } |
548 | { | 548 | |
549 | tempByte = landData.landBitmapByteArray[i]; | 549 | /// <summary> |
550 | for (bitNum = 0; bitNum < 8; bitNum++) | 550 | /// Converts the land bitmap to a packet friendly byte array |
551 | { | 551 | /// </summary> |
552 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); | 552 | /// <returns></returns> |
553 | tempConvertMap[x, y] = bit; | 553 | private byte[] convertLandBitmapToBytes() |
554 | x++; | 554 | { |
555 | if (x > 63) | 555 | byte[] tempConvertArr = new byte[512]; |
556 | { | 556 | byte tempByte = 0; |
557 | x = 0; | 557 | int x, y, i, byteNum = 0; |
558 | y++; | 558 | i = 0; |
559 | } | 559 | for (y = 0; y < 64; y++) |
560 | } | 560 | { |
561 | } | 561 | for (x = 0; x < 64; x++) |
562 | return tempConvertMap; | 562 | { |
563 | } | 563 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++%8)); |
564 | 564 | if (i%8 == 0) | |
565 | /// <summary> | 565 | { |
566 | /// Full sim land object creation | 566 | tempConvertArr[byteNum] = tempByte; |
567 | /// </summary> | 567 | tempByte = (byte) 0; |
568 | /// <returns></returns> | 568 | i = 0; |
569 | public static bool[,] basicFullRegionLandBitmap() | 569 | byteNum++; |
570 | { | 570 | } |
571 | return getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize); | 571 | } |
572 | } | 572 | } |
573 | 573 | return tempConvertArr; | |
574 | /// <summary> | 574 | } |
575 | /// Used to modify the bitmap between the x and y points. Points use 64 scale | 575 | |
576 | /// </summary> | 576 | private bool[,] convertBytesToLandBitmap() |
577 | /// <param name="start_x"></param> | 577 | { |
578 | /// <param name="start_y"></param> | 578 | bool[,] tempConvertMap = new bool[64,64]; |
579 | /// <param name="end_x"></param> | 579 | tempConvertMap.Initialize(); |
580 | /// <param name="end_y"></param> | 580 | byte tempByte = 0; |
581 | /// <returns></returns> | 581 | int x = 0, y = 0, i = 0, bitNum = 0; |
582 | public static bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) | 582 | for (i = 0; i < 512; i++) |
583 | { | 583 | { |
584 | bool[,] tempBitmap = new bool[64,64]; | 584 | tempByte = landData.landBitmapByteArray[i]; |
585 | tempBitmap.Initialize(); | 585 | for (bitNum = 0; bitNum < 8; bitNum++) |
586 | 586 | { | |
587 | tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); | 587 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); |
588 | return tempBitmap; | 588 | tempConvertMap[x, y] = bit; |
589 | } | 589 | x++; |
590 | 590 | if (x > 63) | |
591 | /// <summary> | 591 | { |
592 | /// Change a land bitmap at within a square and set those points to a specific value | 592 | x = 0; |
593 | /// </summary> | 593 | y++; |
594 | /// <param name="land_bitmap"></param> | 594 | } |
595 | /// <param name="start_x"></param> | 595 | } |
596 | /// <param name="start_y"></param> | 596 | } |
597 | /// <param name="end_x"></param> | 597 | return tempConvertMap; |
598 | /// <param name="end_y"></param> | 598 | } |
599 | /// <param name="set_value"></param> | 599 | |
600 | /// <returns></returns> | 600 | /// <summary> |
601 | public static bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, | 601 | /// Full sim land object creation |
602 | bool set_value) | 602 | /// </summary> |
603 | { | 603 | /// <returns></returns> |
604 | if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) | 604 | public bool[,] basicFullRegionLandBitmap() |
605 | { | 605 | { |
606 | //Throw an exception - The bitmap is not 64x64 | 606 | return getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize); |
607 | //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()"); | 607 | } |
608 | } | 608 | |
609 | 609 | /// <summary> | |
610 | int x, y; | 610 | /// Used to modify the bitmap between the x and y points. Points use 64 scale |
611 | for (y = 0; y < 64; y++) | 611 | /// </summary> |
612 | { | 612 | /// <param name="start_x"></param> |
613 | for (x = 0; x < 64; x++) | 613 | /// <param name="start_y"></param> |
614 | { | 614 | /// <param name="end_x"></param> |
615 | if (x >= start_x/4 && x < end_x/4 | 615 | /// <param name="end_y"></param> |
616 | && y >= start_y/4 && y < end_y/4) | 616 | /// <returns></returns> |
617 | { | 617 | public bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) |
618 | land_bitmap[x, y] = set_value; | 618 | { |
619 | } | 619 | bool[,] tempBitmap = new bool[64,64]; |
620 | } | 620 | tempBitmap.Initialize(); |
621 | } | 621 | |
622 | return land_bitmap; | 622 | tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); |
623 | } | 623 | return tempBitmap; |
624 | 624 | } | |
625 | /// <summary> | 625 | |
626 | /// Join the true values of 2 bitmaps together | 626 | /// <summary> |
627 | /// </summary> | 627 | /// Change a land bitmap at within a square and set those points to a specific value |
628 | /// <param name="bitmap_base"></param> | 628 | /// </summary> |
629 | /// <param name="bitmap_add"></param> | 629 | /// <param name="land_bitmap"></param> |
630 | /// <returns></returns> | 630 | /// <param name="start_x"></param> |
631 | public static bool[,] mergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) | 631 | /// <param name="start_y"></param> |
632 | { | 632 | /// <param name="end_x"></param> |
633 | if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) | 633 | /// <param name="end_y"></param> |
634 | { | 634 | /// <param name="set_value"></param> |
635 | //Throw an exception - The bitmap is not 64x64 | 635 | /// <returns></returns> |
636 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps"); | 636 | public bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, |
637 | } | 637 | bool set_value) |
638 | if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) | 638 | { |
639 | { | 639 | if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) |
640 | //Throw an exception - The bitmap is not 64x64 | 640 | { |
641 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); | 641 | //Throw an exception - The bitmap is not 64x64 |
642 | } | 642 | //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()"); |
643 | 643 | } | |
644 | int x, y; | 644 | |
645 | for (y = 0; y < 64; y++) | 645 | int x, y; |
646 | { | 646 | for (y = 0; y < 64; y++) |
647 | for (x = 0; x < 64; x++) | 647 | { |
648 | { | 648 | for (x = 0; x < 64; x++) |
649 | if (bitmap_add[x, y]) | 649 | { |
650 | { | 650 | if (x >= start_x/4 && x < end_x/4 |
651 | bitmap_base[x, y] = true; | 651 | && y >= start_y/4 && y < end_y/4) |
652 | } | 652 | { |
653 | } | 653 | land_bitmap[x, y] = set_value; |
654 | } | 654 | } |
655 | return bitmap_base; | 655 | } |
656 | } | 656 | } |
657 | 657 | return land_bitmap; | |
658 | #endregion | 658 | } |
659 | 659 | ||
660 | #region Object Select and Object Owner Listing | 660 | /// <summary> |
661 | 661 | /// Join the true values of 2 bitmaps together | |
662 | public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) | 662 | /// </summary> |
663 | { | 663 | /// <param name="bitmap_base"></param> |
664 | List<uint> resultLocalIDs = new List<uint>(); | 664 | /// <param name="bitmap_add"></param> |
665 | foreach (SceneObjectGroup obj in primsOverMe) | 665 | /// <returns></returns> |
666 | { | 666 | public bool[,] mergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) |
667 | if (obj.LocalId > 0) | 667 | { |
668 | { | 668 | if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) |
669 | if (request_type == LandManager.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID) | 669 | { |
670 | { | 670 | //Throw an exception - The bitmap is not 64x64 |
671 | resultLocalIDs.Add(obj.LocalId); | 671 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps"); |
672 | } | 672 | } |
673 | // else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && ...) // TODO: group support | 673 | if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) |
674 | // { | 674 | { |
675 | // } | 675 | //Throw an exception - The bitmap is not 64x64 |
676 | else if (request_type == LandManager.LAND_SELECT_OBJECTS_OTHER && | 676 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); |
677 | obj.OwnerID != remote_client.AgentId) | 677 | } |
678 | { | 678 | |
679 | resultLocalIDs.Add(obj.LocalId); | 679 | int x, y; |
680 | } | 680 | for (y = 0; y < 64; y++) |
681 | } | 681 | { |
682 | } | 682 | for (x = 0; x < 64; x++) |
683 | 683 | { | |
684 | 684 | if (bitmap_add[x, y]) | |
685 | bool firstCall = true; | 685 | { |
686 | int MAX_OBJECTS_PER_PACKET = 251; | 686 | bitmap_base[x, y] = true; |
687 | ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect); | 687 | } |
688 | // TODO: don't create new blocks if recycling an old packet | 688 | } |
689 | ForceObjectSelectPacket.DataBlock[] data; | 689 | } |
690 | while (resultLocalIDs.Count > 0) | 690 | return bitmap_base; |
691 | { | 691 | } |
692 | if (firstCall) | 692 | |
693 | { | 693 | #endregion |
694 | pack._Header.ResetList = true; | 694 | |
695 | firstCall = false; | 695 | #region Object Select and Object Owner Listing |
696 | } | 696 | |
697 | else | 697 | public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) |
698 | { | 698 | { |
699 | pack._Header.ResetList = false; | 699 | List<uint> resultLocalIDs = new List<uint>(); |
700 | } | 700 | foreach (SceneObjectGroup obj in primsOverMe) |
701 | 701 | { | |
702 | if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET) | 702 | if (obj.LocalId > 0) |
703 | { | 703 | { |
704 | data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET]; | 704 | if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID) |
705 | } | 705 | { |
706 | else | 706 | resultLocalIDs.Add(obj.LocalId); |
707 | { | 707 | } |
708 | data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count]; | 708 | // else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && ...) // TODO: group support |
709 | } | 709 | // { |
710 | 710 | // } | |
711 | int i; | 711 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && |
712 | for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++) | 712 | obj.OwnerID != remote_client.AgentId) |
713 | { | 713 | { |
714 | data[i] = new ForceObjectSelectPacket.DataBlock(); | 714 | resultLocalIDs.Add(obj.LocalId); |
715 | data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]); | 715 | } |
716 | resultLocalIDs.RemoveAt(0); | 716 | } |
717 | } | 717 | } |
718 | pack.Data = data; | 718 | |
719 | remote_client.OutPacket((Packet) pack, ThrottleOutPacketType.Task); | 719 | |
720 | } | 720 | bool firstCall = true; |
721 | } | 721 | int MAX_OBJECTS_PER_PACKET = 251; |
722 | 722 | ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect); | |
723 | public void sendLandObjectOwners(IClientAPI remote_client) | 723 | // TODO: don't create new blocks if recycling an old packet |
724 | { | 724 | ForceObjectSelectPacket.DataBlock[] data; |
725 | Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); | 725 | while (resultLocalIDs.Count > 0) |
726 | ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); | 726 | { |
727 | // TODO: don't create new blocks if recycling an old packet | 727 | if (firstCall) |
728 | 728 | { | |
729 | foreach (SceneObjectGroup obj in primsOverMe) | 729 | pack._Header.ResetList = true; |
730 | { | 730 | firstCall = false; |
731 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) | 731 | } |
732 | { | 732 | else |
733 | ownersAndCount.Add(obj.OwnerID, 0); | 733 | { |
734 | } | 734 | pack._Header.ResetList = false; |
735 | ownersAndCount[obj.OwnerID] += obj.PrimCount; | 735 | } |
736 | } | 736 | |
737 | if (ownersAndCount.Count > 0) | 737 | if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET) |
738 | { | 738 | { |
739 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32]; | 739 | data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET]; |
740 | 740 | } | |
741 | if (ownersAndCount.Count < 32) | 741 | else |
742 | { | 742 | { |
743 | dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[ownersAndCount.Count]; | 743 | data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count]; |
744 | } | 744 | } |
745 | 745 | ||
746 | 746 | int i; | |
747 | int num = 0; | 747 | for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++) |
748 | foreach (LLUUID owner in ownersAndCount.Keys) | 748 | { |
749 | { | 749 | data[i] = new ForceObjectSelectPacket.DataBlock(); |
750 | dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock(); | 750 | data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]); |
751 | dataBlock[num].Count = ownersAndCount[owner]; | 751 | resultLocalIDs.RemoveAt(0); |
752 | dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added | 752 | } |
753 | dataBlock[num].OnlineStatus = true; //TODO: fix me later | 753 | pack.Data = data; |
754 | dataBlock[num].OwnerID = owner; | 754 | remote_client.OutPacket((Packet) pack, ThrottleOutPacketType.Task); |
755 | 755 | } | |
756 | num++; | 756 | } |
757 | } | 757 | |
758 | pack.Data = dataBlock; | 758 | public void sendLandObjectOwners(IClientAPI remote_client) |
759 | } | 759 | { |
760 | remote_client.OutPacket(pack, ThrottleOutPacketType.Task); | 760 | Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); |
761 | } | 761 | ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); |
762 | 762 | // TODO: don't create new blocks if recycling an old packet | |
763 | #endregion | 763 | |
764 | 764 | foreach (SceneObjectGroup obj in primsOverMe) | |
765 | #region Object Returning | 765 | { |
766 | 766 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) | |
767 | public void returnObject(SceneObjectGroup obj) | 767 | { |
768 | { | 768 | ownersAndCount.Add(obj.OwnerID, 0); |
769 | } | 769 | } |
770 | 770 | ownersAndCount[obj.OwnerID] += obj.PrimCount; | |
771 | public void returnLandObjects(int type, LLUUID owner) | 771 | } |
772 | { | 772 | if (ownersAndCount.Count > 0) |
773 | } | 773 | { |
774 | 774 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32]; | |
775 | #endregion | 775 | |
776 | 776 | if (ownersAndCount.Count < 32) | |
777 | #region Object Adding/Removing from Parcel | 777 | { |
778 | 778 | dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[ownersAndCount.Count]; | |
779 | public void resetLandPrimCounts() | 779 | } |
780 | { | 780 | |
781 | landData.groupPrims = 0; | 781 | |
782 | landData.ownerPrims = 0; | 782 | int num = 0; |
783 | landData.otherPrims = 0; | 783 | foreach (LLUUID owner in ownersAndCount.Keys) |
784 | landData.selectedPrims = 0; | 784 | { |
785 | primsOverMe.Clear(); | 785 | dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock(); |
786 | } | 786 | dataBlock[num].Count = ownersAndCount[owner]; |
787 | 787 | dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added | |
788 | public void addPrimToCount(SceneObjectGroup obj) | 788 | dataBlock[num].OnlineStatus = true; //TODO: fix me later |
789 | { | 789 | dataBlock[num].OwnerID = owner; |
790 | LLUUID prim_owner = obj.OwnerID; | 790 | |
791 | int prim_count = obj.PrimCount; | 791 | num++; |
792 | 792 | } | |
793 | if (obj.IsSelected) | 793 | pack.Data = dataBlock; |
794 | { | 794 | } |
795 | landData.selectedPrims += prim_count; | 795 | remote_client.OutPacket(pack, ThrottleOutPacketType.Task); |
796 | } | 796 | } |
797 | else | 797 | |
798 | { | 798 | #endregion |
799 | if (prim_owner == landData.ownerID) | 799 | |
800 | { | 800 | #region Object Returning |
801 | landData.ownerPrims += prim_count; | 801 | |
802 | } | 802 | public void returnObject(SceneObjectGroup obj) |
803 | else | 803 | { |
804 | { | 804 | } |
805 | landData.otherPrims += prim_count; | 805 | |
806 | } | 806 | public void returnLandObjects(int type, LLUUID owner) |
807 | } | 807 | { |
808 | 808 | } | |
809 | primsOverMe.Add(obj); | 809 | |
810 | } | 810 | #endregion |
811 | 811 | ||
812 | public void removePrimFromCount(SceneObjectGroup obj) | 812 | #region Object Adding/Removing from Parcel |
813 | { | 813 | |
814 | if (primsOverMe.Contains(obj)) | 814 | public void resetLandPrimCounts() |
815 | { | 815 | { |
816 | LLUUID prim_owner = obj.OwnerID; | 816 | landData.groupPrims = 0; |
817 | int prim_count = obj.PrimCount; | 817 | landData.ownerPrims = 0; |
818 | 818 | landData.otherPrims = 0; | |
819 | if (prim_owner == landData.ownerID) | 819 | landData.selectedPrims = 0; |
820 | { | 820 | primsOverMe.Clear(); |
821 | landData.ownerPrims -= prim_count; | 821 | } |
822 | } | 822 | |
823 | else if (prim_owner == landData.groupID) | 823 | public void addPrimToCount(SceneObjectGroup obj) |
824 | { | 824 | { |
825 | landData.groupPrims -= prim_count; | 825 | LLUUID prim_owner = obj.OwnerID; |
826 | } | 826 | int prim_count = obj.PrimCount; |
827 | else | 827 | |
828 | { | 828 | if (obj.IsSelected) |
829 | landData.otherPrims -= prim_count; | 829 | { |
830 | } | 830 | landData.selectedPrims += prim_count; |
831 | 831 | } | |
832 | primsOverMe.Remove(obj); | 832 | else |
833 | } | 833 | { |
834 | } | 834 | if (prim_owner == landData.ownerID) |
835 | 835 | { | |
836 | #endregion | 836 | landData.ownerPrims += prim_count; |
837 | 837 | } | |
838 | #endregion | 838 | else |
839 | } | 839 | { |
840 | 840 | landData.otherPrims += prim_count; | |
841 | #endregion | 841 | } |
842 | } | 842 | } |
843 | |||
844 | primsOverMe.Add(obj); | ||
845 | } | ||
846 | |||
847 | public void removePrimFromCount(SceneObjectGroup obj) | ||
848 | { | ||
849 | if (primsOverMe.Contains(obj)) | ||
850 | { | ||
851 | LLUUID prim_owner = obj.OwnerID; | ||
852 | int prim_count = obj.PrimCount; | ||
853 | |||
854 | if (prim_owner == landData.ownerID) | ||
855 | { | ||
856 | landData.ownerPrims -= prim_count; | ||
857 | } | ||
858 | else if (prim_owner == landData.groupID) | ||
859 | { | ||
860 | landData.groupPrims -= prim_count; | ||
861 | } | ||
862 | else | ||
863 | { | ||
864 | landData.otherPrims -= prim_count; | ||
865 | } | ||
866 | |||
867 | primsOverMe.Remove(obj); | ||
868 | } | ||
869 | } | ||
870 | |||
871 | #endregion | ||
872 | |||
873 | #endregion | ||
874 | |||
875 | |||
876 | } | ||
877 | |||
878 | #endregion | ||
879 | } | ||
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 27ec9d1..29987d8 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -26,9 +26,8 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using OpenSim.Region.Environment.LandManagement; | ||
30 | using OpenSim.Region.Environment.Scenes; | 29 | using OpenSim.Region.Environment.Scenes; |
31 | 30 | using OpenSim.Region.Environment.Interfaces; | |
32 | namespace OpenSim.Region.Environment | 31 | namespace OpenSim.Region.Environment |
33 | { | 32 | { |
34 | public class PermissionManager | 33 | public class PermissionManager |
@@ -126,7 +125,7 @@ namespace OpenSim.Region.Environment | |||
126 | 125 | ||
127 | string reason = "Insufficient permission"; | 126 | string reason = "Insufficient permission"; |
128 | 127 | ||
129 | Land land = m_scene.LandManager.getLandObject(position.X, position.Y); | 128 | ILandObject land = m_scene.LandChannel.getLandObject(position.X, position.Y); |
130 | if (land == null) return false; | 129 | if (land == null) return false; |
131 | 130 | ||
132 | if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) == | 131 | if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) == |
@@ -230,7 +229,7 @@ namespace OpenSim.Region.Environment | |||
230 | } | 229 | } |
231 | 230 | ||
232 | // Users should be able to edit what is over their land. | 231 | // Users should be able to edit what is over their land. |
233 | Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); | 232 | ILandObject parcel = m_scene.LandChannel.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); |
234 | if (parcel != null && parcel.landData.ownerID == user) | 233 | if (parcel != null && parcel.landData.ownerID == user) |
235 | return objectOwnerMask; | 234 | return objectOwnerMask; |
236 | 235 | ||
@@ -324,7 +323,7 @@ namespace OpenSim.Region.Environment | |||
324 | } | 323 | } |
325 | 324 | ||
326 | // Users should be able to edit what is over their land. | 325 | // Users should be able to edit what is over their land. |
327 | Land parcel = m_scene.LandManager.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y); | 326 | ILandObject parcel = m_scene.LandChannel.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y); |
328 | if ((parcel != null) && (parcel.landData.ownerID == currentUser)) | 327 | if ((parcel != null) && (parcel.landData.ownerID == currentUser)) |
329 | { | 328 | { |
330 | permission = true; | 329 | permission = true; |
@@ -551,7 +550,7 @@ namespace OpenSim.Region.Environment | |||
551 | Y = 0; | 550 | Y = 0; |
552 | 551 | ||
553 | // Land owner can terraform too | 552 | // Land owner can terraform too |
554 | Land parcel = m_scene.LandManager.getLandObject(X, Y); | 553 | ILandObject parcel = m_scene.LandChannel.getLandObject(X, Y); |
555 | if (parcel != null && GenericParcelPermission(user, parcel)) | 554 | if (parcel != null && GenericParcelPermission(user, parcel)) |
556 | permission = true; | 555 | permission = true; |
557 | 556 | ||
@@ -596,7 +595,7 @@ namespace OpenSim.Region.Environment | |||
596 | 595 | ||
597 | #region Parcel Permissions | 596 | #region Parcel Permissions |
598 | 597 | ||
599 | protected virtual bool GenericParcelPermission(LLUUID user, Land parcel) | 598 | protected virtual bool GenericParcelPermission(LLUUID user, ILandObject parcel) |
600 | { | 599 | { |
601 | bool permission = false; | 600 | bool permission = false; |
602 | 601 | ||
@@ -625,22 +624,22 @@ namespace OpenSim.Region.Environment | |||
625 | 624 | ||
626 | protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) | 625 | protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) |
627 | { | 626 | { |
628 | Land parcel = m_scene.LandManager.getLandObject(pos.X, pos.Y); | 627 | ILandObject parcel = m_scene.LandChannel.getLandObject(pos.X, pos.Y); |
629 | if (parcel == null) return false; | 628 | if (parcel == null) return false; |
630 | return GenericParcelPermission(user, parcel); | 629 | return GenericParcelPermission(user, parcel); |
631 | } | 630 | } |
632 | 631 | ||
633 | public virtual bool CanEditParcel(LLUUID user, Land parcel) | 632 | public virtual bool CanEditParcel(LLUUID user, ILandObject parcel) |
634 | { | 633 | { |
635 | return GenericParcelPermission(user, parcel); | 634 | return GenericParcelPermission(user, parcel); |
636 | } | 635 | } |
637 | 636 | ||
638 | public virtual bool CanSellParcel(LLUUID user, Land parcel) | 637 | public virtual bool CanSellParcel(LLUUID user, ILandObject parcel) |
639 | { | 638 | { |
640 | return GenericParcelPermission(user, parcel); | 639 | return GenericParcelPermission(user, parcel); |
641 | } | 640 | } |
642 | 641 | ||
643 | public virtual bool CanAbandonParcel(LLUUID user, Land parcel) | 642 | public virtual bool CanAbandonParcel(LLUUID user, ILandObject parcel) |
644 | { | 643 | { |
645 | return GenericParcelPermission(user, parcel); | 644 | return GenericParcelPermission(user, parcel); |
646 | } | 645 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index e4ba7ef..869c936 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -89,7 +89,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
89 | { | 89 | { |
90 | ((SceneObjectGroup) ent).GetProperties(remoteClient); | 90 | ((SceneObjectGroup) ent).GetProperties(remoteClient); |
91 | ((SceneObjectGroup) ent).IsSelected = true; | 91 | ((SceneObjectGroup) ent).IsSelected = true; |
92 | LandManager.setPrimsTainted(); | 92 | LandChannel.setPrimsTainted(); |
93 | } | 93 | } |
94 | break; | 94 | break; |
95 | } | 95 | } |
@@ -115,7 +115,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
115 | if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID)) | 115 | if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID)) |
116 | { | 116 | { |
117 | ((SceneObjectGroup) ent).IsSelected = false; | 117 | ((SceneObjectGroup) ent).IsSelected = false; |
118 | LandManager.setPrimsTainted(); | 118 | LandChannel.setPrimsTainted(); |
119 | break; | 119 | break; |
120 | } | 120 | } |
121 | } | 121 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 94a4e31..8f3495c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -40,7 +40,6 @@ using OpenSim.Framework.Communications; | |||
40 | using OpenSim.Framework.Communications.Cache; | 40 | using OpenSim.Framework.Communications.Cache; |
41 | using OpenSim.Framework.Servers; | 41 | using OpenSim.Framework.Servers; |
42 | using OpenSim.Region.Environment.Interfaces; | 42 | using OpenSim.Region.Environment.Interfaces; |
43 | using OpenSim.Region.Environment.LandManagement; | ||
44 | using OpenSim.Region.Environment.Modules; | 43 | using OpenSim.Region.Environment.Modules; |
45 | using OpenSim.Region.Environment.Scenes.Scripting; | 44 | using OpenSim.Region.Environment.Scenes.Scripting; |
46 | using OpenSim.Region.Physics.Manager; | 45 | using OpenSim.Region.Physics.Manager; |
@@ -154,13 +153,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
154 | get { return m_authenticateHandler; } | 153 | get { return m_authenticateHandler; } |
155 | } | 154 | } |
156 | 155 | ||
157 | protected readonly LandManager m_LandManager; | ||
158 | // LandManager object instance that manages land related things. Parcel, primcounts etc.. | ||
159 | public LandManager LandManager | ||
160 | { | ||
161 | get { return m_LandManager; } | ||
162 | } | ||
163 | |||
164 | protected readonly EstateManager m_estateManager; | 156 | protected readonly EstateManager m_estateManager; |
165 | // an instance to the physics plugin's Scene object. | 157 | // an instance to the physics plugin's Scene object. |
166 | public PhysicsScene PhysicsScene | 158 | public PhysicsScene PhysicsScene |
@@ -256,8 +248,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
256 | 248 | ||
257 | m_eventManager = new EventManager(); | 249 | m_eventManager = new EventManager(); |
258 | 250 | ||
259 | m_LandManager = new LandManager(this, m_regInfo); | ||
260 | |||
261 | //Bind Storage Manager functions to some land manager functions for this scene | 251 | //Bind Storage Manager functions to some land manager functions for this scene |
262 | EventManager.OnLandObjectAdded += | 252 | EventManager.OnLandObjectAdded += |
263 | new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); | 253 | new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); |
@@ -335,8 +325,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
335 | 325 | ||
336 | protected virtual void RegisterDefaultSceneEvents() | 326 | protected virtual void RegisterDefaultSceneEvents() |
337 | { | 327 | { |
338 | m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts; | ||
339 | m_eventManager.OnParcelPrimCountUpdate += addPrimsToParcelCounts; | ||
340 | m_eventManager.OnPermissionError += SendPermissionAlert; | 328 | m_eventManager.OnPermissionError += SendPermissionAlert; |
341 | } | 329 | } |
342 | 330 | ||
@@ -837,10 +825,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
837 | 825 | ||
838 | private void UpdateLand() | 826 | private void UpdateLand() |
839 | { | 827 | { |
840 | if (m_LandManager.landPrimCountTainted) | 828 | if (LandChannel != null) |
841 | { | 829 | { |
842 | //Perform land update of prim count | 830 | if (LandChannel.isLandPrimCountTainted()) |
843 | performParcelPrimCountUpdate(); | 831 | { |
832 | LandChannel.performParcelPrimCountUpdate(); | ||
833 | } | ||
844 | } | 834 | } |
845 | } | 835 | } |
846 | 836 | ||
@@ -974,12 +964,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
974 | if (dGridSettings["allow_forceful_banlines"] != "TRUE") | 964 | if (dGridSettings["allow_forceful_banlines"] != "TRUE") |
975 | { | 965 | { |
976 | m_log.Info("[GRID]: Grid is disabling forceful parcel banlists"); | 966 | m_log.Info("[GRID]: Grid is disabling forceful parcel banlists"); |
977 | m_LandManager.allowedForcefulBans = false; | 967 | LandChannel.allowedForcefulBans = false; |
978 | } | 968 | } |
979 | else | 969 | else |
980 | { | 970 | { |
981 | m_log.Info("[GRID]: Grid is allowing forceful parcel banlists"); | 971 | m_log.Info("[GRID]: Grid is allowing forceful parcel banlists"); |
982 | m_LandManager.allowedForcefulBans = true; | 972 | LandChannel.allowedForcefulBans = true; |
983 | } | 973 | } |
984 | } | 974 | } |
985 | } | 975 | } |
@@ -1016,11 +1006,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1016 | 1006 | ||
1017 | if (landData.Count == 0) | 1007 | if (landData.Count == 0) |
1018 | { | 1008 | { |
1019 | m_LandManager.NoLandDataFromStorage(); | 1009 | LandChannel.NoLandDataFromStorage(); |
1020 | } | 1010 | } |
1021 | else | 1011 | else |
1022 | { | 1012 | { |
1023 | m_LandManager.IncomingLandObjectsFromStorage(landData); | 1013 | LandChannel.IncomingLandObjectsFromStorage(landData); |
1024 | } | 1014 | } |
1025 | } | 1015 | } |
1026 | 1016 | ||
@@ -1196,9 +1186,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1196 | { | 1186 | { |
1197 | if (Entities.ContainsKey(sceneObject.UUID)) | 1187 | if (Entities.ContainsKey(sceneObject.UUID)) |
1198 | { | 1188 | { |
1199 | m_LandManager.removePrimFromLandPrimCounts(sceneObject); | 1189 | LandChannel.removePrimFromLandPrimCounts(sceneObject); |
1200 | Entities.Remove(sceneObject.UUID); | 1190 | Entities.Remove(sceneObject.UUID); |
1201 | m_LandManager.setPrimsTainted(); | 1191 | LandChannel.setPrimsTainted(); |
1202 | m_innerScene.RemoveAPrimCount(); | 1192 | m_innerScene.RemoveAPrimCount(); |
1203 | } | 1193 | } |
1204 | } | 1194 | } |
@@ -1209,7 +1199,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1209 | /// <param name="prim"></param> | 1199 | /// <param name="prim"></param> |
1210 | public void AcknowledgeNewPrim(SceneObjectGroup prim) | 1200 | public void AcknowledgeNewPrim(SceneObjectGroup prim) |
1211 | { | 1201 | { |
1212 | prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; | 1202 | prim.OnPrimCountTainted += LandChannel.setPrimsTainted; |
1213 | } | 1203 | } |
1214 | 1204 | ||
1215 | public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) | 1205 | public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) |
@@ -1350,7 +1340,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1350 | 1340 | ||
1351 | CreateAndAddScenePresence(client, child); | 1341 | CreateAndAddScenePresence(client, child); |
1352 | 1342 | ||
1353 | m_LandManager.sendParcelOverlay(client); | 1343 | LandChannel.sendParcelOverlay(client); |
1354 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | 1344 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); |
1355 | } | 1345 | } |
1356 | } | 1346 | } |
@@ -1387,17 +1377,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1387 | client.OnObjectDuplicate += m_innerScene.DuplicateObject; | 1377 | client.OnObjectDuplicate += m_innerScene.DuplicateObject; |
1388 | client.OnUpdatePrimFlags += m_innerScene.UpdatePrimFlags; | 1378 | client.OnUpdatePrimFlags += m_innerScene.UpdatePrimFlags; |
1389 | client.OnRequestObjectPropertiesFamily += m_innerScene.RequestObjectPropertiesFamily; | 1379 | client.OnRequestObjectPropertiesFamily += m_innerScene.RequestObjectPropertiesFamily; |
1390 | client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest); | 1380 | client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(LandChannel.handleParcelPropertiesRequest); |
1391 | client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest); | 1381 | client.OnParcelDivideRequest += new ParcelDivideRequest(LandChannel.handleParcelDivideRequest); |
1392 | client.OnParcelJoinRequest += new ParcelJoinRequest(m_LandManager.handleParcelJoinRequest); | 1382 | client.OnParcelJoinRequest += new ParcelJoinRequest(LandChannel.handleParcelJoinRequest); |
1393 | client.OnParcelPropertiesUpdateRequest += | 1383 | client.OnParcelPropertiesUpdateRequest += |
1394 | new ParcelPropertiesUpdateRequest(m_LandManager.handleParcelPropertiesUpdateRequest); | 1384 | new ParcelPropertiesUpdateRequest(LandChannel.handleParcelPropertiesUpdateRequest); |
1395 | client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest); | 1385 | client.OnParcelSelectObjects += new ParcelSelectObjects(LandChannel.handleParcelSelectObjectsRequest); |
1396 | client.OnParcelObjectOwnerRequest += | 1386 | client.OnParcelObjectOwnerRequest += |
1397 | new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); | 1387 | new ParcelObjectOwnerRequest(LandChannel.handleParcelObjectOwnersRequest); |
1398 | client.OnParcelAccessListRequest += new ParcelAccessListRequest(m_LandManager.handleParcelAccessRequest); | 1388 | client.OnParcelAccessListRequest += new ParcelAccessListRequest(LandChannel.handleParcelAccessRequest); |
1399 | client.OnParcelAccessListUpdateRequest += | 1389 | client.OnParcelAccessListUpdateRequest += |
1400 | new ParcelAccessListUpdateRequest(m_LandManager.handleParcelAccessUpdateRequest); | 1390 | new ParcelAccessListUpdateRequest(LandChannel.handleParcelAccessUpdateRequest); |
1401 | 1391 | ||
1402 | client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); | 1392 | client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); |
1403 | client.OnRegionInfoRequest += m_estateManager.HandleRegionInfoRequest; | 1393 | client.OnRegionInfoRequest += m_estateManager.HandleRegionInfoRequest; |
@@ -1445,7 +1435,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1445 | 1435 | ||
1446 | if (avatar.IsChildAgent) | 1436 | if (avatar.IsChildAgent) |
1447 | { | 1437 | { |
1448 | avatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement; | 1438 | avatar.OnSignificantClientMovement += LandChannel.handleSignificantClientMovement; |
1449 | } | 1439 | } |
1450 | 1440 | ||
1451 | return avatar; | 1441 | return avatar; |
@@ -2021,31 +2011,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2021 | } | 2011 | } |
2022 | return LLUUID.Zero; | 2012 | return LLUUID.Zero; |
2023 | } | 2013 | } |
2024 | 2014 | ||
2025 | /// <summary> | ||
2026 | /// | ||
2027 | /// </summary> | ||
2028 | public void performParcelPrimCountUpdate() | ||
2029 | { | ||
2030 | m_LandManager.resetAllLandPrimCounts(); | ||
2031 | m_eventManager.TriggerParcelPrimCountUpdate(); | ||
2032 | m_LandManager.finalizeLandPrimCountUpdate(); | ||
2033 | m_LandManager.landPrimCountTainted = false; | ||
2034 | } | ||
2035 | |||
2036 | /// <summary> | ||
2037 | /// | ||
2038 | /// </summary> | ||
2039 | public void addPrimsToParcelCounts() | ||
2040 | { | ||
2041 | foreach (EntityBase obj in Entities.Values) | ||
2042 | { | ||
2043 | if (obj is SceneObjectGroup) | ||
2044 | { | ||
2045 | m_eventManager.TriggerParcelPrimCountAdd((SceneObjectGroup)obj); | ||
2046 | } | ||
2047 | } | ||
2048 | } | ||
2049 | 2015 | ||
2050 | /// <summary> | 2016 | /// <summary> |
2051 | /// This method is a way for the Friends Module to create an instant | 2017 | /// This method is a way for the Friends Module to create an instant |
@@ -2455,7 +2421,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2455 | 2421 | ||
2456 | public LLUUID GetLandOwner(float x, float y) | 2422 | public LLUUID GetLandOwner(float x, float y) |
2457 | { | 2423 | { |
2458 | Land land = LandManager.getLandObject(x, y); | 2424 | ILandObject land = LandChannel.getLandObject(x, y); |
2459 | if (land == null) | 2425 | if (land == null) |
2460 | { | 2426 | { |
2461 | return LLUUID.Zero; | 2427 | return LLUUID.Zero; |
@@ -2468,12 +2434,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
2468 | 2434 | ||
2469 | public LandData GetLandData(float x, float y) | 2435 | public LandData GetLandData(float x, float y) |
2470 | { | 2436 | { |
2471 | return LandManager.getLandObject(x, y).landData; | 2437 | return LandChannel.getLandObject(x, y).landData; |
2472 | } | 2438 | } |
2473 | 2439 | ||
2474 | public void SetLandMusicURL(float x, float y, string url) | 2440 | public void SetLandMusicURL(float x, float y, string url) |
2475 | { | 2441 | { |
2476 | Land land = LandManager.getLandObject(x, y); | 2442 | ILandObject land = LandChannel.getLandObject(x, y); |
2477 | if (land == null) | 2443 | if (land == null) |
2478 | { | 2444 | { |
2479 | return; | 2445 | return; |
@@ -2487,7 +2453,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2487 | 2453 | ||
2488 | public void SetLandMediaURL(float x, float y, string url) | 2454 | public void SetLandMediaURL(float x, float y, string url) |
2489 | { | 2455 | { |
2490 | Land land = LandManager.getLandObject(x, y); | 2456 | ILandObject land = LandChannel.getLandObject(x, y); |
2491 | 2457 | ||
2492 | if (land == null) | 2458 | if (land == null) |
2493 | { | 2459 | { |
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 4002aaf..5551173 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs | |||
@@ -62,6 +62,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
62 | //public TerrainEngine Terrain; | 62 | //public TerrainEngine Terrain; |
63 | public ITerrainChannel Heightmap; | 63 | public ITerrainChannel Heightmap; |
64 | 64 | ||
65 | public ILandChannel LandChannel; | ||
66 | |||
65 | protected EventManager m_eventManager; | 67 | protected EventManager m_eventManager; |
66 | 68 | ||
67 | public EventManager EventManager | 69 | public EventManager EventManager |
@@ -69,6 +71,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
69 | get { return m_eventManager; } | 71 | get { return m_eventManager; } |
70 | } | 72 | } |
71 | 73 | ||
74 | |||
72 | protected string m_datastore; | 75 | protected string m_datastore; |
73 | 76 | ||
74 | private uint m_nextLocalId = 8880000; | 77 | private uint m_nextLocalId = 8880000; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 4df5b10..809507c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
@@ -29,7 +29,6 @@ using libsecondlife; | |||
29 | using System; | 29 | using System; |
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
32 | using OpenSim.Region.Environment.LandManagement; | ||
33 | 32 | ||
34 | namespace OpenSim.Region.Environment.Scenes | 33 | namespace OpenSim.Region.Environment.Scenes |
35 | { | 34 | { |
@@ -106,7 +105,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
106 | 105 | ||
107 | public event SceneGroupGrabed OnSceneGroupGrab; | 106 | public event SceneGroupGrabed OnSceneGroupGrab; |
108 | 107 | ||
109 | public delegate void LandObjectAdded(Land newParcel, LLUUID regionUUID); | 108 | public delegate void LandObjectAdded(ILandObject newParcel); |
110 | 109 | ||
111 | public event LandObjectAdded OnLandObjectAdded; | 110 | public event LandObjectAdded OnLandObjectAdded; |
112 | 111 | ||
@@ -352,13 +351,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
352 | } | 351 | } |
353 | } | 352 | } |
354 | 353 | ||
355 | public void TriggerLandObjectAdded(Land newParcel, LLUUID regionID) | 354 | public void TriggerLandObjectAdded(ILandObject newParcel) |
356 | { | 355 | { |
357 | handlerLandObjectAdded = OnLandObjectAdded; | 356 | handlerLandObjectAdded = OnLandObjectAdded; |
358 | 357 | ||
359 | if (handlerLandObjectAdded != null) | 358 | if (handlerLandObjectAdded != null) |
360 | { | 359 | { |
361 | handlerLandObjectAdded(newParcel, regionID); | 360 | handlerLandObjectAdded(newParcel); |
362 | } | 361 | } |
363 | } | 362 | } |
364 | 363 | ||
@@ -371,11 +370,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
371 | } | 370 | } |
372 | } | 371 | } |
373 | 372 | ||
374 | public void TriggerLandObjectUpdated(uint localParcelID, Land newParcel) | 373 | public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel) |
375 | { | 374 | { |
376 | //triggerLandObjectRemoved(localParcelID); | 375 | //triggerLandObjectRemoved(localParcelID); |
377 | 376 | ||
378 | TriggerLandObjectAdded(newParcel, newParcel.m_scene.RegionInfo.RegionID); | 377 | TriggerLandObjectAdded(newParcel); |
379 | } | 378 | } |
380 | 379 | ||
381 | public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID) | 380 | public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID) |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 67a4b97..f58109d 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -371,7 +371,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
371 | RegisterToEvents(); | 371 | RegisterToEvents(); |
372 | SetDirectionVectors(); | 372 | SetDirectionVectors(); |
373 | 373 | ||
374 | m_scene.LandManager.sendLandUpdate(this, true); | 374 | m_scene.LandChannel.sendLandUpdate(this, true); |
375 | } | 375 | } |
376 | 376 | ||
377 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, | 377 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
@@ -549,7 +549,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
549 | //if (!m_gotAllObjectsInScene) | 549 | //if (!m_gotAllObjectsInScene) |
550 | //{ | 550 | //{ |
551 | m_scene.SendAllSceneObjectsToClient(this); | 551 | m_scene.SendAllSceneObjectsToClient(this); |
552 | m_scene.LandManager.sendLandUpdate(this, true); | 552 | m_scene.LandChannel.sendLandUpdate(this, true); |
553 | 553 | ||
554 | //m_gotAllObjectsInScene = true; | 554 | //m_gotAllObjectsInScene = true; |
555 | //} | 555 | //} |
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs index 1578348..d0a0e86 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs | |||
@@ -29,7 +29,7 @@ using System; | |||
29 | using System.Text; | 29 | using System.Text; |
30 | using Axiom.Math; | 30 | using Axiom.Math; |
31 | using OpenSim.Framework.Console; | 31 | using OpenSim.Framework.Console; |
32 | using OpenSim.Region.Environment.LandManagement; | 32 | using OpenSim.Region.Environment.Interfaces; |
33 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
34 | using Key = libsecondlife.LLUUID; | 34 | using Key = libsecondlife.LLUUID; |
35 | using Rotation = libsecondlife.LLQuaternion; | 35 | using Rotation = libsecondlife.LLQuaternion; |
@@ -105,7 +105,7 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
105 | public void osAddToLandPassList(Key avatar, float hours) | 105 | public void osAddToLandPassList(Key avatar, float hours) |
106 | { | 106 | { |
107 | Vector myPosition = Task.AbsolutePosition; | 107 | Vector myPosition = Task.AbsolutePosition; |
108 | Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); | 108 | ILandObject myParcel = Scene.LandChannel.getLandObject(myPosition.X, myPosition.Y); |
109 | if (myParcel == null) | 109 | if (myParcel == null) |
110 | { | 110 | { |
111 | //Dont do anything! | 111 | //Dont do anything! |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index efcec75..62dcf8c 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -4311,7 +4311,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4311 | public int llGetParcelFlags(LSL_Types.Vector3 pos) | 4311 | public int llGetParcelFlags(LSL_Types.Vector3 pos) |
4312 | { | 4312 | { |
4313 | m_host.AddScriptLPS(1); | 4313 | m_host.AddScriptLPS(1); |
4314 | return (int)World.LandManager.getLandObject((float)pos.x, (float)pos.y).landData.landFlags; | 4314 | return (int)World.LandChannel.getLandObject((float)pos.x, (float)pos.y).landData.landFlags; |
4315 | } | 4315 | } |
4316 | 4316 | ||
4317 | public int llGetRegionFlags() | 4317 | public int llGetRegionFlags() |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs index 49a967c..12d6871 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs | |||
@@ -35,7 +35,6 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Data; | 36 | using OpenSim.Framework.Data; |
37 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
38 | using OpenSim.Region.Environment.LandManagement; | ||
39 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
40 | 39 | ||
41 | namespace OpenSim.DataStore.MSSQL | 40 | namespace OpenSim.DataStore.MSSQL |
@@ -304,7 +303,7 @@ namespace OpenSim.DataStore.MSSQL | |||
304 | { | 303 | { |
305 | } | 304 | } |
306 | 305 | ||
307 | public void StoreLandObject(Land parcel, LLUUID regionUUID) | 306 | public void StoreLandObject(ILandObject parcel) |
308 | { | 307 | { |
309 | } | 308 | } |
310 | 309 | ||
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs index 4f24235..ac451d0 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs | |||
@@ -29,7 +29,6 @@ using System.Collections.Generic; | |||
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
32 | using OpenSim.Region.Environment.LandManagement; | ||
33 | using OpenSim.Region.Environment.Scenes; | 32 | using OpenSim.Region.Environment.Scenes; |
34 | 33 | ||
35 | namespace OpenSim.DataStore.NullStorage | 34 | namespace OpenSim.DataStore.NullStorage |
@@ -72,7 +71,7 @@ namespace OpenSim.DataStore.NullStorage | |||
72 | { | 71 | { |
73 | } | 72 | } |
74 | 73 | ||
75 | public void StoreLandObject(Land land, LLUUID regionUUID) | 74 | public void StoreLandObject(ILandObject land) |
76 | { | 75 | { |
77 | } | 76 | } |
78 | 77 | ||