diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 2fff4c1..eb6187b 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -30,10 +30,14 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Net; | 32 | using System.Net; |
33 | |||
33 | using log4net; | 34 | using log4net; |
34 | using Nini.Config; | 35 | using Nini.Config; |
36 | |||
35 | using OpenMetaverse; | 37 | using OpenMetaverse; |
36 | using Mono.Addins; | 38 | using Mono.Addins; |
39 | |||
40 | using OpenSim.Data; | ||
37 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
38 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | 42 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
39 | using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; | 43 | using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; |
@@ -130,8 +134,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
130 | { | 134 | { |
131 | if (m_scene.Heightmap == null) | 135 | if (m_scene.Heightmap == null) |
132 | { | 136 | { |
133 | m_channel = new TerrainChannel(m_InitialTerrain, | 137 | m_channel = new TerrainChannel(m_InitialTerrain, (int)m_scene.RegionInfo.RegionSizeX, |
134 | m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY, m_scene.RegionInfo.RegionSizeZ); | 138 | (int)m_scene.RegionInfo.RegionSizeY, |
139 | (int)m_scene.RegionInfo.RegionSizeZ); | ||
135 | m_scene.Heightmap = m_channel; | 140 | m_scene.Heightmap = m_channel; |
136 | UpdateRevertMap(); | 141 | UpdateRevertMap(); |
137 | } | 142 | } |
@@ -707,7 +712,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
707 | private void CheckForTerrainUpdates(bool respectEstateSettings) | 712 | private void CheckForTerrainUpdates(bool respectEstateSettings) |
708 | { | 713 | { |
709 | bool shouldTaint = false; | 714 | bool shouldTaint = false; |
710 | float[] serialised = m_channel.GetFloatsSerialised(); | 715 | float[] terrData = m_channel.GetFloatsSerialised(); |
711 | int x; | 716 | int x; |
712 | for (x = 0; x < m_channel.Width; x += Constants.TerrainPatchSize) | 717 | for (x = 0; x < m_channel.Width; x += Constants.TerrainPatchSize) |
713 | { | 718 | { |
@@ -716,16 +721,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
716 | { | 721 | { |
717 | if (m_channel.Tainted(x, y)) | 722 | if (m_channel.Tainted(x, y)) |
718 | { | 723 | { |
719 | // if we should respect the estate settings then | 724 | // If we should respect the estate settings then |
720 | // fixup and height deltas that don't respect them | 725 | // fixup and height deltas that don't respect them. |
726 | // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. | ||
721 | if (respectEstateSettings && LimitChannelChanges(x, y)) | 727 | if (respectEstateSettings && LimitChannelChanges(x, y)) |
722 | { | 728 | { |
723 | // this has been vetoed, so update | 729 | // Terrain heights were modified. Refetch the terrain info. |
724 | // what we are going to send to the client | 730 | terrData = m_channel.GetFloatsSerialised(); |
725 | serialised = m_channel.GetFloatsSerialised(); | ||
726 | } | 731 | } |
727 | 732 | ||
728 | SendToClients(serialised, x, y); | 733 | SendToClients(terrData, x, y); |
729 | shouldTaint = true; | 734 | shouldTaint = true; |
730 | } | 735 | } |
731 | } | 736 | } |
@@ -794,13 +799,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
794 | /// <param name="serialised">A copy of the terrain as a 1D float array of size w*h</param> | 799 | /// <param name="serialised">A copy of the terrain as a 1D float array of size w*h</param> |
795 | /// <param name="x">The patch corner to send</param> | 800 | /// <param name="x">The patch corner to send</param> |
796 | /// <param name="y">The patch corner to send</param> | 801 | /// <param name="y">The patch corner to send</param> |
797 | private void SendToClients(float[] serialised, int x, int y) | 802 | private void SendToClients(float[] heightMap, int x, int y) |
798 | { | 803 | { |
799 | m_scene.ForEachClient( | 804 | m_scene.ForEachClient( |
800 | delegate(IClientAPI controller) | 805 | delegate(IClientAPI controller) |
801 | { controller.SendLayerData( | 806 | { controller.SendLayerData( x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, heightMap); } |
802 | x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, serialised); | ||
803 | } | ||
804 | ); | 807 | ); |
805 | } | 808 | } |
806 | 809 | ||