Fix a bug where estate not found would result in a dummy estate record with erroneous information.

Also, added conversion of EstateSettings from/to key-value pairs in preparation for robust net work connectors.
bullet-2.82
Diva Canto 2014-05-31 11:40:54 -07:00
parent d6f9f690e5
commit eaf595c008
2 changed files with 28 additions and 2 deletions

View File

@ -145,7 +145,11 @@ namespace OpenSim.Data.MySQL
cmd.CommandText = sql;
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
return DoLoad(cmd, regionID, create);
EstateSettings e = DoLoad(cmd, regionID, create);
if (!create && e.EstateID == 0) // Not found
return null;
return e;
}
}
@ -427,7 +431,10 @@ namespace OpenSim.Data.MySQL
cmd.CommandText = sql;
cmd.Parameters.AddWithValue("?EstateID", estateID);
return DoLoad(cmd, UUID.Zero, false);
EstateSettings e = DoLoad(cmd, UUID.Zero, false);
if (e.EstateID != estateID)
return null;
return e;
}
}

View File

@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using OpenMetaverse;
namespace OpenSim.Framework
@ -411,5 +412,23 @@ namespace OpenSim.Framework
{
return l_EstateGroups.Contains(groupID);
}
public Dictionary<string, object> ToMap()
{
Dictionary<string, object> map = new Dictionary<string, object>();
PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo p in properties)
map[p.Name] = p.GetValue(this, null);
return map;
}
public EstateSettings(Dictionary<string, object> map)
{
PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo p in properties)
p.SetValue(this, map[p.Name], null);
}
}
}