From d8997b59d30b63218f594d840d924a10287ce509 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Tue, 24 Jul 2007 05:22:33 +0000
Subject: * Terrain should now send just updated patches.
---
OpenSim/Region/Environment/Scenes/Scene.cs | 45 ++++++++++++++++++--------
OpenSim/Region/Environment/Scenes/SceneBase.cs | 4 +--
2 files changed, 33 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/Environment')
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 16b8b4c..564ba5f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -235,25 +235,40 @@ namespace OpenSim.Region.Environment.Scenes
storageCount = 0;
}
- if (Terrain.tainted > 0)
+ if (Terrain.Tainted())
{
- lock (m_syncRoot)
+ lock (Terrain.heightmap)
{
- phyScene.SetTerrain(Terrain.GetHeights1D());
- }
+ lock (m_syncRoot)
+ {
+ phyScene.SetTerrain(Terrain.GetHeights1D());
+ }
- storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
+ storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
- ForEachScenePresence(delegate(ScenePresence presence)
- {
- SendLayerData(presence.ControllingClient);
- });
+ float[] terData = Terrain.GetHeights1D();
+
+ ForEachScenePresence(delegate(ScenePresence presence)
+ {
+ for (int x = 0; x < 16; x++)
+ {
+ for (int y = 0; y < 16; y++)
+ {
+ if (Terrain.Tainted(x, y))
+ {
+ SendLayerData(x, y, presence.ControllingClient, terData);
+ }
+ }
+ }
+ });
+
+ foreach (LLUUID UUID in Entities.Keys)
+ {
+ Entities[UUID].LandRenegerated();
+ }
- foreach (LLUUID UUID in Entities.Keys)
- {
- Entities[UUID].LandRenegerated();
+ Terrain.ResetTaint();
}
- Terrain.tainted = 0;
}
landPrimCheckCount++;
@@ -365,9 +380,11 @@ namespace OpenSim.Region.Environment.Scenes
{
/* Dont save here, rely on tainting system instead */
+ float[] terrain = Terrain.GetHeights1D();
+
ForEachScenePresence(delegate(ScenePresence presence)
{
- SendLayerData(pointx, pointy, presence.ControllingClient);
+ SendLayerData(pointx, pointy, presence.ControllingClient, terrain);
});
}
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index fb7624a..76a8439 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -90,9 +90,9 @@ namespace OpenSim.Region.Environment.Scenes
/// Patch coordinate (x) 0..16
/// Patch coordinate (y) 0..16
/// The client to send to
- public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient)
+ public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient, float[] terrain)
{
- RemoteClient.SendLayerData(px, py, Terrain.GetHeights1D());
+ RemoteClient.SendLayerData(px, py, terrain);
}
#endregion
--
cgit v1.1