aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTedd Hansen2008-01-13 16:40:33 +0000
committerTedd Hansen2008-01-13 16:40:33 +0000
commit6eaa9b4766d808a3817b7207e48cf65bcbdeff6c (patch)
treef48977ddafc7d1ad41b5689d72886be35353e981 /OpenSim
parent* Removed a debug message that I left in there.... (diff)
downloadopensim-SC_OLD-6eaa9b4766d808a3817b7207e48cf65bcbdeff6c.zip
opensim-SC_OLD-6eaa9b4766d808a3817b7207e48cf65bcbdeff6c.tar.gz
opensim-SC_OLD-6eaa9b4766d808a3817b7207e48cf65bcbdeff6c.tar.bz2
opensim-SC_OLD-6eaa9b4766d808a3817b7207e48cf65bcbdeff6c.tar.xz
Anti-crash fix: Allow int (numbers without dot) when changing Estate terrain settings.
Also added exception handling if string->float conversion still should fail for some reason.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs32
1 files changed, 22 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index 64b9d78..9700e6c 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -426,17 +426,29 @@ namespace OpenSim.Region.Environment
426 } 426 }
427 else 427 else
428 { 428 {
429 float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); 429 try
430 float TerrainRaiseLimit = 430 {
431 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); 431 string tmp;
432 float TerrainLowerLimit = 432 tmp = Helpers.FieldToUTF8String(packet.ParamList[0].Parameter);
433 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); 433 if (!tmp.Contains(".")) tmp += ".00";
434 bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter); 434 float WaterHeight = (float)Convert.ToDecimal(tmp);
435 float SunHour = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 435 tmp = Helpers.FieldToUTF8String(packet.ParamList[1].Parameter);
436 436 if (!tmp.Contains(".")) tmp += ".00";
437 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); 437 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp);
438 tmp = Helpers.FieldToUTF8String(packet.ParamList[2].Parameter);
439 if (!tmp.Contains(".")) tmp += ".00";
440 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp);
441 bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter);
442 float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
443
444 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour);
438 445
439 sendRegionInfoPacketToAll(); 446 sendRegionInfoPacketToAll();
447 }
448 catch (Exception ex)
449 {
450 MainLog.Instance.Error("EstateManager: Exception while setting terrain settings: \n" + packet.ToString() + "\n" + ex.ToString());
451 }
440 } 452 }
441 } 453 }
442 454