diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 77 |
1 files changed, 55 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 06bea3d..9aef26d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -1435,6 +1435,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1435 | /// <param name="map">heightmap</param> | 1435 | /// <param name="map">heightmap</param> |
1436 | public virtual void SendLayerData(float[] map) | 1436 | public virtual void SendLayerData(float[] map) |
1437 | { | 1437 | { |
1438 | DoSendLayerData((object)map); | ||
1438 | ThreadPool.QueueUserWorkItem(DoSendLayerData, map); | 1439 | ThreadPool.QueueUserWorkItem(DoSendLayerData, map); |
1439 | } | 1440 | } |
1440 | 1441 | ||
@@ -1450,16 +1451,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1450 | { | 1451 | { |
1451 | for (int y = 0; y < 16; y++) | 1452 | for (int y = 0; y < 16; y++) |
1452 | { | 1453 | { |
1453 | // For some terrains, sending more than one terrain patch at once results in a libsecondlife exception | 1454 | for (int x = 0; x < 16; x += 4) |
1454 | // see http://opensimulator.org/mantis/view.php?id=1662 | 1455 | { |
1455 | //for (int x = 0; x < 16; x += 4) | 1456 | SendLayerPacket(LLHeightFieldMoronize(map), y, x); |
1456 | //{ | ||
1457 | // SendLayerPacket(map, y, x); | ||
1458 | // Thread.Sleep(150); | ||
1459 | //} | ||
1460 | for (int x = 0; x < 16; x++) | ||
1461 | { | ||
1462 | SendLayerData(x, y, LLHeightFieldMoronize(map)); | ||
1463 | Thread.Sleep(35); | 1457 | Thread.Sleep(35); |
1464 | } | 1458 | } |
1465 | } | 1459 | } |
@@ -1476,17 +1470,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1476 | /// <param name="map">heightmap</param> | 1470 | /// <param name="map">heightmap</param> |
1477 | /// <param name="px">X coordinate for patches 0..12</param> | 1471 | /// <param name="px">X coordinate for patches 0..12</param> |
1478 | /// <param name="py">Y coordinate for patches 0..15</param> | 1472 | /// <param name="py">Y coordinate for patches 0..15</param> |
1479 | // private void SendLayerPacket(float[] map, int y, int x) | 1473 | private void SendLayerPacket(float[] map, int y, int x) |
1480 | // { | 1474 | { |
1481 | // int[] patches = new int[4]; | 1475 | int[] patches = new int[4]; |
1482 | // patches[0] = x + 0 + y * 16; | 1476 | patches[0] = x + 0 + y * 16; |
1483 | // patches[1] = x + 1 + y * 16; | 1477 | patches[1] = x + 1 + y * 16; |
1484 | // patches[2] = x + 2 + y * 16; | 1478 | patches[2] = x + 2 + y * 16; |
1485 | // patches[3] = x + 3 + y * 16; | 1479 | patches[3] = x + 3 + y * 16; |
1486 | 1480 | ||
1487 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1481 | LayerDataPacket layerpack; |
1488 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1482 | try |
1489 | // } | 1483 | { |
1484 | layerpack = TerrainCompressor.CreateLandPacket(map, patches); | ||
1485 | layerpack.Header.Zerocoded = true; | ||
1486 | layerpack.Header.Reliable = true; | ||
1487 | |||
1488 | if (layerpack.Length > 1000) // Oversize packet was created | ||
1489 | { | ||
1490 | for (int xa = 0 ; xa < 4 ; xa++) | ||
1491 | { | ||
1492 | // Send oversize packet in individual patches | ||
1493 | // | ||
1494 | SendLayerData(x+xa, y, map); | ||
1495 | } | ||
1496 | } | ||
1497 | else | ||
1498 | { | ||
1499 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1500 | } | ||
1501 | } | ||
1502 | catch (OverflowException e) | ||
1503 | { | ||
1504 | for (int xa = 0 ; xa < 4 ; xa++) | ||
1505 | { | ||
1506 | // Send oversize packet in individual patches | ||
1507 | // | ||
1508 | SendLayerData(x+xa, y, map); | ||
1509 | } | ||
1510 | } | ||
1511 | catch (IndexOutOfRangeException e) | ||
1512 | { | ||
1513 | for (int xa = 0 ; xa < 4 ; xa++) | ||
1514 | { | ||
1515 | // Bad terrain, send individual chunks | ||
1516 | // | ||
1517 | SendLayerData(x+xa, y, map); | ||
1518 | } | ||
1519 | } | ||
1520 | } | ||
1490 | 1521 | ||
1491 | /// <summary> | 1522 | /// <summary> |
1492 | /// Sends a specified patch to a client | 1523 | /// Sends a specified patch to a client |
@@ -1507,6 +1538,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1507 | 1538 | ||
1508 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(((map.Length==65536)? map : LLHeightFieldMoronize(map)), patches); | 1539 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(((map.Length==65536)? map : LLHeightFieldMoronize(map)), patches); |
1509 | layerpack.Header.Zerocoded = true; | 1540 | layerpack.Header.Zerocoded = true; |
1541 | layerpack.Header.Reliable = true; | ||
1510 | 1542 | ||
1511 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1543 | OutPacket(layerpack, ThrottleOutPacketType.Land); |
1512 | 1544 | ||
@@ -1556,7 +1588,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1556 | /// <param name="windSpeeds">16x16 array of wind speeds</param> | 1588 | /// <param name="windSpeeds">16x16 array of wind speeds</param> |
1557 | public virtual void SendWindData(Vector2[] windSpeeds) | 1589 | public virtual void SendWindData(Vector2[] windSpeeds) |
1558 | { | 1590 | { |
1559 | ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)windSpeeds); | 1591 | DoSendWindData((object)windSpeeds); |
1592 | // ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)windSpeeds); | ||
1560 | } | 1593 | } |
1561 | 1594 | ||
1562 | /// <summary> | 1595 | /// <summary> |