aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorRobert Adams2013-11-10 19:52:31 -0800
committerRobert Adams2013-11-10 19:52:31 -0800
commitc12e68e34d6f9340bbd17a2f183fe9859483cc6f (patch)
tree8fa99677885eb8dde5e352953dbbbb9fbbd2b2c6 /OpenSim
parentMerge branch 'master' into varregion (diff)
downloadopensim-SC_OLD-c12e68e34d6f9340bbd17a2f183fe9859483cc6f.zip
opensim-SC_OLD-c12e68e34d6f9340bbd17a2f183fe9859483cc6f.tar.gz
opensim-SC_OLD-c12e68e34d6f9340bbd17a2f183fe9859483cc6f.tar.bz2
opensim-SC_OLD-c12e68e34d6f9340bbd17a2f183fe9859483cc6f.tar.xz
varregion: fix GetLandObject error return and initialization of square
land object bitmaps. This fixes creation of child presences and the editing of parcels. Also lots of commented out debugging messages.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/TerrainData.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs26
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs17
3 files changed, 37 insertions, 12 deletions
diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs
index 75446d1..1c52a69 100644
--- a/OpenSim/Framework/TerrainData.cs
+++ b/OpenSim/Framework/TerrainData.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Framework
112 public class HeightmapTerrainData : TerrainData 112 public class HeightmapTerrainData : TerrainData
113 { 113 {
114 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 114 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
115 private static string LogHeader = "[TERRAIN DATA]"; 115 private static string LogHeader = "[HEIGHTMAP TERRAIN DATA]";
116 116
117 // TerrainData.this[x, y] 117 // TerrainData.this[x, y]
118 public override float this[int x, int y] 118 public override float this[int x, int y]
@@ -124,7 +124,6 @@ namespace OpenSim.Framework
124 { 124 {
125 m_heightmap[x, y] = newVal; 125 m_heightmap[x, y] = newVal;
126 m_taint[x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize] = true; 126 m_taint[x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize] = true;
127 // m_log.DebugFormat("{0} set[{1},{2}] to {3} ({4})", LogHeader, x, y, value, newVal);
128 } 127 }
129 } 128 }
130 } 129 }
@@ -258,6 +257,7 @@ namespace OpenSim.Framework
258 257
259 } 258 }
260 } 259 }
260 // m_log.DebugFormat("{0} new by doubles. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ);
261 261
262 m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize]; 262 m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize];
263 ClearTaint(); 263 ClearTaint();
@@ -272,6 +272,7 @@ namespace OpenSim.Framework
272 m_compressionFactor = 100.0f; 272 m_compressionFactor = 100.0f;
273 m_heightmap = new short[SizeX, SizeY]; 273 m_heightmap = new short[SizeX, SizeY];
274 m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize]; 274 m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize];
275 // m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ);
275 ClearTaint(); 276 ClearTaint();
276 } 277 }
277 278
@@ -282,6 +283,7 @@ namespace OpenSim.Framework
282 for (int xx = 0; xx < SizeX; xx++) 283 for (int xx = 0; xx < SizeX; xx++)
283 for (int yy = 0; yy < SizeY; yy++) 284 for (int yy = 0; yy < SizeY; yy++)
284 m_heightmap[xx, yy] = cmap[ind++]; 285 m_heightmap[xx, yy] = cmap[ind++];
286 // m_log.DebugFormat("{0} new by compressed map. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ);
285 } 287 }
286 288
287 // Create a heighmap from a database blob 289 // Create a heighmap from a database blob
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 3f21f85..5b98d97 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -635,14 +635,14 @@ namespace OpenSim.Region.CoreModules.World.Land
635 new_land.LandData.LocalID = newLandLocalID; 635 new_land.LandData.LocalID = newLandLocalID;
636 636
637 bool[,] landBitmap = new_land.GetLandBitmap(); 637 bool[,] landBitmap = new_land.GetLandBitmap();
638 m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). bitmap[600/4,600/4]={3}, newLocalID={4}", 638 // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}",
639 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), landBitmap[600/4, 600/4], newLandLocalID); 639 // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID);
640 640
641 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) 641 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1))
642 { 642 {
643 // Going to variable sized regions can cause mismatches 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})", 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) ); 645 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) );
646 } 646 }
647 else 647 else
648 { 648 {
@@ -769,7 +769,7 @@ namespace OpenSim.Region.CoreModules.World.Land
769 /// <returns>Land object at the point supplied</returns> 769 /// <returns>Land object at the point supplied</returns>
770 public ILandObject GetLandObject(float x_float, float y_float) 770 public ILandObject GetLandObject(float x_float, float y_float)
771 { 771 {
772 return GetLandObject((int)x_float, (int)y_float); 772 return GetLandObject((int)x_float, (int)y_float, true /* returnNullIfLandObjectNotFound */);
773 /* 773 /*
774 int x; 774 int x;
775 int y; 775 int y;
@@ -823,18 +823,28 @@ namespace OpenSim.Region.CoreModules.World.Land
823 */ 823 */
824 } 824 }
825 825
826 // Given a region position, return the parcel land object for that location 826 // Public entry.
827 // Throws exception if land object is not found
827 public ILandObject GetLandObject(int x, int y) 828 public ILandObject GetLandObject(int x, int y)
828 { 829 {
830 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */);
831 }
832
833 // Given a region position, return the parcel land object for that location
834 private ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectNotFound)
835 {
829 ILandObject ret = null; 836 ILandObject ret = null;
830 837
831 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) 838 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
832 { 839 {
833 // These exceptions here will cause a lot of complaints from the users specifically because 840 // These exceptions here will cause a lot of complaints from the users specifically because
834 // they happen every time at border crossings 841 // they happen every time at border crossings
835 throw new Exception( 842 if (returnNullIfLandObjectNotFound)
836 String.Format("{0} GetLandObject for non-existant position. Region={1}, pos=<{2},{3}", 843 return null;
837 LogHeader, m_scene.RegionInfo.RegionName, x, y) 844 else
845 throw new Exception(
846 String.Format("{0} GetLandObject for non-existant position. Region={1}, pos=<{2},{3}",
847 LogHeader, m_scene.RegionInfo.RegionName, x, y)
838 ); 848 );
839 } 849 }
840 850
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 0bde877..2a4d8d8 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -102,6 +102,8 @@ namespace OpenSim.Region.CoreModules.World.Land
102 } 102 }
103 } 103 }
104 104
105 m_log.ErrorFormat("{0} StartPoint. No start point found. bitmapSize=<{1},{2}>",
106 LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
105 return new Vector3(-1, -1, -1); 107 return new Vector3(-1, -1, -1);
106 } 108 }
107 } 109 }
@@ -121,6 +123,8 @@ namespace OpenSim.Region.CoreModules.World.Land
121 } 123 }
122 } 124 }
123 125
126 m_log.ErrorFormat("{0} EndPoint. No end point found. bitmapSize=<{1},{2}>",
127 LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
124 return new Vector3(-1, -1, -1); 128 return new Vector3(-1, -1, -1);
125 } 129 }
126 } 130 }
@@ -757,6 +761,7 @@ namespace OpenSim.Region.CoreModules.World.Land
757 public void SetLandBitmap(bool[,] bitmap) 761 public void SetLandBitmap(bool[,] bitmap)
758 { 762 {
759 LandBitmap = bitmap; 763 LandBitmap = bitmap;
764 // m_log.DebugFormat("{0} SetLandBitmap. BitmapSize=<{1},{2}>", LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
760 ForceUpdateLandInfo(); 765 ForceUpdateLandInfo();
761 } 766 }
762 767
@@ -776,10 +781,14 @@ namespace OpenSim.Region.CoreModules.World.Land
776 781
777 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) 782 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
778 { 783 {
779 bool[,] tempBitmap = new bool[(end_x-start_x)/landUnit,(end_y-start_y)/landUnit]; 784 // Empty bitmap for the whole region
785 bool[,] tempBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
780 tempBitmap.Initialize(); 786 tempBitmap.Initialize();
781 787
788 // Fill the bitmap square area specified by state and end
782 tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); 789 tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
790 // m_log.DebugFormat("{0} GetSquareLandBitmap. tempBitmapSize=<{1},{2}>",
791 // LogHeader, tempBitmap.GetLength(0), tempBitmap.GetLength(1));
783 return tempBitmap; 792 return tempBitmap;
784 } 793 }
785 794
@@ -808,6 +817,8 @@ namespace OpenSim.Region.CoreModules.World.Land
808 } 817 }
809 } 818 }
810 } 819 }
820 // m_log.DebugFormat("{0} ModifyLandBitmapSquare. startXY=<{1},{2}>, endXY=<{3},{4}>, val={5}, landBitmapSize=<{6},{7}>",
821 // LogHeader, start_x, start_y, end_x, end_y, set_value, land_bitmap.GetLength(0), land_bitmap.GetLength(1));
811 return land_bitmap; 822 return land_bitmap;
812 } 823 }
813 824
@@ -868,6 +879,8 @@ namespace OpenSim.Region.CoreModules.World.Land
868 } 879 }
869 } 880 }
870 } 881 }
882 // m_log.DebugFormat("{0} ConvertLandBitmapToBytes. BitmapSize=<{1},{2}>",
883 // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
871 return tempConvertArr; 884 return tempConvertArr;
872 } 885 }
873 886
@@ -886,7 +899,7 @@ namespace OpenSim.Region.CoreModules.World.Land
886 // and only set the lower area of the larger region. 899 // and only set the lower area of the larger region.
887 xLen = (int)(Constants.RegionSize / landUnit); 900 xLen = (int)(Constants.RegionSize / landUnit);
888 } 901 }
889 m_log.DebugFormat("{0} ConvertBytesToLandBitmap: bitmapLen={1}, xLen={2}", LogHeader, bitmapLen, xLen); 902 // m_log.DebugFormat("{0} ConvertBytesToLandBitmap: bitmapLen={1}, xLen={2}", LogHeader, bitmapLen, xLen);
890 903
891 int x = 0, y = 0; 904 int x = 0, y = 0;
892 for (int i = 0; i < bitmapLen; i++) 905 for (int i = 0; i < bitmapLen; i++)