* Refactor: Change multiple requests for a module interface to use a stored reference instead.

0.6.0-stable
Justin Clarke Casey 2008-05-30 18:01:28 +00:00
parent 4f237f3ae3
commit 83f390e421
1 changed files with 12 additions and 16 deletions

View File

@ -121,6 +121,8 @@ namespace OpenSim.Region.Environment.Scenes
protected IWorldComm m_worldCommModule; protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory; protected IAvatarFactory m_AvatarFactory;
protected IConfigSource m_config; protected IConfigSource m_config;
protected IRegionArchiver m_archiver;
protected IRegionSerialiser m_serialiser;
// Central Update Loop // Central Update Loop
@ -643,6 +645,8 @@ namespace OpenSim.Region.Environment.Scenes
m_worldCommModule = RequestModuleInterface<IWorldComm>(); m_worldCommModule = RequestModuleInterface<IWorldComm>();
XferManager = RequestModuleInterface<IXfer>(); XferManager = RequestModuleInterface<IXfer>();
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
m_archiver = RequestModuleInterface<IRegionArchiver>();
m_serialiser = RequestModuleInterface<IRegionSerialiser>();
} }
#endregion #endregion
@ -1398,26 +1402,22 @@ namespace OpenSim.Region.Environment.Scenes
public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset)
{ {
IRegionSerialiser loader = RequestModuleInterface<IRegionSerialiser>(); m_serialiser.LoadPrimsFromXml(this, fileName, newIdsFlag, loadOffset);
loader.LoadPrimsFromXml(this, fileName, newIdsFlag, loadOffset);
} }
public void SavePrimsToXml(string fileName) public void SavePrimsToXml(string fileName)
{ {
IRegionSerialiser loader = RequestModuleInterface<IRegionSerialiser>(); m_serialiser.SavePrimsToXml(this, fileName);
loader.SavePrimsToXml(this, fileName);
} }
public void LoadPrimsFromXml2(string fileName) public void LoadPrimsFromXml2(string fileName)
{ {
IRegionSerialiser loader = RequestModuleInterface<IRegionSerialiser>(); m_serialiser.LoadPrimsFromXml2(this, fileName);
loader.LoadPrimsFromXml2(this, fileName);
} }
public void SavePrimsToXml2(string fileName) public void SavePrimsToXml2(string fileName)
{ {
IRegionSerialiser loader = RequestModuleInterface<IRegionSerialiser>(); m_serialiser.SavePrimsToXml2(this, fileName);
loader.SavePrimsToXml2(this, fileName);
} }
/// <summary> /// <summary>
@ -1426,8 +1426,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="filePath"></param> /// <param name="filePath"></param>
public void LoadPrimsFromArchive(string filePath) public void LoadPrimsFromArchive(string filePath)
{ {
IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>(); m_archiver.DearchiveRegion(filePath);
archiver.DearchiveRegion(filePath);
} }
/// <summary> /// <summary>
@ -1436,8 +1435,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="filePath"></param> /// <param name="filePath"></param>
public void SavePrimsToArchive(string filePath) public void SavePrimsToArchive(string filePath)
{ {
IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>(); m_archiver.ArchiveRegion(filePath);
archiver.ArchiveRegion(filePath);
} }
/// <summary> /// <summary>
@ -1516,10 +1514,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
bool successYN = false; bool successYN = false;
IRegionSerialiser loader = RequestModuleInterface<IRegionSerialiser>();
successYN successYN
= m_sceneGridService.PrimCrossToNeighboringRegion( = m_sceneGridService.PrimCrossToNeighboringRegion(
newRegionHandle, grp.UUID, loader.SavePrimGroupToXML2String(grp), primcrossingXMLmethod); newRegionHandle, grp.UUID, m_serialiser.SavePrimGroupToXML2String(grp), primcrossingXMLmethod);
if (successYN) if (successYN)
{ {
@ -1552,8 +1549,7 @@ namespace OpenSim.Region.Environment.Scenes
m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor");
if (XMLMethod == 0) if (XMLMethod == 0)
{ {
IRegionSerialiser loader = RequestModuleInterface<IRegionSerialiser>(); m_serialiser.LoadGroupFromXml2String(this, objXMLData);
loader.LoadGroupFromXml2String(this, objXMLData);
SceneObjectPart RootPrim = GetSceneObjectPart(primID); SceneObjectPart RootPrim = GetSceneObjectPart(primID);
if (RootPrim != null) if (RootPrim != null)