From 01ec93945e69b2fbeabc8fedaec0c9c9224b442e Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Sun, 13 Sep 2009 13:56:09 +0900
Subject: Formatting cleanup.

---
 .../Authorization/RemoteAuthorizationServiceConnector.cs   |  2 +-
 OpenSim/Region/Framework/Scenes/Scene.cs                   | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
index ac8b566..9241851 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
                 }
             }
             
-            if(scene != null)
+            if (scene != null)
             {
                 UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(new UUID(userID));
                 isAuthorized = IsAuthorizedForRegion(userID, profile.FirstName, profile.SurName,
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d95d9d3..0c2f991 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3253,18 +3253,18 @@ namespace OpenSim.Region.Framework.Scenes
                       
             if (AuthorizationService != null)
             {
-				if(!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString()))
-				{
-					m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
-                                	agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
-					return false;	
-				}
+                if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString()))
+                {
+                    m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
+                                     agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
+                    return false;    
+                }
             }
 
             if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
             {
                 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
-                                agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
+                                 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
                 reason = String.Format("Denied access to region {0}: You have been banned from that region.",
                                        RegionInfo.RegionName);
                 return false;
-- 
cgit v1.1


From 4241cdc9291eb5beeaa3120bf3079541b6452410 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Sun, 13 Sep 2009 07:20:18 -0400
Subject: * More comments in the RegionCombinerModule * Changed the Destination
 ID to 0 in the TeleportFinish Event (why did we have it as 3?) * Added border
 based trigger teleports * Fix MakeRootAgent border cross tests for ensuring
 that the position is inside the region to use the borders to figure out if
 it's outside the Region

---
 .../CoreModules/World/Land/RegionCombinerModule.cs | 130 ++++++++++++++++++---
 .../Framework/Scenes/SceneCommunicationService.cs  | 124 ++++++++++++++++++--
 OpenSim/Region/Framework/Scenes/ScenePresence.cs   |  26 ++++-
 3 files changed, 251 insertions(+), 29 deletions(-)

diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index 45e09a3..df2975b 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -80,9 +80,15 @@ namespace OpenSim.Region.CoreModules.World.Land
             if (!enabledYN)
                 return;
 
+            /* For testing on a single instance
+            if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
+                return;
+            */
+
             lock (m_startingScenes)
                 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
 
+            // Give each region a standard set of non-infinite borders
             Border northBorder = new Border();
             northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize);  //<---
             northBorder.CrossDirection = Cardinals.N;
@@ -103,6 +109,8 @@ namespace OpenSim.Region.CoreModules.World.Land
             westBorder.CrossDirection = Cardinals.W;
             scene.WestBorders[0] = westBorder;
 
+
+
             RegionConnections regionConnections = new RegionConnections();
             regionConnections.ConnectedRegions = new List<RegionData>();
             regionConnections.RegionScene = scene;
@@ -112,6 +120,8 @@ namespace OpenSim.Region.CoreModules.World.Land
             regionConnections.Y = scene.RegionInfo.RegionLocY;
             regionConnections.XEnd = (int)Constants.RegionSize;
             regionConnections.YEnd = (int)Constants.RegionSize;
+
+
             lock (m_regions)
             {
                 bool connectedYN = false;
@@ -280,6 +290,7 @@ namespace OpenSim.Region.CoreModules.World.Land
                     //xxx
                     //xxy
                     //xxx
+
                     if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
                         >= (regionConnections.X * (int)Constants.RegionSize))
                         && (((int)conn.Y * (int)Constants.RegionSize)
@@ -310,9 +321,13 @@ namespace OpenSim.Region.CoreModules.World.Land
                         ConnectedRegion.RegionScene = scene;
                         conn.ConnectedRegions.Add(ConnectedRegion);
 
+                        // Inform root region Physics about the extents of this region
                         conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
+
+                        // Inform Child region that it needs to forward it's terrain to the root region
                         scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
 
+                        // Extend the borders as appropriate
                         lock (conn.RegionScene.EastBorders)
                             conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
 
@@ -323,15 +338,24 @@ namespace OpenSim.Region.CoreModules.World.Land
                             conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
 
                         lock (scene.WestBorders)
-                            scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
+                        {
+                            scene.WestBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport West
 
-                        // Reset Terrain..  since terrain normally loads first.
-                        //
-                        scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
-                        //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
+                            // Trigger auto teleport to root region
+                            scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
+                            scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
+                        }
 
+                        // Reset Terrain..  since terrain loads before we get here, we need to load 
+                        // it again so it loads in the root region
+                        
+                        scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
+                        
+                        // Unlock borders
                         conn.RegionScene.BordersLocked = false;
                         scene.BordersLocked = false;
+
+                        // Create a client event forwarder and add this region's events to the root region.
                         if (conn.ClientEventForwarder != null)
                             conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
                         connectedYN = true;
@@ -381,7 +405,11 @@ namespace OpenSim.Region.CoreModules.World.Land
                         lock (conn.RegionScene.WestBorders)
                             conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
                         lock (scene.SouthBorders)
-                            scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
+                        {
+                            scene.SouthBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport south
+                            scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
+                            scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
+                        }
 
                         // Reset Terrain..  since terrain normally loads first.
                         //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
@@ -446,8 +474,13 @@ namespace OpenSim.Region.CoreModules.World.Land
                                     conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
                             }
                         }
+
                         lock (scene.SouthBorders)
-                            scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
+                        {
+                            scene.SouthBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport south
+                            scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
+                            scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
+                        }
 
                         lock (conn.RegionScene.EastBorders)
                         {
@@ -463,9 +496,14 @@ namespace OpenSim.Region.CoreModules.World.Land
 
                             }
                         }
-                        
+
                         lock (scene.WestBorders)
-                            scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
+                        {
+                            scene.WestBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport West
+                            scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
+                            scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
+                        }
+
                         /*  
                                                 else
                                                 {
@@ -495,17 +533,21 @@ namespace OpenSim.Region.CoreModules.World.Land
                     }
                 }
 
+                // If !connectYN means that this region is a root region
                 if (!connectedYN)
                 {
                     RegionData rdata = new RegionData();
                     rdata.Offset = Vector3.Zero;
                     rdata.RegionId = scene.RegionInfo.originRegionID;
                     rdata.RegionScene = scene;
+                    // save it's land channel
                     regionConnections.RegionLandChannel = scene.LandChannel;
 
+                    // Substitue our landchannel
                     RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
                                                                     regionConnections.ConnectedRegions);
                     scene.LandChannel = lnd;
+                    // Forward the permissions modules of each of the connected regions to the root region
                     lock (m_regions)
                     {
                         foreach (RegionData r in regionConnections.ConnectedRegions)
@@ -513,12 +555,17 @@ namespace OpenSim.Region.CoreModules.World.Land
                             ForwardPermissionRequests(regionConnections, r.RegionScene);
                         }
                     }
-
+                    // Create the root region's Client Event Forwarder
                     regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
+
+                    // Sets up the CoarseLocationUpdate forwarder for this root region
                     scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
+
+                    // Adds this root region to a dictionary of regions that are connectable
                     m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
                 }
             }
+            // Set up infinite borders around the entire AABB of the combined ConnectedRegions
             AdjustLargeRegionBounds();
         }
 
@@ -646,6 +693,13 @@ namespace OpenSim.Region.CoreModules.World.Land
             }
         }
 
+        /// <summary>
+        /// Locates a the Client of a particular region in an Array of RegionData based on offset
+        /// </summary>
+        /// <param name="offset"></param>
+        /// <param name="uUID"></param>
+        /// <param name="rdata"></param>
+        /// <returns>IClientAPI or null</returns>
         private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
         {
             IClientAPI returnclient = null;
@@ -664,6 +718,10 @@ namespace OpenSim.Region.CoreModules.World.Land
         {
         }
         
+        /// <summary>
+        /// TODO:
+        /// </summary>
+        /// <param name="rdata"></param>
         public void UnCombineRegion(RegionData rdata)
         {
             lock (m_regions)
@@ -706,7 +764,7 @@ namespace OpenSim.Region.CoreModules.World.Land
                     lock (rconn.RegionScene.NorthBorders)
                     {
                         Border northBorder = null;
-                        
+                        // If we don't already have an infinite border, create one.
                         if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
                         {
                             northBorder = new Border();
@@ -721,6 +779,7 @@ namespace OpenSim.Region.CoreModules.World.Land
                     lock (rconn.RegionScene.SouthBorders)
                     {
                         Border southBorder = null;
+                        // If we don't already have an infinite border, create one.
                         if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
                         {
                             southBorder = new Border();
@@ -733,6 +792,7 @@ namespace OpenSim.Region.CoreModules.World.Land
                     lock (rconn.RegionScene.EastBorders)
                     {
                         Border eastBorder = null;
+                        // If we don't already have an infinite border, create one.
                         if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
                         {
                             eastBorder = new Border();
@@ -746,6 +806,7 @@ namespace OpenSim.Region.CoreModules.World.Land
                     lock (rconn.RegionScene.WestBorders)
                     {
                         Border westBorder = null;
+                        // If we don't already have an infinite border, create one.
                         if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
                         {
                             westBorder = new Border();
@@ -761,6 +822,12 @@ namespace OpenSim.Region.CoreModules.World.Land
             }
         }
 
+        /// <summary>
+        /// Try and get an Infinite border out of a listT of borders
+        /// </summary>
+        /// <param name="borders"></param>
+        /// <param name="oborder"></param>
+        /// <returns></returns>
         public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
         {
             // Warning! Should be locked before getting here!
@@ -847,8 +914,19 @@ namespace OpenSim.Region.CoreModules.World.Land
 
     public class RegionConnections
     {
+        /// <summary>
+        /// Root Region ID
+        /// </summary>
         public UUID RegionId;
+
+        /// <summary>
+        /// Root Region Scene
+        /// </summary>
         public Scene RegionScene;
+
+        /// <summary>
+        /// LargeLandChannel for combined region
+        /// </summary>
         public ILandChannel RegionLandChannel;
         public uint X;
         public uint Y;
@@ -1323,7 +1401,7 @@ namespace OpenSim.Region.CoreModules.World.Land
             m_virtScene.UnSubscribeToClientPrimRezEvents(client);
             m_virtScene.UnSubscribeToClientInventoryEvents(client);
             m_virtScene.UnSubscribeToClientAttachmentEvents(client);
-            m_virtScene.UnSubscribeToClientTeleportEvents(client);
+            //m_virtScene.UnSubscribeToClientTeleportEvents(client);
             m_virtScene.UnSubscribeToClientScriptEvents(client);
             m_virtScene.UnSubscribeToClientGodEvents(client);
             m_virtScene.UnSubscribeToClientNetworkEvents(client);
@@ -1333,7 +1411,7 @@ namespace OpenSim.Region.CoreModules.World.Land
             client.OnRezObject += LocalRezObject;
             m_rootScene.SubscribeToClientInventoryEvents(client);
             m_rootScene.SubscribeToClientAttachmentEvents(client);
-            m_rootScene.SubscribeToClientTeleportEvents(client);
+            //m_rootScene.SubscribeToClientTeleportEvents(client);
             m_rootScene.SubscribeToClientScriptEvents(client);
             m_rootScene.SubscribeToClientGodEvents(client);
             m_rootScene.SubscribeToClientNetworkEvents(client);
@@ -1343,6 +1421,19 @@ namespace OpenSim.Region.CoreModules.World.Land
         {
         }
 
+        /// <summary>
+        /// Fixes position based on the region the Rez event came in on
+        /// </summary>
+        /// <param name="remoteclient"></param>
+        /// <param name="itemid"></param>
+        /// <param name="rayend"></param>
+        /// <param name="raystart"></param>
+        /// <param name="raytargetid"></param>
+        /// <param name="bypassraycast"></param>
+        /// <param name="rayendisintersection"></param>
+        /// <param name="rezselected"></param>
+        /// <param name="removeitem"></param>
+        /// <param name="fromtaskid"></param>
         private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, 
             UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, 
             UUID fromtaskid)
@@ -1357,7 +1448,18 @@ namespace OpenSim.Region.CoreModules.World.Land
             m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
                                   rayendisintersection, rezselected, removeitem, fromtaskid);
         }
-
+        /// <summary>
+        /// Fixes position based on the region the AddPrimShape event came in on
+        /// </summary>
+        /// <param name="ownerid"></param>
+        /// <param name="groupid"></param>
+        /// <param name="rayend"></param>
+        /// <param name="rot"></param>
+        /// <param name="shape"></param>
+        /// <param name="bypassraycast"></param>
+        /// <param name="raystart"></param>
+        /// <param name="raytargetid"></param>
+        /// <param name="rayendisintersection"></param>
         private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, 
             PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, 
             byte rayendisintersection)
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 1c71a99..b38148b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -1074,7 +1074,7 @@ namespace OpenSim.Region.Framework.Scenes
                         if (eq != null)
                         {
                             eq.TeleportFinishEvent(reg.RegionHandle, 13, endPoint,
-                                                   4, teleportFlags, capsPath, avatar.UUID);
+                                                   0, teleportFlags, capsPath, avatar.UUID);
                         }
                         else
                         {
@@ -1269,16 +1269,53 @@ namespace OpenSim.Region.Framework.Scenes
                 if (scene.TestBorderCross(pos + northCross, Cardinals.N))
                 {
                     Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
-                    neighboury += (uint)(int)(b.BorderLine.Z/(int)Constants.RegionSize);
+                    neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
                 }
                 else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
                 {
-                    neighboury--;
-                    newpos.Y = Constants.RegionSize - enterDistance;
+                    Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
+                    if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0)
+                    {
+                        neighboury--;
+                        newpos.Y = Constants.RegionSize - enterDistance;
+                    }
+                    else
+                    {
+                        neighboury = b.TriggerRegionY;
+                        neighbourx = b.TriggerRegionX;
+                        
+                        Vector3 newposition = pos;
+                        newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
+                        newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
+                        agent.ControllingClient.SendAgentAlertMessage(
+                            String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
+                        InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
+                        return;
+                    }
                 }
 
-                neighbourx--;
-                newpos.X = Constants.RegionSize - enterDistance;
+                Border ba = scene.GetCrossedBorder(pos + westCross, Cardinals.W);
+                if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0)
+                {
+                    neighbourx--;
+                    newpos.X = Constants.RegionSize - enterDistance;
+                }
+                else
+                {
+                    neighboury = ba.TriggerRegionY;
+                    neighbourx = ba.TriggerRegionX;
+
+
+                    Vector3 newposition = pos;
+                    newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
+                    newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
+                    agent.ControllingClient.SendAgentAlertMessage(
+                            String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
+                    InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
+
+
+                    return;
+                }
 
             }
             else if (scene.TestBorderCross(pos + eastCross, Cardinals.E))
@@ -1289,8 +1326,24 @@ namespace OpenSim.Region.Framework.Scenes
 
                 if (scene.TestBorderCross(pos + southCross, Cardinals.S))
                 {
-                    neighboury--;
-                    newpos.Y = Constants.RegionSize - enterDistance;
+                    Border ba = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
+                    if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0)
+                    {
+                        neighboury--;
+                        newpos.Y = Constants.RegionSize - enterDistance;
+                    }
+                    else
+                    {
+                        neighboury = ba.TriggerRegionY;
+                        neighbourx = ba.TriggerRegionX;
+                        Vector3 newposition = pos;
+                        newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
+                        newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
+                        agent.ControllingClient.SendAgentAlertMessage(
+                            String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
+                        InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
+                        return;
+                    }
                 }
                 else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
                 {
@@ -1298,16 +1351,33 @@ namespace OpenSim.Region.Framework.Scenes
                     neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize);
                     newpos.Y = enterDistance;
                 }
-                
+
 
             }
             else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
             {
-                neighboury--;
-                newpos.Y = Constants.RegionSize - enterDistance;
+                Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
+                if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0)
+                {
+                    neighboury--;
+                    newpos.Y = Constants.RegionSize - enterDistance;
+                }
+                else
+                {
+                    neighboury = b.TriggerRegionY;
+                    neighbourx = b.TriggerRegionX;
+                    Vector3 newposition = pos;
+                    newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
+                    newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
+                    agent.ControllingClient.SendAgentAlertMessage(
+                            String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
+                    InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
+                    return;
+                }
             }
             else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
             {
+
                 Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
                 neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
                 newpos.Y = enterDistance;
@@ -1342,6 +1412,38 @@ namespace OpenSim.Region.Framework.Scenes
             d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d);
         }
 
+        public void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene)
+        {
+            Util.FireAndForget(delegate
+            {
+                Thread.Sleep(10000);
+                IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>();
+                if (im != null)
+                {
+                    UUID gotoLocation = Util.BuildFakeParcelID(
+                        Util.UIntsToLong(
+                                                  (regionX *
+                                                   (uint)Constants.RegionSize),
+                                                  (regionY *
+                                                   (uint)Constants.RegionSize)),
+                        (uint)(int)position.X,
+                        (uint)(int)position.Y,
+                        (uint)(int)position.Z);
+                    GridInstantMessage m = new GridInstantMessage(initiatingScene, UUID.Zero,
+                    "Region", agent.UUID,
+                    (byte)InstantMessageDialog.GodLikeRequestTeleport, false,
+                    "", gotoLocation, false, new Vector3(127, 0, 0),
+                    new Byte[0]);
+                    im.SendInstantMessage(m, delegate(bool success)
+                    {
+                        m_log.DebugFormat("[CLIENT]: Client Initiating Teleport sending IM success = {0}", success);
+                    });
+
+                }
+
+            });
+        }
+
         public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying);
 
                 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1024857..23fe2d3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -776,8 +776,20 @@ namespace OpenSim.Region.Framework.Scenes
             // before the inventory is processed in MakeRootAgent. This fixes a race condition
             // related to the handling of attachments
             //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);            
+            if (m_scene.TestBorderCross(pos, Cardinals.E))
+            {
+                Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
+                pos.X = crossedBorder.BorderLine.Z - 1;
+            }
+
+            if (m_scene.TestBorderCross(pos, Cardinals.N))
+            {
+                Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
+                pos.Y = crossedBorder.BorderLine.Z - 1;
+            }
+
 
-            if (pos.X < 0 || pos.X >= (int)Constants.RegionSize || pos.Y < 0 || pos.Y >= (int)Constants.RegionSize || pos.Z < 0)
+            if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
             {
                 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
 
@@ -795,7 +807,11 @@ namespace OpenSim.Region.Framework.Scenes
                 localAVHeight = m_avHeight;
             }
 
-            float posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
+            float posZLimit = 0;
+
+            if (pos.X <Constants.RegionSize && pos.Y < Constants.RegionSize)
+                posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
+            
             float newPosZ = posZLimit + localAVHeight / 2;
             if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
             {
@@ -877,6 +893,7 @@ namespace OpenSim.Region.Framework.Scenes
             m_isChildAgent = true;
             m_scene.SwapRootAgentCount(true);
             RemoveFromPhysicalScene();
+            
             m_scene.EventManager.TriggerOnMakeChildAgent(this);
         }
 
@@ -904,7 +921,7 @@ namespace OpenSim.Region.Framework.Scenes
             bool isFlying = false;
             if (m_physicsActor != null)
                 isFlying = m_physicsActor.Flying;
-
+            
             RemoveFromPhysicalScene();
             Velocity = new Vector3(0, 0, 0);
             AbsolutePosition = pos;
@@ -2412,7 +2429,8 @@ namespace OpenSim.Region.Framework.Scenes
                 }
 
                 // followed suggestion from mic bowman. reversed the two lines below.
-                CheckForBorderCrossing();
+                if (m_parentID == 0 && m_physicsActor != null || m_parentID != 0) // Check that we have a physics actor or we're sitting on something
+                    CheckForBorderCrossing();
                 CheckForSignificantMovement(); // sends update to the modules.
             }
         }
-- 
cgit v1.1


From 38e462ed8a9a890a069fc429c7a3919e9af7d0ec Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Sun, 13 Sep 2009 07:27:24 -0400
Subject: * Milestone GridFriendly reached so Adding CombineContiguousRegions
 to the OpenSim.ini.example

---
 bin/OpenSim.ini.example | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index ff1a773..a255260 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -80,6 +80,11 @@
 
     ; How many prims to send to each avatar in the scene on each Update()
     ; MaxPrimsPerFrame = 200
+    
+    ; Combine all contiguous regions into one large region
+    ; Order your regions from South to North, West to East in your regions.ini and then set this to true
+    ; Warning!  Don't use this with regions that have existing content!, This will likely break them
+     CombineContiguousRegions=false
 
     ; ##
     ; ## STORAGE
-- 
cgit v1.1


From efc43aa0d90e7e35408e7eb7fd475eaa3c3b0a31 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 13 Sep 2009 18:24:00 +0100
Subject: Change the type value for given folders to -1. Prevents inventory
 blowups

---
 OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4ea283f..eb397f6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1136,7 +1136,7 @@ namespace OpenSim.Region.Framework.Scenes
 
             UUID newFolderID = UUID.Random();
 
-            InventoryFolderBase newFolder = new InventoryFolderBase(newFolderID, category, destID, 0xff, rootFolder.ID, rootFolder.Version);
+            InventoryFolderBase newFolder = new InventoryFolderBase(newFolderID, category, destID, -1, rootFolder.ID, rootFolder.Version);
             InventoryService.AddFolder(newFolder);
 
             foreach (UUID itemID in items)
-- 
cgit v1.1


From eadea36142ca17b38b08ef4c9647808fec034664 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Sun, 13 Sep 2009 18:12:24 -0400
Subject: * Move nested classes from the RegionCombinerModule into their own
 file. * Rename the RegionCombinerModuleIndividualForwarder to
 RegionCombinerIndividualEventForwarder so there's no possibility that
 mono.addins sees any names similar

---
 .../Land/RegionCombinerClientEventForwarder.cs     |  94 ++++
 .../Land/RegionCombinerIndividualEventForwarder.cs | 125 +++++
 .../World/Land/RegionCombinerLargeLandChannel.cs   | 163 ++++++
 .../CoreModules/World/Land/RegionCombinerModule.cs | 563 ---------------------
 .../World/Land/RegionCombinerPermissionModule.cs   | 275 ++++++++++
 .../CoreModules/World/Land/RegionConnections.cs    |  65 +++
 .../CoreModules/World/Land/RegionCourseLocation.cs |  43 ++
 .../Region/CoreModules/World/Land/RegionData.cs    |  39 ++
 8 files changed, 804 insertions(+), 563 deletions(-)
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionData.cs

diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
new file mode 100644
index 0000000..70d6de3
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+public class RegionCombinerClientEventForwarder
+    {
+        private Scene m_rootScene;
+        private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>();
+        private Dictionary<UUID,RegionCombinerIndividualEventForwarder> m_forwarders = new Dictionary<UUID,
+            RegionCombinerIndividualEventForwarder>();
+
+        public RegionCombinerClientEventForwarder(RegionConnections rootScene)
+        {
+            m_rootScene = rootScene.RegionScene;
+        }
+
+        public void AddSceneToEventForwarding(Scene virtualScene)
+        {
+            lock (m_virtScene)
+            {
+                if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
+                {
+                    m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene;
+                }
+                else
+                {
+                    m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene);
+                }
+            }
+            
+            lock (m_forwarders)
+            {
+                // TODO: Fix this to unregister if this happens
+                if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID))
+                    m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
+
+                RegionCombinerIndividualEventForwarder forwarder =
+                    new RegionCombinerIndividualEventForwarder(m_rootScene, virtualScene);
+                m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder);
+
+                virtualScene.EventManager.OnNewClient += forwarder.ClientConnect;
+                virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed;
+            }
+        }
+
+        public void RemoveSceneFromEventForwarding (Scene virtualScene)
+        {
+            lock (m_forwarders)
+            {
+                RegionCombinerIndividualEventForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID];
+                virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect;
+                virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed;
+                m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
+            }
+            lock (m_virtScene)
+            {
+                if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
+                {
+                    m_virtScene.Remove(virtualScene.RegionInfo.originRegionID);
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
new file mode 100644
index 0000000..65f22b1
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+ public class RegionCombinerIndividualEventForwarder
+    {
+        private Scene m_rootScene;
+        private Scene m_virtScene;
+
+        public RegionCombinerIndividualEventForwarder(Scene rootScene, Scene virtScene)
+        {
+            m_rootScene = rootScene;
+            m_virtScene = virtScene;
+        }
+
+        public void ClientConnect(IClientAPI client)
+        {
+            m_virtScene.UnSubscribeToClientPrimEvents(client);
+            m_virtScene.UnSubscribeToClientPrimRezEvents(client);
+            m_virtScene.UnSubscribeToClientInventoryEvents(client);
+            m_virtScene.UnSubscribeToClientAttachmentEvents(client);
+            //m_virtScene.UnSubscribeToClientTeleportEvents(client);
+            m_virtScene.UnSubscribeToClientScriptEvents(client);
+            m_virtScene.UnSubscribeToClientGodEvents(client);
+            m_virtScene.UnSubscribeToClientNetworkEvents(client);
+
+            m_rootScene.SubscribeToClientPrimEvents(client);
+            client.OnAddPrim += LocalAddNewPrim;
+            client.OnRezObject += LocalRezObject;
+            m_rootScene.SubscribeToClientInventoryEvents(client);
+            m_rootScene.SubscribeToClientAttachmentEvents(client);
+            //m_rootScene.SubscribeToClientTeleportEvents(client);
+            m_rootScene.SubscribeToClientScriptEvents(client);
+            m_rootScene.SubscribeToClientGodEvents(client);
+            m_rootScene.SubscribeToClientNetworkEvents(client);
+        }
+
+        public void ClientClosed(UUID clientid, Scene scene)
+        {
+        }
+
+        /// <summary>
+        /// Fixes position based on the region the Rez event came in on
+        /// </summary>
+        /// <param name="remoteclient"></param>
+        /// <param name="itemid"></param>
+        /// <param name="rayend"></param>
+        /// <param name="raystart"></param>
+        /// <param name="raytargetid"></param>
+        /// <param name="bypassraycast"></param>
+        /// <param name="rayendisintersection"></param>
+        /// <param name="rezselected"></param>
+        /// <param name="removeitem"></param>
+        /// <param name="fromtaskid"></param>
+        private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, 
+            UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, 
+            UUID fromtaskid)
+        {     
+            int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
+            int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
+            rayend.X += differenceX * (int)Constants.RegionSize;
+            rayend.Y += differenceY * (int)Constants.RegionSize;
+            raystart.X += differenceX * (int)Constants.RegionSize;
+            raystart.Y += differenceY * (int)Constants.RegionSize;
+
+            m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
+                                  rayendisintersection, rezselected, removeitem, fromtaskid);
+        }
+        /// <summary>
+        /// Fixes position based on the region the AddPrimShape event came in on
+        /// </summary>
+        /// <param name="ownerid"></param>
+        /// <param name="groupid"></param>
+        /// <param name="rayend"></param>
+        /// <param name="rot"></param>
+        /// <param name="shape"></param>
+        /// <param name="bypassraycast"></param>
+        /// <param name="raystart"></param>
+        /// <param name="raytargetid"></param>
+        /// <param name="rayendisintersection"></param>
+        private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, 
+            PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, 
+            byte rayendisintersection)
+        {
+            int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
+            int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
+            rayend.X += differenceX * (int)Constants.RegionSize;
+            rayend.Y += differenceY * (int)Constants.RegionSize;
+            raystart.X += differenceX * (int)Constants.RegionSize;
+            raystart.Y += differenceY * (int)Constants.RegionSize;
+            m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
+                                   rayendisintersection);
+        }
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
new file mode 100644
index 0000000..9e46b94
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+public class RegionCombinerLargeLandChannel : ILandChannel
+    {
+        // private static readonly ILog m_log =
+        //     LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+        private RegionData RegData;
+        private ILandChannel RootRegionLandChannel;
+        private readonly List<RegionData> RegionConnections;
+        
+        #region ILandChannel Members
+
+        public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
+                                              List<RegionData> regionConnections)
+        {
+            RegData = regData;
+            RootRegionLandChannel = rootRegionLandChannel;
+            RegionConnections = regionConnections;
+        }
+
+        public List<ILandObject> ParcelsNearPoint(Vector3 position)
+        {
+            //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
+            return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
+        }
+
+        public List<ILandObject> AllParcels()
+        {
+            return RootRegionLandChannel.AllParcels();
+        }
+
+        public ILandObject GetLandObject(int x, int y)
+        {
+            //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
+
+            if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
+            {
+                return RootRegionLandChannel.GetLandObject(x, y);
+            }
+            else
+            {
+                int offsetX = (x / (int)Constants.RegionSize);
+                int offsetY = (y / (int)Constants.RegionSize);
+                offsetX *= (int)Constants.RegionSize;
+                offsetY *= (int)Constants.RegionSize;
+
+                foreach (RegionData regionData in RegionConnections)
+                {
+                    if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
+                    {
+                        return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
+                    }
+                }
+                ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
+                obj.landData.Name = "NO LAND";
+                return obj;
+            }
+        }
+
+        public ILandObject GetLandObject(int localID)
+        {
+            return RootRegionLandChannel.GetLandObject(localID);
+        }
+
+        public ILandObject GetLandObject(float x, float y)
+        {
+            //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
+            
+            if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
+            {
+                return RootRegionLandChannel.GetLandObject(x, y);
+            }
+            else
+            {
+                int offsetX = (int)(x/(int) Constants.RegionSize);
+                int offsetY = (int)(y/(int) Constants.RegionSize);
+                offsetX *= (int) Constants.RegionSize;
+                offsetY *= (int) Constants.RegionSize;
+
+                foreach (RegionData regionData in RegionConnections)
+                {
+                    if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
+                    {
+                        return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
+                    }
+                }
+                ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
+                obj.landData.Name = "NO LAND";
+                return obj;
+            }
+        }
+
+        public bool IsLandPrimCountTainted()
+        {
+            return RootRegionLandChannel.IsLandPrimCountTainted();
+        }
+
+        public bool IsForcefulBansAllowed()
+        {
+            return RootRegionLandChannel.IsForcefulBansAllowed();
+        }
+
+        public void UpdateLandObject(int localID, LandData data)
+        {
+            RootRegionLandChannel.UpdateLandObject(localID, data);
+        }
+
+        public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
+        {
+            RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
+        }
+
+        public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
+        {
+            RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
+        }
+
+        public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
+        {
+            RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
+        }
+
+        public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
+        {
+            RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index df2975b..98c7aa8 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -911,567 +911,4 @@ namespace OpenSim.Region.CoreModules.World.Land
             VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED
         }
     }
-
-    public class RegionConnections
-    {
-        /// <summary>
-        /// Root Region ID
-        /// </summary>
-        public UUID RegionId;
-
-        /// <summary>
-        /// Root Region Scene
-        /// </summary>
-        public Scene RegionScene;
-
-        /// <summary>
-        /// LargeLandChannel for combined region
-        /// </summary>
-        public ILandChannel RegionLandChannel;
-        public uint X;
-        public uint Y;
-        public int XEnd;
-        public int YEnd;
-        public List<RegionData> ConnectedRegions;
-        public RegionCombinerPermissionModule PermissionModule;
-        public RegionCombinerClientEventForwarder ClientEventForwarder;
-        public void UpdateExtents(Vector3 extents)
-        {
-            XEnd = (int)extents.X;
-            YEnd = (int)extents.Y;
-        }
-    }
-
-    public class RegionData
-    {
-        public UUID RegionId;
-        public Scene RegionScene;
-        public Vector3 Offset;
-    }
-
-    struct RegionCourseLocationStruct
-    {
-        public List<Vector3> Locations;
-        public List<UUID> Uuids;
-        public IClientAPI UserAPI;
-        public Vector2 Offset;
-    }
-
-    public class RegionCombinerLargeLandChannel : ILandChannel
-    {
-        // private static readonly ILog m_log =
-        //     LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-        private RegionData RegData;
-        private ILandChannel RootRegionLandChannel;
-        private readonly List<RegionData> RegionConnections;
-        
-        #region ILandChannel Members
-
-        public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
-                                              List<RegionData> regionConnections)
-        {
-            RegData = regData;
-            RootRegionLandChannel = rootRegionLandChannel;
-            RegionConnections = regionConnections;
-        }
-
-        public List<ILandObject> ParcelsNearPoint(Vector3 position)
-        {
-            //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
-            return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
-        }
-
-        public List<ILandObject> AllParcels()
-        {
-            return RootRegionLandChannel.AllParcels();
-        }
-
-        public ILandObject GetLandObject(int x, int y)
-        {
-            //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
-
-            if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
-            {
-                return RootRegionLandChannel.GetLandObject(x, y);
-            }
-            else
-            {
-                int offsetX = (x / (int)Constants.RegionSize);
-                int offsetY = (y / (int)Constants.RegionSize);
-                offsetX *= (int)Constants.RegionSize;
-                offsetY *= (int)Constants.RegionSize;
-
-                foreach (RegionData regionData in RegionConnections)
-                {
-                    if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
-                    {
-                        return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
-                    }
-                }
-                ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
-                obj.landData.Name = "NO LAND";
-                return obj;
-            }
-        }
-
-        public ILandObject GetLandObject(int localID)
-        {
-            return RootRegionLandChannel.GetLandObject(localID);
-        }
-
-        public ILandObject GetLandObject(float x, float y)
-        {
-            //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
-            
-            if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
-            {
-                return RootRegionLandChannel.GetLandObject(x, y);
-            }
-            else
-            {
-                int offsetX = (int)(x/(int) Constants.RegionSize);
-                int offsetY = (int)(y/(int) Constants.RegionSize);
-                offsetX *= (int) Constants.RegionSize;
-                offsetY *= (int) Constants.RegionSize;
-
-                foreach (RegionData regionData in RegionConnections)
-                {
-                    if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
-                    {
-                        return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
-                    }
-                }
-                ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
-                obj.landData.Name = "NO LAND";
-                return obj;
-            }
-        }
-
-        public bool IsLandPrimCountTainted()
-        {
-            return RootRegionLandChannel.IsLandPrimCountTainted();
-        }
-
-        public bool IsForcefulBansAllowed()
-        {
-            return RootRegionLandChannel.IsForcefulBansAllowed();
-        }
-
-        public void UpdateLandObject(int localID, LandData data)
-        {
-            RootRegionLandChannel.UpdateLandObject(localID, data);
-        }
-
-        public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
-        {
-            RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
-        }
-
-        public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
-        {
-            RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
-        }
-
-        public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
-        {
-            RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
-        }
-
-        public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
-        {
-            RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
-        }
-
-        #endregion
-    }
-
-    public class RegionCombinerPermissionModule
-    {
-        private Scene m_rootScene;
-
-        public RegionCombinerPermissionModule(Scene RootScene)
-        {
-            m_rootScene = RootScene;
-        }
-
-        #region Permission Override
-
-        public bool BypassPermissions()
-        {
-            return m_rootScene.Permissions.BypassPermissions();
-        }
-
-        public void SetBypassPermissions(bool value)
-        {
-            m_rootScene.Permissions.SetBypassPermissions(value);
-        }
-
-        public bool PropagatePermissions()
-        {
-            return m_rootScene.Permissions.PropagatePermissions();
-        }
-
-        public uint GenerateClientFlags(UUID userid, UUID objectidid)
-        {
-            return m_rootScene.Permissions.GenerateClientFlags(userid,objectidid);
-        }
-
-        public bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanAbandonParcel(user,parcel);
-        }
-
-        public bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanReclaimParcel(user, parcel);
-        }
-
-        public bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanDeedParcel(user, parcel);
-        }
-
-        public bool CanDeedObject(UUID user, UUID @group, Scene scene)
-        {
-            return m_rootScene.Permissions.CanDeedObject(user,@group);
-        }
-
-        public bool IsGod(UUID user, Scene requestfromscene)
-        {
-            return m_rootScene.Permissions.IsGod(user);
-        }
-
-        public bool CanDuplicateObject(int objectcount, UUID objectid, UUID owner, Scene scene, Vector3 objectposition)
-        {
-            return m_rootScene.Permissions.CanDuplicateObject(objectcount, objectid, owner, objectposition);
-        }
-
-        public bool CanDeleteObject(UUID objectid, UUID deleter, Scene scene)
-        {
-            return m_rootScene.Permissions.CanDeleteObject(objectid, deleter);
-        }
-
-        public bool CanEditObject(UUID objectid, UUID editorid, Scene scene)
-        {
-            return m_rootScene.Permissions.CanEditObject(objectid, editorid);
-        }
-
-        public bool CanEditParcel(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanEditParcel(user, parcel);
-        }
-
-        public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
-        {
-            return m_rootScene.Permissions.CanInstantMessage(user, target);
-        }
-
-        public bool CanInventoryTransfer(UUID user, UUID target, Scene startscene)
-        {
-            return m_rootScene.Permissions.CanInventoryTransfer(user, target);
-        }
-
-        public bool CanIssueEstateCommand(UUID user, Scene requestfromscene, bool ownercommand)
-        {
-            return m_rootScene.Permissions.CanIssueEstateCommand(user, ownercommand);
-        }
-
-        public bool CanMoveObject(UUID objectid, UUID moverid, Scene scene)
-        {
-            return m_rootScene.Permissions.CanMoveObject(objectid, moverid);
-        }
-
-        public bool CanObjectEntry(UUID objectid, bool enteringregion, Vector3 newpoint, Scene scene)
-        {
-            return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint);
-        }
-
-        public bool CanReturnObject(UUID objectid, UUID returnerid, Scene scene)
-        {
-            return m_rootScene.Permissions.CanReturnObject(objectid, returnerid);
-        }
-
-        public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene)
-        {
-            return m_rootScene.Permissions.CanRezObject(objectcount, owner, objectposition);
-        }
-
-        public bool CanRunConsoleCommand(UUID user, Scene requestfromscene)
-        {
-            return m_rootScene.Permissions.CanRunConsoleCommand(user);
-        }
-
-        public bool CanRunScript(UUID script, UUID objectid, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanRunScript(script, objectid, user);
-        }
-
-        public bool CanCompileScript(UUID owneruuid, int scripttype, Scene scene)
-        {
-            return m_rootScene.Permissions.CanCompileScript(owneruuid, scripttype);
-        }
-
-        public bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanSellParcel(user, parcel);
-        }
-
-        public bool CanTakeObject(UUID objectid, UUID stealer, Scene scene)
-        {
-            return m_rootScene.Permissions.CanTakeObject(objectid, stealer);
-        }
-
-        public bool CanTakeCopyObject(UUID objectid, UUID userid, Scene inscene)
-        {
-            return m_rootScene.Permissions.CanTakeObject(objectid, userid);
-        }
-
-        public bool CanTerraformLand(UUID user, Vector3 position, Scene requestfromscene)
-        {
-            return m_rootScene.Permissions.CanTerraformLand(user, position);
-        }
-
-        public bool CanLinkObject(UUID user, UUID objectid)
-        {
-            return m_rootScene.Permissions.CanLinkObject(user, objectid);
-        }
-
-        public bool CanDelinkObject(UUID user, UUID objectid)
-        {
-            return m_rootScene.Permissions.CanDelinkObject(user, objectid);
-        }
-
-        public bool CanBuyLand(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanBuyLand(user, parcel);
-        }
-
-        public bool CanViewNotecard(UUID script, UUID objectid, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanViewNotecard(script, objectid, user);
-        }
-
-        public bool CanViewScript(UUID script, UUID objectid, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanViewScript(script, objectid, user);
-        }
-
-        public bool CanEditNotecard(UUID notecard, UUID objectid, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanEditNotecard(notecard, objectid, user);
-        }
-
-        public bool CanEditScript(UUID script, UUID objectid, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanEditScript(script, objectid, user);
-        }
-
-        public bool CanCreateObjectInventory(int invtype, UUID objectid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanCreateObjectInventory(invtype, objectid, userid);
-        }
-
-        public bool CanEditObjectInventory(UUID objectid, UUID editorid, Scene scene)
-        {
-            return m_rootScene.Permissions.CanEditObjectInventory(objectid, editorid);
-        }
-
-        public bool CanCopyObjectInventory(UUID itemid, UUID objectid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanCopyObjectInventory(itemid, objectid, userid);
-        }
-
-        public bool CanDeleteObjectInventory(UUID itemid, UUID objectid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanDeleteObjectInventory(itemid, objectid, userid);
-        }
-
-        public bool CanResetScript(UUID prim, UUID script, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanResetScript(prim, script, user);
-        }
-
-        public bool CanCreateUserInventory(int invtype, UUID userid)
-        {
-            return m_rootScene.Permissions.CanCreateUserInventory(invtype, userid);
-        }
-
-        public bool CanCopyUserInventory(UUID itemid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanCopyUserInventory(itemid, userid);
-        }
-
-        public bool CanEditUserInventory(UUID itemid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanEditUserInventory(itemid, userid);
-        }
-
-        public bool CanDeleteUserInventory(UUID itemid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanDeleteUserInventory(itemid, userid);
-        }
-
-        public bool CanTeleport(UUID userid, Scene scene)
-        {
-            return m_rootScene.Permissions.CanTeleport(userid);
-        }
-
-        public bool CanUseObjectReturn(ILandObject landdata, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
-        {
-            return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist);
-        }
-
-        #endregion
-    }
-
-    public class RegionCombinerClientEventForwarder
-    {
-        private Scene m_rootScene;
-        private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>();
-        private Dictionary<UUID,RegionCombinerModuleIndividualForwarder> m_forwarders = new Dictionary<UUID, 
-            RegionCombinerModuleIndividualForwarder>();
-
-        public RegionCombinerClientEventForwarder(RegionConnections rootScene)
-        {
-            m_rootScene = rootScene.RegionScene;
-        }
-
-        public void AddSceneToEventForwarding(Scene virtualScene)
-        {
-            lock (m_virtScene)
-            {
-                if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
-                {
-                    m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene;
-                }
-                else
-                {
-                    m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene);
-                }
-            }
-            
-            lock (m_forwarders)
-            {
-                // TODO: Fix this to unregister if this happens
-                if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID))
-                    m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
-
-                RegionCombinerModuleIndividualForwarder forwarder =
-                    new RegionCombinerModuleIndividualForwarder(m_rootScene, virtualScene);
-                m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder);
-
-                virtualScene.EventManager.OnNewClient += forwarder.ClientConnect;
-                virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed;
-            }
-        }
-
-        public void RemoveSceneFromEventForwarding (Scene virtualScene)
-        {
-            lock (m_forwarders)
-            {
-                RegionCombinerModuleIndividualForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID];
-                virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect;
-                virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed;
-                m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
-            }
-            lock (m_virtScene)
-            {
-                if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
-                {
-                    m_virtScene.Remove(virtualScene.RegionInfo.originRegionID);
-                }
-            }
-        }
-    }
-
-    public class RegionCombinerModuleIndividualForwarder
-    {
-        private Scene m_rootScene;
-        private Scene m_virtScene;
-
-        public RegionCombinerModuleIndividualForwarder(Scene rootScene, Scene virtScene)
-        {
-            m_rootScene = rootScene;
-            m_virtScene = virtScene;
-        }
-
-        public void ClientConnect(IClientAPI client)
-        {
-            m_virtScene.UnSubscribeToClientPrimEvents(client);
-            m_virtScene.UnSubscribeToClientPrimRezEvents(client);
-            m_virtScene.UnSubscribeToClientInventoryEvents(client);
-            m_virtScene.UnSubscribeToClientAttachmentEvents(client);
-            //m_virtScene.UnSubscribeToClientTeleportEvents(client);
-            m_virtScene.UnSubscribeToClientScriptEvents(client);
-            m_virtScene.UnSubscribeToClientGodEvents(client);
-            m_virtScene.UnSubscribeToClientNetworkEvents(client);
-
-            m_rootScene.SubscribeToClientPrimEvents(client);
-            client.OnAddPrim += LocalAddNewPrim;
-            client.OnRezObject += LocalRezObject;
-            m_rootScene.SubscribeToClientInventoryEvents(client);
-            m_rootScene.SubscribeToClientAttachmentEvents(client);
-            //m_rootScene.SubscribeToClientTeleportEvents(client);
-            m_rootScene.SubscribeToClientScriptEvents(client);
-            m_rootScene.SubscribeToClientGodEvents(client);
-            m_rootScene.SubscribeToClientNetworkEvents(client);
-        }
-
-        public void ClientClosed(UUID clientid, Scene scene)
-        {
-        }
-
-        /// <summary>
-        /// Fixes position based on the region the Rez event came in on
-        /// </summary>
-        /// <param name="remoteclient"></param>
-        /// <param name="itemid"></param>
-        /// <param name="rayend"></param>
-        /// <param name="raystart"></param>
-        /// <param name="raytargetid"></param>
-        /// <param name="bypassraycast"></param>
-        /// <param name="rayendisintersection"></param>
-        /// <param name="rezselected"></param>
-        /// <param name="removeitem"></param>
-        /// <param name="fromtaskid"></param>
-        private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, 
-            UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, 
-            UUID fromtaskid)
-        {     
-            int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
-            int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
-            rayend.X += differenceX * (int)Constants.RegionSize;
-            rayend.Y += differenceY * (int)Constants.RegionSize;
-            raystart.X += differenceX * (int)Constants.RegionSize;
-            raystart.Y += differenceY * (int)Constants.RegionSize;
-
-            m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
-                                  rayendisintersection, rezselected, removeitem, fromtaskid);
-        }
-        /// <summary>
-        /// Fixes position based on the region the AddPrimShape event came in on
-        /// </summary>
-        /// <param name="ownerid"></param>
-        /// <param name="groupid"></param>
-        /// <param name="rayend"></param>
-        /// <param name="rot"></param>
-        /// <param name="shape"></param>
-        /// <param name="bypassraycast"></param>
-        /// <param name="raystart"></param>
-        /// <param name="raytargetid"></param>
-        /// <param name="rayendisintersection"></param>
-        private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, 
-            PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, 
-            byte rayendisintersection)
-        {
-            int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
-            int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
-            rayend.X += differenceX * (int)Constants.RegionSize;
-            rayend.Y += differenceY * (int)Constants.RegionSize;
-            raystart.X += differenceX * (int)Constants.RegionSize;
-            raystart.Y += differenceY * (int)Constants.RegionSize;
-            m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
-                                   rayendisintersection);
-        }
-    }
 }
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
new file mode 100644
index 0000000..76ca5e3
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+ public class RegionCombinerPermissionModule
+    {
+        private Scene m_rootScene;
+
+        public RegionCombinerPermissionModule(Scene RootScene)
+        {
+            m_rootScene = RootScene;
+        }
+
+        #region Permission Override
+
+        public bool BypassPermissions()
+        {
+            return m_rootScene.Permissions.BypassPermissions();
+        }
+
+        public void SetBypassPermissions(bool value)
+        {
+            m_rootScene.Permissions.SetBypassPermissions(value);
+        }
+
+        public bool PropagatePermissions()
+        {
+            return m_rootScene.Permissions.PropagatePermissions();
+        }
+
+        public uint GenerateClientFlags(UUID userid, UUID objectidid)
+        {
+            return m_rootScene.Permissions.GenerateClientFlags(userid,objectidid);
+        }
+
+        public bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanAbandonParcel(user,parcel);
+        }
+
+        public bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanReclaimParcel(user, parcel);
+        }
+
+        public bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanDeedParcel(user, parcel);
+        }
+
+        public bool CanDeedObject(UUID user, UUID @group, Scene scene)
+        {
+            return m_rootScene.Permissions.CanDeedObject(user,@group);
+        }
+
+        public bool IsGod(UUID user, Scene requestfromscene)
+        {
+            return m_rootScene.Permissions.IsGod(user);
+        }
+
+        public bool CanDuplicateObject(int objectcount, UUID objectid, UUID owner, Scene scene, Vector3 objectposition)
+        {
+            return m_rootScene.Permissions.CanDuplicateObject(objectcount, objectid, owner, objectposition);
+        }
+
+        public bool CanDeleteObject(UUID objectid, UUID deleter, Scene scene)
+        {
+            return m_rootScene.Permissions.CanDeleteObject(objectid, deleter);
+        }
+
+        public bool CanEditObject(UUID objectid, UUID editorid, Scene scene)
+        {
+            return m_rootScene.Permissions.CanEditObject(objectid, editorid);
+        }
+
+        public bool CanEditParcel(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanEditParcel(user, parcel);
+        }
+
+        public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
+        {
+            return m_rootScene.Permissions.CanInstantMessage(user, target);
+        }
+
+        public bool CanInventoryTransfer(UUID user, UUID target, Scene startscene)
+        {
+            return m_rootScene.Permissions.CanInventoryTransfer(user, target);
+        }
+
+        public bool CanIssueEstateCommand(UUID user, Scene requestfromscene, bool ownercommand)
+        {
+            return m_rootScene.Permissions.CanIssueEstateCommand(user, ownercommand);
+        }
+
+        public bool CanMoveObject(UUID objectid, UUID moverid, Scene scene)
+        {
+            return m_rootScene.Permissions.CanMoveObject(objectid, moverid);
+        }
+
+        public bool CanObjectEntry(UUID objectid, bool enteringregion, Vector3 newpoint, Scene scene)
+        {
+            return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint);
+        }
+
+        public bool CanReturnObject(UUID objectid, UUID returnerid, Scene scene)
+        {
+            return m_rootScene.Permissions.CanReturnObject(objectid, returnerid);
+        }
+
+        public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene)
+        {
+            return m_rootScene.Permissions.CanRezObject(objectcount, owner, objectposition);
+        }
+
+        public bool CanRunConsoleCommand(UUID user, Scene requestfromscene)
+        {
+            return m_rootScene.Permissions.CanRunConsoleCommand(user);
+        }
+
+        public bool CanRunScript(UUID script, UUID objectid, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanRunScript(script, objectid, user);
+        }
+
+        public bool CanCompileScript(UUID owneruuid, int scripttype, Scene scene)
+        {
+            return m_rootScene.Permissions.CanCompileScript(owneruuid, scripttype);
+        }
+
+        public bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanSellParcel(user, parcel);
+        }
+
+        public bool CanTakeObject(UUID objectid, UUID stealer, Scene scene)
+        {
+            return m_rootScene.Permissions.CanTakeObject(objectid, stealer);
+        }
+
+        public bool CanTakeCopyObject(UUID objectid, UUID userid, Scene inscene)
+        {
+            return m_rootScene.Permissions.CanTakeObject(objectid, userid);
+        }
+
+        public bool CanTerraformLand(UUID user, Vector3 position, Scene requestfromscene)
+        {
+            return m_rootScene.Permissions.CanTerraformLand(user, position);
+        }
+
+        public bool CanLinkObject(UUID user, UUID objectid)
+        {
+            return m_rootScene.Permissions.CanLinkObject(user, objectid);
+        }
+
+        public bool CanDelinkObject(UUID user, UUID objectid)
+        {
+            return m_rootScene.Permissions.CanDelinkObject(user, objectid);
+        }
+
+        public bool CanBuyLand(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanBuyLand(user, parcel);
+        }
+
+        public bool CanViewNotecard(UUID script, UUID objectid, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanViewNotecard(script, objectid, user);
+        }
+
+        public bool CanViewScript(UUID script, UUID objectid, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanViewScript(script, objectid, user);
+        }
+
+        public bool CanEditNotecard(UUID notecard, UUID objectid, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanEditNotecard(notecard, objectid, user);
+        }
+
+        public bool CanEditScript(UUID script, UUID objectid, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanEditScript(script, objectid, user);
+        }
+
+        public bool CanCreateObjectInventory(int invtype, UUID objectid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanCreateObjectInventory(invtype, objectid, userid);
+        }
+
+        public bool CanEditObjectInventory(UUID objectid, UUID editorid, Scene scene)
+        {
+            return m_rootScene.Permissions.CanEditObjectInventory(objectid, editorid);
+        }
+
+        public bool CanCopyObjectInventory(UUID itemid, UUID objectid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanCopyObjectInventory(itemid, objectid, userid);
+        }
+
+        public bool CanDeleteObjectInventory(UUID itemid, UUID objectid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanDeleteObjectInventory(itemid, objectid, userid);
+        }
+
+        public bool CanResetScript(UUID prim, UUID script, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanResetScript(prim, script, user);
+        }
+
+        public bool CanCreateUserInventory(int invtype, UUID userid)
+        {
+            return m_rootScene.Permissions.CanCreateUserInventory(invtype, userid);
+        }
+
+        public bool CanCopyUserInventory(UUID itemid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanCopyUserInventory(itemid, userid);
+        }
+
+        public bool CanEditUserInventory(UUID itemid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanEditUserInventory(itemid, userid);
+        }
+
+        public bool CanDeleteUserInventory(UUID itemid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanDeleteUserInventory(itemid, userid);
+        }
+
+        public bool CanTeleport(UUID userid, Scene scene)
+        {
+            return m_rootScene.Permissions.CanTeleport(userid);
+        }
+
+        public bool CanUseObjectReturn(ILandObject landdata, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
+        {
+            return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist);
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs b/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
new file mode 100644
index 0000000..419ed74
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+    public class RegionConnections
+    {
+        /// <summary>
+        /// Root Region ID
+        /// </summary>
+        public UUID RegionId;
+
+        /// <summary>
+        /// Root Region Scene
+        /// </summary>
+        public Scene RegionScene;
+
+        /// <summary>
+        /// LargeLandChannel for combined region
+        /// </summary>
+        public ILandChannel RegionLandChannel;
+        public uint X;
+        public uint Y;
+        public int XEnd;
+        public int YEnd;
+        public List<RegionData> ConnectedRegions;
+        public RegionCombinerPermissionModule PermissionModule;
+        public RegionCombinerClientEventForwarder ClientEventForwarder;
+        public void UpdateExtents(Vector3 extents)
+        {
+            XEnd = (int)extents.X;
+            YEnd = (int)extents.Y;
+        }
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs b/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
new file mode 100644
index 0000000..175ca89
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Framework;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+
+    struct RegionCourseLocationStruct
+    {
+        public List<Vector3> Locations;
+        public List<UUID> Uuids;
+        public IClientAPI UserAPI;
+        public Vector2 Offset;
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionData.cs b/OpenSim/Region/CoreModules/World/Land/RegionData.cs
new file mode 100644
index 0000000..3383527
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionData.cs
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using OpenMetaverse;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+    public class RegionData
+    {
+        public UUID RegionId;
+        public Scene RegionScene;
+        public Vector3 Offset;
+    }
+}
\ No newline at end of file
-- 
cgit v1.1


From ed475f21eee93210f1cdfcb9a9778da91f2b1d38 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Sun, 13 Sep 2009 18:28:45 -0400
Subject: * Use the BeginInvoke methodology instead of the FireAndForget
 methodology to try to mitigate a mono assert.   Same functionality done a
 different way.

---
 .../Framework/Scenes/SceneCommunicationService.cs  | 30 ++++++++++++++++++----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index b38148b..204c319 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -1412,10 +1412,25 @@ namespace OpenSim.Region.Framework.Scenes
             d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d);
         }
 
-        public void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene)
+        public delegate void InformClientToInitateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY,
+                                                                    Vector3 position,
+                                                                    Scene initiatingScene);
+
+        public void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, 
+            Scene initiatingScene)
+        {
+
+            // This assumes that we know what our neighbors are.
+            
+                InformClientToInitateTeleportToLocationDelegate d = InformClientToInitiateTeleportToLocationAsync;
+                        d.BeginInvoke(agent,regionX,regionY,position,initiatingScene,
+                                      InformClientToInitiateTeleportToLocationCompleted,
+                                      d);
+        }
+
+        public void InformClientToInitiateTeleportToLocationAsync(ScenePresence agent, uint regionX, uint regionY, Vector3 position, 
+            Scene initiatingScene)
         {
-            Util.FireAndForget(delegate
-            {
                 Thread.Sleep(10000);
                 IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>();
                 if (im != null)
@@ -1440,13 +1455,18 @@ namespace OpenSim.Region.Framework.Scenes
                     });
 
                 }
+        }
 
-            });
+        private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar)
+        {
+            InformClientToInitateTeleportToLocationDelegate icon =
+                (InformClientToInitateTeleportToLocationDelegate) iar.AsyncState;
+            icon.EndInvoke(iar);
         }
 
         public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying);
 
-                /// <summary>
+        /// <summary>
         /// This Closes child agents on neighboring regions
         /// Calls an asynchronous method to do so..  so it doesn't lag the sim.
         /// </summary>
-- 
cgit v1.1


From 3a9e1cf0a322cdac9bdd50ba44679d2fc2489cfe Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Sun, 13 Sep 2009 18:43:20 -0400
Subject: Temporarily removing the RegionCombinerModule to debug a mono assert
 on linux

---
 .../Resources/CoreModulePlugin.addin.xml           |   1 -
 .../Land/RegionCombinerClientEventForwarder.cs     |  94 ---
 .../Land/RegionCombinerIndividualEventForwarder.cs | 125 ---
 .../World/Land/RegionCombinerLargeLandChannel.cs   | 163 ----
 .../CoreModules/World/Land/RegionCombinerModule.cs | 914 ---------------------
 .../World/Land/RegionCombinerPermissionModule.cs   | 275 -------
 .../CoreModules/World/Land/RegionConnections.cs    |  65 --
 .../CoreModules/World/Land/RegionCourseLocation.cs |  43 -
 .../Region/CoreModules/World/Land/RegionData.cs    |  39 -
 9 files changed, 1719 deletions(-)
 delete mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
 delete mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
 delete mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
 delete mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
 delete mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
 delete mode 100644 OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
 delete mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
 delete mode 100644 OpenSim/Region/CoreModules/World/Land/RegionData.cs

diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index f9e61aa..1cb9917 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -13,7 +13,6 @@
         <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" />
         <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" />
         <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" />
-        <RegionModule id="RegionCombinerModule" type="OpenSim.Region.CoreModules.World.Land.RegionCombinerModule" />
         <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" />
         <RegionModule id="HGWorldMapModule" type="OpenSim.Region.CoreModules.Hypergrid.HGWorldMapModule" />
         <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" />
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
deleted file mode 100644
index 70d6de3..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the OpenSimulator Project nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using OpenMetaverse;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Region.CoreModules.World.Land
-{
-public class RegionCombinerClientEventForwarder
-    {
-        private Scene m_rootScene;
-        private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>();
-        private Dictionary<UUID,RegionCombinerIndividualEventForwarder> m_forwarders = new Dictionary<UUID,
-            RegionCombinerIndividualEventForwarder>();
-
-        public RegionCombinerClientEventForwarder(RegionConnections rootScene)
-        {
-            m_rootScene = rootScene.RegionScene;
-        }
-
-        public void AddSceneToEventForwarding(Scene virtualScene)
-        {
-            lock (m_virtScene)
-            {
-                if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
-                {
-                    m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene;
-                }
-                else
-                {
-                    m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene);
-                }
-            }
-            
-            lock (m_forwarders)
-            {
-                // TODO: Fix this to unregister if this happens
-                if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID))
-                    m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
-
-                RegionCombinerIndividualEventForwarder forwarder =
-                    new RegionCombinerIndividualEventForwarder(m_rootScene, virtualScene);
-                m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder);
-
-                virtualScene.EventManager.OnNewClient += forwarder.ClientConnect;
-                virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed;
-            }
-        }
-
-        public void RemoveSceneFromEventForwarding (Scene virtualScene)
-        {
-            lock (m_forwarders)
-            {
-                RegionCombinerIndividualEventForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID];
-                virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect;
-                virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed;
-                m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
-            }
-            lock (m_virtScene)
-            {
-                if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
-                {
-                    m_virtScene.Remove(virtualScene.RegionInfo.originRegionID);
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
deleted file mode 100644
index 65f22b1..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the OpenSimulator Project nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Region.CoreModules.World.Land
-{
- public class RegionCombinerIndividualEventForwarder
-    {
-        private Scene m_rootScene;
-        private Scene m_virtScene;
-
-        public RegionCombinerIndividualEventForwarder(Scene rootScene, Scene virtScene)
-        {
-            m_rootScene = rootScene;
-            m_virtScene = virtScene;
-        }
-
-        public void ClientConnect(IClientAPI client)
-        {
-            m_virtScene.UnSubscribeToClientPrimEvents(client);
-            m_virtScene.UnSubscribeToClientPrimRezEvents(client);
-            m_virtScene.UnSubscribeToClientInventoryEvents(client);
-            m_virtScene.UnSubscribeToClientAttachmentEvents(client);
-            //m_virtScene.UnSubscribeToClientTeleportEvents(client);
-            m_virtScene.UnSubscribeToClientScriptEvents(client);
-            m_virtScene.UnSubscribeToClientGodEvents(client);
-            m_virtScene.UnSubscribeToClientNetworkEvents(client);
-
-            m_rootScene.SubscribeToClientPrimEvents(client);
-            client.OnAddPrim += LocalAddNewPrim;
-            client.OnRezObject += LocalRezObject;
-            m_rootScene.SubscribeToClientInventoryEvents(client);
-            m_rootScene.SubscribeToClientAttachmentEvents(client);
-            //m_rootScene.SubscribeToClientTeleportEvents(client);
-            m_rootScene.SubscribeToClientScriptEvents(client);
-            m_rootScene.SubscribeToClientGodEvents(client);
-            m_rootScene.SubscribeToClientNetworkEvents(client);
-        }
-
-        public void ClientClosed(UUID clientid, Scene scene)
-        {
-        }
-
-        /// <summary>
-        /// Fixes position based on the region the Rez event came in on
-        /// </summary>
-        /// <param name="remoteclient"></param>
-        /// <param name="itemid"></param>
-        /// <param name="rayend"></param>
-        /// <param name="raystart"></param>
-        /// <param name="raytargetid"></param>
-        /// <param name="bypassraycast"></param>
-        /// <param name="rayendisintersection"></param>
-        /// <param name="rezselected"></param>
-        /// <param name="removeitem"></param>
-        /// <param name="fromtaskid"></param>
-        private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, 
-            UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, 
-            UUID fromtaskid)
-        {     
-            int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
-            int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
-            rayend.X += differenceX * (int)Constants.RegionSize;
-            rayend.Y += differenceY * (int)Constants.RegionSize;
-            raystart.X += differenceX * (int)Constants.RegionSize;
-            raystart.Y += differenceY * (int)Constants.RegionSize;
-
-            m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
-                                  rayendisintersection, rezselected, removeitem, fromtaskid);
-        }
-        /// <summary>
-        /// Fixes position based on the region the AddPrimShape event came in on
-        /// </summary>
-        /// <param name="ownerid"></param>
-        /// <param name="groupid"></param>
-        /// <param name="rayend"></param>
-        /// <param name="rot"></param>
-        /// <param name="shape"></param>
-        /// <param name="bypassraycast"></param>
-        /// <param name="raystart"></param>
-        /// <param name="raytargetid"></param>
-        /// <param name="rayendisintersection"></param>
-        private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, 
-            PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, 
-            byte rayendisintersection)
-        {
-            int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
-            int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
-            rayend.X += differenceX * (int)Constants.RegionSize;
-            rayend.Y += differenceY * (int)Constants.RegionSize;
-            raystart.X += differenceX * (int)Constants.RegionSize;
-            raystart.Y += differenceY * (int)Constants.RegionSize;
-            m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
-                                   rayendisintersection);
-        }
-    }
-}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
deleted file mode 100644
index 9e46b94..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the OpenSimulator Project nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
-
-namespace OpenSim.Region.CoreModules.World.Land
-{
-public class RegionCombinerLargeLandChannel : ILandChannel
-    {
-        // private static readonly ILog m_log =
-        //     LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-        private RegionData RegData;
-        private ILandChannel RootRegionLandChannel;
-        private readonly List<RegionData> RegionConnections;
-        
-        #region ILandChannel Members
-
-        public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
-                                              List<RegionData> regionConnections)
-        {
-            RegData = regData;
-            RootRegionLandChannel = rootRegionLandChannel;
-            RegionConnections = regionConnections;
-        }
-
-        public List<ILandObject> ParcelsNearPoint(Vector3 position)
-        {
-            //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
-            return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
-        }
-
-        public List<ILandObject> AllParcels()
-        {
-            return RootRegionLandChannel.AllParcels();
-        }
-
-        public ILandObject GetLandObject(int x, int y)
-        {
-            //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
-
-            if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
-            {
-                return RootRegionLandChannel.GetLandObject(x, y);
-            }
-            else
-            {
-                int offsetX = (x / (int)Constants.RegionSize);
-                int offsetY = (y / (int)Constants.RegionSize);
-                offsetX *= (int)Constants.RegionSize;
-                offsetY *= (int)Constants.RegionSize;
-
-                foreach (RegionData regionData in RegionConnections)
-                {
-                    if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
-                    {
-                        return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
-                    }
-                }
-                ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
-                obj.landData.Name = "NO LAND";
-                return obj;
-            }
-        }
-
-        public ILandObject GetLandObject(int localID)
-        {
-            return RootRegionLandChannel.GetLandObject(localID);
-        }
-
-        public ILandObject GetLandObject(float x, float y)
-        {
-            //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
-            
-            if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
-            {
-                return RootRegionLandChannel.GetLandObject(x, y);
-            }
-            else
-            {
-                int offsetX = (int)(x/(int) Constants.RegionSize);
-                int offsetY = (int)(y/(int) Constants.RegionSize);
-                offsetX *= (int) Constants.RegionSize;
-                offsetY *= (int) Constants.RegionSize;
-
-                foreach (RegionData regionData in RegionConnections)
-                {
-                    if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
-                    {
-                        return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
-                    }
-                }
-                ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
-                obj.landData.Name = "NO LAND";
-                return obj;
-            }
-        }
-
-        public bool IsLandPrimCountTainted()
-        {
-            return RootRegionLandChannel.IsLandPrimCountTainted();
-        }
-
-        public bool IsForcefulBansAllowed()
-        {
-            return RootRegionLandChannel.IsForcefulBansAllowed();
-        }
-
-        public void UpdateLandObject(int localID, LandData data)
-        {
-            RootRegionLandChannel.UpdateLandObject(localID, data);
-        }
-
-        public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
-        {
-            RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
-        }
-
-        public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
-        {
-            RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
-        }
-
-        public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
-        {
-            RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
-        }
-
-        public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
-        {
-            RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
-        }
-
-        #endregion
-    }
-}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
deleted file mode 100644
index 98c7aa8..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ /dev/null
@@ -1,914 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the OpenSimulator Project nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using log4net;
-using Nini.Config;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Framework.Client;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Region.CoreModules.World.Land
-{
-    public class RegionCombinerModule : ISharedRegionModule
-    {
-        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
-        public string Name
-        {
-            get { return "RegionCombinerModule"; }
-        }
-
-        public Type ReplaceableInterface
-        {
-            get { return null; }
-        }
-
-        private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
-        private bool enabledYN = false;
-        private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
-
-        public void Initialise(IConfigSource source)
-        {
-            IConfig myConfig = source.Configs["Startup"];
-            enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
-            //enabledYN = true;
-        }
-
-        public void Close()
-        {
-        }
-
-        public void AddRegion(Scene scene)
-        {
-        }
-
-        public void RemoveRegion(Scene scene)
-        {
-        }
-
-        public void RegionLoaded(Scene scene)
-        {
-            if (!enabledYN)
-                return;
-
-            /* For testing on a single instance
-            if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
-                return;
-            */
-
-            lock (m_startingScenes)
-                m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
-
-            // Give each region a standard set of non-infinite borders
-            Border northBorder = new Border();
-            northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize);  //<---
-            northBorder.CrossDirection = Cardinals.N;
-            scene.NorthBorders[0] = northBorder;
-
-            Border southBorder = new Border();
-            southBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0);    //--->
-            southBorder.CrossDirection = Cardinals.S;
-            scene.SouthBorders[0] = southBorder;
-
-            Border eastBorder = new Border();
-            eastBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize);   //<---
-            eastBorder.CrossDirection = Cardinals.E;
-            scene.EastBorders[0] = eastBorder;
-
-            Border westBorder = new Border();
-            westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0);     //--->
-            westBorder.CrossDirection = Cardinals.W;
-            scene.WestBorders[0] = westBorder;
-
-
-
-            RegionConnections regionConnections = new RegionConnections();
-            regionConnections.ConnectedRegions = new List<RegionData>();
-            regionConnections.RegionScene = scene;
-            regionConnections.RegionLandChannel = scene.LandChannel;
-            regionConnections.RegionId = scene.RegionInfo.originRegionID;
-            regionConnections.X = scene.RegionInfo.RegionLocX;
-            regionConnections.Y = scene.RegionInfo.RegionLocY;
-            regionConnections.XEnd = (int)Constants.RegionSize;
-            regionConnections.YEnd = (int)Constants.RegionSize;
-
-
-            lock (m_regions)
-            {
-                bool connectedYN = false;
-
-                foreach (RegionConnections conn in m_regions.Values)
-                {
-                    #region commented
-                    /*
-                    // If we're one region over +x +y
-                    //xxy
-                    //xxx
-                    //xxx
-                    if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd 
-                        == (regionConnections.X * (int)Constants.RegionSize)) 
-                        && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd 
-                        == (regionConnections.Y * (int)Constants.RegionSize)))
-                    {
-                        Vector3 offset = Vector3.Zero;
-                        offset.X = (((regionConnections.X * (int) Constants.RegionSize)) -
-                                    ((conn.X * (int) Constants.RegionSize)));
-                        offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) -
-                                    ((conn.Y * (int) Constants.RegionSize)));
-
-                        Vector3 extents = Vector3.Zero;
-                        extents.Y = regionConnections.YEnd + conn.YEnd;
-                        extents.X = conn.XEnd + conn.XEnd;
-
-                        m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}.  Offset: {2}.  Extents:{3}",
-                                          conn.RegionScene.RegionInfo.RegionName,
-                                          regionConnections.RegionScene.RegionInfo.RegionName,
-                                          offset, extents);
-
-                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
-                            
-                        connectedYN = true;
-                        break;
-                    }
-                    */
-
-                    /*
-                    //If we're one region over x +y
-                    //xxx
-                    //xxx
-                    //xyx
-                    if ((((int)conn.X * (int)Constants.RegionSize)
-                        == (regionConnections.X * (int)Constants.RegionSize))
-                        && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
-                        == (regionConnections.Y * (int)Constants.RegionSize)))
-                    {
-                        Vector3 offset = Vector3.Zero;
-                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
-                                    ((conn.X * (int)Constants.RegionSize)));
-                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
-                                    ((conn.Y * (int)Constants.RegionSize)));
-
-                        Vector3 extents = Vector3.Zero;
-                        extents.Y = regionConnections.YEnd + conn.YEnd;
-                        extents.X = conn.XEnd;
-
-                        m_log.DebugFormat("Scene: {0} to the north of Scene{1}.  Offset: {2}. Extents:{3}",
-                                          conn.RegionScene.RegionInfo.RegionName,
-                                          regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
-
-                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
-                        connectedYN = true;
-                        break;
-                    }
-                    */
-
-                    /*
-                    // If we're one region over -x +y
-                    //xxx
-                    //xxx
-                    //yxx
-                    if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
-                        == (regionConnections.X * (int)Constants.RegionSize))
-                        && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
-                        == (regionConnections.Y * (int)Constants.RegionSize)))
-                    {
-                        Vector3 offset = Vector3.Zero;
-                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
-                                    ((conn.X * (int)Constants.RegionSize)));
-                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
-                                    ((conn.Y * (int)Constants.RegionSize)));
-
-                        Vector3 extents = Vector3.Zero;
-                        extents.Y = regionConnections.YEnd + conn.YEnd;
-                        extents.X = conn.XEnd + conn.XEnd;
-
-                        m_log.DebugFormat("Scene: {0} to the northeast of Scene.  Offset: {2}. Extents:{3}",
-                                          conn.RegionScene.RegionInfo.RegionName,
-                                          regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
-
-                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
-
-
-                        connectedYN = true;
-                        break;
-                    }
-                    */
-
-                    /*
-                    // If we're one region over -x y
-                    //xxx
-                    //yxx
-                    //xxx
-                    if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
-                        == (regionConnections.X * (int)Constants.RegionSize))
-                        && (((int)conn.Y * (int)Constants.RegionSize)
-                        == (regionConnections.Y * (int)Constants.RegionSize)))
-                    {
-                        Vector3 offset = Vector3.Zero;
-                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
-                                    ((conn.X * (int)Constants.RegionSize)));
-                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
-                                    ((conn.Y * (int)Constants.RegionSize)));
-
-                        Vector3 extents = Vector3.Zero;
-                        extents.Y = regionConnections.YEnd;
-                        extents.X = conn.XEnd + conn.XEnd;
-
-                        m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}",
-                                          conn.RegionScene.RegionInfo.RegionName,
-                                          regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
-
-                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
-
-                        connectedYN = true;
-                        break;
-                    }
-                    */
-
-                    /*
-                        // If we're one region over -x -y
-                        //yxx
-                        //xxx
-                        //xxx
-                        if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
-                            == (regionConnections.X * (int)Constants.RegionSize))
-                            && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
-                            == (regionConnections.Y * (int)Constants.RegionSize)))
-                        {
-                            Vector3 offset = Vector3.Zero;
-                            offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
-                                        ((conn.X * (int)Constants.RegionSize)));
-                            offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
-                                        ((conn.Y * (int)Constants.RegionSize)));
-
-                            Vector3 extents = Vector3.Zero;
-                            extents.Y = regionConnections.YEnd + conn.YEnd;
-                            extents.X = conn.XEnd + conn.XEnd;
-
-                            m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
-                                              conn.RegionScene.RegionInfo.RegionName,
-                                              regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
-
-                            scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
-
-                            connectedYN = true;
-                            break;
-                        }
-                        */
-                    #endregion
-
-                    // If we're one region over +x y
-                    //xxx
-                    //xxy
-                    //xxx
-
-                    if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
-                        >= (regionConnections.X * (int)Constants.RegionSize))
-                        && (((int)conn.Y * (int)Constants.RegionSize)
-                        >= (regionConnections.Y * (int)Constants.RegionSize)))
-                    {
-                        Vector3 offset = Vector3.Zero;
-                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
-                                    ((conn.X * (int)Constants.RegionSize)));
-                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
-                                    ((conn.Y * (int)Constants.RegionSize)));
-
-                        Vector3 extents = Vector3.Zero;
-                        extents.Y = conn.YEnd;
-                        extents.X = conn.XEnd + regionConnections.XEnd;
-
-                        conn.UpdateExtents(extents);
-
-                        m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
-                                          conn.RegionScene.RegionInfo.RegionName,
-                                          regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
-
-                        scene.BordersLocked = true;
-                        conn.RegionScene.BordersLocked = true;
-
-                        RegionData ConnectedRegion = new RegionData();
-                        ConnectedRegion.Offset = offset;
-                        ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
-                        ConnectedRegion.RegionScene = scene;
-                        conn.ConnectedRegions.Add(ConnectedRegion);
-
-                        // Inform root region Physics about the extents of this region
-                        conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
-
-                        // Inform Child region that it needs to forward it's terrain to the root region
-                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
-
-                        // Extend the borders as appropriate
-                        lock (conn.RegionScene.EastBorders)
-                            conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
-
-                        lock (conn.RegionScene.NorthBorders)
-                            conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
-
-                        lock (conn.RegionScene.SouthBorders)
-                            conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
-
-                        lock (scene.WestBorders)
-                        {
-                            scene.WestBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport West
-
-                            // Trigger auto teleport to root region
-                            scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
-                            scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
-                        }
-
-                        // Reset Terrain..  since terrain loads before we get here, we need to load 
-                        // it again so it loads in the root region
-                        
-                        scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
-                        
-                        // Unlock borders
-                        conn.RegionScene.BordersLocked = false;
-                        scene.BordersLocked = false;
-
-                        // Create a client event forwarder and add this region's events to the root region.
-                        if (conn.ClientEventForwarder != null)
-                            conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
-                        connectedYN = true;
-                        break;
-                    }
-
-                    // If we're one region over x +y
-                    //xyx
-                    //xxx
-                    //xxx
-                    if ((((int)conn.X * (int)Constants.RegionSize)
-                        >= (regionConnections.X * (int)Constants.RegionSize))
-                        && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
-                        >= (regionConnections.Y * (int)Constants.RegionSize)))
-                    {
-                        Vector3 offset = Vector3.Zero;
-                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
-                                    ((conn.X * (int)Constants.RegionSize)));
-                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
-                                    ((conn.Y * (int)Constants.RegionSize)));
-
-                        Vector3 extents = Vector3.Zero;
-                        extents.Y = regionConnections.YEnd + conn.YEnd;
-                        extents.X = conn.XEnd;
-                        conn.UpdateExtents(extents);
-
-                        scene.BordersLocked = true;
-                        conn.RegionScene.BordersLocked = true;
-
-                        RegionData ConnectedRegion = new RegionData();
-                        ConnectedRegion.Offset = offset;
-                        ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
-                        ConnectedRegion.RegionScene = scene;
-                        conn.ConnectedRegions.Add(ConnectedRegion);
-
-                        m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
-                                         conn.RegionScene.RegionInfo.RegionName,
-                                         regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
-
-                        conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
-                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
-
-                        lock (conn.RegionScene.NorthBorders)
-                            conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
-                        lock (conn.RegionScene.EastBorders)
-                            conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
-                        lock (conn.RegionScene.WestBorders)
-                            conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
-                        lock (scene.SouthBorders)
-                        {
-                            scene.SouthBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport south
-                            scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
-                            scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
-                        }
-
-                        // Reset Terrain..  since terrain normally loads first.
-                        //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
-                        scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
-                        //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
-
-                        scene.BordersLocked = false;
-                        conn.RegionScene.BordersLocked = false;
-                        if (conn.ClientEventForwarder != null)
-                            conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
-                        connectedYN = true;
-                        break;
-                    }
-
-                    // If we're one region over +x +y
-                    //xxy
-                    //xxx
-                    //xxx
-                    if ((((int)conn.X * (int)Constants.RegionSize) + conn.YEnd
-                        >= (regionConnections.X * (int)Constants.RegionSize))
-                        && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
-                        >= (regionConnections.Y * (int)Constants.RegionSize)))
-                    {
-                        Vector3 offset = Vector3.Zero;
-                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
-                                    ((conn.X * (int)Constants.RegionSize)));
-                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
-                                    ((conn.Y * (int)Constants.RegionSize)));
-
-                        Vector3 extents = Vector3.Zero;
-                        extents.Y = regionConnections.YEnd + conn.YEnd;
-                        extents.X = regionConnections.XEnd + conn.XEnd;
-                        conn.UpdateExtents(extents);
-
-                        scene.BordersLocked = true;
-                        conn.RegionScene.BordersLocked = true;
-
-                        RegionData ConnectedRegion = new RegionData();
-                        ConnectedRegion.Offset = offset;
-                        ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
-                        ConnectedRegion.RegionScene = scene;
-
-                        conn.ConnectedRegions.Add(ConnectedRegion);
-
-                        m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
-                                         conn.RegionScene.RegionInfo.RegionName,
-                                         regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
-
-                        conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
-                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
-                        lock (conn.RegionScene.NorthBorders)
-                        {
-                            if (conn.RegionScene.NorthBorders.Count == 1)// &&  2)
-                            {
-                                //compound border
-                                // already locked above
-                                conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
-
-                                lock (conn.RegionScene.EastBorders)
-                                    conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
-                                lock (conn.RegionScene.WestBorders)
-                                    conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
-                            }
-                        }
-
-                        lock (scene.SouthBorders)
-                        {
-                            scene.SouthBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport south
-                            scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
-                            scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
-                        }
-
-                        lock (conn.RegionScene.EastBorders)
-                        {
-                            if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
-                            {
-
-                                conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
-                                lock (conn.RegionScene.NorthBorders)
-                                    conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
-                                lock (conn.RegionScene.SouthBorders)
-                                    conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
-
-
-                            }
-                        }
-
-                        lock (scene.WestBorders)
-                        {
-                            scene.WestBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport West
-                            scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
-                            scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
-                        }
-
-                        /*  
-                                                else
-                                                {
-                                                    conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
-                                                    conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
-                                                    conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
-                                                    scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
-                                                }
-                        */
-
-
-                        // Reset Terrain..  since terrain normally loads first.
-                        //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
-                        scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
-                        //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
-                        scene.BordersLocked = false;
-                        conn.RegionScene.BordersLocked = false;
-
-                        if (conn.ClientEventForwarder != null)
-                            conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
-
-                        connectedYN = true;
-
-                        //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
-
-                        break;
-                    }
-                }
-
-                // If !connectYN means that this region is a root region
-                if (!connectedYN)
-                {
-                    RegionData rdata = new RegionData();
-                    rdata.Offset = Vector3.Zero;
-                    rdata.RegionId = scene.RegionInfo.originRegionID;
-                    rdata.RegionScene = scene;
-                    // save it's land channel
-                    regionConnections.RegionLandChannel = scene.LandChannel;
-
-                    // Substitue our landchannel
-                    RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
-                                                                    regionConnections.ConnectedRegions);
-                    scene.LandChannel = lnd;
-                    // Forward the permissions modules of each of the connected regions to the root region
-                    lock (m_regions)
-                    {
-                        foreach (RegionData r in regionConnections.ConnectedRegions)
-                        {
-                            ForwardPermissionRequests(regionConnections, r.RegionScene);
-                        }
-                    }
-                    // Create the root region's Client Event Forwarder
-                    regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
-
-                    // Sets up the CoarseLocationUpdate forwarder for this root region
-                    scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
-
-                    // Adds this root region to a dictionary of regions that are connectable
-                    m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
-                }
-            }
-            // Set up infinite borders around the entire AABB of the combined ConnectedRegions
-            AdjustLargeRegionBounds();
-        }
-
-        private void SetCourseLocationDelegate(ScenePresence presence)
-        {
-            presence.SetSendCourseLocationMethod(SendCourseLocationUpdates);
-        }
-
-        private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence)
-        {
-            RegionConnections connectiondata = null; 
-            lock (m_regions)
-            {
-                if (m_regions.ContainsKey(sceneId))
-                    connectiondata = m_regions[sceneId];
-                else
-                    return;
-            }
-
-            List<ScenePresence> avatars = connectiondata.RegionScene.GetAvatars();
-            List<Vector3> CoarseLocations = new List<Vector3>();
-            List<UUID> AvatarUUIDs = new List<UUID>();
-            for (int i = 0; i < avatars.Count; i++)
-            {
-                if (avatars[i].UUID != presence.UUID)
-                {
-                    if (avatars[i].ParentID != 0)
-                    {
-                        // sitting avatar
-                        SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID);
-                        if (sop != null)
-                        {
-                            CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition);
-                            AvatarUUIDs.Add(avatars[i].UUID);
-                        }
-                        else
-                        {
-                            // we can't find the parent..  ! arg!
-                            CoarseLocations.Add(avatars[i].AbsolutePosition);
-                            AvatarUUIDs.Add(avatars[i].UUID);
-                        }
-                    }
-                    else
-                    {
-                        CoarseLocations.Add(avatars[i].AbsolutePosition);
-                        AvatarUUIDs.Add(avatars[i].UUID);
-                    }
-                }
-            }
-            DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
-        }
-
-        private void DistributeCourseLocationUpdates(List<Vector3> locations, List<UUID> uuids, 
-                                                     RegionConnections connectiondata, ScenePresence rootPresence)
-        {
-            RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
-            //List<IClientAPI> clients = new List<IClientAPI>();
-            Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>();
-            
-            // Root Region entry
-            RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct();
-            rootupdatedata.Locations = new List<Vector3>();
-            rootupdatedata.Uuids = new List<UUID>();
-            rootupdatedata.Offset = Vector2.Zero;
-
-            rootupdatedata.UserAPI = rootPresence.ControllingClient;
-
-            if (rootupdatedata.UserAPI != null)
-                updates.Add(Vector2.Zero, rootupdatedata);
-
-            //Each Region needs an entry or we will end up with dead minimap dots
-            foreach (RegionData regiondata in rdata)
-            {
-                Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y);
-                RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
-                updatedata.Locations = new List<Vector3>();
-                updatedata.Uuids = new List<UUID>();
-                updatedata.Offset = offset;
-
-                if (offset == Vector2.Zero)
-                    updatedata.UserAPI = rootPresence.ControllingClient;
-                else
-                    updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
-
-                if (updatedata.UserAPI != null)
-                    updates.Add(offset, updatedata);
-            }
-
-            // go over the locations and assign them to an IClientAPI
-            for (int i = 0; i < locations.Count; i++)
-            //{locations[i]/(int) Constants.RegionSize;
-            {
-                Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize, 
-                                                (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z);
-                Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize,
-                                             pPosition.Y*(int) Constants.RegionSize);
-                
-                if (!updates.ContainsKey(offset))
-                {
-                    // This shouldn't happen
-                    RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
-                    updatedata.Locations = new List<Vector3>();
-                    updatedata.Uuids = new List<UUID>();
-                    updatedata.Offset = offset;
-                    
-                    if (offset == Vector2.Zero)
-                        updatedata.UserAPI = rootPresence.ControllingClient;
-                    else 
-                        updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
-
-                    updates.Add(offset,updatedata);
-                }
-                
-                updates[offset].Locations.Add(locations[i]);
-                updates[offset].Uuids.Add(uuids[i]);
-            }
-
-            // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is
-            foreach (Vector2 offset in updates.Keys)
-            {
-                if (updates[offset].UserAPI != null)
-                {
-                    updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations);
-                }
-            }
-        }
-
-        /// <summary>
-        /// Locates a the Client of a particular region in an Array of RegionData based on offset
-        /// </summary>
-        /// <param name="offset"></param>
-        /// <param name="uUID"></param>
-        /// <param name="rdata"></param>
-        /// <returns>IClientAPI or null</returns>
-        private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
-        {
-            IClientAPI returnclient = null;
-            foreach (RegionData r in rdata)
-            {
-                if (r.Offset.X == offset.X && r.Offset.Y == offset.Y)
-                {
-                    return r.RegionScene.SceneGraph.GetControllingClient(uUID);
-                }
-            }
-
-            return returnclient;
-        }
-
-        public void PostInitialise()
-        {
-        }
-        
-        /// <summary>
-        /// TODO:
-        /// </summary>
-        /// <param name="rdata"></param>
-        public void UnCombineRegion(RegionData rdata)
-        {
-            lock (m_regions)
-            {
-                if (m_regions.ContainsKey(rdata.RegionId))
-                {
-                    // uncombine root region and virtual regions
-                }
-                else
-                {
-                    foreach (RegionConnections r in m_regions.Values)
-                    {
-                        foreach (RegionData rd in r.ConnectedRegions)
-                        {
-                            if (rd.RegionId == rdata.RegionId)
-                            {
-                                // uncombine virtual region
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        // Create a set of infinite borders around the whole aabb of the combined island.
-        private void AdjustLargeRegionBounds()
-        {
-            lock (m_regions)
-            {
-                foreach (RegionConnections rconn in m_regions.Values)
-                {
-                    Vector3 offset = Vector3.Zero;
-                    rconn.RegionScene.BordersLocked = true;
-                    foreach (RegionData rdata in rconn.ConnectedRegions)
-                    {
-                        if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X;
-                        if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y;
-                    }
-
-                    lock (rconn.RegionScene.NorthBorders)
-                    {
-                        Border northBorder = null;
-                        // If we don't already have an infinite border, create one.
-                        if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
-                        {
-                            northBorder = new Border();
-                            rconn.RegionScene.NorthBorders.Add(northBorder);
-                        }
-                        
-                        northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
-                                                             offset.Y + (int) Constants.RegionSize); //<---
-                        northBorder.CrossDirection = Cardinals.N;
-                    }
-
-                    lock (rconn.RegionScene.SouthBorders)
-                    {
-                        Border southBorder = null;
-                        // If we don't already have an infinite border, create one.
-                        if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
-                        {
-                            southBorder = new Border();
-                            rconn.RegionScene.SouthBorders.Add(southBorder);
-                        }
-                        southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
-                        southBorder.CrossDirection = Cardinals.S;
-                    }
-
-                    lock (rconn.RegionScene.EastBorders)
-                    {
-                        Border eastBorder = null;
-                        // If we don't already have an infinite border, create one.
-                        if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
-                        {
-                            eastBorder = new Border();
-                            rconn.RegionScene.EastBorders.Add(eastBorder);
-                        }
-                        eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize);
-                        //<---
-                        eastBorder.CrossDirection = Cardinals.E;
-                    }
-
-                    lock (rconn.RegionScene.WestBorders)
-                    {
-                        Border westBorder = null;
-                        // If we don't already have an infinite border, create one.
-                        if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
-                        {
-                            westBorder = new Border();
-                            rconn.RegionScene.WestBorders.Add(westBorder);
-
-                        }
-                        westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
-                        westBorder.CrossDirection = Cardinals.W;
-                    }
-
-                    rconn.RegionScene.BordersLocked = false;
-                }
-            }
-        }
-
-        /// <summary>
-        /// Try and get an Infinite border out of a listT of borders
-        /// </summary>
-        /// <param name="borders"></param>
-        /// <param name="oborder"></param>
-        /// <returns></returns>
-        public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
-        {
-            // Warning! Should be locked before getting here!
-            foreach (Border b in borders)
-            {
-                if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue)
-                {
-                    oborder = b;
-                    return true;
-                }
-            }
-            oborder = null;
-            return false;
-        }
-       
-        public RegionData GetRegionFromPosition(Vector3 pPosition)
-        {
-            pPosition = pPosition/(int) Constants.RegionSize;
-            int OffsetX = (int) pPosition.X;
-            int OffsetY = (int) pPosition.Y;
-            foreach (RegionConnections regConn in m_regions.Values)
-            {
-                foreach (RegionData reg in regConn.ConnectedRegions)
-                {
-                    if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
-                        return reg;
-                }
-            }
-            return new RegionData();
-        }
-
-        public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion)
-        {
-            if (BigRegion.PermissionModule == null)
-                BigRegion.PermissionModule = new RegionCombinerPermissionModule(BigRegion.RegionScene);
-
-            VirtualRegion.Permissions.OnBypassPermissions += BigRegion.PermissionModule.BypassPermissions;
-            VirtualRegion.Permissions.OnSetBypassPermissions += BigRegion.PermissionModule.SetBypassPermissions;
-            VirtualRegion.Permissions.OnPropagatePermissions += BigRegion.PermissionModule.PropagatePermissions;
-            VirtualRegion.Permissions.OnGenerateClientFlags += BigRegion.PermissionModule.GenerateClientFlags;
-            VirtualRegion.Permissions.OnAbandonParcel += BigRegion.PermissionModule.CanAbandonParcel;
-            VirtualRegion.Permissions.OnReclaimParcel += BigRegion.PermissionModule.CanReclaimParcel;
-            VirtualRegion.Permissions.OnDeedParcel += BigRegion.PermissionModule.CanDeedParcel;
-            VirtualRegion.Permissions.OnDeedObject += BigRegion.PermissionModule.CanDeedObject;
-            VirtualRegion.Permissions.OnIsGod += BigRegion.PermissionModule.IsGod;
-            VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
-            VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
-            VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
-            VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED            
-            VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
-            VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
-            VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED
-            VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry;
-            VirtualRegion.Permissions.OnReturnObject += BigRegion.PermissionModule.CanReturnObject; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED
-            VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand;
-            VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnCompileScript += BigRegion.PermissionModule.CanCompileScript;
-            VirtualRegion.Permissions.OnSellParcel += BigRegion.PermissionModule.CanSellParcel;
-            VirtualRegion.Permissions.OnTakeObject += BigRegion.PermissionModule.CanTakeObject;
-            VirtualRegion.Permissions.OnTakeCopyObject += BigRegion.PermissionModule.CanTakeCopyObject;
-            VirtualRegion.Permissions.OnTerraformLand += BigRegion.PermissionModule.CanTerraformLand;
-            VirtualRegion.Permissions.OnLinkObject += BigRegion.PermissionModule.CanLinkObject; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED                       
-            VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED            
-            VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED            
-            VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE 
-            VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED            
-            VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
-            VirtualRegion.Permissions.OnCreateUserInventory += BigRegion.PermissionModule.CanCreateUserInventory; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnCopyUserInventory += BigRegion.PermissionModule.CanCopyUserInventory; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
-            VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED
-        }
-    }
-}
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
deleted file mode 100644
index 76ca5e3..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the OpenSimulator Project nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Region.CoreModules.World.Land
-{
- public class RegionCombinerPermissionModule
-    {
-        private Scene m_rootScene;
-
-        public RegionCombinerPermissionModule(Scene RootScene)
-        {
-            m_rootScene = RootScene;
-        }
-
-        #region Permission Override
-
-        public bool BypassPermissions()
-        {
-            return m_rootScene.Permissions.BypassPermissions();
-        }
-
-        public void SetBypassPermissions(bool value)
-        {
-            m_rootScene.Permissions.SetBypassPermissions(value);
-        }
-
-        public bool PropagatePermissions()
-        {
-            return m_rootScene.Permissions.PropagatePermissions();
-        }
-
-        public uint GenerateClientFlags(UUID userid, UUID objectidid)
-        {
-            return m_rootScene.Permissions.GenerateClientFlags(userid,objectidid);
-        }
-
-        public bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanAbandonParcel(user,parcel);
-        }
-
-        public bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanReclaimParcel(user, parcel);
-        }
-
-        public bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanDeedParcel(user, parcel);
-        }
-
-        public bool CanDeedObject(UUID user, UUID @group, Scene scene)
-        {
-            return m_rootScene.Permissions.CanDeedObject(user,@group);
-        }
-
-        public bool IsGod(UUID user, Scene requestfromscene)
-        {
-            return m_rootScene.Permissions.IsGod(user);
-        }
-
-        public bool CanDuplicateObject(int objectcount, UUID objectid, UUID owner, Scene scene, Vector3 objectposition)
-        {
-            return m_rootScene.Permissions.CanDuplicateObject(objectcount, objectid, owner, objectposition);
-        }
-
-        public bool CanDeleteObject(UUID objectid, UUID deleter, Scene scene)
-        {
-            return m_rootScene.Permissions.CanDeleteObject(objectid, deleter);
-        }
-
-        public bool CanEditObject(UUID objectid, UUID editorid, Scene scene)
-        {
-            return m_rootScene.Permissions.CanEditObject(objectid, editorid);
-        }
-
-        public bool CanEditParcel(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanEditParcel(user, parcel);
-        }
-
-        public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
-        {
-            return m_rootScene.Permissions.CanInstantMessage(user, target);
-        }
-
-        public bool CanInventoryTransfer(UUID user, UUID target, Scene startscene)
-        {
-            return m_rootScene.Permissions.CanInventoryTransfer(user, target);
-        }
-
-        public bool CanIssueEstateCommand(UUID user, Scene requestfromscene, bool ownercommand)
-        {
-            return m_rootScene.Permissions.CanIssueEstateCommand(user, ownercommand);
-        }
-
-        public bool CanMoveObject(UUID objectid, UUID moverid, Scene scene)
-        {
-            return m_rootScene.Permissions.CanMoveObject(objectid, moverid);
-        }
-
-        public bool CanObjectEntry(UUID objectid, bool enteringregion, Vector3 newpoint, Scene scene)
-        {
-            return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint);
-        }
-
-        public bool CanReturnObject(UUID objectid, UUID returnerid, Scene scene)
-        {
-            return m_rootScene.Permissions.CanReturnObject(objectid, returnerid);
-        }
-
-        public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene)
-        {
-            return m_rootScene.Permissions.CanRezObject(objectcount, owner, objectposition);
-        }
-
-        public bool CanRunConsoleCommand(UUID user, Scene requestfromscene)
-        {
-            return m_rootScene.Permissions.CanRunConsoleCommand(user);
-        }
-
-        public bool CanRunScript(UUID script, UUID objectid, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanRunScript(script, objectid, user);
-        }
-
-        public bool CanCompileScript(UUID owneruuid, int scripttype, Scene scene)
-        {
-            return m_rootScene.Permissions.CanCompileScript(owneruuid, scripttype);
-        }
-
-        public bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanSellParcel(user, parcel);
-        }
-
-        public bool CanTakeObject(UUID objectid, UUID stealer, Scene scene)
-        {
-            return m_rootScene.Permissions.CanTakeObject(objectid, stealer);
-        }
-
-        public bool CanTakeCopyObject(UUID objectid, UUID userid, Scene inscene)
-        {
-            return m_rootScene.Permissions.CanTakeObject(objectid, userid);
-        }
-
-        public bool CanTerraformLand(UUID user, Vector3 position, Scene requestfromscene)
-        {
-            return m_rootScene.Permissions.CanTerraformLand(user, position);
-        }
-
-        public bool CanLinkObject(UUID user, UUID objectid)
-        {
-            return m_rootScene.Permissions.CanLinkObject(user, objectid);
-        }
-
-        public bool CanDelinkObject(UUID user, UUID objectid)
-        {
-            return m_rootScene.Permissions.CanDelinkObject(user, objectid);
-        }
-
-        public bool CanBuyLand(UUID user, ILandObject parcel, Scene scene)
-        {
-            return m_rootScene.Permissions.CanBuyLand(user, parcel);
-        }
-
-        public bool CanViewNotecard(UUID script, UUID objectid, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanViewNotecard(script, objectid, user);
-        }
-
-        public bool CanViewScript(UUID script, UUID objectid, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanViewScript(script, objectid, user);
-        }
-
-        public bool CanEditNotecard(UUID notecard, UUID objectid, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanEditNotecard(notecard, objectid, user);
-        }
-
-        public bool CanEditScript(UUID script, UUID objectid, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanEditScript(script, objectid, user);
-        }
-
-        public bool CanCreateObjectInventory(int invtype, UUID objectid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanCreateObjectInventory(invtype, objectid, userid);
-        }
-
-        public bool CanEditObjectInventory(UUID objectid, UUID editorid, Scene scene)
-        {
-            return m_rootScene.Permissions.CanEditObjectInventory(objectid, editorid);
-        }
-
-        public bool CanCopyObjectInventory(UUID itemid, UUID objectid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanCopyObjectInventory(itemid, objectid, userid);
-        }
-
-        public bool CanDeleteObjectInventory(UUID itemid, UUID objectid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanDeleteObjectInventory(itemid, objectid, userid);
-        }
-
-        public bool CanResetScript(UUID prim, UUID script, UUID user, Scene scene)
-        {
-            return m_rootScene.Permissions.CanResetScript(prim, script, user);
-        }
-
-        public bool CanCreateUserInventory(int invtype, UUID userid)
-        {
-            return m_rootScene.Permissions.CanCreateUserInventory(invtype, userid);
-        }
-
-        public bool CanCopyUserInventory(UUID itemid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanCopyUserInventory(itemid, userid);
-        }
-
-        public bool CanEditUserInventory(UUID itemid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanEditUserInventory(itemid, userid);
-        }
-
-        public bool CanDeleteUserInventory(UUID itemid, UUID userid)
-        {
-            return m_rootScene.Permissions.CanDeleteUserInventory(itemid, userid);
-        }
-
-        public bool CanTeleport(UUID userid, Scene scene)
-        {
-            return m_rootScene.Permissions.CanTeleport(userid);
-        }
-
-        public bool CanUseObjectReturn(ILandObject landdata, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
-        {
-            return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist);
-        }
-
-        #endregion
-    }
-}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs b/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
deleted file mode 100644
index 419ed74..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the OpenSimulator Project nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using OpenMetaverse;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Region.CoreModules.World.Land
-{
-    public class RegionConnections
-    {
-        /// <summary>
-        /// Root Region ID
-        /// </summary>
-        public UUID RegionId;
-
-        /// <summary>
-        /// Root Region Scene
-        /// </summary>
-        public Scene RegionScene;
-
-        /// <summary>
-        /// LargeLandChannel for combined region
-        /// </summary>
-        public ILandChannel RegionLandChannel;
-        public uint X;
-        public uint Y;
-        public int XEnd;
-        public int YEnd;
-        public List<RegionData> ConnectedRegions;
-        public RegionCombinerPermissionModule PermissionModule;
-        public RegionCombinerClientEventForwarder ClientEventForwarder;
-        public void UpdateExtents(Vector3 extents)
-        {
-            XEnd = (int)extents.X;
-            YEnd = (int)extents.Y;
-        }
-    }
-}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs b/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
deleted file mode 100644
index 175ca89..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the OpenSimulator Project nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using OpenMetaverse;
-using OpenSim.Framework;
-
-namespace OpenSim.Region.CoreModules.World.Land
-{
-
-    struct RegionCourseLocationStruct
-    {
-        public List<Vector3> Locations;
-        public List<UUID> Uuids;
-        public IClientAPI UserAPI;
-        public Vector2 Offset;
-    }
-}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionData.cs b/OpenSim/Region/CoreModules/World/Land/RegionData.cs
deleted file mode 100644
index 3383527..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionData.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the OpenSimulator Project nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using OpenMetaverse;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Region.CoreModules.World.Land
-{
-    public class RegionData
-    {
-        public UUID RegionId;
-        public Scene RegionScene;
-        public Vector3 Offset;
-    }
-}
\ No newline at end of file
-- 
cgit v1.1


From feccfe409667003c64fecdf7f9c712414aaee0a1 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Sun, 13 Sep 2009 19:09:48 -0400
Subject: * Add the RegionCombinerModule back * Yay anonymous delegate in an
 anonymous delegate.

---
 .../Resources/CoreModulePlugin.addin.xml           |   1 +
 .../Land/RegionCombinerClientEventForwarder.cs     |  94 +++
 .../Land/RegionCombinerIndividualEventForwarder.cs | 125 +++
 .../World/Land/RegionCombinerLargeLandChannel.cs   | 163 ++++
 .../CoreModules/World/Land/RegionCombinerModule.cs | 914 +++++++++++++++++++++
 .../World/Land/RegionCombinerPermissionModule.cs   | 275 +++++++
 .../CoreModules/World/Land/RegionConnections.cs    |  65 ++
 .../CoreModules/World/Land/RegionCourseLocation.cs |  43 +
 .../Region/CoreModules/World/Land/RegionData.cs    |  39 +
 9 files changed, 1719 insertions(+)
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
 create mode 100644 OpenSim/Region/CoreModules/World/Land/RegionData.cs

diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 1cb9917..f9e61aa 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -13,6 +13,7 @@
         <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" />
         <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" />
         <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" />
+        <RegionModule id="RegionCombinerModule" type="OpenSim.Region.CoreModules.World.Land.RegionCombinerModule" />
         <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" />
         <RegionModule id="HGWorldMapModule" type="OpenSim.Region.CoreModules.Hypergrid.HGWorldMapModule" />
         <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" />
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
new file mode 100644
index 0000000..70d6de3
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+public class RegionCombinerClientEventForwarder
+    {
+        private Scene m_rootScene;
+        private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>();
+        private Dictionary<UUID,RegionCombinerIndividualEventForwarder> m_forwarders = new Dictionary<UUID,
+            RegionCombinerIndividualEventForwarder>();
+
+        public RegionCombinerClientEventForwarder(RegionConnections rootScene)
+        {
+            m_rootScene = rootScene.RegionScene;
+        }
+
+        public void AddSceneToEventForwarding(Scene virtualScene)
+        {
+            lock (m_virtScene)
+            {
+                if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
+                {
+                    m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene;
+                }
+                else
+                {
+                    m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene);
+                }
+            }
+            
+            lock (m_forwarders)
+            {
+                // TODO: Fix this to unregister if this happens
+                if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID))
+                    m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
+
+                RegionCombinerIndividualEventForwarder forwarder =
+                    new RegionCombinerIndividualEventForwarder(m_rootScene, virtualScene);
+                m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder);
+
+                virtualScene.EventManager.OnNewClient += forwarder.ClientConnect;
+                virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed;
+            }
+        }
+
+        public void RemoveSceneFromEventForwarding (Scene virtualScene)
+        {
+            lock (m_forwarders)
+            {
+                RegionCombinerIndividualEventForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID];
+                virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect;
+                virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed;
+                m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
+            }
+            lock (m_virtScene)
+            {
+                if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
+                {
+                    m_virtScene.Remove(virtualScene.RegionInfo.originRegionID);
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
new file mode 100644
index 0000000..65f22b1
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+ public class RegionCombinerIndividualEventForwarder
+    {
+        private Scene m_rootScene;
+        private Scene m_virtScene;
+
+        public RegionCombinerIndividualEventForwarder(Scene rootScene, Scene virtScene)
+        {
+            m_rootScene = rootScene;
+            m_virtScene = virtScene;
+        }
+
+        public void ClientConnect(IClientAPI client)
+        {
+            m_virtScene.UnSubscribeToClientPrimEvents(client);
+            m_virtScene.UnSubscribeToClientPrimRezEvents(client);
+            m_virtScene.UnSubscribeToClientInventoryEvents(client);
+            m_virtScene.UnSubscribeToClientAttachmentEvents(client);
+            //m_virtScene.UnSubscribeToClientTeleportEvents(client);
+            m_virtScene.UnSubscribeToClientScriptEvents(client);
+            m_virtScene.UnSubscribeToClientGodEvents(client);
+            m_virtScene.UnSubscribeToClientNetworkEvents(client);
+
+            m_rootScene.SubscribeToClientPrimEvents(client);
+            client.OnAddPrim += LocalAddNewPrim;
+            client.OnRezObject += LocalRezObject;
+            m_rootScene.SubscribeToClientInventoryEvents(client);
+            m_rootScene.SubscribeToClientAttachmentEvents(client);
+            //m_rootScene.SubscribeToClientTeleportEvents(client);
+            m_rootScene.SubscribeToClientScriptEvents(client);
+            m_rootScene.SubscribeToClientGodEvents(client);
+            m_rootScene.SubscribeToClientNetworkEvents(client);
+        }
+
+        public void ClientClosed(UUID clientid, Scene scene)
+        {
+        }
+
+        /// <summary>
+        /// Fixes position based on the region the Rez event came in on
+        /// </summary>
+        /// <param name="remoteclient"></param>
+        /// <param name="itemid"></param>
+        /// <param name="rayend"></param>
+        /// <param name="raystart"></param>
+        /// <param name="raytargetid"></param>
+        /// <param name="bypassraycast"></param>
+        /// <param name="rayendisintersection"></param>
+        /// <param name="rezselected"></param>
+        /// <param name="removeitem"></param>
+        /// <param name="fromtaskid"></param>
+        private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, 
+            UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, 
+            UUID fromtaskid)
+        {     
+            int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
+            int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
+            rayend.X += differenceX * (int)Constants.RegionSize;
+            rayend.Y += differenceY * (int)Constants.RegionSize;
+            raystart.X += differenceX * (int)Constants.RegionSize;
+            raystart.Y += differenceY * (int)Constants.RegionSize;
+
+            m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
+                                  rayendisintersection, rezselected, removeitem, fromtaskid);
+        }
+        /// <summary>
+        /// Fixes position based on the region the AddPrimShape event came in on
+        /// </summary>
+        /// <param name="ownerid"></param>
+        /// <param name="groupid"></param>
+        /// <param name="rayend"></param>
+        /// <param name="rot"></param>
+        /// <param name="shape"></param>
+        /// <param name="bypassraycast"></param>
+        /// <param name="raystart"></param>
+        /// <param name="raytargetid"></param>
+        /// <param name="rayendisintersection"></param>
+        private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, 
+            PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, 
+            byte rayendisintersection)
+        {
+            int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
+            int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
+            rayend.X += differenceX * (int)Constants.RegionSize;
+            rayend.Y += differenceY * (int)Constants.RegionSize;
+            raystart.X += differenceX * (int)Constants.RegionSize;
+            raystart.Y += differenceY * (int)Constants.RegionSize;
+            m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
+                                   rayendisintersection);
+        }
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
new file mode 100644
index 0000000..9e46b94
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+public class RegionCombinerLargeLandChannel : ILandChannel
+    {
+        // private static readonly ILog m_log =
+        //     LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+        private RegionData RegData;
+        private ILandChannel RootRegionLandChannel;
+        private readonly List<RegionData> RegionConnections;
+        
+        #region ILandChannel Members
+
+        public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
+                                              List<RegionData> regionConnections)
+        {
+            RegData = regData;
+            RootRegionLandChannel = rootRegionLandChannel;
+            RegionConnections = regionConnections;
+        }
+
+        public List<ILandObject> ParcelsNearPoint(Vector3 position)
+        {
+            //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
+            return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
+        }
+
+        public List<ILandObject> AllParcels()
+        {
+            return RootRegionLandChannel.AllParcels();
+        }
+
+        public ILandObject GetLandObject(int x, int y)
+        {
+            //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
+
+            if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
+            {
+                return RootRegionLandChannel.GetLandObject(x, y);
+            }
+            else
+            {
+                int offsetX = (x / (int)Constants.RegionSize);
+                int offsetY = (y / (int)Constants.RegionSize);
+                offsetX *= (int)Constants.RegionSize;
+                offsetY *= (int)Constants.RegionSize;
+
+                foreach (RegionData regionData in RegionConnections)
+                {
+                    if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
+                    {
+                        return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
+                    }
+                }
+                ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
+                obj.landData.Name = "NO LAND";
+                return obj;
+            }
+        }
+
+        public ILandObject GetLandObject(int localID)
+        {
+            return RootRegionLandChannel.GetLandObject(localID);
+        }
+
+        public ILandObject GetLandObject(float x, float y)
+        {
+            //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
+            
+            if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
+            {
+                return RootRegionLandChannel.GetLandObject(x, y);
+            }
+            else
+            {
+                int offsetX = (int)(x/(int) Constants.RegionSize);
+                int offsetY = (int)(y/(int) Constants.RegionSize);
+                offsetX *= (int) Constants.RegionSize;
+                offsetY *= (int) Constants.RegionSize;
+
+                foreach (RegionData regionData in RegionConnections)
+                {
+                    if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
+                    {
+                        return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
+                    }
+                }
+                ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
+                obj.landData.Name = "NO LAND";
+                return obj;
+            }
+        }
+
+        public bool IsLandPrimCountTainted()
+        {
+            return RootRegionLandChannel.IsLandPrimCountTainted();
+        }
+
+        public bool IsForcefulBansAllowed()
+        {
+            return RootRegionLandChannel.IsForcefulBansAllowed();
+        }
+
+        public void UpdateLandObject(int localID, LandData data)
+        {
+            RootRegionLandChannel.UpdateLandObject(localID, data);
+        }
+
+        public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
+        {
+            RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
+        }
+
+        public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
+        {
+            RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
+        }
+
+        public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
+        {
+            RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
+        }
+
+        public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
+        {
+            RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
new file mode 100644
index 0000000..1436912
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -0,0 +1,914 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using log4net;
+using Nini.Config;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Framework.Client;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+    public class RegionCombinerModule : ISharedRegionModule
+    {
+        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        public string Name
+        {
+            get { return "RegionCombinerModule"; }
+        }
+
+        public Type ReplaceableInterface
+        {
+            get { return null; }
+        }
+
+        private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
+        private bool enabledYN = false;
+        private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
+
+        public void Initialise(IConfigSource source)
+        {
+            IConfig myConfig = source.Configs["Startup"];
+            enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
+            //enabledYN = true;
+        }
+
+        public void Close()
+        {
+        }
+
+        public void AddRegion(Scene scene)
+        {
+        }
+
+        public void RemoveRegion(Scene scene)
+        {
+        }
+
+        public void RegionLoaded(Scene scene)
+        {
+            if (!enabledYN)
+                return;
+
+            // For testing on a single instance
+            if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
+                return;
+            //
+
+            lock (m_startingScenes)
+                m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
+
+            // Give each region a standard set of non-infinite borders
+            Border northBorder = new Border();
+            northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize);  //<---
+            northBorder.CrossDirection = Cardinals.N;
+            scene.NorthBorders[0] = northBorder;
+
+            Border southBorder = new Border();
+            southBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0);    //--->
+            southBorder.CrossDirection = Cardinals.S;
+            scene.SouthBorders[0] = southBorder;
+
+            Border eastBorder = new Border();
+            eastBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize);   //<---
+            eastBorder.CrossDirection = Cardinals.E;
+            scene.EastBorders[0] = eastBorder;
+
+            Border westBorder = new Border();
+            westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0);     //--->
+            westBorder.CrossDirection = Cardinals.W;
+            scene.WestBorders[0] = westBorder;
+
+
+
+            RegionConnections regionConnections = new RegionConnections();
+            regionConnections.ConnectedRegions = new List<RegionData>();
+            regionConnections.RegionScene = scene;
+            regionConnections.RegionLandChannel = scene.LandChannel;
+            regionConnections.RegionId = scene.RegionInfo.originRegionID;
+            regionConnections.X = scene.RegionInfo.RegionLocX;
+            regionConnections.Y = scene.RegionInfo.RegionLocY;
+            regionConnections.XEnd = (int)Constants.RegionSize;
+            regionConnections.YEnd = (int)Constants.RegionSize;
+
+
+            lock (m_regions)
+            {
+                bool connectedYN = false;
+
+                foreach (RegionConnections conn in m_regions.Values)
+                {
+                    #region commented
+                    /*
+                    // If we're one region over +x +y
+                    //xxy
+                    //xxx
+                    //xxx
+                    if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd 
+                        == (regionConnections.X * (int)Constants.RegionSize)) 
+                        && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd 
+                        == (regionConnections.Y * (int)Constants.RegionSize)))
+                    {
+                        Vector3 offset = Vector3.Zero;
+                        offset.X = (((regionConnections.X * (int) Constants.RegionSize)) -
+                                    ((conn.X * (int) Constants.RegionSize)));
+                        offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) -
+                                    ((conn.Y * (int) Constants.RegionSize)));
+
+                        Vector3 extents = Vector3.Zero;
+                        extents.Y = regionConnections.YEnd + conn.YEnd;
+                        extents.X = conn.XEnd + conn.XEnd;
+
+                        m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}.  Offset: {2}.  Extents:{3}",
+                                          conn.RegionScene.RegionInfo.RegionName,
+                                          regionConnections.RegionScene.RegionInfo.RegionName,
+                                          offset, extents);
+
+                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
+                            
+                        connectedYN = true;
+                        break;
+                    }
+                    */
+
+                    /*
+                    //If we're one region over x +y
+                    //xxx
+                    //xxx
+                    //xyx
+                    if ((((int)conn.X * (int)Constants.RegionSize)
+                        == (regionConnections.X * (int)Constants.RegionSize))
+                        && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
+                        == (regionConnections.Y * (int)Constants.RegionSize)))
+                    {
+                        Vector3 offset = Vector3.Zero;
+                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
+                                    ((conn.X * (int)Constants.RegionSize)));
+                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
+                                    ((conn.Y * (int)Constants.RegionSize)));
+
+                        Vector3 extents = Vector3.Zero;
+                        extents.Y = regionConnections.YEnd + conn.YEnd;
+                        extents.X = conn.XEnd;
+
+                        m_log.DebugFormat("Scene: {0} to the north of Scene{1}.  Offset: {2}. Extents:{3}",
+                                          conn.RegionScene.RegionInfo.RegionName,
+                                          regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
+
+                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
+                        connectedYN = true;
+                        break;
+                    }
+                    */
+
+                    /*
+                    // If we're one region over -x +y
+                    //xxx
+                    //xxx
+                    //yxx
+                    if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
+                        == (regionConnections.X * (int)Constants.RegionSize))
+                        && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
+                        == (regionConnections.Y * (int)Constants.RegionSize)))
+                    {
+                        Vector3 offset = Vector3.Zero;
+                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
+                                    ((conn.X * (int)Constants.RegionSize)));
+                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
+                                    ((conn.Y * (int)Constants.RegionSize)));
+
+                        Vector3 extents = Vector3.Zero;
+                        extents.Y = regionConnections.YEnd + conn.YEnd;
+                        extents.X = conn.XEnd + conn.XEnd;
+
+                        m_log.DebugFormat("Scene: {0} to the northeast of Scene.  Offset: {2}. Extents:{3}",
+                                          conn.RegionScene.RegionInfo.RegionName,
+                                          regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
+
+                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
+
+
+                        connectedYN = true;
+                        break;
+                    }
+                    */
+
+                    /*
+                    // If we're one region over -x y
+                    //xxx
+                    //yxx
+                    //xxx
+                    if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
+                        == (regionConnections.X * (int)Constants.RegionSize))
+                        && (((int)conn.Y * (int)Constants.RegionSize)
+                        == (regionConnections.Y * (int)Constants.RegionSize)))
+                    {
+                        Vector3 offset = Vector3.Zero;
+                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
+                                    ((conn.X * (int)Constants.RegionSize)));
+                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
+                                    ((conn.Y * (int)Constants.RegionSize)));
+
+                        Vector3 extents = Vector3.Zero;
+                        extents.Y = regionConnections.YEnd;
+                        extents.X = conn.XEnd + conn.XEnd;
+
+                        m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}",
+                                          conn.RegionScene.RegionInfo.RegionName,
+                                          regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
+
+                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
+
+                        connectedYN = true;
+                        break;
+                    }
+                    */
+
+                    /*
+                        // If we're one region over -x -y
+                        //yxx
+                        //xxx
+                        //xxx
+                        if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
+                            == (regionConnections.X * (int)Constants.RegionSize))
+                            && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
+                            == (regionConnections.Y * (int)Constants.RegionSize)))
+                        {
+                            Vector3 offset = Vector3.Zero;
+                            offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
+                                        ((conn.X * (int)Constants.RegionSize)));
+                            offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
+                                        ((conn.Y * (int)Constants.RegionSize)));
+
+                            Vector3 extents = Vector3.Zero;
+                            extents.Y = regionConnections.YEnd + conn.YEnd;
+                            extents.X = conn.XEnd + conn.XEnd;
+
+                            m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
+                                              conn.RegionScene.RegionInfo.RegionName,
+                                              regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
+
+                            scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
+
+                            connectedYN = true;
+                            break;
+                        }
+                        */
+                    #endregion
+
+                    // If we're one region over +x y
+                    //xxx
+                    //xxy
+                    //xxx
+
+                    if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
+                        >= (regionConnections.X * (int)Constants.RegionSize))
+                        && (((int)conn.Y * (int)Constants.RegionSize)
+                        >= (regionConnections.Y * (int)Constants.RegionSize)))
+                    {
+                        Vector3 offset = Vector3.Zero;
+                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
+                                    ((conn.X * (int)Constants.RegionSize)));
+                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
+                                    ((conn.Y * (int)Constants.RegionSize)));
+
+                        Vector3 extents = Vector3.Zero;
+                        extents.Y = conn.YEnd;
+                        extents.X = conn.XEnd + regionConnections.XEnd;
+
+                        conn.UpdateExtents(extents);
+
+                        m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
+                                          conn.RegionScene.RegionInfo.RegionName,
+                                          regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
+
+                        scene.BordersLocked = true;
+                        conn.RegionScene.BordersLocked = true;
+
+                        RegionData ConnectedRegion = new RegionData();
+                        ConnectedRegion.Offset = offset;
+                        ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
+                        ConnectedRegion.RegionScene = scene;
+                        conn.ConnectedRegions.Add(ConnectedRegion);
+
+                        // Inform root region Physics about the extents of this region
+                        conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
+
+                        // Inform Child region that it needs to forward it's terrain to the root region
+                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
+
+                        // Extend the borders as appropriate
+                        lock (conn.RegionScene.EastBorders)
+                            conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
+
+                        lock (conn.RegionScene.NorthBorders)
+                            conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
+
+                        lock (conn.RegionScene.SouthBorders)
+                            conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
+
+                        lock (scene.WestBorders)
+                        {
+                            scene.WestBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport West
+
+                            // Trigger auto teleport to root region
+                            scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
+                            scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
+                        }
+
+                        // Reset Terrain..  since terrain loads before we get here, we need to load 
+                        // it again so it loads in the root region
+                        
+                        scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
+                        
+                        // Unlock borders
+                        conn.RegionScene.BordersLocked = false;
+                        scene.BordersLocked = false;
+
+                        // Create a client event forwarder and add this region's events to the root region.
+                        if (conn.ClientEventForwarder != null)
+                            conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
+                        connectedYN = true;
+                        break;
+                    }
+
+                    // If we're one region over x +y
+                    //xyx
+                    //xxx
+                    //xxx
+                    if ((((int)conn.X * (int)Constants.RegionSize)
+                        >= (regionConnections.X * (int)Constants.RegionSize))
+                        && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
+                        >= (regionConnections.Y * (int)Constants.RegionSize)))
+                    {
+                        Vector3 offset = Vector3.Zero;
+                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
+                                    ((conn.X * (int)Constants.RegionSize)));
+                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
+                                    ((conn.Y * (int)Constants.RegionSize)));
+
+                        Vector3 extents = Vector3.Zero;
+                        extents.Y = regionConnections.YEnd + conn.YEnd;
+                        extents.X = conn.XEnd;
+                        conn.UpdateExtents(extents);
+
+                        scene.BordersLocked = true;
+                        conn.RegionScene.BordersLocked = true;
+
+                        RegionData ConnectedRegion = new RegionData();
+                        ConnectedRegion.Offset = offset;
+                        ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
+                        ConnectedRegion.RegionScene = scene;
+                        conn.ConnectedRegions.Add(ConnectedRegion);
+
+                        m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
+                                         conn.RegionScene.RegionInfo.RegionName,
+                                         regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
+
+                        conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
+                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
+
+                        lock (conn.RegionScene.NorthBorders)
+                            conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
+                        lock (conn.RegionScene.EastBorders)
+                            conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
+                        lock (conn.RegionScene.WestBorders)
+                            conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
+                        lock (scene.SouthBorders)
+                        {
+                            scene.SouthBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport south
+                            scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
+                            scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
+                        }
+
+                        // Reset Terrain..  since terrain normally loads first.
+                        //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
+                        scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
+                        //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
+
+                        scene.BordersLocked = false;
+                        conn.RegionScene.BordersLocked = false;
+                        if (conn.ClientEventForwarder != null)
+                            conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
+                        connectedYN = true;
+                        break;
+                    }
+
+                    // If we're one region over +x +y
+                    //xxy
+                    //xxx
+                    //xxx
+                    if ((((int)conn.X * (int)Constants.RegionSize) + conn.YEnd
+                        >= (regionConnections.X * (int)Constants.RegionSize))
+                        && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
+                        >= (regionConnections.Y * (int)Constants.RegionSize)))
+                    {
+                        Vector3 offset = Vector3.Zero;
+                        offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
+                                    ((conn.X * (int)Constants.RegionSize)));
+                        offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
+                                    ((conn.Y * (int)Constants.RegionSize)));
+
+                        Vector3 extents = Vector3.Zero;
+                        extents.Y = regionConnections.YEnd + conn.YEnd;
+                        extents.X = regionConnections.XEnd + conn.XEnd;
+                        conn.UpdateExtents(extents);
+
+                        scene.BordersLocked = true;
+                        conn.RegionScene.BordersLocked = true;
+
+                        RegionData ConnectedRegion = new RegionData();
+                        ConnectedRegion.Offset = offset;
+                        ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
+                        ConnectedRegion.RegionScene = scene;
+
+                        conn.ConnectedRegions.Add(ConnectedRegion);
+
+                        m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
+                                         conn.RegionScene.RegionInfo.RegionName,
+                                         regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
+
+                        conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
+                        scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
+                        lock (conn.RegionScene.NorthBorders)
+                        {
+                            if (conn.RegionScene.NorthBorders.Count == 1)// &&  2)
+                            {
+                                //compound border
+                                // already locked above
+                                conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
+
+                                lock (conn.RegionScene.EastBorders)
+                                    conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
+                                lock (conn.RegionScene.WestBorders)
+                                    conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
+                            }
+                        }
+
+                        lock (scene.SouthBorders)
+                        {
+                            scene.SouthBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport south
+                            scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
+                            scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
+                        }
+
+                        lock (conn.RegionScene.EastBorders)
+                        {
+                            if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
+                            {
+
+                                conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
+                                lock (conn.RegionScene.NorthBorders)
+                                    conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
+                                lock (conn.RegionScene.SouthBorders)
+                                    conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
+
+
+                            }
+                        }
+
+                        lock (scene.WestBorders)
+                        {
+                            scene.WestBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport West
+                            scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
+                            scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
+                        }
+
+                        /*  
+                                                else
+                                                {
+                                                    conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
+                                                    conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
+                                                    conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
+                                                    scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
+                                                }
+                        */
+
+
+                        // Reset Terrain..  since terrain normally loads first.
+                        //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
+                        scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
+                        //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
+                        scene.BordersLocked = false;
+                        conn.RegionScene.BordersLocked = false;
+
+                        if (conn.ClientEventForwarder != null)
+                            conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
+
+                        connectedYN = true;
+
+                        //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
+
+                        break;
+                    }
+                }
+
+                // If !connectYN means that this region is a root region
+                if (!connectedYN)
+                {
+                    RegionData rdata = new RegionData();
+                    rdata.Offset = Vector3.Zero;
+                    rdata.RegionId = scene.RegionInfo.originRegionID;
+                    rdata.RegionScene = scene;
+                    // save it's land channel
+                    regionConnections.RegionLandChannel = scene.LandChannel;
+
+                    // Substitue our landchannel
+                    RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
+                                                                    regionConnections.ConnectedRegions);
+                    scene.LandChannel = lnd;
+                    // Forward the permissions modules of each of the connected regions to the root region
+                    lock (m_regions)
+                    {
+                        foreach (RegionData r in regionConnections.ConnectedRegions)
+                        {
+                            ForwardPermissionRequests(regionConnections, r.RegionScene);
+                        }
+                    }
+                    // Create the root region's Client Event Forwarder
+                    regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
+
+                    // Sets up the CoarseLocationUpdate forwarder for this root region
+                    scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
+
+                    // Adds this root region to a dictionary of regions that are connectable
+                    m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
+                }
+            }
+            // Set up infinite borders around the entire AABB of the combined ConnectedRegions
+            AdjustLargeRegionBounds();
+        }
+
+        private void SetCourseLocationDelegate(ScenePresence presence)
+        {
+            presence.SetSendCourseLocationMethod(SendCourseLocationUpdates);
+        }
+
+        private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence)
+        {
+            RegionConnections connectiondata = null; 
+            lock (m_regions)
+            {
+                if (m_regions.ContainsKey(sceneId))
+                    connectiondata = m_regions[sceneId];
+                else
+                    return;
+            }
+
+            List<ScenePresence> avatars = connectiondata.RegionScene.GetAvatars();
+            List<Vector3> CoarseLocations = new List<Vector3>();
+            List<UUID> AvatarUUIDs = new List<UUID>();
+            for (int i = 0; i < avatars.Count; i++)
+            {
+                if (avatars[i].UUID != presence.UUID)
+                {
+                    if (avatars[i].ParentID != 0)
+                    {
+                        // sitting avatar
+                        SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID);
+                        if (sop != null)
+                        {
+                            CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition);
+                            AvatarUUIDs.Add(avatars[i].UUID);
+                        }
+                        else
+                        {
+                            // we can't find the parent..  ! arg!
+                            CoarseLocations.Add(avatars[i].AbsolutePosition);
+                            AvatarUUIDs.Add(avatars[i].UUID);
+                        }
+                    }
+                    else
+                    {
+                        CoarseLocations.Add(avatars[i].AbsolutePosition);
+                        AvatarUUIDs.Add(avatars[i].UUID);
+                    }
+                }
+            }
+            DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
+        }
+
+        private void DistributeCourseLocationUpdates(List<Vector3> locations, List<UUID> uuids, 
+                                                     RegionConnections connectiondata, ScenePresence rootPresence)
+        {
+            RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
+            //List<IClientAPI> clients = new List<IClientAPI>();
+            Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>();
+            
+            // Root Region entry
+            RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct();
+            rootupdatedata.Locations = new List<Vector3>();
+            rootupdatedata.Uuids = new List<UUID>();
+            rootupdatedata.Offset = Vector2.Zero;
+
+            rootupdatedata.UserAPI = rootPresence.ControllingClient;
+
+            if (rootupdatedata.UserAPI != null)
+                updates.Add(Vector2.Zero, rootupdatedata);
+
+            //Each Region needs an entry or we will end up with dead minimap dots
+            foreach (RegionData regiondata in rdata)
+            {
+                Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y);
+                RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
+                updatedata.Locations = new List<Vector3>();
+                updatedata.Uuids = new List<UUID>();
+                updatedata.Offset = offset;
+
+                if (offset == Vector2.Zero)
+                    updatedata.UserAPI = rootPresence.ControllingClient;
+                else
+                    updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
+
+                if (updatedata.UserAPI != null)
+                    updates.Add(offset, updatedata);
+            }
+
+            // go over the locations and assign them to an IClientAPI
+            for (int i = 0; i < locations.Count; i++)
+            //{locations[i]/(int) Constants.RegionSize;
+            {
+                Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize, 
+                                                (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z);
+                Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize,
+                                             pPosition.Y*(int) Constants.RegionSize);
+                
+                if (!updates.ContainsKey(offset))
+                {
+                    // This shouldn't happen
+                    RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
+                    updatedata.Locations = new List<Vector3>();
+                    updatedata.Uuids = new List<UUID>();
+                    updatedata.Offset = offset;
+                    
+                    if (offset == Vector2.Zero)
+                        updatedata.UserAPI = rootPresence.ControllingClient;
+                    else 
+                        updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
+
+                    updates.Add(offset,updatedata);
+                }
+                
+                updates[offset].Locations.Add(locations[i]);
+                updates[offset].Uuids.Add(uuids[i]);
+            }
+
+            // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is
+            foreach (Vector2 offset in updates.Keys)
+            {
+                if (updates[offset].UserAPI != null)
+                {
+                    updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Locates a the Client of a particular region in an Array of RegionData based on offset
+        /// </summary>
+        /// <param name="offset"></param>
+        /// <param name="uUID"></param>
+        /// <param name="rdata"></param>
+        /// <returns>IClientAPI or null</returns>
+        private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
+        {
+            IClientAPI returnclient = null;
+            foreach (RegionData r in rdata)
+            {
+                if (r.Offset.X == offset.X && r.Offset.Y == offset.Y)
+                {
+                    return r.RegionScene.SceneGraph.GetControllingClient(uUID);
+                }
+            }
+
+            return returnclient;
+        }
+
+        public void PostInitialise()
+        {
+        }
+        
+        /// <summary>
+        /// TODO:
+        /// </summary>
+        /// <param name="rdata"></param>
+        public void UnCombineRegion(RegionData rdata)
+        {
+            lock (m_regions)
+            {
+                if (m_regions.ContainsKey(rdata.RegionId))
+                {
+                    // uncombine root region and virtual regions
+                }
+                else
+                {
+                    foreach (RegionConnections r in m_regions.Values)
+                    {
+                        foreach (RegionData rd in r.ConnectedRegions)
+                        {
+                            if (rd.RegionId == rdata.RegionId)
+                            {
+                                // uncombine virtual region
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        // Create a set of infinite borders around the whole aabb of the combined island.
+        private void AdjustLargeRegionBounds()
+        {
+            lock (m_regions)
+            {
+                foreach (RegionConnections rconn in m_regions.Values)
+                {
+                    Vector3 offset = Vector3.Zero;
+                    rconn.RegionScene.BordersLocked = true;
+                    foreach (RegionData rdata in rconn.ConnectedRegions)
+                    {
+                        if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X;
+                        if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y;
+                    }
+
+                    lock (rconn.RegionScene.NorthBorders)
+                    {
+                        Border northBorder = null;
+                        // If we don't already have an infinite border, create one.
+                        if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
+                        {
+                            northBorder = new Border();
+                            rconn.RegionScene.NorthBorders.Add(northBorder);
+                        }
+                        
+                        northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
+                                                             offset.Y + (int) Constants.RegionSize); //<---
+                        northBorder.CrossDirection = Cardinals.N;
+                    }
+
+                    lock (rconn.RegionScene.SouthBorders)
+                    {
+                        Border southBorder = null;
+                        // If we don't already have an infinite border, create one.
+                        if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
+                        {
+                            southBorder = new Border();
+                            rconn.RegionScene.SouthBorders.Add(southBorder);
+                        }
+                        southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
+                        southBorder.CrossDirection = Cardinals.S;
+                    }
+
+                    lock (rconn.RegionScene.EastBorders)
+                    {
+                        Border eastBorder = null;
+                        // If we don't already have an infinite border, create one.
+                        if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
+                        {
+                            eastBorder = new Border();
+                            rconn.RegionScene.EastBorders.Add(eastBorder);
+                        }
+                        eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize);
+                        //<---
+                        eastBorder.CrossDirection = Cardinals.E;
+                    }
+
+                    lock (rconn.RegionScene.WestBorders)
+                    {
+                        Border westBorder = null;
+                        // If we don't already have an infinite border, create one.
+                        if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
+                        {
+                            westBorder = new Border();
+                            rconn.RegionScene.WestBorders.Add(westBorder);
+
+                        }
+                        westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
+                        westBorder.CrossDirection = Cardinals.W;
+                    }
+
+                    rconn.RegionScene.BordersLocked = false;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Try and get an Infinite border out of a listT of borders
+        /// </summary>
+        /// <param name="borders"></param>
+        /// <param name="oborder"></param>
+        /// <returns></returns>
+        public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
+        {
+            // Warning! Should be locked before getting here!
+            foreach (Border b in borders)
+            {
+                if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue)
+                {
+                    oborder = b;
+                    return true;
+                }
+            }
+            oborder = null;
+            return false;
+        }
+       
+        public RegionData GetRegionFromPosition(Vector3 pPosition)
+        {
+            pPosition = pPosition/(int) Constants.RegionSize;
+            int OffsetX = (int) pPosition.X;
+            int OffsetY = (int) pPosition.Y;
+            foreach (RegionConnections regConn in m_regions.Values)
+            {
+                foreach (RegionData reg in regConn.ConnectedRegions)
+                {
+                    if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
+                        return reg;
+                }
+            }
+            return new RegionData();
+        }
+
+        public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion)
+        {
+            if (BigRegion.PermissionModule == null)
+                BigRegion.PermissionModule = new RegionCombinerPermissionModule(BigRegion.RegionScene);
+
+            VirtualRegion.Permissions.OnBypassPermissions += BigRegion.PermissionModule.BypassPermissions;
+            VirtualRegion.Permissions.OnSetBypassPermissions += BigRegion.PermissionModule.SetBypassPermissions;
+            VirtualRegion.Permissions.OnPropagatePermissions += BigRegion.PermissionModule.PropagatePermissions;
+            VirtualRegion.Permissions.OnGenerateClientFlags += BigRegion.PermissionModule.GenerateClientFlags;
+            VirtualRegion.Permissions.OnAbandonParcel += BigRegion.PermissionModule.CanAbandonParcel;
+            VirtualRegion.Permissions.OnReclaimParcel += BigRegion.PermissionModule.CanReclaimParcel;
+            VirtualRegion.Permissions.OnDeedParcel += BigRegion.PermissionModule.CanDeedParcel;
+            VirtualRegion.Permissions.OnDeedObject += BigRegion.PermissionModule.CanDeedObject;
+            VirtualRegion.Permissions.OnIsGod += BigRegion.PermissionModule.IsGod;
+            VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
+            VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
+            VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
+            VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED            
+            VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
+            VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
+            VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED
+            VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry;
+            VirtualRegion.Permissions.OnReturnObject += BigRegion.PermissionModule.CanReturnObject; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED
+            VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand;
+            VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnCompileScript += BigRegion.PermissionModule.CanCompileScript;
+            VirtualRegion.Permissions.OnSellParcel += BigRegion.PermissionModule.CanSellParcel;
+            VirtualRegion.Permissions.OnTakeObject += BigRegion.PermissionModule.CanTakeObject;
+            VirtualRegion.Permissions.OnTakeCopyObject += BigRegion.PermissionModule.CanTakeCopyObject;
+            VirtualRegion.Permissions.OnTerraformLand += BigRegion.PermissionModule.CanTerraformLand;
+            VirtualRegion.Permissions.OnLinkObject += BigRegion.PermissionModule.CanLinkObject; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED                       
+            VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED            
+            VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED            
+            VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE 
+            VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED            
+            VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
+            VirtualRegion.Permissions.OnCreateUserInventory += BigRegion.PermissionModule.CanCreateUserInventory; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnCopyUserInventory += BigRegion.PermissionModule.CanCopyUserInventory; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
+            VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED
+        }
+    }
+}
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
new file mode 100644
index 0000000..76ca5e3
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+ public class RegionCombinerPermissionModule
+    {
+        private Scene m_rootScene;
+
+        public RegionCombinerPermissionModule(Scene RootScene)
+        {
+            m_rootScene = RootScene;
+        }
+
+        #region Permission Override
+
+        public bool BypassPermissions()
+        {
+            return m_rootScene.Permissions.BypassPermissions();
+        }
+
+        public void SetBypassPermissions(bool value)
+        {
+            m_rootScene.Permissions.SetBypassPermissions(value);
+        }
+
+        public bool PropagatePermissions()
+        {
+            return m_rootScene.Permissions.PropagatePermissions();
+        }
+
+        public uint GenerateClientFlags(UUID userid, UUID objectidid)
+        {
+            return m_rootScene.Permissions.GenerateClientFlags(userid,objectidid);
+        }
+
+        public bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanAbandonParcel(user,parcel);
+        }
+
+        public bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanReclaimParcel(user, parcel);
+        }
+
+        public bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanDeedParcel(user, parcel);
+        }
+
+        public bool CanDeedObject(UUID user, UUID @group, Scene scene)
+        {
+            return m_rootScene.Permissions.CanDeedObject(user,@group);
+        }
+
+        public bool IsGod(UUID user, Scene requestfromscene)
+        {
+            return m_rootScene.Permissions.IsGod(user);
+        }
+
+        public bool CanDuplicateObject(int objectcount, UUID objectid, UUID owner, Scene scene, Vector3 objectposition)
+        {
+            return m_rootScene.Permissions.CanDuplicateObject(objectcount, objectid, owner, objectposition);
+        }
+
+        public bool CanDeleteObject(UUID objectid, UUID deleter, Scene scene)
+        {
+            return m_rootScene.Permissions.CanDeleteObject(objectid, deleter);
+        }
+
+        public bool CanEditObject(UUID objectid, UUID editorid, Scene scene)
+        {
+            return m_rootScene.Permissions.CanEditObject(objectid, editorid);
+        }
+
+        public bool CanEditParcel(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanEditParcel(user, parcel);
+        }
+
+        public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
+        {
+            return m_rootScene.Permissions.CanInstantMessage(user, target);
+        }
+
+        public bool CanInventoryTransfer(UUID user, UUID target, Scene startscene)
+        {
+            return m_rootScene.Permissions.CanInventoryTransfer(user, target);
+        }
+
+        public bool CanIssueEstateCommand(UUID user, Scene requestfromscene, bool ownercommand)
+        {
+            return m_rootScene.Permissions.CanIssueEstateCommand(user, ownercommand);
+        }
+
+        public bool CanMoveObject(UUID objectid, UUID moverid, Scene scene)
+        {
+            return m_rootScene.Permissions.CanMoveObject(objectid, moverid);
+        }
+
+        public bool CanObjectEntry(UUID objectid, bool enteringregion, Vector3 newpoint, Scene scene)
+        {
+            return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint);
+        }
+
+        public bool CanReturnObject(UUID objectid, UUID returnerid, Scene scene)
+        {
+            return m_rootScene.Permissions.CanReturnObject(objectid, returnerid);
+        }
+
+        public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene)
+        {
+            return m_rootScene.Permissions.CanRezObject(objectcount, owner, objectposition);
+        }
+
+        public bool CanRunConsoleCommand(UUID user, Scene requestfromscene)
+        {
+            return m_rootScene.Permissions.CanRunConsoleCommand(user);
+        }
+
+        public bool CanRunScript(UUID script, UUID objectid, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanRunScript(script, objectid, user);
+        }
+
+        public bool CanCompileScript(UUID owneruuid, int scripttype, Scene scene)
+        {
+            return m_rootScene.Permissions.CanCompileScript(owneruuid, scripttype);
+        }
+
+        public bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanSellParcel(user, parcel);
+        }
+
+        public bool CanTakeObject(UUID objectid, UUID stealer, Scene scene)
+        {
+            return m_rootScene.Permissions.CanTakeObject(objectid, stealer);
+        }
+
+        public bool CanTakeCopyObject(UUID objectid, UUID userid, Scene inscene)
+        {
+            return m_rootScene.Permissions.CanTakeObject(objectid, userid);
+        }
+
+        public bool CanTerraformLand(UUID user, Vector3 position, Scene requestfromscene)
+        {
+            return m_rootScene.Permissions.CanTerraformLand(user, position);
+        }
+
+        public bool CanLinkObject(UUID user, UUID objectid)
+        {
+            return m_rootScene.Permissions.CanLinkObject(user, objectid);
+        }
+
+        public bool CanDelinkObject(UUID user, UUID objectid)
+        {
+            return m_rootScene.Permissions.CanDelinkObject(user, objectid);
+        }
+
+        public bool CanBuyLand(UUID user, ILandObject parcel, Scene scene)
+        {
+            return m_rootScene.Permissions.CanBuyLand(user, parcel);
+        }
+
+        public bool CanViewNotecard(UUID script, UUID objectid, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanViewNotecard(script, objectid, user);
+        }
+
+        public bool CanViewScript(UUID script, UUID objectid, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanViewScript(script, objectid, user);
+        }
+
+        public bool CanEditNotecard(UUID notecard, UUID objectid, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanEditNotecard(notecard, objectid, user);
+        }
+
+        public bool CanEditScript(UUID script, UUID objectid, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanEditScript(script, objectid, user);
+        }
+
+        public bool CanCreateObjectInventory(int invtype, UUID objectid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanCreateObjectInventory(invtype, objectid, userid);
+        }
+
+        public bool CanEditObjectInventory(UUID objectid, UUID editorid, Scene scene)
+        {
+            return m_rootScene.Permissions.CanEditObjectInventory(objectid, editorid);
+        }
+
+        public bool CanCopyObjectInventory(UUID itemid, UUID objectid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanCopyObjectInventory(itemid, objectid, userid);
+        }
+
+        public bool CanDeleteObjectInventory(UUID itemid, UUID objectid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanDeleteObjectInventory(itemid, objectid, userid);
+        }
+
+        public bool CanResetScript(UUID prim, UUID script, UUID user, Scene scene)
+        {
+            return m_rootScene.Permissions.CanResetScript(prim, script, user);
+        }
+
+        public bool CanCreateUserInventory(int invtype, UUID userid)
+        {
+            return m_rootScene.Permissions.CanCreateUserInventory(invtype, userid);
+        }
+
+        public bool CanCopyUserInventory(UUID itemid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanCopyUserInventory(itemid, userid);
+        }
+
+        public bool CanEditUserInventory(UUID itemid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanEditUserInventory(itemid, userid);
+        }
+
+        public bool CanDeleteUserInventory(UUID itemid, UUID userid)
+        {
+            return m_rootScene.Permissions.CanDeleteUserInventory(itemid, userid);
+        }
+
+        public bool CanTeleport(UUID userid, Scene scene)
+        {
+            return m_rootScene.Permissions.CanTeleport(userid);
+        }
+
+        public bool CanUseObjectReturn(ILandObject landdata, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
+        {
+            return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist);
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs b/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
new file mode 100644
index 0000000..419ed74
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+    public class RegionConnections
+    {
+        /// <summary>
+        /// Root Region ID
+        /// </summary>
+        public UUID RegionId;
+
+        /// <summary>
+        /// Root Region Scene
+        /// </summary>
+        public Scene RegionScene;
+
+        /// <summary>
+        /// LargeLandChannel for combined region
+        /// </summary>
+        public ILandChannel RegionLandChannel;
+        public uint X;
+        public uint Y;
+        public int XEnd;
+        public int YEnd;
+        public List<RegionData> ConnectedRegions;
+        public RegionCombinerPermissionModule PermissionModule;
+        public RegionCombinerClientEventForwarder ClientEventForwarder;
+        public void UpdateExtents(Vector3 extents)
+        {
+            XEnd = (int)extents.X;
+            YEnd = (int)extents.Y;
+        }
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs b/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
new file mode 100644
index 0000000..175ca89
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Framework;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+
+    struct RegionCourseLocationStruct
+    {
+        public List<Vector3> Locations;
+        public List<UUID> Uuids;
+        public IClientAPI UserAPI;
+        public Vector2 Offset;
+    }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionData.cs b/OpenSim/Region/CoreModules/World/Land/RegionData.cs
new file mode 100644
index 0000000..3383527
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/RegionData.cs
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using OpenMetaverse;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Land
+{
+    public class RegionData
+    {
+        public UUID RegionId;
+        public Scene RegionScene;
+        public Vector3 Offset;
+    }
+}
\ No newline at end of file
-- 
cgit v1.1


From 19c5c8b98de2688fb472ac11eb629e4e8c3aab53 Mon Sep 17 00:00:00 2001
From: dr scofield (aka dirk husemann)
Date: Mon, 14 Sep 2009 16:14:59 +0200
Subject: fix to preserve UTF8 encoding in saved script state.

---
 OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 04f7862..650d9fa 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -298,14 +298,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
                 try
                 {
                     FileInfo fi = new FileInfo(savedState);
-                    int size=(int)fi.Length;
+                    int size = (int)fi.Length;
                     if (size < 512000)
                     {
                         using (FileStream fs = File.Open(savedState,
                                                          FileMode.Open, FileAccess.Read, FileShare.None))
                         {
-                            System.Text.ASCIIEncoding enc =
-                                new System.Text.ASCIIEncoding();
+                            System.Text.UTF8Encoding enc =
+                                new System.Text.UTF8Encoding();
 
                             Byte[] data = new Byte[size];
                             fs.Read(data, 0, size);
@@ -899,7 +899,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
                 try
                 {
                     FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"));
-                    System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
+                    System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
                     Byte[] buf = enc.GetBytes(xml);
                     fs.Write(buf, 0, buf.Length);
                     fs.Close();
-- 
cgit v1.1


From dd4d70eafef1d4ba3696967c1dc2bcac722413c3 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 14 Sep 2009 16:54:36 +0100
Subject: re-enable load and save iar commands

---
 .../Avatar/Inventory/Archiver/InventoryArchiverModule.cs          | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 4d96b28..358f17e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -233,9 +233,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
         /// <param name="cmdparams"></param>
         protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
         {
-            return;
-
-            /*
             if (cmdparams.Length < 5)
             {
                 m_log.Error(
@@ -256,7 +253,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
                 m_log.InfoFormat(
                     "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
                     loadPath, firstName, lastName);
-                    */
         }
         
         /// <summary>
@@ -265,9 +261,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
         /// <param name="cmdparams"></param>
         protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
         {
-            return;
-
-            /*
             if (cmdparams.Length < 5)
             {
                 m_log.Error(
@@ -289,7 +282,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
 
             lock (m_pendingConsoleSaves)
                 m_pendingConsoleSaves.Add(id);
-                */
         }        
         
         private void SaveInvConsoleCommandCompleted(
-- 
cgit v1.1


From 5a64ca4642f00272d7424684d72a7088e4103dec Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 14 Sep 2009 16:57:47 +0100
Subject: label load and save iar commands as experimental.

---
 .../Avatar/Inventory/Archiver/InventoryArchiverModule.cs          | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 358f17e..00faabb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -92,12 +92,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
                 scene.AddCommand(
                     this, "load iar",
                     "load iar <first> <last> <inventory path> [<archive path>]",
-                    "Load user inventory archive.  EXPERIMENTAL, CURRENTLY DISABLED", HandleLoadInvConsoleCommand); 
+                    "Load user inventory archive.  EXPERIMENTAL", HandleLoadInvConsoleCommand); 
                 
                 scene.AddCommand(
                     this, "save iar",
                     "save iar <first> <last> <inventory path> [<archive path>]",
-                    "Save user inventory archive.  EXPERIMENTAL, CURRENTLY DISABLED", HandleSaveInvConsoleCommand);
+                    "Save user inventory archive.  EXPERIMENTAL", HandleSaveInvConsoleCommand);
 
                 m_aScene = scene;
             }
@@ -240,6 +240,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
                 return;
             }
 
+            m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL.  BUG REPORTS WELCOME.");
+
             string firstName = cmdparams[2];
             string lastName = cmdparams[3];
             string invPath = cmdparams[4];
@@ -268,6 +270,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
                 return;
             }
 
+            m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL.  BUG REPORTS WELCOME.");
+
             string firstName = cmdparams[2];
             string lastName = cmdparams[3];
             string invPath = cmdparams[4];
-- 
cgit v1.1