Fix interface registration/deregistration mechanics

0.6.5-rc1
Melanie Thielker 2009-05-12 23:49:42 +00:00
parent 55dd6d4334
commit 88371e4f98
2 changed files with 16 additions and 9 deletions

View File

@ -107,6 +107,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.User
{
if (!m_Enabled)
return;
scene.RegisterModuleInterface<IUserService>(m_UserService);
}
public void RemoveRegion(Scene scene)

View File

@ -368,19 +368,24 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="mod"></param>
public void RegisterModuleInterface<M>(M mod)
{
if (!ModuleInterfaces.ContainsKey(typeof(M)))
List<Object> l = null;
if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
{
List<Object> l = new List<Object>();
l.Add(mod);
l = new List<Object>();
ModuleInterfaces.Add(typeof(M), l);
}
if (mod is IEntityCreator)
if (l.Count > 0)
return;
l.Add(mod);
if (mod is IEntityCreator)
{
IEntityCreator entityCreator = (IEntityCreator)mod;
foreach (PCode pcode in entityCreator.CreationCapabilities)
{
IEntityCreator entityCreator = (IEntityCreator)mod;
foreach (PCode pcode in entityCreator.CreationCapabilities)
{
m_entityCreators[pcode] = entityCreator;
}
m_entityCreators[pcode] = entityCreator;
}
}
}