aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs64
1 files changed, 19 insertions, 45 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 9a88804..024c29b 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -516,29 +516,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain
516 // ITerrainModule.PushTerrain() 516 // ITerrainModule.PushTerrain()
517 public void PushTerrain(IClientAPI pClient) 517 public void PushTerrain(IClientAPI pClient)
518 { 518 {
519 if (m_sendTerrainUpdatesByViewDistance) 519 ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId);
520 if (presence != null)
520 { 521 {
521 ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId); 522 lock (m_perClientPatchUpdates)
522 if (presence != null)
523 { 523 {
524 lock (m_perClientPatchUpdates) 524 PatchUpdates pups;
525 if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups))
525 { 526 {
526 PatchUpdates pups; 527 // There is a ScenePresence without a send patch map. Create one.
527 if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups)) 528 pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence);
528 { 529 m_perClientPatchUpdates.Add(presence.UUID, pups);
529 // There is a ScenePresence without a send patch map. Create one.
530 pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence);
531 m_perClientPatchUpdates.Add(presence.UUID, pups);
532 }
533 pups.SetAll(true);
534 } 530 }
531 pups.SetAll(true);
535 } 532 }
536 } 533 }
537 else
538 {
539 // The traditional way is to call into the protocol stack to send them all.
540 pClient.SendLayerData(new float[10]);
541 }
542 } 534 }
543 535
544 #region Plugin Loading Methods 536 #region Plugin Loading Methods
@@ -957,37 +949,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
957 /// <param name="y">The patch corner to send</param> 949 /// <param name="y">The patch corner to send</param>
958 private void SendToClients(TerrainData terrData, int x, int y) 950 private void SendToClients(TerrainData terrData, int x, int y)
959 { 951 {
960 if (m_sendTerrainUpdatesByViewDistance) 952 // Add that this patch needs to be sent to the accounting for each client.
953 lock (m_perClientPatchUpdates)
961 { 954 {
962 // Add that this patch needs to be sent to the accounting for each client. 955 m_scene.ForEachScenePresence(presence =>
963 lock (m_perClientPatchUpdates) 956 {
964 { 957 PatchUpdates thisClientUpdates;
965 m_scene.ForEachScenePresence(presence => 958 if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates))
966 { 959 {
967 PatchUpdates thisClientUpdates; 960 // There is a ScenePresence without a send patch map. Create one.
968 if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates)) 961 thisClientUpdates = new PatchUpdates(terrData, presence);
969 { 962 m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates);
970 // There is a ScenePresence without a send patch map. Create one.
971 thisClientUpdates = new PatchUpdates(terrData, presence);
972 m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates);
973 }
974 thisClientUpdates.SetByXY(x, y, true);
975 } 963 }
976 ); 964 thisClientUpdates.SetByXY(x, y, true);
977 }
978 }
979 else
980 {
981 // Legacy update sending where the update is sent out as soon as noticed
982 // We know the actual terrain data passed is ignored. This kludge saves changing IClientAPI.
983 //float[] heightMap = terrData.GetFloatsSerialized();
984 float[] heightMap = new float[10];
985 m_scene.ForEachClient(
986 delegate(IClientAPI controller)
987 {
988 controller.SendLayerData(x / Constants.TerrainPatchSize,
989 y / Constants.TerrainPatchSize,
990 heightMap);
991 } 965 }
992 ); 966 );
993 } 967 }