Temporary code to change bad AvatarHeight values in the AvatarService to the default Ruth height.

I was persuaded to do this because simulators on osgrid will persist in inserting bad values for an unknown length of time, even after the original simulator bug which was inserting bad values is out in an osgrid distro
This code can be removed at some point in the future, though I think there is an argument for having services police these values in open grids.
bulletsim
Justin Clark-Casey (justincc) 2011-07-30 00:58:17 +01:00
parent 6d866ba6d5
commit 2f5995f5c0
1 changed files with 27 additions and 1 deletions

View File

@ -109,7 +109,33 @@ namespace OpenSim.Services.AvatarService
foreach (KeyValuePair<string,string> kvp in avatar.Data) foreach (KeyValuePair<string,string> kvp in avatar.Data)
{ {
av.Data["Name"] = kvp.Key; av.Data["Name"] = kvp.Key;
// justincc 20110730. Yes, this is a hack to get around the fact that a bug in OpenSim is causing
// various simulators on osgrid to inject bad values. Since these simulators might be around for a
// long time, we are going to manually police the value.
//
// It should be possible to remove this in half a year if we don't want to police values server side.
if (kvp.Key == "AvatarHeight")
{
float height;
if (!float.TryParse(kvp.Value, out height) || height < 0 || height > 10)
{
string rawHeight = kvp.Value.Replace(",", ".");
if (!float.TryParse(rawHeight, out height) || height < 0 || height > 10)
height = 1.771488f;
m_log.DebugFormat(
"[AVATAR SERVICE]: Rectifying height of avatar {0} from {1} to {2}",
principalID, kvp.Value, height);
}
av.Data["Value"] = height.ToString();
}
else
{
av.Data["Value"] = kvp.Value; av.Data["Value"] = kvp.Value;
}
if (!m_Database.Store(av)) if (!m_Database.Store(av))
{ {