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