aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-17 22:13:32 +0000
committerJustin Clark-Casey (justincc)2011-11-17 22:13:32 +0000
commit352672eaf2d07a210d2d0de97944dac48250828d (patch)
tree76034d2d0511b34f68db462c2cf531e2f37a628a
parentIf the entire simulator is shutting down then don't bother to unload the scri... (diff)
downloadopensim-SC_OLD-352672eaf2d07a210d2d0de97944dac48250828d.zip
opensim-SC_OLD-352672eaf2d07a210d2d0de97944dac48250828d.tar.gz
opensim-SC_OLD-352672eaf2d07a210d2d0de97944dac48250828d.tar.bz2
opensim-SC_OLD-352672eaf2d07a210d2d0de97944dac48250828d.tar.xz
Make "terrain save" more friendly by telling the user if we have saved and putting out a useful complaint message if we haven't for some reason
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs50
1 files changed, 32 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index c832520..428440e 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -86,6 +86,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
86 private volatile bool m_tainted; 86 private volatile bool m_tainted;
87 private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); 87 private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
88 88
89 /// <summary>
90 /// Human readable list of terrain file extensions that are supported.
91 /// </summary>
92 private string m_supportedFileExtensions = "";
93
89 #region ICommandableModule Members 94 #region ICommandableModule Members
90 95
91 public ICommander CommandInterface 96 public ICommander CommandInterface
@@ -135,6 +140,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
135 140
136 InstallDefaultEffects(); 141 InstallDefaultEffects();
137 LoadPlugins(); 142 LoadPlugins();
143
144 // Generate user-readable extensions list
145 string supportedFilesSeparator = "";
146
147 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
148 {
149 m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")";
150 supportedFilesSeparator = ", ";
151 }
138 } 152 }
139 153
140 public void RegionLoaded(Scene scene) 154 public void RegionLoaded(Scene scene)
@@ -251,20 +265,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain
251 if (filename.EndsWith(loader.Key)) 265 if (filename.EndsWith(loader.Key))
252 { 266 {
253 loader.Value.SaveFile(filename, m_channel); 267 loader.Value.SaveFile(filename, m_channel);
268 m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename);
254 return; 269 return;
255 } 270 }
256 } 271 }
257 } 272 }
258 catch (NotImplementedException)
259 {
260 m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented.");
261 throw new TerrainException(String.Format("Unable to save heightmap: saving of this file format not implemented"));
262 }
263 catch (IOException ioe) 273 catch (IOException ioe)
264 { 274 {
265 m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message)); 275 m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message));
266 throw new TerrainException(String.Format("Unable to save heightmap: {0}", ioe.Message)); 276 throw new TerrainException(String.Format("Unable to save heightmap: {0}", ioe.Message));
267 } 277 }
278
279 m_log.ErrorFormat(
280 "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
281 m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
268 } 282 }
269 283
270 /// <summary> 284 /// <summary>
@@ -345,6 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
345 float duration = 0.25f; 359 float duration = 0.25f;
346 if (action == 0) 360 if (action == 0)
347 duration = 4.0f; 361 duration = 4.0f;
362
348 client_OnModifyTerrain(user, (float)pos.Z, duration, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId); 363 client_OnModifyTerrain(user, (float)pos.Z, duration, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId);
349 } 364 }
350 365
@@ -534,6 +549,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
534 m_channel = channel; 549 m_channel = channel;
535 UpdateRevertMap(); 550 UpdateRevertMap();
536 } 551 }
552
537 return; 553 return;
538 } 554 }
539 } 555 }
@@ -566,10 +582,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
566 fileWidth, fileHeight, 582 fileWidth, fileHeight,
567 (int)Constants.RegionSize, 583 (int)Constants.RegionSize,
568 (int)Constants.RegionSize); 584 (int)Constants.RegionSize);
585
586 m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename);
569 } 587 }
588
570 return; 589 return;
571 } 590 }
572 } 591 }
592
593 m_log.ErrorFormat(
594 "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
595 m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
573 } 596 }
574 } 597 }
575 598
@@ -1124,32 +1147,23 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1124 1147
1125 private void InstallInterfaces() 1148 private void InstallInterfaces()
1126 { 1149 {
1127 // Load / Save
1128 string supportedFileExtensions = "";
1129 string supportedFilesSeparator = "";
1130 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
1131 {
1132 supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")";
1133 supportedFilesSeparator = ", ";
1134 }
1135
1136 Command loadFromFileCommand = 1150 Command loadFromFileCommand =
1137 new Command("load", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadFile, "Loads a terrain from a specified file."); 1151 new Command("load", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadFile, "Loads a terrain from a specified file.");
1138 loadFromFileCommand.AddArgument("filename", 1152 loadFromFileCommand.AddArgument("filename",
1139 "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " + 1153 "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " +
1140 supportedFileExtensions, "String"); 1154 m_supportedFileExtensions, "String");
1141 1155
1142 Command saveToFileCommand = 1156 Command saveToFileCommand =
1143 new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveFile, "Saves the current heightmap to a specified file."); 1157 new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveFile, "Saves the current heightmap to a specified file.");
1144 saveToFileCommand.AddArgument("filename", 1158 saveToFileCommand.AddArgument("filename",
1145 "The destination filename for your heightmap, the file extension determines the format to save in. Supported extensions include: " + 1159 "The destination filename for your heightmap, the file extension determines the format to save in. Supported extensions include: " +
1146 supportedFileExtensions, "String"); 1160 m_supportedFileExtensions, "String");
1147 1161
1148 Command loadFromTileCommand = 1162 Command loadFromTileCommand =
1149 new Command("load-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadTileFile, "Loads a terrain from a section of a larger file."); 1163 new Command("load-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadTileFile, "Loads a terrain from a section of a larger file.");
1150 loadFromTileCommand.AddArgument("filename", 1164 loadFromTileCommand.AddArgument("filename",
1151 "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " + 1165 "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " +
1152 supportedFileExtensions, "String"); 1166 m_supportedFileExtensions, "String");
1153 loadFromTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); 1167 loadFromTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer");
1154 loadFromTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); 1168 loadFromTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer");
1155 loadFromTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", 1169 loadFromTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file",
@@ -1161,7 +1175,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1161 new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file."); 1175 new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file.");
1162 saveToTileCommand.AddArgument("filename", 1176 saveToTileCommand.AddArgument("filename",
1163 "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " + 1177 "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " +
1164 supportedFileExtensions, "String"); 1178 m_supportedFileExtensions, "String");
1165 saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); 1179 saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer");
1166 saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); 1180 saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer");
1167 saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", 1181 saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file",