diff options
author | Robert Adams | 2013-11-08 20:51:09 -0800 |
---|---|---|
committer | Robert Adams | 2013-11-08 20:51:09 -0800 |
commit | a7a837550e0ef036c5da43b1ec42a523e28b0cc0 (patch) | |
tree | 69bbe72ecadc9e46e51fb1f41f6fe0dc71e90149 /OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |
parent | Merge branch 'master' into varregion (diff) | |
download | opensim-SC_OLD-a7a837550e0ef036c5da43b1ec42a523e28b0cc0.zip opensim-SC_OLD-a7a837550e0ef036c5da43b1ec42a523e28b0cc0.tar.gz opensim-SC_OLD-a7a837550e0ef036c5da43b1ec42a523e28b0cc0.tar.bz2 opensim-SC_OLD-a7a837550e0ef036c5da43b1ec42a523e28b0cc0.tar.xz |
varregion: Massive work to LandManagementModule and LandObject to
handle variable sized regions. Many changes for both the region and parcels.
Most of the constant "4" (for the 4x4 parcel units) have been replaced
with symbols and math.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 304 |
1 files changed, 202 insertions, 102 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 51ed83f..3f21f85 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -65,6 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
65 | public class LandManagementModule : INonSharedRegionModule | 65 | public class LandManagementModule : INonSharedRegionModule |
66 | { | 66 | { |
67 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 67 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
68 | private static readonly string LogHeader = "[LAND MANAGEMENT MODULE]"; | ||
68 | 69 | ||
69 | private static readonly string remoteParcelRequestPath = "0009/"; | 70 | private static readonly string remoteParcelRequestPath = "0009/"; |
70 | 71 | ||
@@ -76,15 +77,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
76 | protected IPrimCountModule m_primCountModule; | 77 | protected IPrimCountModule m_primCountModule; |
77 | protected IDialogModule m_Dialog; | 78 | protected IDialogModule m_Dialog; |
78 | 79 | ||
79 | // Minimum for parcels to work is 64m even if we don't actually use them. | ||
80 | #pragma warning disable 0429 | ||
81 | private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; | ||
82 | #pragma warning restore 0429 | ||
83 | |||
84 | /// <value> | 80 | /// <value> |
85 | /// Local land ids at specified region co-ordinates (region size / 4) | 81 | /// Local land ids at specified region co-ordinates (region size / 4) |
86 | /// </value> | 82 | /// </value> |
87 | private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; | 83 | private int[,] m_landIDList; |
84 | private const int landUnit = 4; | ||
88 | 85 | ||
89 | /// <value> | 86 | /// <value> |
90 | /// Land objects keyed by local id | 87 | /// Land objects keyed by local id |
@@ -117,6 +114,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
117 | public void AddRegion(Scene scene) | 114 | public void AddRegion(Scene scene) |
118 | { | 115 | { |
119 | m_scene = scene; | 116 | m_scene = scene; |
117 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | ||
118 | |||
120 | m_landIDList.Initialize(); | 119 | m_landIDList.Initialize(); |
121 | landChannel = new LandChannel(scene, this); | 120 | landChannel = new LandChannel(scene, this); |
122 | 121 | ||
@@ -326,6 +325,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
326 | { | 325 | { |
327 | m_landList.Clear(); | 326 | m_landList.Clear(); |
328 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 327 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
328 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | ||
329 | m_landIDList.Initialize(); | 329 | m_landIDList.Initialize(); |
330 | } | 330 | } |
331 | } | 331 | } |
@@ -340,7 +340,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
340 | "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); | 340 | "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); |
341 | 341 | ||
342 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); | 342 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); |
343 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | 343 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, |
344 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); | ||
344 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 345 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
345 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); | 346 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); |
346 | 347 | ||
@@ -467,8 +468,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
467 | 468 | ||
468 | public void SendLandUpdate(ScenePresence avatar, bool force) | 469 | public void SendLandUpdate(ScenePresence avatar, bool force) |
469 | { | 470 | { |
470 | ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), | 471 | ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), |
471 | (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); | 472 | (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); |
472 | 473 | ||
473 | if (over != null) | 474 | if (over != null) |
474 | { | 475 | { |
@@ -634,17 +635,29 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
634 | new_land.LandData.LocalID = newLandLocalID; | 635 | new_land.LandData.LocalID = newLandLocalID; |
635 | 636 | ||
636 | bool[,] landBitmap = new_land.GetLandBitmap(); | 637 | bool[,] landBitmap = new_land.GetLandBitmap(); |
637 | for (int x = 0; x < landArrayMax; x++) | 638 | m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). bitmap[600/4,600/4]={3}, newLocalID={4}", |
639 | LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), landBitmap[600/4, 600/4], newLandLocalID); | ||
640 | |||
641 | if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) | ||
642 | { | ||
643 | // Going to variable sized regions can cause mismatches | ||
644 | m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", | ||
645 | LogHeader, landBitmap.GetLength(0), m_landIDList.GetLength(1), landBitmap.GetLength(0), m_landIDList.GetLength(1) ); | ||
646 | } | ||
647 | else | ||
638 | { | 648 | { |
639 | for (int y = 0; y < landArrayMax; y++) | 649 | for (int x = 0; x < landBitmap.GetLength(0); x++) |
640 | { | 650 | { |
641 | if (landBitmap[x, y]) | 651 | for (int y = 0; y < landBitmap.GetLength(1); y++) |
642 | { | 652 | { |
643 | // m_log.DebugFormat( | 653 | if (landBitmap[x, y]) |
644 | // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", | 654 | { |
645 | // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); | 655 | // m_log.DebugFormat( |
646 | 656 | // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", | |
647 | m_landIDList[x, y] = newLandLocalID; | 657 | // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); |
658 | |||
659 | m_landIDList[x, y] = newLandLocalID; | ||
660 | } | ||
648 | } | 661 | } |
649 | } | 662 | } |
650 | } | 663 | } |
@@ -666,9 +679,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
666 | ILandObject land; | 679 | ILandObject land; |
667 | lock (m_landList) | 680 | lock (m_landList) |
668 | { | 681 | { |
669 | for (int x = 0; x < 64; x++) | 682 | for (int x = 0; x < m_landIDList.GetLength(0); x++) |
670 | { | 683 | { |
671 | for (int y = 0; y < 64; y++) | 684 | for (int y = 0; y < m_landIDList.GetLength(1); y++) |
672 | { | 685 | { |
673 | if (m_landIDList[x, y] == local_id) | 686 | if (m_landIDList[x, y] == local_id) |
674 | { | 687 | { |
@@ -720,9 +733,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
720 | bool[,] landBitmapSlave = slave.GetLandBitmap(); | 733 | bool[,] landBitmapSlave = slave.GetLandBitmap(); |
721 | lock (m_landList) | 734 | lock (m_landList) |
722 | { | 735 | { |
723 | for (int x = 0; x < 64; x++) | 736 | for (int x = 0; x < landBitmapSlave.GetLength(0); x++) |
724 | { | 737 | { |
725 | for (int y = 0; y < 64; y++) | 738 | for (int y = 0; y < landBitmapSlave.GetLength(1); y++) |
726 | { | 739 | { |
727 | if (landBitmapSlave[x, y]) | 740 | if (landBitmapSlave[x, y]) |
728 | { | 741 | { |
@@ -756,23 +769,28 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
756 | /// <returns>Land object at the point supplied</returns> | 769 | /// <returns>Land object at the point supplied</returns> |
757 | public ILandObject GetLandObject(float x_float, float y_float) | 770 | public ILandObject GetLandObject(float x_float, float y_float) |
758 | { | 771 | { |
772 | return GetLandObject((int)x_float, (int)y_float); | ||
773 | /* | ||
759 | int x; | 774 | int x; |
760 | int y; | 775 | int y; |
761 | 776 | ||
762 | if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) | 777 | if (x_float >= m_scene.RegionInfo.RegionSizeX || x_float < 0 || y_float >= m_scene.RegionInfo.RegionSizeX || y_float < 0) |
763 | return null; | 778 | return null; |
764 | 779 | ||
765 | try | 780 | try |
766 | { | 781 | { |
767 | x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); | 782 | x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / (float)landUnit)); |
768 | y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / 4.0)); | 783 | y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / (float)landUnit)); |
769 | } | 784 | } |
770 | catch (OverflowException) | 785 | catch (OverflowException) |
771 | { | 786 | { |
772 | return null; | 787 | return null; |
773 | } | 788 | } |
774 | 789 | ||
775 | if (x >= 64 || y >= 64 || x < 0 || y < 0) | 790 | if (x >= (m_scene.RegionInfo.RegionSizeX / landUnit) |
791 | || y >= (m_scene.RegionInfo.RegionSizeY / landUnit) | ||
792 | || x < 0 | ||
793 | || y < 0) | ||
776 | { | 794 | { |
777 | return null; | 795 | return null; |
778 | } | 796 | } |
@@ -788,38 +806,112 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
788 | // m_log.DebugFormat( | 806 | // m_log.DebugFormat( |
789 | // "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}", | 807 | // "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}", |
790 | // x, y, m_scene.RegionInfo.RegionName); | 808 | // x, y, m_scene.RegionInfo.RegionName); |
791 | 809 | ||
792 | if (m_landList.ContainsKey(m_landIDList[x, y])) | 810 | try |
793 | return m_landList[m_landIDList[x, y]]; | 811 | { |
812 | if (m_landList.ContainsKey(m_landIDList[x, y])) | ||
813 | return m_landList[m_landIDList[x, y]]; | ||
814 | } | ||
815 | catch (Exception e) | ||
816 | { | ||
817 | m_log.DebugFormat("{0} GetLandObject exception. x={1}, y={2}, m_landIDList.len=({3},{4})", | ||
818 | LogHeader, x, y, m_landIDList.GetLength(0), m_landIDList.GetLength(1)); | ||
819 | } | ||
794 | 820 | ||
795 | return null; | 821 | return null; |
796 | } | 822 | } |
823 | */ | ||
797 | } | 824 | } |
798 | 825 | ||
826 | // Given a region position, return the parcel land object for that location | ||
799 | public ILandObject GetLandObject(int x, int y) | 827 | public ILandObject GetLandObject(int x, int y) |
800 | { | 828 | { |
801 | if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) | 829 | ILandObject ret = null; |
830 | |||
831 | if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) | ||
802 | { | 832 | { |
803 | // These exceptions here will cause a lot of complaints from the users specifically because | 833 | // These exceptions here will cause a lot of complaints from the users specifically because |
804 | // they happen every time at border crossings | 834 | // they happen every time at border crossings |
805 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); | 835 | throw new Exception( |
836 | String.Format("{0} GetLandObject for non-existant position. Region={1}, pos=<{2},{3}", | ||
837 | LogHeader, m_scene.RegionInfo.RegionName, x, y) | ||
838 | ); | ||
806 | } | 839 | } |
807 | 840 | ||
808 | lock (m_landIDList) | 841 | lock (m_landIDList) |
809 | { | 842 | { |
810 | try | 843 | try |
811 | { | 844 | { |
812 | return m_landList[m_landIDList[x / 4, y / 4]]; | 845 | int landID = m_landIDList[x / landUnit, y / landUnit]; |
846 | if (landID == 0) | ||
847 | { | ||
848 | // Zero is the uninitialized value saying there is no parcel for this location. | ||
849 | // This sometimes happens when terrain is resized. | ||
850 | if (m_landList.Count == 1) | ||
851 | { | ||
852 | int onlyParcelID = 0; | ||
853 | ILandObject onlyLandObject = null; | ||
854 | foreach (KeyValuePair<int, ILandObject> kvp in m_landList) | ||
855 | { | ||
856 | onlyParcelID = kvp.Key; | ||
857 | onlyLandObject = kvp.Value; | ||
858 | break; | ||
859 | } | ||
860 | |||
861 | // There is only one parcel. Grow it to fill all the unallocated spaces. | ||
862 | for (int xx = 0; xx < m_landIDList.GetLength(0); xx++) | ||
863 | for (int yy = 0; yy < m_landIDList.GetLength(1); yy++) | ||
864 | if (m_landIDList[xx, yy] == 0) | ||
865 | m_landIDList[xx, yy] = onlyParcelID; | ||
866 | |||
867 | onlyLandObject.LandBitmap = CreateBitmapForID(onlyParcelID); | ||
868 | landID = onlyParcelID; | ||
869 | } | ||
870 | else | ||
871 | { | ||
872 | // There are several other parcels so we must create a new one for the unassigned space | ||
873 | ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); | ||
874 | // Claim all the unclaimed "0" ids | ||
875 | newLand.SetLandBitmap(CreateBitmapForID(0)); | ||
876 | newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
877 | newLand.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); | ||
878 | AddLandObject(newLand); | ||
879 | landID = m_lastLandLocalID; | ||
880 | } | ||
881 | } | ||
882 | |||
883 | ret = m_landList[landID]; | ||
813 | } | 884 | } |
814 | catch (IndexOutOfRangeException) | 885 | catch (IndexOutOfRangeException) |
815 | { | 886 | { |
816 | // m_log.WarnFormat( | 887 | m_log.ErrorFormat( |
817 | // "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", | 888 | "{0} GetLandObject: Tried to retrieve land object from out of bounds co-ordinate ({1},{2}) in {3}. landListSize=({4},{5})", |
818 | // x, y, m_scene.RegionInfo.RegionName); | 889 | LogHeader, x, y, m_scene.RegionInfo.RegionName, m_landIDList.GetLength(0), m_landIDList.GetLength(1)); |
819 | 890 | return null; | |
891 | } | ||
892 | catch | ||
893 | { | ||
894 | m_log.ErrorFormat( | ||
895 | "{0} GetLandObject: LandID not in landlist. XY=<{1},{2}> in {3}. landID[x,y]={4}", | ||
896 | LogHeader, x, y, m_scene.RegionInfo.RegionName, m_landIDList[x/landUnit, y/landUnit]); | ||
820 | return null; | 897 | return null; |
821 | } | 898 | } |
822 | } | 899 | } |
900 | return ret; | ||
901 | } | ||
902 | |||
903 | // Create a 'parcel is here' bitmap for the parcel identified by the passed landID | ||
904 | private bool[,] CreateBitmapForID(int landID) | ||
905 | { | ||
906 | bool[,] ret = new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)]; | ||
907 | ret.Initialize(); | ||
908 | |||
909 | for (int xx = 0; xx < m_landIDList.GetLength(0); xx++) | ||
910 | for (int yy = 0; yy < m_landIDList.GetLength(0); yy++) | ||
911 | if (m_landIDList[xx, yy] == landID) | ||
912 | ret[xx, yy] = true; | ||
913 | |||
914 | return ret; | ||
823 | } | 915 | } |
824 | 916 | ||
825 | #endregion | 917 | #endregion |
@@ -1082,85 +1174,93 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1082 | byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | 1174 | byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; |
1083 | int byteArrayCount = 0; | 1175 | int byteArrayCount = 0; |
1084 | int sequenceID = 0; | 1176 | int sequenceID = 0; |
1085 | int blockmeters = 4 * (int) Constants.RegionSize/(int)Constants.TerrainPatchSize; | ||
1086 | 1177 | ||
1087 | 1178 | // Layer data is in landUnit (4m) chunks | |
1088 | for (int y = 0; y < blockmeters; y++) | 1179 | for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++) |
1089 | { | 1180 | { |
1090 | for (int x = 0; x < blockmeters; x++) | 1181 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++) |
1091 | { | 1182 | { |
1092 | byte tempByte = 0; //This represents the byte for the current 4x4 | 1183 | byteArray[byteArrayCount] = BuildLayerByte(GetLandObject(x * landUnit, y * landUnit), x, y, remote_client); |
1184 | byteArrayCount++; | ||
1185 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) | ||
1186 | { | ||
1187 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); | ||
1188 | byteArrayCount = 0; | ||
1189 | sequenceID++; | ||
1190 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | ||
1191 | } | ||
1093 | 1192 | ||
1094 | ILandObject currentParcelBlock = GetLandObject(x * 4, y * 4); | 1193 | } |
1194 | } | ||
1195 | if (byteArrayCount != 0) | ||
1196 | { | ||
1197 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); | ||
1198 | } | ||
1199 | } | ||
1095 | 1200 | ||
1096 | if (currentParcelBlock != null) | 1201 | private byte BuildLayerByte(ILandObject currentParcelBlock, int x, int y, IClientAPI remote_client) |
1097 | { | 1202 | { |
1098 | if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) | 1203 | byte tempByte = 0; //This represents the byte for the current 4x4 |
1099 | { | ||
1100 | //Owner Flag | ||
1101 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | ||
1102 | } | ||
1103 | else if (currentParcelBlock.LandData.SalePrice > 0 && | ||
1104 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | ||
1105 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | ||
1106 | { | ||
1107 | //Sale Flag | ||
1108 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE); | ||
1109 | } | ||
1110 | else if (currentParcelBlock.LandData.OwnerID == UUID.Zero) | ||
1111 | { | ||
1112 | //Public Flag | ||
1113 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC); | ||
1114 | } | ||
1115 | else | ||
1116 | { | ||
1117 | //Other Flag | ||
1118 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_OTHER); | ||
1119 | } | ||
1120 | 1204 | ||
1121 | //Now for border control | 1205 | if (currentParcelBlock != null) |
1206 | { | ||
1207 | if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) | ||
1208 | { | ||
1209 | //Owner Flag | ||
1210 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | ||
1211 | } | ||
1212 | else if (currentParcelBlock.LandData.SalePrice > 0 && | ||
1213 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | ||
1214 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | ||
1215 | { | ||
1216 | //Sale Flag | ||
1217 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE); | ||
1218 | } | ||
1219 | else if (currentParcelBlock.LandData.OwnerID == UUID.Zero) | ||
1220 | { | ||
1221 | //Public Flag | ||
1222 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC); | ||
1223 | } | ||
1224 | else | ||
1225 | { | ||
1226 | //Other Flag | ||
1227 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_OTHER); | ||
1228 | } | ||
1122 | 1229 | ||
1123 | ILandObject westParcel = null; | 1230 | //Now for border control |
1124 | ILandObject southParcel = null; | ||
1125 | if (x > 0) | ||
1126 | { | ||
1127 | westParcel = GetLandObject((x - 1) * 4, y * 4); | ||
1128 | } | ||
1129 | if (y > 0) | ||
1130 | { | ||
1131 | southParcel = GetLandObject(x * 4, (y - 1) * 4); | ||
1132 | } | ||
1133 | 1231 | ||
1134 | if (x == 0) | 1232 | ILandObject westParcel = null; |
1135 | { | 1233 | ILandObject southParcel = null; |
1136 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST); | 1234 | if (x > 0) |
1137 | } | 1235 | { |
1138 | else if (westParcel != null && westParcel != currentParcelBlock) | 1236 | westParcel = GetLandObject((x - 1) * landUnit, y * landUnit); |
1139 | { | 1237 | } |
1140 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST); | 1238 | if (y > 0) |
1141 | } | 1239 | { |
1240 | southParcel = GetLandObject(x * landUnit, (y - 1) * landUnit); | ||
1241 | } | ||
1142 | 1242 | ||
1143 | if (y == 0) | 1243 | if (x == 0) |
1144 | { | 1244 | { |
1145 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); | 1245 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST); |
1146 | } | 1246 | } |
1147 | else if (southParcel != null && southParcel != currentParcelBlock) | 1247 | else if (westParcel != null && westParcel != currentParcelBlock) |
1148 | { | 1248 | { |
1149 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); | 1249 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST); |
1150 | } | 1250 | } |
1151 | 1251 | ||
1152 | byteArray[byteArrayCount] = tempByte; | 1252 | if (y == 0) |
1153 | byteArrayCount++; | 1253 | { |
1154 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) | 1254 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); |
1155 | { | 1255 | } |
1156 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); | 1256 | else if (southParcel != null && southParcel != currentParcelBlock) |
1157 | byteArrayCount = 0; | 1257 | { |
1158 | sequenceID++; | 1258 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); |
1159 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | ||
1160 | } | ||
1161 | } | ||
1162 | } | 1259 | } |
1260 | |||
1163 | } | 1261 | } |
1262 | |||
1263 | return tempByte; | ||
1164 | } | 1264 | } |
1165 | 1265 | ||
1166 | public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, | 1266 | public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, |