aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionInfo.cs
diff options
context:
space:
mode:
authorRobert Adams2013-09-19 12:14:21 -0700
committerRobert Adams2013-09-28 07:33:52 -0700
commit317c04fe1714631d851684e3bb294f02056bcd07 (patch)
treea4e935d869c9cb2d79f545f9b6dd1f73b01a7053 /OpenSim/Framework/RegionInfo.cs
parentminor: Disable logging left active on regression test TestSameSimulatorIsolat... (diff)
downloadopensim-SC_OLD-317c04fe1714631d851684e3bb294f02056bcd07.zip
opensim-SC_OLD-317c04fe1714631d851684e3bb294f02056bcd07.tar.gz
opensim-SC_OLD-317c04fe1714631d851684e3bb294f02056bcd07.tar.bz2
opensim-SC_OLD-317c04fe1714631d851684e3bb294f02056bcd07.tar.xz
VarRegion: change RegionInfo storage of region coordinates from region
count number to integer world coordinates. Added new methods RegionWorldLoc[XY]. Refactored name of 'RegionLoc*' to 'LegacyRegionLoc*' throughout OpenSim. Kept old 'RegionLoc*' entrypoint to RegionInfo for downward compatability of external region management packages.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/RegionInfo.cs82
1 files changed, 59 insertions, 23 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 24b9c89..255c8e0 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -137,8 +137,8 @@ namespace OpenSim.Framework
137 public bool m_allow_alternate_ports; 137 public bool m_allow_alternate_ports;
138 protected string m_externalHostName; 138 protected string m_externalHostName;
139 protected IPEndPoint m_internalEndPoint; 139 protected IPEndPoint m_internalEndPoint;
140 protected uint? m_regionLocX; 140 public uint RegionWorldLocX { get; set; }
141 protected uint? m_regionLocY; 141 public uint RegionWorldLocY { get; set; }
142 protected uint m_remotingPort; 142 protected uint m_remotingPort;
143 public UUID RegionID = UUID.Zero; 143 public UUID RegionID = UUID.Zero;
144 public string RemotingAddress; 144 public string RemotingAddress;
@@ -147,6 +147,11 @@ namespace OpenSim.Framework
147 147
148 private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>(); 148 private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
149 149
150 // Originally, regions were fixed size of 256 in X and Y.
151 // For downward compatability, 'RegionLocX' returns the region coordinates in the legacy region units.
152 // This is the constant used to convert world integer coordinates to legacy region units.
153 public const uint LegacyRegionSize = 256;
154
150 155
151 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 156 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
152 157
@@ -229,10 +234,10 @@ namespace OpenSim.Framework
229 m_serverURI = string.Empty; 234 m_serverURI = string.Empty;
230 } 235 }
231 236
232 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 237 public RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint, string externalUri)
233 { 238 {
234 m_regionLocX = regionLocX; 239 RegionWorldLocX = legacyRegionLocX * LegacyRegionSize;
235 m_regionLocY = regionLocY; 240 RegionWorldLocY = legacyRegionLocY * LegacyRegionSize;
236 241
237 m_internalEndPoint = internalEndPoint; 242 m_internalEndPoint = internalEndPoint;
238 m_externalHostName = externalUri; 243 m_externalHostName = externalUri;
@@ -447,25 +452,56 @@ namespace OpenSim.Framework
447 452
448 /// <summary> 453 /// <summary>
449 /// The x co-ordinate of this region in map tiles (e.g. 1000). 454 /// The x co-ordinate of this region in map tiles (e.g. 1000).
455 /// Coordinate is scaled as world coordinates divided by the legacy region size
456 /// and is thus is the number of legacy regions.
457 /// </summary>
458 public uint LegacyRegionLocX
459 {
460 get { return RegionWorldLocX / LegacyRegionSize; }
461 set { RegionWorldLocX = value * LegacyRegionSize; }
462 }
463
464 /// <summary>
465 /// The y co-ordinate of this region in map tiles (e.g. 1000).
466 /// Coordinate is scaled as world coordinates divided by the legacy region size
467 /// and is thus is the number of legacy regions.
468 /// </summary>
469 public uint LegacyRegionLocY
470 {
471 get { return RegionWorldLocY / LegacyRegionSize; }
472 set { RegionWorldLocY = value * LegacyRegionSize; }
473 }
474
475 /// <summary>
476 /// The x co-ordinate of this region in map tiles (e.g. 1000).
477 /// Coordinate is scaled as world coordinates divided by the legacy region size
478 /// and is thus is the number of legacy regions.
479 /// This entrypoint exists for downward compatability for external modules.
450 /// </summary> 480 /// </summary>
451 public uint RegionLocX 481 public uint RegionLocX
452 { 482 {
453 get { return m_regionLocX.Value; } 483 get { return LegacyRegionLocX; }
454 set { m_regionLocX = value; } 484 set { LegacyRegionLocX = value; }
455 } 485 }
456 486
457 /// <summary> 487 /// <summary>
458 /// The y co-ordinate of this region in map tiles (e.g. 1000). 488 /// The y co-ordinate of this region in map tiles (e.g. 1000).
489 /// Coordinate is scaled as world coordinates divided by the legacy region size
490 /// and is thus is the number of legacy regions.
491 /// This entrypoint exists for downward compatability for external modules.
459 /// </summary> 492 /// </summary>
460 public uint RegionLocY 493 public uint RegionLocY
461 { 494 {
462 get { return m_regionLocY.Value; } 495 get { return LegacyRegionLocY; }
463 set { m_regionLocY = value; } 496 set { LegacyRegionLocY = value; }
464 } 497 }
465 498
499 // A unique region handle is created from the region's world coordinates.
500 // This cannot be changed because some code expects to receive the region handle and then
501 // compute the region coordinates from it.
466 public ulong RegionHandle 502 public ulong RegionHandle
467 { 503 {
468 get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } 504 get { return Util.UIntsToLong(RegionWorldLocX, RegionWorldLocY); }
469 } 505 }
470 506
471 public void SetEndPoint(string ipaddr, int port) 507 public void SetEndPoint(string ipaddr, int port)
@@ -572,8 +608,8 @@ namespace OpenSim.Framework
572 608
573 string[] locationElements = location.Split(new char[] {','}); 609 string[] locationElements = location.Split(new char[] {','});
574 610
575 m_regionLocX = Convert.ToUInt32(locationElements[0]); 611 LegacyRegionLocX = Convert.ToUInt32(locationElements[0]);
576 m_regionLocY = Convert.ToUInt32(locationElements[1]); 612 LegacyRegionLocY = Convert.ToUInt32(locationElements[1]);
577 613
578 // InternalAddress 614 // InternalAddress
579 // 615 //
@@ -704,7 +740,7 @@ namespace OpenSim.Framework
704 740
705 config.Set("RegionUUID", RegionID.ToString()); 741 config.Set("RegionUUID", RegionID.ToString());
706 742
707 string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); 743 string location = String.Format("{0},{1}", LegacyRegionLocX, LegacyRegionLocY);
708 config.Set("Location", location); 744 config.Set("Location", location);
709 745
710 config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); 746 config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
@@ -790,9 +826,9 @@ namespace OpenSim.Framework
790 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 826 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
791 "Region Name", RegionName, true); 827 "Region Name", RegionName, true);
792 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 828 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
793 "Grid Location (X Axis)", m_regionLocX.ToString(), true); 829 "Grid Location (X Axis)", LegacyRegionLocX.ToString(), true);
794 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 830 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
795 "Grid Location (Y Axis)", m_regionLocY.ToString(), true); 831 "Grid Location (Y Axis)", LegacyRegionLocY.ToString(), true);
796 //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); 832 //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
797 configMember.addConfigurationOption("internal_ip_address", 833 configMember.addConfigurationOption("internal_ip_address",
798 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, 834 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
@@ -916,10 +952,10 @@ namespace OpenSim.Framework
916 RegionName = (string) configuration_result; 952 RegionName = (string) configuration_result;
917 break; 953 break;
918 case "sim_location_x": 954 case "sim_location_x":
919 m_regionLocX = (uint) configuration_result; 955 LegacyRegionLocX = (uint) configuration_result;
920 break; 956 break;
921 case "sim_location_y": 957 case "sim_location_y":
922 m_regionLocY = (uint) configuration_result; 958 LegacyRegionLocY = (uint) configuration_result;
923 break; 959 break;
924 case "internal_ip_address": 960 case "internal_ip_address":
925 IPAddress address = (IPAddress) configuration_result; 961 IPAddress address = (IPAddress) configuration_result;
@@ -1000,8 +1036,8 @@ namespace OpenSim.Framework
1000 args["external_host_name"] = OSD.FromString(ExternalHostName); 1036 args["external_host_name"] = OSD.FromString(ExternalHostName);
1001 args["http_port"] = OSD.FromString(HttpPort.ToString()); 1037 args["http_port"] = OSD.FromString(HttpPort.ToString());
1002 args["server_uri"] = OSD.FromString(ServerURI); 1038 args["server_uri"] = OSD.FromString(ServerURI);
1003 args["region_xloc"] = OSD.FromString(RegionLocX.ToString()); 1039 args["region_xloc"] = OSD.FromString(LegacyRegionLocX.ToString());
1004 args["region_yloc"] = OSD.FromString(RegionLocY.ToString()); 1040 args["region_yloc"] = OSD.FromString(LegacyRegionLocY.ToString());
1005 args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString()); 1041 args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString());
1006 args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString()); 1042 args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString());
1007 if ((RemotingAddress != null) && !RemotingAddress.Equals("")) 1043 if ((RemotingAddress != null) && !RemotingAddress.Equals(""))
@@ -1032,13 +1068,13 @@ namespace OpenSim.Framework
1032 { 1068 {
1033 uint locx; 1069 uint locx;
1034 UInt32.TryParse(args["region_xloc"].AsString(), out locx); 1070 UInt32.TryParse(args["region_xloc"].AsString(), out locx);
1035 RegionLocX = locx; 1071 LegacyRegionLocX = locx;
1036 } 1072 }
1037 if (args["region_yloc"] != null) 1073 if (args["region_yloc"] != null)
1038 { 1074 {
1039 uint locy; 1075 uint locy;
1040 UInt32.TryParse(args["region_yloc"].AsString(), out locy); 1076 UInt32.TryParse(args["region_yloc"].AsString(), out locy);
1041 RegionLocY = locy; 1077 LegacyRegionLocY = locy;
1042 } 1078 }
1043 IPAddress ip_addr = null; 1079 IPAddress ip_addr = null;
1044 if (args["internal_ep_address"] != null) 1080 if (args["internal_ep_address"] != null)
@@ -1081,8 +1117,8 @@ namespace OpenSim.Framework
1081 { 1117 {
1082 Dictionary<string, object> kvp = new Dictionary<string, object>(); 1118 Dictionary<string, object> kvp = new Dictionary<string, object>();
1083 kvp["uuid"] = RegionID.ToString(); 1119 kvp["uuid"] = RegionID.ToString();
1084 kvp["locX"] = RegionLocX.ToString(); 1120 kvp["locX"] = LegacyRegionLocX.ToString();
1085 kvp["locY"] = RegionLocY.ToString(); 1121 kvp["locY"] = LegacyRegionLocY.ToString();
1086 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); 1122 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
1087 kvp["external_port"] = ExternalEndPoint.Port.ToString(); 1123 kvp["external_port"] = ExternalEndPoint.Port.ToString();
1088 kvp["external_host_name"] = ExternalHostName; 1124 kvp["external_host_name"] = ExternalHostName;