From e21b3bf390ea8803c58f866afa51fe9089531f27 Mon Sep 17 00:00:00 2001
From: MW
Date: Fri, 16 Jan 2009 17:56:44 +0000
Subject: Added support so that during the loading of a xml link list, it
 checks if a linked hypergrid region's real location is within 4096,4096 map
 spaces of its "local" location. If it is outside of that range ( so it
 wouldn't be possible to teleport to it) then it ignores it and doesn't create
 a link. See the hypergrid wiki page for more details.

---
 OpenSim/Region/Application/HGOpenSimNode.cs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs
index 6a525be..358370b 100644
--- a/OpenSim/Region/Application/HGOpenSimNode.cs
+++ b/OpenSim/Region/Application/HGOpenSimNode.cs
@@ -267,11 +267,14 @@ namespace OpenSim
             uint xloc, yloc;
             uint externalPort;
             string externalHostName;
+            uint realXLoc, realYLoc;
 
             xloc = Convert.ToUInt32(config.GetString("xloc", "0"));
             yloc = Convert.ToUInt32(config.GetString("yloc", "0"));
             externalPort = Convert.ToUInt32(config.GetString("externalPort", "0"));
             externalHostName = config.GetString("externalHostName", "");
+            realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0"));
+            realYLoc = Convert.ToUInt32(config.GetString("real-yloc", "0"));
 
             if (m_enableAutoMapping)
             {
@@ -279,9 +282,12 @@ namespace OpenSim
                 yloc = (uint)((yloc % 100) + m_autoMappingY);
             }
 
-            if (TryCreateLink(xloc, yloc, externalPort, externalHostName, out regInfo))
+            if (((realXLoc == 0) && (realYLoc == 0)) || (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) && ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
             {
-                regInfo.RegionName = config.GetString("localName", "");
+                if (TryCreateLink(xloc, yloc, externalPort, externalHostName, out regInfo))
+                {
+                    regInfo.RegionName = config.GetString("localName", "");
+                }
             }
         }
 
-- 
cgit v1.1