aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMelanie2014-01-05 20:12:32 +0000
committerMelanie2014-01-05 20:12:32 +0000
commite79fab91dbe731e9d177de61993d963bcc067299 (patch)
tree4358fd508e55dd91774ba83b8e4c30fc24f452c7 /OpenSim/Framework
parentMerge commit '92aad6f1bb45974927fa43d6fd30f98337dee3f0' into careminster (diff)
parentSome missing definitions needed for successful compilation. (diff)
downloadopensim-SC_OLD-e79fab91dbe731e9d177de61993d963bcc067299.zip
opensim-SC_OLD-e79fab91dbe731e9d177de61993d963bcc067299.tar.gz
opensim-SC_OLD-e79fab91dbe731e9d177de61993d963bcc067299.tar.bz2
opensim-SC_OLD-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')
-rw-r--r--OpenSim/Framework/Constants.cs11
-rw-r--r--OpenSim/Framework/RegionInfo.cs172
-rw-r--r--OpenSim/Framework/SLUtil.cs30
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs4
-rw-r--r--OpenSim/Framework/Util.cs43
5 files changed, 223 insertions, 37 deletions
diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs
index a2eb5ee..3ba264c 100644
--- a/OpenSim/Framework/Constants.cs
+++ b/OpenSim/Framework/Constants.cs
@@ -30,9 +30,18 @@ namespace OpenSim.Framework
30{ 30{
31 public class Constants 31 public class Constants
32 { 32 {
33 // 'RegionSize' is the legacy region size.
34 // DO NOT USE THIS FOR ANY NEW CODE. Use Scene.RegionInfo.RegionSize[XYZ] as a region might not
35 // be the legacy region size.
33 public const uint RegionSize = 256; 36 public const uint RegionSize = 256;
34 public const uint RegionHeight = 4096; 37 public const uint RegionHeight = 4096;
35 public const byte TerrainPatchSize = 16; 38 // This could be a parameters but, really, a region of greater than this is pretty unmanageable
39 public const uint MaximumRegionSize = 8192;
40
41 // Since terrain is stored in 16x16 heights, regions must be a multiple of this number and that is the minimum
42 public const int MinRegionSize = 16;
43 public const int TerrainPatchSize = 16;
44
36 public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f"; 45 public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f";
37 46
38 public enum EstateAccessCodex : uint 47 public enum EstateAccessCodex : uint
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 {
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs
index 537de7a..cb73e8f 100644
--- a/OpenSim/Framework/SLUtil.cs
+++ b/OpenSim/Framework/SLUtil.cs
@@ -247,12 +247,18 @@ namespace OpenSim.Framework
247 /// <returns></returns> 247 /// <returns></returns>
248 public static List<string> ParseNotecardToList(string rawInput) 248 public static List<string> ParseNotecardToList(string rawInput)
249 { 249 {
250 string[] input = rawInput.Replace("\r", "").Split('\n'); 250 string[] input;
251 int idx = 0; 251 int idx = 0;
252 int level = 0; 252 int level = 0;
253 List<string> output = new List<string>(); 253 List<string> output = new List<string>();
254 string[] words; 254 string[] words;
255 255
256 //The Linden format always ends with a } after the input data.
257 //Strip off trailing } so there is nothing after the input data.
258 int i = rawInput.LastIndexOf("}");
259 rawInput = rawInput.Remove(i, rawInput.Length-i);
260 input = rawInput.Replace("\r", "").Split('\n');
261
256 while (idx < input.Length) 262 while (idx < input.Length)
257 { 263 {
258 if (input[idx] == "{") 264 if (input[idx] == "{")
@@ -287,24 +293,18 @@ namespace OpenSim.Framework
287 break; 293 break;
288 if (words[0] == "Text") 294 if (words[0] == "Text")
289 { 295 {
290 int len = int.Parse(words[2]); 296 idx++; //Now points to first line of notecard text
291 idx++;
292 297
293 int count = -1; 298 //Number of lines in notecard.
299 int lines = input.Length - idx;
300 int line = 0;
294 301
295 while (count < len && idx < input.Length) 302 while (line < lines)
296 { 303 {
297 // int l = input[idx].Length; 304// m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", input[idx]);
298 string ln = input[idx]; 305 output.Add(input[idx]);
299
300 int need = len-count-1;
301 if (ln.Length > need)
302 ln = ln.Substring(0, need);
303
304// m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", ln);
305 output.Add(ln);
306 count += ln.Length + 1;
307 idx++; 306 idx++;
307 line++;
308 } 308 }
309 309
310 return output; 310 return output;
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index bfd67c7..cbd34a2 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -145,8 +145,8 @@ namespace OpenSim.Framework.Servers
145 145
146 TimeSpan timeTaken = DateTime.Now - m_startuptime; 146 TimeSpan timeTaken = DateTime.Now - m_startuptime;
147 147
148 m_log.InfoFormat( 148 MainConsole.Instance.OutputFormat(
149 "[STARTUP]: Non-script portion of startup took {0}m {1}s. PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED.", 149 "PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED. Non-script portion of startup took {0}m {1}s.",
150 timeTaken.Minutes, timeTaken.Seconds); 150 timeTaken.Minutes, timeTaken.Seconds);
151 } 151 }
152 152
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 7db575b..87a53ff 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -333,6 +333,49 @@ namespace OpenSim.Framework
333 return Utils.UIntsToLong(X, Y); 333 return Utils.UIntsToLong(X, Y);
334 } 334 }
335 335
336 // Regions are identified with a 'handle' made up of its region coordinates packed into a ulong.
337 // Several places rely on the ability to extract a region's location from its handle.
338 // Note the location is in 'world coordinates' (see below).
339 // Region handles are based on the lowest coordinate of the region so trim the passed x,y to be the regions 0,0.
340 public static ulong RegionWorldLocToHandle(uint X, uint Y)
341 {
342 return Utils.UIntsToLong(X, Y);
343 }
344
345 public static ulong RegionLocToHandle(uint X, uint Y)
346 {
347 return Utils.UIntsToLong(Util.RegionToWorldLoc(X), Util.RegionToWorldLoc(Y));
348 }
349
350 public static void RegionHandleToWorldLoc(ulong handle, out uint X, out uint Y)
351 {
352 X = (uint)(handle >> 32);
353 Y = (uint)(handle & (ulong)uint.MaxValue);
354 }
355
356 public static void RegionHandleToRegionLoc(ulong handle, out uint X, out uint Y)
357 {
358 uint worldX, worldY;
359 RegionHandleToWorldLoc(handle, out worldX, out worldY);
360 X = WorldToRegionLoc(worldX);
361 Y = WorldToRegionLoc(worldY);
362 }
363
364 // A region location can be 'world coordinates' (meters from zero) or 'region coordinates'
365 // (number of regions from zero). This measurement of regions relies on the legacy 256 region size.
366 // These routines exist to make what is being converted explicit so the next person knows what was meant.
367 // Convert a region's 'world coordinate' to its 'region coordinate'.
368 public static uint WorldToRegionLoc(uint worldCoord)
369 {
370 return worldCoord / Constants.RegionSize;
371 }
372
373 // Convert a region's 'region coordinate' to its 'world coordinate'.
374 public static uint RegionToWorldLoc(uint regionCoord)
375 {
376 return regionCoord * Constants.RegionSize;
377 }
378
336 public static T Clamp<T>(T x, T min, T max) 379 public static T Clamp<T>(T x, T min, T max)
337 where T : IComparable<T> 380 where T : IComparable<T>
338 { 381 {