aboutsummaryrefslogtreecommitdiffstatshomepage
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
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.
-rw-r--r--OpenSim/Framework/RegionInfo.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs15
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs67
3 files changed, 58 insertions, 30 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 5ba3863..a505524 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -421,12 +421,18 @@ namespace OpenSim.Framework
421 set { m_internalEndPoint = value; } 421 set { m_internalEndPoint = value; }
422 } 422 }
423 423
424 /// <summary>
425 /// The x co-ordinate of this region in map tiles (e.g. 1000).
426 /// </summary>
424 public uint RegionLocX 427 public uint RegionLocX
425 { 428 {
426 get { return m_regionLocX.Value; } 429 get { return m_regionLocX.Value; }
427 set { m_regionLocX = value; } 430 set { m_regionLocX = value; }
428 } 431 }
429 432
433 /// <summary>
434 /// The y co-ordinate of this region in map tiles (e.g. 1000).
435 /// </summary>
430 public uint RegionLocY 436 public uint RegionLocY
431 { 437 {
432 get { return m_regionLocY.Value; } 438 get { return m_regionLocY.Value; }
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs
index 7237f90..d407617 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs
@@ -38,6 +38,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain
38 ITerrainChannel LoadStream(Stream stream); 38 ITerrainChannel LoadStream(Stream stream);
39 void SaveFile(string filename, ITerrainChannel map); 39 void SaveFile(string filename, ITerrainChannel map);
40 void SaveStream(Stream stream, ITerrainChannel map); 40 void SaveStream(Stream stream, ITerrainChannel map);
41
42 /// <summary>
43 /// Save a number of map tiles to a single big image file.
44 /// </summary>
45 /// <remarks>
46 /// If the image file already exists then the tiles saved will replace those already in the file - other tiles
47 /// will be untouched.
48 /// </remarks>
49 /// <param name="filename">The terrain file to save</param>
50 /// <param name="offsetX">The map x co-ordinate at which to begin the save.</param>
51 /// <param name="offsetY">The may y co-ordinate at which to begin the save.</param>
52 /// <param name="fileWidth">The number of tiles to save along the X axis.</param>
53 /// <param name="fileHeight">The number of tiles to save along the Y axis.</param>
54 /// <param name="regionSizeX">The width of a map tile.</param>
55 /// <param name="regionSizeY">The height of a map tile.</param>
41 void SaveFile(ITerrainChannel map, string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int regionSizeX, int regionSizeY); 56 void SaveFile(ITerrainChannel map, string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int regionSizeX, int regionSizeY);
42 } 57 }
43} \ No newline at end of file 58} \ No newline at end of file
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>