aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs37
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs24
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs6
4 files changed, 62 insertions, 10 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 9142b36..d8f786b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1457,7 +1457,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1457 //} 1457 //}
1458 for (int x = 0; x < 16; x++) 1458 for (int x = 0; x < 16; x++)
1459 { 1459 {
1460 SendLayerData(x, y, map); 1460 SendLayerData(x, y, LLHeightFieldMoronize(map));
1461 Thread.Sleep(35); 1461 Thread.Sleep(35);
1462 } 1462 }
1463 } 1463 }
@@ -1503,7 +1503,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1503 1503
1504 patches[0] = patchx + 0 + patchy * 16; 1504 patches[0] = patchx + 0 + patchy * 16;
1505 1505
1506 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(map, patches); 1506 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(((map.Length==65536)? map : LLHeightFieldMoronize(map)), patches);
1507 layerpack.Header.Zerocoded = true; 1507 layerpack.Header.Zerocoded = true;
1508 1508
1509 OutPacket(layerpack, ThrottleOutPacketType.Land); 1509 OutPacket(layerpack, ThrottleOutPacketType.Land);
@@ -1516,6 +1516,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1516 } 1516 }
1517 1517
1518 /// <summary> 1518 /// <summary>
1519 /// Munges heightfield into the LLUDP backed in restricted heightfield.
1520 /// </summary>
1521 /// <param name="map">float array in the base; Constants.RegionSize</param>
1522 /// <returns>float array in the base 256</returns>
1523 internal float[] LLHeightFieldMoronize(float[] map)
1524 {
1525 if (map.Length == 65536)
1526 return map;
1527 else
1528 {
1529 float[] returnmap = new float[65536];
1530
1531 if (map.Length < 65535)
1532 {
1533 // rebase the vector stride to 256
1534 for (int i = 0; i < Constants.RegionSize; i++)
1535 Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, (int)Constants.RegionSize);
1536 }
1537 else
1538 {
1539 for (int i = 0; i < 256; i++)
1540 Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, 256);
1541 }
1542
1543
1544 //Array.Copy(map,0,returnmap,0,(map.Length < 65536)? map.Length : 65536);
1545
1546 return returnmap;
1547 }
1548
1549 }
1550
1551 /// <summary>
1519 /// Send the wind matrix to the client 1552 /// Send the wind matrix to the client
1520 /// </summary> 1553 /// </summary>
1521 /// <param name="windSpeeds">16x16 array of wind speeds</param> 1554 /// <param name="windSpeeds">16x16 array of wind speeds</param>
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 097a62d..c917840 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -60,7 +60,10 @@ namespace OpenSim.Region.CoreModules.World.Land
60 private LandChannel landChannel; 60 private LandChannel landChannel;
61 private Scene m_scene; 61 private Scene m_scene;
62 62
63 private readonly int[,] m_landIDList = new int[64, 64]; 63 // Minimum for parcels to work is 64m even if we don't actually use them.
64 private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64;
65
66 private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax];
64 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); 67 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
65 68
66 private bool m_landPrimCountTainted; 69 private bool m_landPrimCountTainted;
@@ -456,9 +459,9 @@ namespace OpenSim.Region.CoreModules.World.Land
456 new_land.landData.LocalID = newLandLocalID; 459 new_land.landData.LocalID = newLandLocalID;
457 460
458 bool[,] landBitmap = new_land.getLandBitmap(); 461 bool[,] landBitmap = new_land.getLandBitmap();
459 for (int x = 0; x < 64; x++) 462 for (int x = 0; x < landArrayMax; x++)
460 { 463 {
461 for (int y = 0; y < 64; y++) 464 for (int y = 0; y < landArrayMax; y++)
462 { 465 {
463 if (landBitmap[x, y]) 466 if (landBitmap[x, y])
464 { 467 {
@@ -581,10 +584,17 @@ namespace OpenSim.Region.CoreModules.World.Land
581 } 584 }
582 lock (m_landIDList) 585 lock (m_landIDList)
583 { 586 {
584 if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) 587 try
585 return m_landList[m_landIDList[x / 4, y / 4]]; 588 {
586 else 589 if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
590 return m_landList[m_landIDList[x / 4, y / 4]];
591 else
592 return null;
593 }
594 catch (IndexOutOfRangeException)
595 {
587 return null; 596 return null;
597 }
588 } 598 }
589 } 599 }
590 600
@@ -941,6 +951,7 @@ namespace OpenSim.Region.CoreModules.World.Land
941 { 951 {
942 for (int y = 0; y < inc_y; y++) 952 for (int y = 0; y < inc_y; y++)
943 { 953 {
954
944 ILandObject currentParcel = GetLandObject(start_x + x, start_y + y); 955 ILandObject currentParcel = GetLandObject(start_x + x, start_y + y);
945 956
946 if (currentParcel != null) 957 if (currentParcel != null)
@@ -951,6 +962,7 @@ namespace OpenSim.Region.CoreModules.World.Land
951 temp.Add(currentParcel); 962 temp.Add(currentParcel);
952 } 963 }
953 } 964 }
965
954 } 966 }
955 } 967 }
956 968
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index f41bdac..bb06996 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -44,7 +44,8 @@ namespace OpenSim.Region.CoreModules.World.Land
44 #region Member Variables 44 #region Member Variables
45 45
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private bool[,] m_landBitmap = new bool[64,64]; 47 private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64;
48 private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax];
48 49
49 protected LandData m_landData = new LandData(); 50 protected LandData m_landData = new LandData();
50 protected Scene m_scene; 51 protected Scene m_scene;
@@ -630,7 +631,7 @@ namespace OpenSim.Region.CoreModules.World.Land
630 631
631 private bool[,] convertBytesToLandBitmap() 632 private bool[,] convertBytesToLandBitmap()
632 { 633 {
633 bool[,] tempConvertMap = new bool[64,64]; 634 bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax];
634 tempConvertMap.Initialize(); 635 tempConvertMap.Initialize();
635 byte tempByte = 0; 636 byte tempByte = 0;
636 int x = 0, y = 0, i = 0, bitNum = 0; 637 int x = 0, y = 0, i = 0, bitNum = 0;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e344da3..7f1936e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2494,6 +2494,12 @@ namespace OpenSim.Region.Framework.Scenes
2494 2494
2495 if (!agent.child) 2495 if (!agent.child)
2496 { 2496 {
2497 if (agent.startpos.X > (int)Constants.RegionSize - 1)
2498 agent.startpos.X = (int)Constants.RegionSize - 1;
2499
2500 if (agent.startpos.Y > (int)Constants.RegionSize - 1)
2501 agent.startpos.Y = (int)Constants.RegionSize - 1;
2502
2497 // Honor parcel landing type and position. 2503 // Honor parcel landing type and position.
2498 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); 2504 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
2499 if (land != null) 2505 if (land != null)