diff options
author | UbitUmarov | 2018-01-05 22:37:42 +0000 |
---|---|---|
committer | UbitUmarov | 2018-01-05 22:37:42 +0000 |
commit | 875ca104b85dbf48fc0e5035dc2c01b10a61f8e9 (patch) | |
tree | 5a48cbd483b57c88d5be9c012e8f28422f3e368f /OpenSim/Region/Framework/Scenes | |
parent | Merge branch 'master' into httptests (diff) | |
parent | a few more xml things (diff) | |
download | opensim-SC-875ca104b85dbf48fc0e5035dc2c01b10a61f8e9.zip opensim-SC-875ca104b85dbf48fc0e5035dc2c01b10a61f8e9.tar.gz opensim-SC-875ca104b85dbf48fc0e5035dc2c01b10a61f8e9.tar.bz2 opensim-SC-875ca104b85dbf48fc0e5035dc2c01b10a61f8e9.tar.xz |
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
12 files changed, 222 insertions, 161 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs index b8db3a9..38ab934 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs | |||
@@ -58,7 +58,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
58 | 58 | ||
59 | using (XmlTextReader reader = new XmlTextReader(path)) | 59 | using (XmlTextReader reader = new XmlTextReader(path)) |
60 | { | 60 | { |
61 | reader.DtdProcessing = DtdProcessing.Prohibit; | ||
62 | reader.XmlResolver = null; | ||
61 | XmlDocument doc = new XmlDocument(); | 63 | XmlDocument doc = new XmlDocument(); |
64 | doc.XmlResolver = null; | ||
65 | |||
62 | doc.Load(reader); | 66 | doc.Load(reader); |
63 | // if (doc.DocumentElement != null) | 67 | // if (doc.DocumentElement != null) |
64 | // { | 68 | // { |
diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs index 351eda3..22734b3 100644 --- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs | |||
@@ -593,6 +593,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
593 | UTF8Encoding enc = new UTF8Encoding(); | 593 | UTF8Encoding enc = new UTF8Encoding(); |
594 | MemoryStream ms = new MemoryStream(enc.GetBytes(text)); | 594 | MemoryStream ms = new MemoryStream(enc.GetBytes(text)); |
595 | XmlTextReader xreader = new XmlTextReader(ms); | 595 | XmlTextReader xreader = new XmlTextReader(ms); |
596 | xreader.DtdProcessing = DtdProcessing.Prohibit; | ||
597 | xreader.XmlResolver = null; | ||
596 | 598 | ||
597 | SOPVehicle v = new SOPVehicle(); | 599 | SOPVehicle v = new SOPVehicle(); |
598 | bool error; | 600 | bool error; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f29cdf4..84367df 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2389,7 +2389,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2389 | { | 2389 | { |
2390 | using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) | 2390 | using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) |
2391 | { | 2391 | { |
2392 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) | 2392 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null })) |
2393 | { | 2393 | { |
2394 | reader.Read(); | 2394 | reader.Read(); |
2395 | bool isSingleObject = reader.Name != "CoalescedObject"; | 2395 | bool isSingleObject = reader.Name != "CoalescedObject"; |
@@ -2420,6 +2420,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2420 | else | 2420 | else |
2421 | { | 2421 | { |
2422 | XmlDocument doc = new XmlDocument(); | 2422 | XmlDocument doc = new XmlDocument(); |
2423 | doc.XmlResolver=null; | ||
2423 | doc.LoadXml(xmlData); | 2424 | doc.LoadXml(xmlData); |
2424 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); | 2425 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); |
2425 | XmlElement coll = (XmlElement)e; | 2426 | XmlElement coll = (XmlElement)e; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index bf217a5..c20c81d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -505,6 +505,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
505 | foreach (KeyValuePair<UUID, string> state in states) | 505 | foreach (KeyValuePair<UUID, string> state in states) |
506 | { | 506 | { |
507 | XmlDocument sdoc = new XmlDocument(); | 507 | XmlDocument sdoc = new XmlDocument(); |
508 | sdoc.XmlResolver=null; | ||
508 | sdoc.LoadXml(state.Value); | 509 | sdoc.LoadXml(state.Value); |
509 | XmlNodeList rootL = sdoc.GetElementsByTagName("State"); | 510 | XmlNodeList rootL = sdoc.GetElementsByTagName("State"); |
510 | XmlNode rootNode = rootL[0]; | 511 | XmlNode rootNode = rootL[0]; |
@@ -540,6 +541,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
540 | return; | 541 | return; |
541 | 542 | ||
542 | XmlDocument doc = new XmlDocument(); | 543 | XmlDocument doc = new XmlDocument(); |
544 | doc.XmlResolver=null; | ||
543 | try | 545 | try |
544 | { | 546 | { |
545 | doc.LoadXml(objXMLData); | 547 | doc.LoadXml(objXMLData); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3380191..21311b0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1994,6 +1994,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1994 | public void SaveScriptedState(XmlTextWriter writer, bool oldIDs) | 1994 | public void SaveScriptedState(XmlTextWriter writer, bool oldIDs) |
1995 | { | 1995 | { |
1996 | XmlDocument doc = new XmlDocument(); | 1996 | XmlDocument doc = new XmlDocument(); |
1997 | doc.XmlResolver=null; | ||
1997 | Dictionary<UUID,string> states = new Dictionary<UUID,string>(); | 1998 | Dictionary<UUID,string> states = new Dictionary<UUID,string>(); |
1998 | 1999 | ||
1999 | SceneObjectPart[] parts = m_parts.GetArray(); | 2000 | SceneObjectPart[] parts = m_parts.GetArray(); |
@@ -2782,7 +2783,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2782 | return RootPart.Torque; | 2783 | return RootPart.Torque; |
2783 | } | 2784 | } |
2784 | 2785 | ||
2785 | // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object | 2786 | // This is used by llMoveToTarget() in an attached object |
2786 | public void MoveToTarget(Vector3 target, float tau) | 2787 | public void MoveToTarget(Vector3 target, float tau) |
2787 | { | 2788 | { |
2788 | if (IsAttachment) | 2789 | if (IsAttachment) |
@@ -2790,7 +2791,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2790 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); | 2791 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
2791 | 2792 | ||
2792 | if (avatar != null) | 2793 | if (avatar != null) |
2793 | avatar.MoveToTarget(target, false, false); | 2794 | avatar.MoveToTarget(target, false, false, tau); |
2794 | } | 2795 | } |
2795 | else | 2796 | else |
2796 | { | 2797 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index b22bda0..0b8cc7f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -455,7 +455,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
455 | if (m_part.ParentGroup.m_savedScriptState.ContainsKey(stateID)) | 455 | if (m_part.ParentGroup.m_savedScriptState.ContainsKey(stateID)) |
456 | { | 456 | { |
457 | XmlDocument doc = new XmlDocument(); | 457 | XmlDocument doc = new XmlDocument(); |
458 | 458 | doc.XmlResolver=null; | |
459 | doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]); | 459 | doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]); |
460 | 460 | ||
461 | ////////// CRUFT WARNING /////////////////////////////////// | 461 | ////////// CRUFT WARNING /////////////////////////////////// |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6bce406..e10e787 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -101,7 +101,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
101 | public bool IsGod { get; set; } | 101 | public bool IsGod { get; set; } |
102 | 102 | ||
103 | private PresenceType m_presenceType; | 103 | private PresenceType m_presenceType; |
104 | public PresenceType PresenceType { | 104 | public PresenceType PresenceType |
105 | { | ||
105 | get {return m_presenceType;} | 106 | get {return m_presenceType;} |
106 | private set | 107 | private set |
107 | { | 108 | { |
@@ -368,8 +369,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
368 | private Quaternion m_headrotation = Quaternion.Identity; | 369 | private Quaternion m_headrotation = Quaternion.Identity; |
369 | 370 | ||
370 | //PauPaw:Proper PID Controler for autopilot************ | 371 | //PauPaw:Proper PID Controler for autopilot************ |
371 | public bool MovingToTarget { get; private set; } | 372 | |
372 | public Vector3 MoveToPositionTarget { get; private set; } | 373 | private bool m_movingToTarget; |
374 | public bool MovingToTarget | ||
375 | { | ||
376 | get {return m_movingToTarget;} | ||
377 | private set {m_movingToTarget = value; } | ||
378 | } | ||
379 | |||
380 | private Vector3 m_moveToPositionTarget; | ||
381 | public Vector3 MoveToPositionTarget | ||
382 | { | ||
383 | get {return m_moveToPositionTarget;} | ||
384 | private set {m_moveToPositionTarget = value; } | ||
385 | } | ||
386 | |||
387 | private float m_moveToSpeed; | ||
388 | public float MoveToSpeed | ||
389 | { | ||
390 | get {return m_moveToSpeed;} | ||
391 | private set {m_moveToSpeed = value; } | ||
392 | } | ||
393 | |||
373 | private double m_delayedStop = -1.0; | 394 | private double m_delayedStop = -1.0; |
374 | 395 | ||
375 | /// <summary> | 396 | /// <summary> |
@@ -1160,7 +1181,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1160 | ControllingClient.OnStopAnim += HandleStopAnim; | 1181 | ControllingClient.OnStopAnim += HandleStopAnim; |
1161 | ControllingClient.OnChangeAnim += avnHandleChangeAnim; | 1182 | ControllingClient.OnChangeAnim += avnHandleChangeAnim; |
1162 | ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; | 1183 | ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; |
1163 | ControllingClient.OnAutoPilotGo += MoveToTarget; | 1184 | ControllingClient.OnAutoPilotGo += MoveToTargetHandle; |
1164 | ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; | 1185 | ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; |
1165 | // ControllingClient.OnAgentFOV += HandleAgentFOV; | 1186 | // ControllingClient.OnAgentFOV += HandleAgentFOV; |
1166 | 1187 | ||
@@ -1180,7 +1201,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1180 | ControllingClient.OnStopAnim -= HandleStopAnim; | 1201 | ControllingClient.OnStopAnim -= HandleStopAnim; |
1181 | ControllingClient.OnChangeAnim -= avnHandleChangeAnim; | 1202 | ControllingClient.OnChangeAnim -= avnHandleChangeAnim; |
1182 | ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; | 1203 | ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; |
1183 | ControllingClient.OnAutoPilotGo -= MoveToTarget; | 1204 | ControllingClient.OnAutoPilotGo -= MoveToTargetHandle; |
1184 | ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; | 1205 | ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; |
1185 | // ControllingClient.OnAgentFOV += HandleAgentFOV; | 1206 | // ControllingClient.OnAgentFOV += HandleAgentFOV; |
1186 | } | 1207 | } |
@@ -2587,11 +2608,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2587 | } | 2608 | } |
2588 | 2609 | ||
2589 | bool update_movementflag = false; | 2610 | bool update_movementflag = false; |
2590 | bool mvToTarget = MovingToTarget; | 2611 | bool mvToTarget = m_movingToTarget; |
2591 | if (agentData.UseClientAgentPosition) | 2612 | if (agentData.UseClientAgentPosition) |
2592 | { | 2613 | { |
2593 | MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).LengthSquared() > 0.04f; | 2614 | m_movingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).LengthSquared() > 0.04f; |
2594 | MoveToPositionTarget = agentData.ClientAgentPosition; | 2615 | m_moveToPositionTarget = agentData.ClientAgentPosition; |
2616 | m_moveToSpeed = -1f; | ||
2595 | } | 2617 | } |
2596 | 2618 | ||
2597 | int i = 0; | 2619 | int i = 0; |
@@ -2686,7 +2708,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2686 | update_movementflag = true; | 2708 | update_movementflag = true; |
2687 | } | 2709 | } |
2688 | 2710 | ||
2689 | if (MovingToTarget) | 2711 | if (m_movingToTarget) |
2690 | { | 2712 | { |
2691 | // If the user has pressed a key then we want to cancel any move to target. | 2713 | // If the user has pressed a key then we want to cancel any move to target. |
2692 | if (DCFlagKeyPressed) | 2714 | if (DCFlagKeyPressed) |
@@ -2787,7 +2809,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2787 | } | 2809 | } |
2788 | else | 2810 | else |
2789 | { | 2811 | { |
2790 | if(MovingToTarget || | 2812 | if(m_movingToTarget || |
2791 | (Animator.currentControlState != ScenePresenceAnimator.motionControlStates.flying && | 2813 | (Animator.currentControlState != ScenePresenceAnimator.motionControlStates.flying && |
2792 | Animator.currentControlState != ScenePresenceAnimator.motionControlStates.onsurface) | 2814 | Animator.currentControlState != ScenePresenceAnimator.motionControlStates.onsurface) |
2793 | ) | 2815 | ) |
@@ -2878,7 +2900,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2878 | 2900 | ||
2879 | bool updated = false; | 2901 | bool updated = false; |
2880 | 2902 | ||
2881 | Vector3 LocalVectorToTarget3D = MoveToPositionTarget - AbsolutePosition; | 2903 | Vector3 LocalVectorToTarget3D = m_moveToPositionTarget - AbsolutePosition; |
2882 | 2904 | ||
2883 | // m_log.DebugFormat( | 2905 | // m_log.DebugFormat( |
2884 | // "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}", | 2906 | // "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}", |
@@ -2891,9 +2913,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2891 | } | 2913 | } |
2892 | else | 2914 | else |
2893 | { | 2915 | { |
2894 | Vector3 hdist = LocalVectorToTarget3D; | 2916 | distanceToTarget = (float)Math.Sqrt(LocalVectorToTarget3D.X * LocalVectorToTarget3D.X + |
2895 | hdist.Z = 0; | 2917 | LocalVectorToTarget3D.Y * LocalVectorToTarget3D.Y); |
2896 | distanceToTarget = hdist.Length(); | ||
2897 | } | 2918 | } |
2898 | 2919 | ||
2899 | // m_log.DebugFormat( | 2920 | // m_log.DebugFormat( |
@@ -2905,128 +2926,126 @@ namespace OpenSim.Region.Framework.Scenes | |||
2905 | { | 2926 | { |
2906 | // We are close enough to the target | 2927 | // We are close enough to the target |
2907 | Velocity = Vector3.Zero; | 2928 | Velocity = Vector3.Zero; |
2908 | AbsolutePosition = MoveToPositionTarget; | 2929 | AbsolutePosition = m_moveToPositionTarget; |
2909 | if (Flying) | 2930 | if (Flying) |
2910 | { | 2931 | { |
2911 | if (LandAtTarget) | 2932 | if (LandAtTarget) |
2912 | Flying = false; | 2933 | Flying = false; |
2913 | 2934 | ||
2914 | // A horrible hack to stop the avatar dead in its tracks rather than having them overshoot | 2935 | // A horrible hack to stop the avatar dead in its tracks rather than having them overshoot |
2915 | // the target if flying. | 2936 | // the target if flying. |
2916 | // We really need to be more subtle (slow the avatar as it approaches the target) or at | 2937 | // We really need to be more subtle (slow the avatar as it approaches the target) or at |
2917 | // least be able to set collision status once, rather than 5 times to give it enough | 2938 | // least be able to set collision status once, rather than 5 times to give it enough |
2918 | // weighting so that that PhysicsActor thinks it really is colliding. | 2939 | // weighting so that that PhysicsActor thinks it really is colliding. |
2919 | for (int i = 0; i < 5; i++) | 2940 | for (int i = 0; i < 5; i++) |
2920 | IsColliding = true; | 2941 | IsColliding = true; |
2921 | } | 2942 | } |
2922 | ResetMoveToTarget(); | 2943 | ResetMoveToTarget(); |
2923 | return false; | 2944 | return false; |
2924 | } | 2945 | } |
2925 | else | ||
2926 | { | ||
2927 | try | ||
2928 | { | ||
2929 | // move avatar in 3D at one meter/second towards target, in avatar coordinate frame. | ||
2930 | // This movement vector gets added to the velocity through AddNewMovement(). | ||
2931 | // Theoretically we might need a more complex PID approach here if other | ||
2932 | // unknown forces are acting on the avatar and we need to adaptively respond | ||
2933 | // to such forces, but the following simple approach seems to works fine. | ||
2934 | |||
2935 | LocalVectorToTarget3D = LocalVectorToTarget3D * Quaternion.Inverse(Rotation); // change to avatar coords | ||
2936 | 2946 | ||
2937 | LocalVectorToTarget3D.Normalize(); | 2947 | if(m_moveToSpeed > 0 && distanceToTarget <= m_moveToSpeed * Scene.FrameTime) |
2938 | 2948 | m_moveToSpeed = distanceToTarget / Scene.FrameTime; | |
2939 | // update avatar movement flags. the avatar coordinate system is as follows: | ||
2940 | // | ||
2941 | // +X (forward) | ||
2942 | // | ||
2943 | // ^ | ||
2944 | // | | ||
2945 | // | | ||
2946 | // | | ||
2947 | // | | ||
2948 | // (left) +Y <--------o--------> -Y | ||
2949 | // avatar | ||
2950 | // | | ||
2951 | // | | ||
2952 | // | | ||
2953 | // | | ||
2954 | // v | ||
2955 | // -X | ||
2956 | // | ||
2957 | |||
2958 | // based on the above avatar coordinate system, classify the movement into | ||
2959 | // one of left/right/back/forward. | ||
2960 | |||
2961 | const uint noMovFlagsMask = (uint)(~(Dir_ControlFlags.DIR_CONTROL_FLAG_BACK | | ||
2962 | Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD | Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT | | ||
2963 | Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT | Dir_ControlFlags.DIR_CONTROL_FLAG_UP | | ||
2964 | Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN)); | ||
2965 | |||
2966 | MovementFlag &= noMovFlagsMask; | ||
2967 | uint tmpAgentControlFlags = (uint)m_AgentControlFlags; | ||
2968 | tmpAgentControlFlags &= noMovFlagsMask; | ||
2969 | |||
2970 | if (LocalVectorToTarget3D.X < 0) //MoveBack | ||
2971 | { | ||
2972 | MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; | ||
2973 | tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; | ||
2974 | updated = true; | ||
2975 | } | ||
2976 | else if (LocalVectorToTarget3D.X > 0) //Move Forward | ||
2977 | { | ||
2978 | MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; | ||
2979 | tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; | ||
2980 | updated = true; | ||
2981 | } | ||
2982 | |||
2983 | if (LocalVectorToTarget3D.Y > 0) //MoveLeft | ||
2984 | { | ||
2985 | MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; | ||
2986 | tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; | ||
2987 | updated = true; | ||
2988 | } | ||
2989 | else if (LocalVectorToTarget3D.Y < 0) //MoveRight | ||
2990 | { | ||
2991 | MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; | ||
2992 | tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; | ||
2993 | updated = true; | ||
2994 | } | ||
2995 | |||
2996 | if (LocalVectorToTarget3D.Z > 0) //Up | ||
2997 | { | ||
2998 | // Don't set these flags for up or down - doing so will make the avatar crouch or | ||
2999 | // keep trying to jump even if walking along level ground | ||
3000 | //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; | ||
3001 | //AgentControlFlags | ||
3002 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; | ||
3003 | updated = true; | ||
3004 | } | ||
3005 | else if (LocalVectorToTarget3D.Z < 0) //Down | ||
3006 | { | ||
3007 | //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; | ||
3008 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; | ||
3009 | updated = true; | ||
3010 | } | ||
3011 | 2949 | ||
2950 | try | ||
2951 | { | ||
2952 | // move avatar in 3D towards target, in avatar coordinate frame. | ||
2953 | // This movement vector gets added to the velocity through AddNewMovement(). | ||
2954 | // Theoretically we might need a more complex PID approach here if other | ||
2955 | // unknown forces are acting on the avatar and we need to adaptively respond | ||
2956 | // to such forces, but the following simple approach seems to works fine. | ||
2957 | |||
2958 | float angle = 0.5f * (float)Math.Atan2(LocalVectorToTarget3D.Y, LocalVectorToTarget3D.X); | ||
2959 | Quaternion rot = new Quaternion(0,0, (float)Math.Sin(angle),(float)Math.Cos(angle)); | ||
2960 | Rotation = rot; | ||
2961 | LocalVectorToTarget3D = LocalVectorToTarget3D * Quaternion.Inverse(rot); // change to avatar coords | ||
2962 | LocalVectorToTarget3D.Normalize(); | ||
2963 | |||
2964 | // update avatar movement flags. the avatar coordinate system is as follows: | ||
2965 | // | ||
2966 | // +X (forward) | ||
2967 | // | ||
2968 | // ^ | ||
2969 | // | | ||
2970 | // | | ||
2971 | // | | ||
2972 | // | | ||
2973 | // (left) +Y <--------o--------> -Y | ||
2974 | // avatar | ||
2975 | // | | ||
2976 | // | | ||
2977 | // | | ||
2978 | // | | ||
2979 | // v | ||
2980 | // -X | ||
2981 | // | ||
2982 | |||
2983 | // based on the above avatar coordinate system, classify the movement into | ||
2984 | // one of left/right/back/forward. | ||
2985 | |||
2986 | const uint noMovFlagsMask = (uint)(~(Dir_ControlFlags.DIR_CONTROL_FLAG_BACK | | ||
2987 | Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD | Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT | | ||
2988 | Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT | Dir_ControlFlags.DIR_CONTROL_FLAG_UP | | ||
2989 | Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN)); | ||
2990 | |||
2991 | MovementFlag &= noMovFlagsMask; | ||
2992 | uint tmpAgentControlFlags = (uint)m_AgentControlFlags; | ||
2993 | tmpAgentControlFlags &= noMovFlagsMask; | ||
2994 | |||
2995 | if (LocalVectorToTarget3D.X < 0) //MoveBack | ||
2996 | { | ||
2997 | MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; | ||
2998 | tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; | ||
2999 | updated = true; | ||
3000 | } | ||
3001 | else if (LocalVectorToTarget3D.X > 0) //Move Forward | ||
3002 | { | ||
3003 | MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; | ||
3004 | tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; | ||
3005 | updated = true; | ||
3006 | } | ||
3007 | |||
3008 | if (LocalVectorToTarget3D.Y > 0) //MoveLeft | ||
3009 | { | ||
3010 | MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; | ||
3011 | tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; | ||
3012 | updated = true; | ||
3013 | } | ||
3014 | else if (LocalVectorToTarget3D.Y < 0) //MoveRight | ||
3015 | { | ||
3016 | MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; | ||
3017 | tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; | ||
3018 | updated = true; | ||
3019 | } | ||
3020 | |||
3021 | if (LocalVectorToTarget3D.Z > 0) //Up | ||
3022 | updated = true; | ||
3023 | |||
3024 | else if (LocalVectorToTarget3D.Z < 0) //Down | ||
3025 | updated = true; | ||
3026 | |||
3012 | // m_log.DebugFormat( | 3027 | // m_log.DebugFormat( |
3013 | // "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}", | 3028 | // "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}", |
3014 | // LocalVectorToTarget3D, agent_control_v3, Name); | 3029 | // LocalVectorToTarget3D, agent_control_v3, Name); |
3015 | 3030 | ||
3016 | m_AgentControlFlags = (AgentManager.ControlFlags) tmpAgentControlFlags; | 3031 | m_AgentControlFlags = (AgentManager.ControlFlags) tmpAgentControlFlags; |
3032 | if(updated) | ||
3017 | agent_control_v3 += LocalVectorToTarget3D; | 3033 | agent_control_v3 += LocalVectorToTarget3D; |
3018 | } | 3034 | } |
3019 | catch (Exception e) | 3035 | catch (Exception e) |
3020 | { | 3036 | { |
3021 | //Avoid system crash, can be slower but... | 3037 | //Avoid system crash, can be slower but... |
3022 | m_log.DebugFormat("Crash! {0}", e.ToString()); | 3038 | m_log.DebugFormat("Crash! {0}", e.ToString()); |
3023 | } | ||
3024 | } | 3039 | } |
3025 | 3040 | ||
3026 | return updated; | 3041 | return updated; |
3027 | // AddNewMovement(agent_control_v3); | 3042 | // AddNewMovement(agent_control_v3); |
3028 | } | 3043 | } |
3029 | 3044 | ||
3045 | public void MoveToTargetHandle(Vector3 pos, bool noFly, bool landAtTarget) | ||
3046 | { | ||
3047 | MoveToTarget(pos, noFly, landAtTarget); | ||
3048 | } | ||
3030 | /// <summary> | 3049 | /// <summary> |
3031 | /// Move to the given target over time. | 3050 | /// Move to the given target over time. |
3032 | /// </summary> | 3051 | /// </summary> |
@@ -3039,8 +3058,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3039 | /// <param name="landAtTarget"> | 3058 | /// <param name="landAtTarget"> |
3040 | /// If true and the avatar starts flying during the move then land at the target. | 3059 | /// If true and the avatar starts flying during the move then land at the target. |
3041 | /// </param> | 3060 | /// </param> |
3042 | public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget) | 3061 | public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget, float tau = -1f) |
3043 | { | 3062 | { |
3044 | m_delayedStop = -1; | 3063 | m_delayedStop = -1; |
3045 | 3064 | ||
3046 | if (SitGround) | 3065 | if (SitGround) |
@@ -3073,30 +3092,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3073 | // "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", | 3092 | // "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", |
3074 | // Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); | 3093 | // Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); |
3075 | 3094 | ||
3095 | terrainHeight += Appearance.AvatarHeight; // so 1.5 * AvatarHeight above ground at target | ||
3076 | bool shouldfly = Flying; | 3096 | bool shouldfly = Flying; |
3077 | if (noFly) | 3097 | if (noFly) |
3078 | shouldfly = false; | 3098 | shouldfly = false; |
3079 | else if (pos.Z > terrainHeight || Flying) | 3099 | else if (pos.Z > terrainHeight || Flying) |
3080 | shouldfly = true; | 3100 | shouldfly = true; |
3081 | 3101 | ||
3082 | LandAtTarget = landAtTarget; | ||
3083 | MovingToTarget = true; | ||
3084 | MoveToPositionTarget = pos; | ||
3085 | Flying = shouldfly; | ||
3086 | |||
3087 | // Rotate presence around the z-axis to point in same direction as movement. | ||
3088 | // Ignore z component of vector | ||
3089 | Vector3 localVectorToTarget3D = pos - AbsolutePosition; | 3102 | Vector3 localVectorToTarget3D = pos - AbsolutePosition; |
3090 | 3103 | ||
3091 | // m_log.DebugFormat("[SCENE PRESENCE]: Local vector to target is {0},[1}", localVectorToTarget3D.X,localVectorToTarget3D.Y); | 3104 | // m_log.DebugFormat("[SCENE PRESENCE]: Local vector to target is {0},[1}", localVectorToTarget3D.X,localVectorToTarget3D.Y); |
3105 | |||
3106 | m_movingToTarget = true; | ||
3107 | LandAtTarget = landAtTarget; | ||
3108 | m_moveToPositionTarget = pos; | ||
3109 | if(tau > 0) | ||
3110 | { | ||
3111 | if(tau < Scene.FrameTime) | ||
3112 | tau = Scene.FrameTime; | ||
3113 | m_moveToSpeed = localVectorToTarget3D.Length() / tau; | ||
3114 | if(m_moveToSpeed < 0.5f) //to tune | ||
3115 | m_moveToSpeed = 0.5f; | ||
3116 | else if(m_moveToSpeed > 50f) | ||
3117 | m_moveToSpeed = 50f; | ||
3092 | 3118 | ||
3093 | // Calculate the yaw. | 3119 | SetAlwaysRun = false; |
3094 | Vector3 angle = new Vector3(0, 0, (float)(Math.Atan2(localVectorToTarget3D.Y, localVectorToTarget3D.X))); | 3120 | } |
3095 | 3121 | else | |
3096 | // m_log.DebugFormat("[SCENE PRESENCE]: Angle is {0}", angle); | 3122 | m_moveToSpeed = 4.096f * m_speedModifier; |
3097 | 3123 | ||
3098 | Rotation = Quaternion.CreateFromEulers(angle); | 3124 | Flying = shouldfly; |
3099 | // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); | ||
3100 | 3125 | ||
3101 | Vector3 control = Vector3.Zero; | 3126 | Vector3 control = Vector3.Zero; |
3102 | if(HandleMoveToTargetUpdate(1f, ref control)) | 3127 | if(HandleMoveToTargetUpdate(1f, ref control)) |
@@ -3110,7 +3135,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3110 | { | 3135 | { |
3111 | // m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); | 3136 | // m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); |
3112 | 3137 | ||
3113 | MovingToTarget = false; | 3138 | m_movingToTarget = false; |
3139 | m_moveToSpeed = -1f; | ||
3114 | // MoveToPositionTarget = Vector3.Zero; | 3140 | // MoveToPositionTarget = Vector3.Zero; |
3115 | // lock(m_forceToApplyLock) | 3141 | // lock(m_forceToApplyLock) |
3116 | // m_forceToApplyValid = false; // cancel possible last action | 3142 | // m_forceToApplyValid = false; // cancel possible last action |
@@ -3294,7 +3320,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3294 | RemoveFromPhysicalScene(); | 3320 | RemoveFromPhysicalScene(); |
3295 | } | 3321 | } |
3296 | 3322 | ||
3297 | if (MovingToTarget) | 3323 | if (m_movingToTarget) |
3298 | ResetMoveToTarget(); | 3324 | ResetMoveToTarget(); |
3299 | 3325 | ||
3300 | Velocity = Vector3.Zero; | 3326 | Velocity = Vector3.Zero; |
@@ -3436,7 +3462,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3436 | 3462 | ||
3437 | RemoveFromPhysicalScene(); | 3463 | RemoveFromPhysicalScene(); |
3438 | 3464 | ||
3439 | if (MovingToTarget) | 3465 | if (m_movingToTarget) |
3440 | ResetMoveToTarget(); | 3466 | ResetMoveToTarget(); |
3441 | 3467 | ||
3442 | Velocity = Vector3.Zero; | 3468 | Velocity = Vector3.Zero; |
@@ -3716,8 +3742,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3716 | if ((vec.Z == 0f) && !Flying) | 3742 | if ((vec.Z == 0f) && !Flying) |
3717 | direc.Z = 0f; // Prevent camera WASD up. | 3743 | direc.Z = 0f; // Prevent camera WASD up. |
3718 | 3744 | ||
3745 | bool notmvtrgt = !m_movingToTarget || m_moveToSpeed <= 0; | ||
3719 | // odd rescalings | 3746 | // odd rescalings |
3720 | direc *= 0.032f * 128f * SpeedModifier * thisAddSpeedModifier; | 3747 | if(notmvtrgt) |
3748 | direc *= 4.096f * SpeedModifier * thisAddSpeedModifier; | ||
3749 | else | ||
3750 | direc *= m_moveToSpeed; | ||
3721 | 3751 | ||
3722 | // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name); | 3752 | // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name); |
3723 | 3753 | ||
@@ -3735,12 +3765,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3735 | // landing situation, prevent avatar moving or it may fail to land | 3765 | // landing situation, prevent avatar moving or it may fail to land |
3736 | // animator will handle this condition and do the land | 3766 | // animator will handle this condition and do the land |
3737 | direc = Vector3.Zero; | 3767 | direc = Vector3.Zero; |
3738 | else | 3768 | else if(notmvtrgt) |
3739 | direc *= 4.0f; | 3769 | direc *= 4.0f; |
3740 | } | 3770 | } |
3741 | else if (IsColliding) | 3771 | else if (IsColliding) |
3742 | { | 3772 | { |
3743 | if (direc.Z > 2.0f) // reinforce jumps | 3773 | if (direc.Z > 2.0f && notmvtrgt) // reinforce jumps |
3744 | { | 3774 | { |
3745 | direc.Z *= 2.6f; | 3775 | direc.Z *= 2.6f; |
3746 | } | 3776 | } |
@@ -3780,7 +3810,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3780 | if (IsInTransit || IsLoggingIn) | 3810 | if (IsInTransit || IsLoggingIn) |
3781 | return; | 3811 | return; |
3782 | 3812 | ||
3783 | if(MovingToTarget) | 3813 | if(m_movingToTarget) |
3784 | { | 3814 | { |
3785 | m_delayedStop = -1; | 3815 | m_delayedStop = -1; |
3786 | Vector3 control = Vector3.Zero; | 3816 | Vector3 control = Vector3.Zero; |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index 41f3ef4..c3bc4a0 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | |||
@@ -133,6 +133,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
133 | { | 133 | { |
134 | using (XmlTextReader reader = new XmlTextReader(sr)) | 134 | using (XmlTextReader reader = new XmlTextReader(sr)) |
135 | { | 135 | { |
136 | reader.DtdProcessing = DtdProcessing.Prohibit; | ||
137 | reader.XmlResolver = null; | ||
138 | |||
136 | reader.MoveToContent(); // skip possible xml declaration | 139 | reader.MoveToContent(); // skip possible xml declaration |
137 | 140 | ||
138 | if (reader.Name != "CoalescedObject") | 141 | if (reader.Name != "CoalescedObject") |
@@ -147,6 +150,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
147 | } | 150 | } |
148 | 151 | ||
149 | XmlDocument doc = new XmlDocument(); | 152 | XmlDocument doc = new XmlDocument(); |
153 | doc.XmlResolver=null; | ||
150 | doc.LoadXml(xml); | 154 | doc.LoadXml(xml); |
151 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); | 155 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); |
152 | if (e == null) | 156 | if (e == null) |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 82bbe6f..a2d512a 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
63 | String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData); | 63 | String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData); |
64 | using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null)) | 64 | using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null)) |
65 | { | 65 | { |
66 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) | 66 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null })) |
67 | { | 67 | { |
68 | try | 68 | try |
69 | { | 69 | { |
@@ -255,6 +255,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
255 | try | 255 | try |
256 | { | 256 | { |
257 | XmlDocument doc = new XmlDocument(); | 257 | XmlDocument doc = new XmlDocument(); |
258 | doc.XmlResolver=null; | ||
258 | doc.LoadXml(xmlData); | 259 | doc.LoadXml(xmlData); |
259 | 260 | ||
260 | XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); | 261 | XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); |
@@ -266,18 +267,29 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
266 | return null; | 267 | return null; |
267 | } | 268 | } |
268 | 269 | ||
269 | StringReader sr = new StringReader(parts[0].OuterXml); | 270 | SceneObjectGroup sceneObject; |
270 | XmlTextReader reader = new XmlTextReader(sr); | 271 | using(StringReader sr = new StringReader(parts[0].OuterXml)) |
271 | SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); | 272 | { |
272 | reader.Close(); | 273 | using(XmlTextReader reader = new XmlTextReader(sr)) |
273 | sr.Close(); | 274 | { |
275 | reader.DtdProcessing = DtdProcessing.Prohibit; | ||
276 | reader.XmlResolver = null; | ||
277 | |||
278 | sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); | ||
279 | } | ||
280 | } | ||
274 | 281 | ||
275 | // Then deal with the rest | 282 | // Then deal with the rest |
283 | SceneObjectPart part; | ||
276 | for (int i = 1; i < parts.Count; i++) | 284 | for (int i = 1; i < parts.Count; i++) |
277 | { | 285 | { |
278 | sr = new StringReader(parts[i].OuterXml); | 286 | using(StringReader sr = new StringReader(parts[i].OuterXml)) |
279 | reader = new XmlTextReader(sr); | 287 | { |
280 | SceneObjectPart part = SceneObjectPart.FromXml(reader); | 288 | using(XmlTextReader reader = new XmlTextReader(sr)) |
289 | { | ||
290 | part = SceneObjectPart.FromXml(reader); | ||
291 | } | ||
292 | } | ||
281 | 293 | ||
282 | int originalLinkNum = part.LinkNum; | 294 | int originalLinkNum = part.LinkNum; |
283 | 295 | ||
@@ -288,8 +300,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
288 | if (originalLinkNum != 0) | 300 | if (originalLinkNum != 0) |
289 | part.LinkNum = originalLinkNum; | 301 | part.LinkNum = originalLinkNum; |
290 | 302 | ||
291 | reader.Close(); | ||
292 | sr.Close(); | ||
293 | } | 303 | } |
294 | 304 | ||
295 | XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); | 305 | XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index 34fdb6d..977dd73 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | |||
@@ -49,14 +49,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
49 | public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) | 49 | public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) |
50 | { | 50 | { |
51 | XmlDocument doc = new XmlDocument(); | 51 | XmlDocument doc = new XmlDocument(); |
52 | doc.XmlResolver=null; | ||
52 | XmlNode rootNode; | 53 | XmlNode rootNode; |
53 | 54 | ||
54 | if (fileName.StartsWith("http:") || File.Exists(fileName)) | 55 | if (fileName.StartsWith("http:") || File.Exists(fileName)) |
55 | { | 56 | { |
56 | XmlTextReader reader = new XmlTextReader(fileName); | 57 | using(XmlTextReader reader = new XmlTextReader(fileName)) |
57 | reader.WhitespaceHandling = WhitespaceHandling.None; | 58 | { |
58 | doc.Load(reader); | 59 | reader.WhitespaceHandling = WhitespaceHandling.None; |
59 | reader.Close(); | 60 | reader.DtdProcessing = DtdProcessing.Prohibit; |
61 | reader.XmlResolver = null; | ||
62 | |||
63 | doc.Load(reader); | ||
64 | } | ||
60 | rootNode = doc.FirstChild; | 65 | rootNode = doc.FirstChild; |
61 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) | 66 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) |
62 | { | 67 | { |
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index 89d78cf..1beca04 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs | |||
@@ -196,13 +196,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
196 | // ITerrainChannel.LoadFromXmlString() | 196 | // ITerrainChannel.LoadFromXmlString() |
197 | public void LoadFromXmlString(string data) | 197 | public void LoadFromXmlString(string data) |
198 | { | 198 | { |
199 | StringReader sr = new StringReader(data); | 199 | using(StringReader sr = new StringReader(data)) |
200 | XmlTextReader reader = new XmlTextReader(sr); | 200 | { |
201 | reader.Read(); | 201 | using(XmlTextReader reader = new XmlTextReader(sr)) |
202 | 202 | { | |
203 | ReadXml(reader); | 203 | reader.DtdProcessing = DtdProcessing.Prohibit; |
204 | reader.Close(); | 204 | reader.XmlResolver = null; |
205 | sr.Close(); | 205 | ReadXml(reader); |
206 | } | ||
207 | } | ||
206 | } | 208 | } |
207 | 209 | ||
208 | // ITerrainChannel.Merge | 210 | // ITerrainChannel.Merge |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index e5c847e..90c5197 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs | |||
@@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
97 | Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); | 97 | Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); |
98 | Assert.That(sp.AbsolutePosition.Z, Is.LessThan(targetPos.X)); | 98 | Assert.That(sp.AbsolutePosition.Z, Is.LessThan(targetPos.X)); |
99 | 99 | ||
100 | m_scene.Update(10); | 100 | m_scene.Update(50); |
101 | 101 | ||
102 | double distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); | 102 | double distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); |
103 | Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on first move"); | 103 | Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on first move"); |
@@ -121,7 +121,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
121 | Assert.That(sp.AbsolutePosition.Y, Is.EqualTo(startPos.Y)); | 121 | Assert.That(sp.AbsolutePosition.Y, Is.EqualTo(startPos.Y)); |
122 | Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); | 122 | Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); |
123 | 123 | ||
124 | m_scene.Update(10); | 124 | m_scene.Update(50); |
125 | 125 | ||
126 | distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); | 126 | distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); |
127 | Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on second move"); | 127 | Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on second move"); |