diff options
author | Melanie | 2014-01-05 20:12:32 +0000 |
---|---|---|
committer | Melanie | 2014-01-05 20:12:32 +0000 |
commit | e79fab91dbe731e9d177de61993d963bcc067299 (patch) | |
tree | 4358fd508e55dd91774ba83b8e4c30fc24f452c7 /OpenSim/Framework/RegionInfo.cs | |
parent | Merge commit '92aad6f1bb45974927fa43d6fd30f98337dee3f0' into careminster (diff) | |
parent | Some missing definitions needed for successful compilation. (diff) | |
download | opensim-SC-e79fab91dbe731e9d177de61993d963bcc067299.zip opensim-SC-e79fab91dbe731e9d177de61993d963bcc067299.tar.gz opensim-SC-e79fab91dbe731e9d177de61993d963bcc067299.tar.bz2 opensim-SC-e79fab91dbe731e9d177de61993d963bcc067299.tar.xz |
Intermediate commit. Sill errors.
Merge branch 'master' into careminster
Conflicts:
OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
OpenSim/Framework/RegionInfo.cs
OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
OpenSim/Services/UserProfilesService/UserProfilesService.cs
Diffstat (limited to 'OpenSim/Framework/RegionInfo.cs')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 172 |
1 files changed, 153 insertions, 19 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 6dde62f..b9e84ac 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -100,6 +100,7 @@ namespace OpenSim.Framework | |||
100 | public class RegionInfo | 100 | public class RegionInfo |
101 | { | 101 | { |
102 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 102 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
103 | private static readonly string LogHeader = "[REGION INFO]"; | ||
103 | 104 | ||
104 | public bool commFailTF = false; | 105 | public bool commFailTF = false; |
105 | public ConfigurationMember configMember; | 106 | public ConfigurationMember configMember; |
@@ -139,16 +140,20 @@ namespace OpenSim.Framework | |||
139 | public bool m_allow_alternate_ports; | 140 | public bool m_allow_alternate_ports; |
140 | protected string m_externalHostName; | 141 | protected string m_externalHostName; |
141 | protected IPEndPoint m_internalEndPoint; | 142 | protected IPEndPoint m_internalEndPoint; |
142 | protected uint? m_regionLocX; | ||
143 | protected uint? m_regionLocY; | ||
144 | protected uint m_remotingPort; | 143 | protected uint m_remotingPort; |
145 | public UUID RegionID = UUID.Zero; | 144 | public UUID RegionID = UUID.Zero; |
146 | public string RemotingAddress; | 145 | public string RemotingAddress; |
147 | public UUID ScopeID = UUID.Zero; | 146 | public UUID ScopeID = UUID.Zero; |
148 | private UUID m_maptileStaticUUID = UUID.Zero; | 147 | private UUID m_maptileStaticUUID = UUID.Zero; |
149 | 148 | ||
150 | private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>(); | 149 | public uint WorldLocX = 0; |
150 | public uint WorldLocY = 0; | ||
151 | public uint WorldLocZ = 0; | ||
152 | public uint RegionSizeX = Constants.RegionSize; | ||
153 | public uint RegionSizeY = Constants.RegionSize; | ||
154 | public uint RegionSizeZ = Constants.RegionHeight; | ||
151 | 155 | ||
156 | private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>(); | ||
152 | 157 | ||
153 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. | 158 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. |
154 | 159 | ||
@@ -231,11 +236,12 @@ namespace OpenSim.Framework | |||
231 | m_serverURI = string.Empty; | 236 | m_serverURI = string.Empty; |
232 | } | 237 | } |
233 | 238 | ||
234 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | 239 | public RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint, string externalUri) |
235 | { | 240 | { |
236 | m_regionLocX = regionLocX; | 241 | RegionLocX = legacyRegionLocX; |
237 | m_regionLocY = regionLocY; | 242 | RegionLocY = legacyRegionLocY; |
238 | 243 | RegionSizeX = Constants.RegionSize; | |
244 | RegionSizeY = Constants.RegionSize; | ||
239 | m_internalEndPoint = internalEndPoint; | 245 | m_internalEndPoint = internalEndPoint; |
240 | m_externalHostName = externalUri; | 246 | m_externalHostName = externalUri; |
241 | m_serverURI = string.Empty; | 247 | m_serverURI = string.Empty; |
@@ -449,25 +455,42 @@ namespace OpenSim.Framework | |||
449 | 455 | ||
450 | /// <summary> | 456 | /// <summary> |
451 | /// The x co-ordinate of this region in map tiles (e.g. 1000). | 457 | /// The x co-ordinate of this region in map tiles (e.g. 1000). |
458 | /// Coordinate is scaled as world coordinates divided by the legacy region size | ||
459 | /// and is thus is the number of legacy regions. | ||
452 | /// </summary> | 460 | /// </summary> |
453 | public uint RegionLocX | 461 | public uint RegionLocX |
454 | { | 462 | { |
455 | get { return m_regionLocX.Value; } | 463 | get { return WorldLocX / Constants.RegionSize; } |
456 | set { m_regionLocX = value; } | 464 | set { WorldLocX = value * Constants.RegionSize; } |
457 | } | 465 | } |
458 | 466 | ||
459 | /// <summary> | 467 | /// <summary> |
460 | /// The y co-ordinate of this region in map tiles (e.g. 1000). | 468 | /// The y co-ordinate of this region in map tiles (e.g. 1000). |
469 | /// Coordinate is scaled as world coordinates divided by the legacy region size | ||
470 | /// and is thus is the number of legacy regions. | ||
461 | /// </summary> | 471 | /// </summary> |
462 | public uint RegionLocY | 472 | public uint RegionLocY |
463 | { | 473 | { |
464 | get { return m_regionLocY.Value; } | 474 | get { return WorldLocY / Constants.RegionSize; } |
465 | set { m_regionLocY = value; } | 475 | set { WorldLocY = value * Constants.RegionSize; } |
466 | } | 476 | } |
467 | 477 | ||
478 | public void SetDefaultRegionSize() | ||
479 | { | ||
480 | WorldLocX = 0; | ||
481 | WorldLocY = 0; | ||
482 | WorldLocZ = 0; | ||
483 | RegionSizeX = Constants.RegionSize; | ||
484 | RegionSizeY = Constants.RegionSize; | ||
485 | RegionSizeZ = Constants.RegionHeight; | ||
486 | } | ||
487 | |||
488 | // A unique region handle is created from the region's world coordinates. | ||
489 | // This cannot be changed because some code expects to receive the region handle and then | ||
490 | // compute the region coordinates from it. | ||
468 | public ulong RegionHandle | 491 | public ulong RegionHandle |
469 | { | 492 | { |
470 | get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } | 493 | get { return Util.UIntsToLong(WorldLocX, WorldLocY); } |
471 | } | 494 | } |
472 | 495 | ||
473 | public void SetEndPoint(string ipaddr, int port) | 496 | public void SetEndPoint(string ipaddr, int port) |
@@ -574,8 +597,25 @@ namespace OpenSim.Framework | |||
574 | 597 | ||
575 | string[] locationElements = location.Split(new char[] {','}); | 598 | string[] locationElements = location.Split(new char[] {','}); |
576 | 599 | ||
577 | m_regionLocX = Convert.ToUInt32(locationElements[0]); | 600 | RegionLocX = Convert.ToUInt32(locationElements[0]); |
578 | m_regionLocY = Convert.ToUInt32(locationElements[1]); | 601 | RegionLocY = Convert.ToUInt32(locationElements[1]); |
602 | |||
603 | // Region size | ||
604 | // Default to legacy region size if not specified. | ||
605 | allKeys.Remove("SizeX"); | ||
606 | string configSizeX = config.GetString("SizeX", Constants.RegionSize.ToString()); | ||
607 | config.Set("SizeX", configSizeX); | ||
608 | RegionSizeX = Convert.ToUInt32(configSizeX); | ||
609 | allKeys.Remove("SizeY"); | ||
610 | string configSizeY = config.GetString("SizeY", Constants.RegionSize.ToString()); | ||
611 | config.Set("SizeY", configSizeX); | ||
612 | RegionSizeY = Convert.ToUInt32(configSizeY); | ||
613 | allKeys.Remove("SizeZ"); | ||
614 | string configSizeZ = config.GetString("SizeZ", Constants.RegionHeight.ToString()); | ||
615 | config.Set("SizeZ", configSizeX); | ||
616 | RegionSizeZ = Convert.ToUInt32(configSizeZ); | ||
617 | |||
618 | DoRegionSizeSanityChecks(); | ||
579 | 619 | ||
580 | // InternalAddress | 620 | // InternalAddress |
581 | // | 621 | // |
@@ -695,6 +735,57 @@ namespace OpenSim.Framework | |||
695 | } | 735 | } |
696 | } | 736 | } |
697 | 737 | ||
738 | // Make sure user specified region sizes are sane. | ||
739 | // Must be multiples of legacy region size (256). | ||
740 | private void DoRegionSizeSanityChecks() | ||
741 | { | ||
742 | if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize) | ||
743 | { | ||
744 | // Doing non-legacy region sizes. | ||
745 | // Enforce region size to be multiples of the legacy region size (256) | ||
746 | uint partial = RegionSizeX % Constants.RegionSize; | ||
747 | if (partial != 0) | ||
748 | { | ||
749 | RegionSizeX -= partial; | ||
750 | if (RegionSizeX == 0) | ||
751 | RegionSizeX = Constants.RegionSize; | ||
752 | m_log.ErrorFormat("{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeX={3} instead of specified {4}", | ||
753 | LogHeader, Constants.RegionSize, m_regionName, RegionSizeX, RegionSizeX + partial); | ||
754 | } | ||
755 | partial = RegionSizeY % Constants.RegionSize; | ||
756 | if (partial != 0) | ||
757 | { | ||
758 | RegionSizeY -= partial; | ||
759 | if (RegionSizeY == 0) | ||
760 | RegionSizeY = Constants.RegionSize; | ||
761 | m_log.ErrorFormat("{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeY={3} instead of specified {4}", | ||
762 | LogHeader, Constants.RegionSize, m_regionName, RegionSizeY, RegionSizeY + partial); | ||
763 | } | ||
764 | |||
765 | // Because of things in the viewer, regions MUST be square. | ||
766 | // Remove this check when viewers have been updated. | ||
767 | if (RegionSizeX != RegionSizeY) | ||
768 | { | ||
769 | uint minSize = Math.Min(RegionSizeX, RegionSizeY); | ||
770 | RegionSizeX = minSize; | ||
771 | RegionSizeY = minSize; | ||
772 | m_log.ErrorFormat("{0} Regions must be square until viewers are updated. Forcing region {1} size to <{2},{3}>", | ||
773 | LogHeader, m_regionName, RegionSizeX, RegionSizeY); | ||
774 | } | ||
775 | |||
776 | // There is a practical limit to region size. | ||
777 | if (RegionSizeX > Constants.MaximumRegionSize || RegionSizeY > Constants.MaximumRegionSize) | ||
778 | { | ||
779 | RegionSizeX = Util.Clamp<uint>(RegionSizeX, Constants.RegionSize, Constants.MaximumRegionSize); | ||
780 | RegionSizeY = Util.Clamp<uint>(RegionSizeY, Constants.RegionSize, Constants.MaximumRegionSize); | ||
781 | m_log.ErrorFormat("{0} Region dimensions must be less than {1}. Clamping {2}'s size to <{3},{4}>", | ||
782 | LogHeader, Constants.MaximumRegionSize, m_regionName, RegionSizeX, RegionSizeY); | ||
783 | } | ||
784 | |||
785 | m_log.InfoFormat("{0} Region {1} size set to <{2},{3}>", LogHeader, m_regionName, RegionSizeX, RegionSizeY); | ||
786 | } | ||
787 | } | ||
788 | |||
698 | private void WriteNiniConfig(IConfigSource source) | 789 | private void WriteNiniConfig(IConfigSource source) |
699 | { | 790 | { |
700 | IConfig config = source.Configs[RegionName]; | 791 | IConfig config = source.Configs[RegionName]; |
@@ -706,11 +797,17 @@ namespace OpenSim.Framework | |||
706 | 797 | ||
707 | config.Set("RegionUUID", RegionID.ToString()); | 798 | config.Set("RegionUUID", RegionID.ToString()); |
708 | 799 | ||
709 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); | 800 | string location = String.Format("{0},{1}", RegionLocX, RegionLocY); |
710 | config.Set("Location", location); | 801 | config.Set("Location", location); |
711 | 802 | ||
712 | if (DataStore != String.Empty) | 803 | if (DataStore != String.Empty) |
713 | config.Set("Datastore", DataStore); | 804 | config.Set("Datastore", DataStore); |
805 | if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize) | ||
806 | { | ||
807 | config.Set("SizeX", RegionSizeX); | ||
808 | config.Set("SizeY", RegionSizeY); | ||
809 | config.Set("SizeZ", RegionSizeZ); | ||
810 | } | ||
714 | 811 | ||
715 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); | 812 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); |
716 | config.Set("InternalPort", m_internalEndPoint.Port); | 813 | config.Set("InternalPort", m_internalEndPoint.Port); |
@@ -794,10 +891,18 @@ namespace OpenSim.Framework | |||
794 | RegionID.ToString(), true); | 891 | RegionID.ToString(), true); |
795 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | 892 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
796 | "Region Name", RegionName, true); | 893 | "Region Name", RegionName, true); |
894 | |||
797 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | 895 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, |
798 | "Grid Location (X Axis)", m_regionLocX.ToString(), true); | 896 | "Grid Location (X Axis)", RegionLocX.ToString(), true); |
799 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | 897 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, |
800 | "Grid Location (Y Axis)", m_regionLocY.ToString(), true); | 898 | "Grid Location (Y Axis)", RegionLocY.ToString(), true); |
899 | configMember.addConfigurationOption("sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
900 | "Size of region in X dimension", RegionSizeX.ToString(), true); | ||
901 | configMember.addConfigurationOption("sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
902 | "Size of region in Y dimension", RegionSizeY.ToString(), true); | ||
903 | configMember.addConfigurationOption("sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
904 | "Size of region in Z dimension", RegionSizeZ.ToString(), true); | ||
905 | |||
801 | //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); | 906 | //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); |
802 | configMember.addConfigurationOption("internal_ip_address", | 907 | configMember.addConfigurationOption("internal_ip_address", |
803 | ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, | 908 | ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, |
@@ -860,10 +965,18 @@ namespace OpenSim.Framework | |||
860 | UUID.Random().ToString(), true); | 965 | UUID.Random().ToString(), true); |
861 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | 966 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
862 | "Region Name", "OpenSim Test", false); | 967 | "Region Name", "OpenSim Test", false); |
968 | |||
863 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | 969 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, |
864 | "Grid Location (X Axis)", "1000", false); | 970 | "Grid Location (X Axis)", "1000", false); |
865 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | 971 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, |
866 | "Grid Location (Y Axis)", "1000", false); | 972 | "Grid Location (Y Axis)", "1000", false); |
973 | configMember.addConfigurationOption("sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
974 | "Size of region in X dimension", Constants.RegionSize.ToString(), false); | ||
975 | configMember.addConfigurationOption("sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
976 | "Size of region in Y dimension", Constants.RegionSize.ToString(), false); | ||
977 | configMember.addConfigurationOption("sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
978 | "Size of region in Z dimension", Constants.RegionHeight.ToString(), false); | ||
979 | |||
867 | //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); | 980 | //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); |
868 | configMember.addConfigurationOption("internal_ip_address", | 981 | configMember.addConfigurationOption("internal_ip_address", |
869 | ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, | 982 | ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, |
@@ -921,10 +1034,19 @@ namespace OpenSim.Framework | |||
921 | RegionName = (string) configuration_result; | 1034 | RegionName = (string) configuration_result; |
922 | break; | 1035 | break; |
923 | case "sim_location_x": | 1036 | case "sim_location_x": |
924 | m_regionLocX = (uint) configuration_result; | 1037 | RegionLocX = (uint) configuration_result; |
925 | break; | 1038 | break; |
926 | case "sim_location_y": | 1039 | case "sim_location_y": |
927 | m_regionLocY = (uint) configuration_result; | 1040 | RegionLocY = (uint) configuration_result; |
1041 | break; | ||
1042 | case "sim_size_x": | ||
1043 | RegionSizeX = (uint) configuration_result; | ||
1044 | break; | ||
1045 | case "sim_size_y": | ||
1046 | RegionSizeY = (uint) configuration_result; | ||
1047 | break; | ||
1048 | case "sim_size_z": | ||
1049 | RegionSizeZ = (uint) configuration_result; | ||
928 | break; | 1050 | break; |
929 | case "datastore": | 1051 | case "datastore": |
930 | DataStore = (string) configuration_result; | 1052 | DataStore = (string) configuration_result; |
@@ -1008,8 +1130,13 @@ namespace OpenSim.Framework | |||
1008 | args["external_host_name"] = OSD.FromString(ExternalHostName); | 1130 | args["external_host_name"] = OSD.FromString(ExternalHostName); |
1009 | args["http_port"] = OSD.FromString(HttpPort.ToString()); | 1131 | args["http_port"] = OSD.FromString(HttpPort.ToString()); |
1010 | args["server_uri"] = OSD.FromString(ServerURI); | 1132 | args["server_uri"] = OSD.FromString(ServerURI); |
1133 | |||
1011 | args["region_xloc"] = OSD.FromString(RegionLocX.ToString()); | 1134 | args["region_xloc"] = OSD.FromString(RegionLocX.ToString()); |
1012 | args["region_yloc"] = OSD.FromString(RegionLocY.ToString()); | 1135 | args["region_yloc"] = OSD.FromString(RegionLocY.ToString()); |
1136 | args["region_size_x"] = OSD.FromString(RegionSizeX.ToString()); | ||
1137 | args["region_size_y"] = OSD.FromString(RegionSizeY.ToString()); | ||
1138 | args["region_size_z"] = OSD.FromString(RegionSizeZ.ToString()); | ||
1139 | |||
1013 | args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString()); | 1140 | args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString()); |
1014 | args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString()); | 1141 | args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString()); |
1015 | if ((RemotingAddress != null) && !RemotingAddress.Equals("")) | 1142 | if ((RemotingAddress != null) && !RemotingAddress.Equals("")) |
@@ -1048,6 +1175,13 @@ namespace OpenSim.Framework | |||
1048 | UInt32.TryParse(args["region_yloc"].AsString(), out locy); | 1175 | UInt32.TryParse(args["region_yloc"].AsString(), out locy); |
1049 | RegionLocY = locy; | 1176 | RegionLocY = locy; |
1050 | } | 1177 | } |
1178 | if (args.ContainsKey("region_size_x")) | ||
1179 | RegionSizeX = (uint)args["region_size_x"].AsInteger(); | ||
1180 | if (args.ContainsKey("region_size_y")) | ||
1181 | RegionSizeY = (uint)args["region_size_y"].AsInteger(); | ||
1182 | if (args.ContainsKey("region_size_z")) | ||
1183 | RegionSizeZ = (uint)args["region_size_z"].AsInteger(); | ||
1184 | |||
1051 | IPAddress ip_addr = null; | 1185 | IPAddress ip_addr = null; |
1052 | if (args["internal_ep_address"] != null) | 1186 | if (args["internal_ep_address"] != null) |
1053 | { | 1187 | { |