* Added try{}catch{} to RunTerrainCmd
* Exposed Thermal Erosion functions to RunTerrainCmd * Exposed Aerobic Erosion functions to RunTerrainCmd0.1-prestable
parent
7dd98f3094
commit
46eaa79cd9
|
@ -102,11 +102,16 @@ namespace OpenSim.Terrain
|
|||
/// <summary>
|
||||
/// Processes a terrain-specific command
|
||||
/// </summary>
|
||||
/// <remarks>TODO: Move this into BasicTerrain directly (no need to hard limit what each terrain engine can support)</remarks>
|
||||
/// <param name="args"></param>
|
||||
/// <param name="args">Commandline arguments (space seperated)</param>
|
||||
/// <param name="resultText">Reference that returns error or help text if returning false</param>
|
||||
/// <returns>If the operation was successful (if not, the error is placed into resultText)</returns>
|
||||
public bool RunTerrainCmd(string[] args, ref string resultText)
|
||||
{
|
||||
string command = args[0];
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case "help":
|
||||
|
@ -115,6 +120,8 @@ namespace OpenSim.Terrain
|
|||
resultText += "terrain load <type> <filename> - loads a terrain from disk, type can be 'F32', 'F64' or 'IMG'\n";
|
||||
resultText += "terrain save <type> <filename> - saves a terrain to disk, type can be 'F32' or 'F64'\n";
|
||||
resultText += "terrain rescale <min> <max> - rescales a terrain to be between <min> and <max> meters high\n";
|
||||
resultText += "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest>\n";
|
||||
resultText += "terrain erode thermal <talus> <rounds> <carry>\n";
|
||||
resultText += "terrain multiply <val> - multiplies a terrain by <val>\n";
|
||||
return false;
|
||||
|
||||
|
@ -122,6 +129,22 @@ namespace OpenSim.Terrain
|
|||
setSeed(Convert.ToInt32(args[1]));
|
||||
break;
|
||||
|
||||
case "erode":
|
||||
switch (args[1].ToLower())
|
||||
{
|
||||
case "aerobic":
|
||||
// WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest
|
||||
heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]));
|
||||
break;
|
||||
case "thermal":
|
||||
heightmap.thermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4]));
|
||||
break;
|
||||
default:
|
||||
resultText = "Unknown erosion type";
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case "regenerate":
|
||||
hills();
|
||||
break;
|
||||
|
@ -178,6 +201,12 @@ namespace OpenSim.Terrain
|
|||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
resultText = "Error running terrain command: " + e.ToString();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renormalises the array between min and max
|
||||
|
|
Loading…
Reference in New Issue