diff options
author | Robert Adams | 2013-11-10 21:12:17 -0800 |
---|---|---|
committer | Robert Adams | 2013-11-10 21:12:17 -0800 |
commit | e2a1fa806d93cdf4f6fd27ce0fb9bd865041f0ef (patch) | |
tree | f016fb4bf627588cf346d39ddf4e8d8c6702baef /OpenSim/Region | |
parent | varregion: fix GetLandObject error return and initialization of square (diff) | |
download | opensim-SC-e2a1fa806d93cdf4f6fd27ce0fb9bd865041f0ef.zip opensim-SC-e2a1fa806d93cdf4f6fd27ce0fb9bd865041f0ef.tar.gz opensim-SC-e2a1fa806d93cdf4f6fd27ce0fb9bd865041f0ef.tar.bz2 opensim-SC-e2a1fa806d93cdf4f6fd27ce0fb9bd865041f0ef.tar.xz |
varregion: extend TerrainModule to use the region size from RegionInfo
rather than using Constants.RegionSize. This allows loading and saving
of terrain heightmaps that match the size of non-legacy sized regions.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 459af73..d991a30 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -235,11 +235,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
235 | try | 235 | try |
236 | { | 236 | { |
237 | ITerrainChannel channel = loader.Value.LoadFile(filename); | 237 | ITerrainChannel channel = loader.Value.LoadFile(filename); |
238 | if (channel.Width != Constants.RegionSize || channel.Height != Constants.RegionSize) | 238 | if (channel.Width != m_scene.RegionInfo.RegionSizeX || channel.Height != m_scene.RegionInfo.RegionSizeY) |
239 | { | 239 | { |
240 | // TerrainChannel expects a RegionSize x RegionSize map, currently | 240 | // TerrainChannel expects a RegionSize x RegionSize map, currently |
241 | throw new ArgumentException(String.Format("wrong size, use a file with size {0} x {1}", | 241 | throw new ArgumentException(String.Format("wrong size, use a file with size {0} x {1}", |
242 | Constants.RegionSize, Constants.RegionSize)); | 242 | m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY)); |
243 | } | 243 | } |
244 | m_log.DebugFormat("[TERRAIN]: Loaded terrain, wd/ht: {0}/{1}", channel.Width, channel.Height); | 244 | m_log.DebugFormat("[TERRAIN]: Loaded terrain, wd/ht: {0}/{1}", channel.Width, channel.Height); |
245 | m_scene.Heightmap = channel; | 245 | m_scene.Heightmap = channel; |
@@ -575,8 +575,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
575 | { | 575 | { |
576 | ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, | 576 | ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, |
577 | fileWidth, fileHeight, | 577 | fileWidth, fileHeight, |
578 | (int) Constants.RegionSize, | 578 | (int) m_scene.RegionInfo.RegionSizeX, |
579 | (int) Constants.RegionSize); | 579 | (int) m_scene.RegionInfo.RegionSizeY); |
580 | m_scene.Heightmap = channel; | 580 | m_scene.Heightmap = channel; |
581 | m_channel = channel; | 581 | m_channel = channel; |
582 | UpdateRevertMap(); | 582 | UpdateRevertMap(); |
@@ -623,8 +623,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
623 | { | 623 | { |
624 | loader.Value.SaveFile(m_channel, filename, offsetX, offsetY, | 624 | loader.Value.SaveFile(m_channel, filename, offsetX, offsetY, |
625 | fileWidth, fileHeight, | 625 | fileWidth, fileHeight, |
626 | (int)Constants.RegionSize, | 626 | (int)m_scene.RegionInfo.RegionSizeX, |
627 | (int)Constants.RegionSize); | 627 | (int)m_scene.RegionInfo.RegionSizeY); |
628 | 628 | ||
629 | MainConsole.Instance.OutputFormat( | 629 | MainConsole.Instance.OutputFormat( |
630 | "Saved terrain from ({0},{1}) to ({2},{3}) from {4} to {5}", | 630 | "Saved terrain from ({0},{1}) to ({2},{3}) from {4} to {5}", |
@@ -991,28 +991,28 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
991 | 991 | ||
992 | if (direction.ToLower().StartsWith("y")) | 992 | if (direction.ToLower().StartsWith("y")) |
993 | { | 993 | { |
994 | for (int x = 0; x < Constants.RegionSize; x++) | 994 | for (int x = 0; x < m_channel.Width; x++) |
995 | { | 995 | { |
996 | for (int y = 0; y < Constants.RegionSize / 2; y++) | 996 | for (int y = 0; y < m_channel.Height / 2; y++) |
997 | { | 997 | { |
998 | double height = m_channel[x, y]; | 998 | double height = m_channel[x, y]; |
999 | double flippedHeight = m_channel[x, (int)Constants.RegionSize - 1 - y]; | 999 | double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y]; |
1000 | m_channel[x, y] = flippedHeight; | 1000 | m_channel[x, y] = flippedHeight; |
1001 | m_channel[x, (int)Constants.RegionSize - 1 - y] = height; | 1001 | m_channel[x, (int)m_channel.Height - 1 - y] = height; |
1002 | 1002 | ||
1003 | } | 1003 | } |
1004 | } | 1004 | } |
1005 | } | 1005 | } |
1006 | else if (direction.ToLower().StartsWith("x")) | 1006 | else if (direction.ToLower().StartsWith("x")) |
1007 | { | 1007 | { |
1008 | for (int y = 0; y < Constants.RegionSize; y++) | 1008 | for (int y = 0; y < m_channel.Height; y++) |
1009 | { | 1009 | { |
1010 | for (int x = 0; x < Constants.RegionSize / 2; x++) | 1010 | for (int x = 0; x < m_channel.Width / 2; x++) |
1011 | { | 1011 | { |
1012 | double height = m_channel[x, y]; | 1012 | double height = m_channel[x, y]; |
1013 | double flippedHeight = m_channel[(int)Constants.RegionSize - 1 - x, y]; | 1013 | double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y]; |
1014 | m_channel[x, y] = flippedHeight; | 1014 | m_channel[x, y] = flippedHeight; |
1015 | m_channel[(int)Constants.RegionSize - 1 - x, y] = height; | 1015 | m_channel[(int)m_channel.Width - 1 - x, y] = height; |
1016 | 1016 | ||
1017 | } | 1017 | } |
1018 | } | 1018 | } |