aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-24 02:16:44 +0000
committerJustin Clark-Casey (justincc)2012-03-24 02:16:44 +0000
commitcf61c74e90324e07cb4b15f9c597fef00c047c75 (patch)
tree25a16f21955b0766b045cc7e2115ff59c338140b /OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
parentHave the PhysicsParameters module output console command responses (diff)
downloadopensim-SC_OLD-cf61c74e90324e07cb4b15f9c597fef00c047c75.zip
opensim-SC_OLD-cf61c74e90324e07cb4b15f9c597fef00c047c75.tar.gz
opensim-SC_OLD-cf61c74e90324e07cb4b15f9c597fef00c047c75.tar.bz2
opensim-SC_OLD-cf61c74e90324e07cb4b15f9c597fef00c047c75.tar.xz
Give feedback when "terrain save-tile" is not successfully invoked.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs67
1 files changed, 37 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 9cd8f2b..7c5ea29 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -561,49 +561,56 @@ namespace OpenSim.Region.CoreModules.World.Terrain
561 } 561 }
562 562
563 /// <summary> 563 /// <summary>
564 /// Saves the terrain to a larger terrain file. 564 /// Save a number of map tiles to a single big image file.
565 /// </summary> 565 /// </summary>
566 /// <remarks>
567 /// If the image file already exists then the tiles saved will replace those already in the file - other tiles
568 /// will be untouched.
569 /// </remarks>
566 /// <param name="filename">The terrain file to save</param> 570 /// <param name="filename">The terrain file to save</param>
567 /// <param name="fileWidth">The width of the file in units</param> 571 /// <param name="fileWidth">The number of tiles to save along the X axis.</param>
568 /// <param name="fileHeight">The height of the file in units</param> 572 /// <param name="fileHeight">The number of tiles to save along the Y axis.</param>
569 /// <param name="fileStartX">Where to begin our slice</param> 573 /// <param name="fileStartX">The map x co-ordinate at which to begin the save.</param>
570 /// <param name="fileStartY">Where to begin our slice</param> 574 /// <param name="fileStartY">The may y co-ordinate at which to begin the save.</param>
571 public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY) 575 public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY)
572 { 576 {
573 int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX; 577 int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX;
574 int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY; 578 int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY;
575 579
576 if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight) 580 if (offsetX < 0 || offsetX >= fileWidth || offsetY < 0 || offsetY >= fileHeight)
577 { 581 {
578 // this region is included in the tile request 582 MainConsole.Instance.OutputFormat(
579 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) 583 "ERROR: file width + minimum X tile and file height + minimum Y tile must incorporate the current region at ({0},{1}). File width {2} from {3} and file height {4} from {5} does not.",
584 m_scene.RegionInfo.RegionLocX, m_scene.RegionInfo.RegionLocY, fileWidth, fileStartX, fileHeight, fileStartY);
585
586 return;
587 }
588
589 // this region is included in the tile request
590 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
591 {
592 if (filename.EndsWith(loader.Key))
580 { 593 {
581 if (filename.EndsWith(loader.Key)) 594 lock (m_scene)
582 { 595 {
583 lock (m_scene) 596 loader.Value.SaveFile(m_channel, filename, offsetX, offsetY,
584 { 597 fileWidth, fileHeight,
585 loader.Value.SaveFile(m_channel, filename, offsetX, offsetY, 598 (int)Constants.RegionSize,
586 fileWidth, fileHeight, 599 (int)Constants.RegionSize);
587 (int)Constants.RegionSize, 600
588 (int)Constants.RegionSize); 601 MainConsole.Instance.OutputFormat(
589 602 "Saved terrain from ({0},{1}) to ({2},{3}) from {4} to {5}",
590 m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename); 603 fileStartX, fileStartY, fileStartX + fileWidth - 1, fileStartY + fileHeight - 1,
591 } 604 m_scene.RegionInfo.RegionName, filename);
592
593 return;
594 } 605 }
606
607 return;
595 } 608 }
596
597 m_log.ErrorFormat(
598 "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
599 m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
600 } 609 }
601// else 610
602// { 611 MainConsole.Instance.OutputFormat(
603// m_log.ErrorFormat( 612 "ERROR: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
604// "[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}", 613 m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
605// m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY);
606// }
607 } 614 }
608 615
609 /// <summary> 616 /// <summary>