aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorRobert Adams2013-09-19 14:12:52 -0700
committerRobert Adams2013-09-28 07:33:53 -0700
commit139639d25e59d9c461e47c2cda39ba0e536820e2 (patch)
tree27a7469793e3a2672cc7f8f56bd718c7f6f58430 /OpenSim/Framework
parentVarRegion: change RegionInfo storage of region coordinates from region (diff)
downloadopensim-SC_OLD-139639d25e59d9c461e47c2cda39ba0e536820e2.zip
opensim-SC_OLD-139639d25e59d9c461e47c2cda39ba0e536820e2.tar.gz
opensim-SC_OLD-139639d25e59d9c461e47c2cda39ba0e536820e2.tar.bz2
opensim-SC_OLD-139639d25e59d9c461e47c2cda39ba0e536820e2.tar.xz
VarRegion: add RegionSize[XYZ] to RegionInfo.cs.
Update RegionInfo parameter and serialization routines to serialize the region size if it is not the LegacyRegionSize.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/RegionInfo.cs101
1 files changed, 78 insertions, 23 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 255c8e0..437c7ff 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -137,14 +137,20 @@ 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 public uint RegionWorldLocX { get; set; }
141 public uint RegionWorldLocY { get; set; }
142 protected uint m_remotingPort; 140 protected uint m_remotingPort;
143 public UUID RegionID = UUID.Zero; 141 public UUID RegionID = UUID.Zero;
144 public string RemotingAddress; 142 public string RemotingAddress;
145 public UUID ScopeID = UUID.Zero; 143 public UUID ScopeID = UUID.Zero;
146 private UUID m_maptileStaticUUID = UUID.Zero; 144 private UUID m_maptileStaticUUID = UUID.Zero;
147 145
146 public uint RegionWorldLocX = 0;
147 public uint RegionWorldLocY = 0;
148 public uint RegionWorldLocZ = 0;
149 public uint RegionSizeX = LegacyRegionSize;
150 public uint RegionSizeY = LegacyRegionSize;
151 public uint RegionSizeZ = Constants.RegionHeight;
152
153
148 private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>(); 154 private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
149 155
150 // Originally, regions were fixed size of 256 in X and Y. 156 // Originally, regions were fixed size of 256 in X and Y.
@@ -236,9 +242,6 @@ namespace OpenSim.Framework
236 242
237 public RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint, string externalUri) 243 public RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint, string externalUri)
238 { 244 {
239 RegionWorldLocX = legacyRegionLocX * LegacyRegionSize;
240 RegionWorldLocY = legacyRegionLocY * LegacyRegionSize;
241
242 m_internalEndPoint = internalEndPoint; 245 m_internalEndPoint = internalEndPoint;
243 m_externalHostName = externalUri; 246 m_externalHostName = externalUri;
244 m_serverURI = string.Empty; 247 m_serverURI = string.Empty;
@@ -484,6 +487,17 @@ namespace OpenSim.Framework
484 set { LegacyRegionLocX = value; } 487 set { LegacyRegionLocX = value; }
485 } 488 }
486 489
490 public void SetDefaultRegionSize()
491 {
492 RegionWorldLocX = 0;
493 RegionWorldLocY = 0;
494 RegionWorldLocZ = 0;
495 RegionSizeX = LegacyRegionSize;
496 RegionSizeY = LegacyRegionSize;
497 RegionSizeZ = Constants.RegionHeight;
498 }
499
500
487 /// <summary> 501 /// <summary>
488 /// The y co-ordinate of this region in map tiles (e.g. 1000). 502 /// 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 503 /// Coordinate is scaled as world coordinates divided by the legacy region size
@@ -611,6 +625,21 @@ namespace OpenSim.Framework
611 LegacyRegionLocX = Convert.ToUInt32(locationElements[0]); 625 LegacyRegionLocX = Convert.ToUInt32(locationElements[0]);
612 LegacyRegionLocY = Convert.ToUInt32(locationElements[1]); 626 LegacyRegionLocY = Convert.ToUInt32(locationElements[1]);
613 627
628 // Region size
629 // Default to legacy region size if not specified.
630 allKeys.Remove("SizeX");
631 string configSizeX = config.GetString("SizeX", LegacyRegionSize.ToString());
632 config.Set("SizeX", configSizeX);
633 RegionSizeX = Convert.ToUInt32(configSizeX);
634 allKeys.Remove("SizeY");
635 string configSizeY = config.GetString("SizeY", LegacyRegionSize.ToString());
636 config.Set("SizeY", configSizeX);
637 RegionSizeY = Convert.ToUInt32(configSizeY);
638 allKeys.Remove("SizeZ");
639 string configSizeZ = config.GetString("SizeZ", Constants.RegionHeight.ToString());
640 config.Set("SizeZ", configSizeX);
641 RegionSizeZ = Convert.ToUInt32(configSizeZ);
642
614 // InternalAddress 643 // InternalAddress
615 // 644 //
616 IPAddress address; 645 IPAddress address;
@@ -743,6 +772,13 @@ namespace OpenSim.Framework
743 string location = String.Format("{0},{1}", LegacyRegionLocX, LegacyRegionLocY); 772 string location = String.Format("{0},{1}", LegacyRegionLocX, LegacyRegionLocY);
744 config.Set("Location", location); 773 config.Set("Location", location);
745 774
775 if (RegionSizeX != LegacyRegionSize || RegionSizeY != LegacyRegionSize)
776 {
777 config.Set("SizeX", RegionSizeX);
778 config.Set("SizeY", RegionSizeY);
779 config.Set("SizeZ", RegionSizeZ);
780 }
781
746 config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); 782 config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
747 config.Set("InternalPort", m_internalEndPoint.Port); 783 config.Set("InternalPort", m_internalEndPoint.Port);
748 784
@@ -825,10 +861,18 @@ namespace OpenSim.Framework
825 RegionID.ToString(), true); 861 RegionID.ToString(), true);
826 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 862 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
827 "Region Name", RegionName, true); 863 "Region Name", RegionName, true);
864
828 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 865 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
829 "Grid Location (X Axis)", LegacyRegionLocX.ToString(), true); 866 "Grid Location (X Axis)", LegacyRegionLocX.ToString(), true);
830 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 867 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
831 "Grid Location (Y Axis)", LegacyRegionLocY.ToString(), true); 868 "Grid Location (Y Axis)", LegacyRegionLocY.ToString(), true);
869 configMember.addConfigurationOption("sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
870 "Size of region in X dimension", RegionSizeX.ToString(), true);
871 configMember.addConfigurationOption("sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
872 "Size of region in Y dimension", RegionSizeY.ToString(), true);
873 configMember.addConfigurationOption("sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
874 "Size of region in Z dimension", RegionSizeZ.ToString(), true);
875
832 //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); 876 //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
833 configMember.addConfigurationOption("internal_ip_address", 877 configMember.addConfigurationOption("internal_ip_address",
834 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, 878 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
@@ -891,10 +935,18 @@ namespace OpenSim.Framework
891 UUID.Random().ToString(), true); 935 UUID.Random().ToString(), true);
892 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 936 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
893 "Region Name", "OpenSim Test", false); 937 "Region Name", "OpenSim Test", false);
938
894 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 939 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
895 "Grid Location (X Axis)", "1000", false); 940 "Grid Location (X Axis)", "1000", false);
896 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 941 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
897 "Grid Location (Y Axis)", "1000", false); 942 "Grid Location (Y Axis)", "1000", false);
943 configMember.addConfigurationOption("sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
944 "Size of region in X dimension", LegacyRegionSize.ToString(), false);
945 configMember.addConfigurationOption("sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
946 "Size of region in Y dimension", LegacyRegionSize.ToString(), false);
947 configMember.addConfigurationOption("sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
948 "Size of region in Z dimension", Constants.RegionHeight.ToString(), false);
949
898 //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); 950 //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
899 configMember.addConfigurationOption("internal_ip_address", 951 configMember.addConfigurationOption("internal_ip_address",
900 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, 952 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
@@ -957,6 +1009,15 @@ namespace OpenSim.Framework
957 case "sim_location_y": 1009 case "sim_location_y":
958 LegacyRegionLocY = (uint) configuration_result; 1010 LegacyRegionLocY = (uint) configuration_result;
959 break; 1011 break;
1012 case "sim_size_x":
1013 RegionSizeX = (uint) configuration_result;
1014 break;
1015 case "sim_size_y":
1016 RegionSizeY = (uint) configuration_result;
1017 break;
1018 case "sim_size_z":
1019 RegionSizeZ = (uint) configuration_result;
1020 break;
960 case "internal_ip_address": 1021 case "internal_ip_address":
961 IPAddress address = (IPAddress) configuration_result; 1022 IPAddress address = (IPAddress) configuration_result;
962 m_internalEndPoint = new IPEndPoint(address, 0); 1023 m_internalEndPoint = new IPEndPoint(address, 0);
@@ -1036,8 +1097,13 @@ namespace OpenSim.Framework
1036 args["external_host_name"] = OSD.FromString(ExternalHostName); 1097 args["external_host_name"] = OSD.FromString(ExternalHostName);
1037 args["http_port"] = OSD.FromString(HttpPort.ToString()); 1098 args["http_port"] = OSD.FromString(HttpPort.ToString());
1038 args["server_uri"] = OSD.FromString(ServerURI); 1099 args["server_uri"] = OSD.FromString(ServerURI);
1100
1039 args["region_xloc"] = OSD.FromString(LegacyRegionLocX.ToString()); 1101 args["region_xloc"] = OSD.FromString(LegacyRegionLocX.ToString());
1040 args["region_yloc"] = OSD.FromString(LegacyRegionLocY.ToString()); 1102 args["region_yloc"] = OSD.FromString(LegacyRegionLocY.ToString());
1103 args["region_size_x"] = OSD.FromString(RegionSizeX.ToString());
1104 args["region_size_y"] = OSD.FromString(RegionSizeY.ToString());
1105 args["region_size_z"] = OSD.FromString(RegionSizeZ.ToString());
1106
1041 args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString()); 1107 args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString());
1042 args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString()); 1108 args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString());
1043 if ((RemotingAddress != null) && !RemotingAddress.Equals("")) 1109 if ((RemotingAddress != null) && !RemotingAddress.Equals(""))
@@ -1076,6 +1142,13 @@ namespace OpenSim.Framework
1076 UInt32.TryParse(args["region_yloc"].AsString(), out locy); 1142 UInt32.TryParse(args["region_yloc"].AsString(), out locy);
1077 LegacyRegionLocY = locy; 1143 LegacyRegionLocY = locy;
1078 } 1144 }
1145 if (args.ContainsKey("region_size_x"))
1146 RegionSizeX = (uint)args["region_size_x"].AsInteger();
1147 if (args.ContainsKey("region_size_y"))
1148 RegionSizeY = (uint)args["region_size_y"].AsInteger();
1149 if (args.ContainsKey("region_size_z"))
1150 RegionSizeZ = (uint)args["region_size_z"].AsInteger();
1151
1079 IPAddress ip_addr = null; 1152 IPAddress ip_addr = null;
1080 if (args["internal_ep_address"] != null) 1153 if (args["internal_ep_address"] != null)
1081 { 1154 {
@@ -1112,23 +1185,5 @@ namespace OpenSim.Framework
1112 regionInfo.ServerURI = serverURI; 1185 regionInfo.ServerURI = serverURI;
1113 return regionInfo; 1186 return regionInfo;
1114 } 1187 }
1115
1116 public Dictionary<string, object> ToKeyValuePairs()
1117 {
1118 Dictionary<string, object> kvp = new Dictionary<string, object>();
1119 kvp["uuid"] = RegionID.ToString();
1120 kvp["locX"] = LegacyRegionLocX.ToString();
1121 kvp["locY"] = LegacyRegionLocY.ToString();
1122 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
1123 kvp["external_port"] = ExternalEndPoint.Port.ToString();
1124 kvp["external_host_name"] = ExternalHostName;
1125 kvp["http_port"] = HttpPort.ToString();
1126 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
1127 kvp["internal_port"] = InternalEndPoint.Port.ToString();
1128 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
1129 kvp["server_uri"] = ServerURI;
1130
1131 return kvp;
1132 }
1133 } 1188 }
1134} 1189}