dont use SendTerrainUpdatesByViewDistance option, code executes as true.

the option will have other use
avinationmerge
UbitUmarov 2015-08-21 03:04:52 +01:00
parent 6555bbffaa
commit 4bb55cad67
1 changed files with 20 additions and 46 deletions

View File

@ -516,29 +516,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain
// ITerrainModule.PushTerrain() // ITerrainModule.PushTerrain()
public void PushTerrain(IClientAPI pClient) public void PushTerrain(IClientAPI pClient)
{ {
if (m_sendTerrainUpdatesByViewDistance) ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId);
if (presence != null)
{ {
ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId); lock (m_perClientPatchUpdates)
if (presence != null)
{ {
lock (m_perClientPatchUpdates) PatchUpdates pups;
if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups))
{ {
PatchUpdates pups; // There is a ScenePresence without a send patch map. Create one.
if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups)) pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence);
{ m_perClientPatchUpdates.Add(presence.UUID, pups);
// There is a ScenePresence without a send patch map. Create one.
pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence);
m_perClientPatchUpdates.Add(presence.UUID, pups);
}
pups.SetAll(true);
} }
pups.SetAll(true);
} }
} }
else
{
// The traditional way is to call into the protocol stack to send them all.
pClient.SendLayerData(new float[10]);
}
} }
#region Plugin Loading Methods #region Plugin Loading Methods
@ -957,37 +949,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
/// <param name="y">The patch corner to send</param> /// <param name="y">The patch corner to send</param>
private void SendToClients(TerrainData terrData, int x, int y) private void SendToClients(TerrainData terrData, int x, int y)
{ {
if (m_sendTerrainUpdatesByViewDistance) // Add that this patch needs to be sent to the accounting for each client.
lock (m_perClientPatchUpdates)
{ {
// Add that this patch needs to be sent to the accounting for each client. m_scene.ForEachScenePresence(presence =>
lock (m_perClientPatchUpdates)
{
m_scene.ForEachScenePresence(presence =>
{
PatchUpdates thisClientUpdates;
if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates))
{
// There is a ScenePresence without a send patch map. Create one.
thisClientUpdates = new PatchUpdates(terrData, presence);
m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates);
}
thisClientUpdates.SetByXY(x, y, true);
}
);
}
}
else
{
// Legacy update sending where the update is sent out as soon as noticed
// We know the actual terrain data passed is ignored. This kludge saves changing IClientAPI.
//float[] heightMap = terrData.GetFloatsSerialized();
float[] heightMap = new float[10];
m_scene.ForEachClient(
delegate(IClientAPI controller)
{ {
controller.SendLayerData(x / Constants.TerrainPatchSize, PatchUpdates thisClientUpdates;
y / Constants.TerrainPatchSize, if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates))
heightMap); {
// There is a ScenePresence without a send patch map. Create one.
thisClientUpdates = new PatchUpdates(terrData, presence);
m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates);
}
thisClientUpdates.SetByXY(x, y, true);
} }
); );
} }