Use Scene or IEntityTransferModule directly in HGEntityTransferModule instead of casting or re-obtaining module.

This code originates from when IEntityTransferModule was shared rather than one per region.
Now it's one per region we know that callers are always in the same scene as the module.
mb-throttle-test
Justin Clark-Casey (justincc) 2014-10-08 23:16:01 +01:00
parent 8d4c1945c2
commit 458ccd26ff
1 changed files with 7 additions and 8 deletions

View File

@ -294,7 +294,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
logout = success; // flag for later logout from this grid; this is an HG TP logout = success; // flag for later logout from this grid; this is an HG TP
if (success) if (success)
sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
return success; return success;
} }
@ -516,13 +516,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Local region? // Local region?
if (info != null) if (info != null)
{ {
((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position, Scene.RequestTeleportLocation(
remoteClient, info.RegionHandle, lm.Position,
Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
} }
else else
{ {
// Foreign region // Foreign region
Scene scene = (Scene)(remoteClient.Scene);
GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
GridRegion gatekeeper = new GridRegion(); GridRegion gatekeeper = new GridRegion();
gatekeeper.ServerURI = lm.Gatekeeper; gatekeeper.ServerURI = lm.Gatekeeper;
@ -533,10 +533,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (finalDestination != null) if (finalDestination != null)
{ {
ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); ScenePresence sp = Scene.GetScenePresence(remoteClient.AgentId);
IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>();
if (transferMod != null && sp != null) if (sp != null)
{ {
if (message != null) if (message != null)
sp.ControllingClient.SendAgentAlertMessage(message, true); sp.ControllingClient.SendAgentAlertMessage(message, true);
@ -549,7 +548,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return; return;
} }
transferMod.DoTeleport( DoTeleport(
sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX, sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX,
(uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
} }
@ -633,4 +632,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return region; return region;
} }
} }
} }