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.
ThreadPoolClientBranch
Tedd Hansen 2008-01-13 16:40:33 +00:00
parent 4f39df42ae
commit 6eaa9b4766
1 changed files with 21 additions and 9 deletions

View File

@ -426,11 +426,18 @@ namespace OpenSim.Region.Environment
}
else
{
float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
float TerrainRaiseLimit =
(float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
float TerrainLowerLimit =
(float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
try
{
string tmp;
tmp = Helpers.FieldToUTF8String(packet.ParamList[0].Parameter);
if (!tmp.Contains(".")) tmp += ".00";
float WaterHeight = (float)Convert.ToDecimal(tmp);
tmp = Helpers.FieldToUTF8String(packet.ParamList[1].Parameter);
if (!tmp.Contains(".")) tmp += ".00";
float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp);
tmp = Helpers.FieldToUTF8String(packet.ParamList[2].Parameter);
if (!tmp.Contains(".")) tmp += ".00";
float TerrainLowerLimit = (float)Convert.ToDecimal(tmp);
bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter);
float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
@ -438,6 +445,11 @@ namespace OpenSim.Region.Environment
sendRegionInfoPacketToAll();
}
catch (Exception ex)
{
MainLog.Instance.Error("EstateManager: Exception while setting terrain settings: \n" + packet.ToString() + "\n" + ex.ToString());
}
}
}
private void estateTextureHeightsHandler(EstateOwnerMessagePacket packet)