From 458ccd26ff293794541c50ff8280e87e0aff0356 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 8 Oct 2014 23:16:01 +0100 Subject: [PATCH] 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. --- .../EntityTransfer/HGEntityTransferModule.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index a0bb1465c6..0c0cdf21d9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -294,7 +294,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer logout = success; // flag for later logout from this grid; this is an HG TP if (success) - sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); + Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); return success; } @@ -516,13 +516,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Local region? 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)); } else { // Foreign region - Scene scene = (Scene)(remoteClient.Scene); GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); GridRegion gatekeeper = new GridRegion(); gatekeeper.ServerURI = lm.Gatekeeper; @@ -533,10 +533,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (finalDestination != null) { - ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); - IEntityTransferModule transferMod = scene.RequestModuleInterface(); + ScenePresence sp = Scene.GetScenePresence(remoteClient.AgentId); - if (transferMod != null && sp != null) + if (sp != null) { if (message != null) sp.ControllingClient.SendAgentAlertMessage(message, true); @@ -549,7 +548,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return; } - transferMod.DoTeleport( + DoTeleport( sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); } @@ -633,4 +632,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return region; } } -} +} \ No newline at end of file