diff options
author | Tom Grimshaw | 2010-05-19 13:44:59 -0700 |
---|---|---|
committer | Tom Grimshaw | 2010-05-19 13:44:59 -0700 |
commit | f77f9ecd8f3f94ccc6d69c7625fd1eacfa9250d7 (patch) | |
tree | 82bb9f0ef147ee8e987f4cb2a02a7b5e19b674df /OpenSim/Region/Framework | |
parent | Fix a null reference issue in cmGetAvatarList() (diff) | |
download | opensim-SC-f77f9ecd8f3f94ccc6d69c7625fd1eacfa9250d7.zip opensim-SC-f77f9ecd8f3f94ccc6d69c7625fd1eacfa9250d7.tar.gz opensim-SC-f77f9ecd8f3f94ccc6d69c7625fd1eacfa9250d7.tar.bz2 opensim-SC-f77f9ecd8f3f94ccc6d69c7625fd1eacfa9250d7.tar.xz |
Fix a nullref issue in SitAltitudeCallback
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 103 |
1 files changed, 53 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 565438d..68acabe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -128,7 +128,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
128 | 128 | ||
129 | private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation | 129 | private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation |
130 | private Vector3 m_avUnscriptedSitPos; // for non-scripted prims | 130 | private Vector3 m_avUnscriptedSitPos; // for non-scripted prims |
131 | private Vector3 m_lastPosition; | 131 | private Vector3 m_lastPosition; |
132 | private Vector3 m_lastWorldPosition; | 132 | private Vector3 m_lastWorldPosition; |
133 | private Quaternion m_lastRotation; | 133 | private Quaternion m_lastRotation; |
134 | private Vector3 m_lastVelocity; | 134 | private Vector3 m_lastVelocity; |
@@ -857,22 +857,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
857 | { | 857 | { |
858 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); | 858 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); |
859 | pos.Y = crossedBorder.BorderLine.Z - 1; | 859 | pos.Y = crossedBorder.BorderLine.Z - 1; |
860 | } | 860 | } |
861 | 861 | ||
862 | //If they're TP'ing in or logging in, we haven't had time to add any known child regions yet. | 862 | //If they're TP'ing in or logging in, we haven't had time to add any known child regions yet. |
863 | //This has the unfortunate consequence that if somebody is TP'ing who is already a child agent, | 863 | //This has the unfortunate consequence that if somebody is TP'ing who is already a child agent, |
864 | //they'll bypass the landing point. But I can't think of any decent way of fixing this. | 864 | //they'll bypass the landing point. But I can't think of any decent way of fixing this. |
865 | if (KnownChildRegionHandles.Count == 0) | 865 | if (KnownChildRegionHandles.Count == 0) |
866 | { | 866 | { |
867 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | 867 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); |
868 | if (land != null) | 868 | if (land != null) |
869 | { | 869 | { |
870 | //Don't restrict gods, estate managers, or land owners to the TP point. This behaviour mimics agni. | 870 | //Don't restrict gods, estate managers, or land owners to the TP point. This behaviour mimics agni. |
871 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero && m_godlevel < 200 && !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid) && land.LandData.OwnerID != m_uuid) | 871 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero && m_godlevel < 200 && !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid) && land.LandData.OwnerID != m_uuid) |
872 | { | 872 | { |
873 | pos = land.LandData.UserLocation; | 873 | pos = land.LandData.UserLocation; |
874 | } | 874 | } |
875 | } | 875 | } |
876 | } | 876 | } |
877 | 877 | ||
878 | if (pos.X < 0 || pos.Y < 0 || pos.Z < 0) | 878 | if (pos.X < 0 || pos.Y < 0 || pos.Z < 0) |
@@ -1036,8 +1036,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1036 | bool isFlying = false; | 1036 | bool isFlying = false; |
1037 | 1037 | ||
1038 | if (m_physicsActor != null) | 1038 | if (m_physicsActor != null) |
1039 | isFlying = m_physicsActor.Flying; | 1039 | isFlying = m_physicsActor.Flying; |
1040 | 1040 | ||
1041 | RemoveFromPhysicalScene(); | 1041 | RemoveFromPhysicalScene(); |
1042 | Velocity = Vector3.Zero; | 1042 | Velocity = Vector3.Zero; |
1043 | AbsolutePosition = pos; | 1043 | AbsolutePosition = pos; |
@@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1048 | SetHeight(m_appearance.AvatarHeight); | 1048 | SetHeight(m_appearance.AvatarHeight); |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | SendTerseUpdateToAllClients(); | 1051 | SendTerseUpdateToAllClients(); |
1052 | 1052 | ||
1053 | } | 1053 | } |
1054 | 1054 | ||
@@ -1736,14 +1736,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1736 | // else | 1736 | // else |
1737 | // { // single or child prim | 1737 | // { // single or child prim |
1738 | 1738 | ||
1739 | // } | 1739 | // } |
1740 | if (part == null) //CW: Part may be gone. llDie() for example. | 1740 | if (part == null) //CW: Part may be gone. llDie() for example. |
1741 | { | 1741 | { |
1742 | partRot = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); | 1742 | partRot = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); |
1743 | } | 1743 | } |
1744 | else | 1744 | else |
1745 | { | 1745 | { |
1746 | partRot = part.GetWorldRotation(); | 1746 | partRot = part.GetWorldRotation(); |
1747 | } | 1747 | } |
1748 | 1748 | ||
1749 | Quaternion partIRot = Quaternion.Inverse(partRot); | 1749 | Quaternion partIRot = Quaternion.Inverse(partRot); |
@@ -1751,22 +1751,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1751 | Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av | 1751 | Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av |
1752 | Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av | 1752 | Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av |
1753 | 1753 | ||
1754 | 1754 | ||
1755 | if (m_physicsActor == null) | 1755 | if (m_physicsActor == null) |
1756 | { | 1756 | { |
1757 | AddToPhysicalScene(false); | 1757 | AddToPhysicalScene(false); |
1758 | } | 1758 | } |
1759 | //CW: If the part isn't null then we can set the current position | 1759 | //CW: If the part isn't null then we can set the current position |
1760 | if (part != null) | 1760 | if (part != null) |
1761 | { | 1761 | { |
1762 | Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + (m_pos * partRot); // + av sit offset! | 1762 | Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + (m_pos * partRot); // + av sit offset! |
1763 | AbsolutePosition = avWorldStandUp; //KF: Fix stand up. | 1763 | AbsolutePosition = avWorldStandUp; //KF: Fix stand up. |
1764 | part.IsOccupied = false; | 1764 | part.IsOccupied = false; |
1765 | } | 1765 | } |
1766 | else | 1766 | else |
1767 | { | 1767 | { |
1768 | //CW: Since the part doesn't exist, a coarse standup position isn't an issue | 1768 | //CW: Since the part doesn't exist, a coarse standup position isn't an issue |
1769 | AbsolutePosition = m_lastWorldPosition; | 1769 | AbsolutePosition = m_lastWorldPosition; |
1770 | } | 1770 | } |
1771 | 1771 | ||
1772 | m_parentPosition = Vector3.Zero; | 1772 | m_parentPosition = Vector3.Zero; |
@@ -1920,7 +1920,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1920 | // if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5) | 1920 | // if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5) |
1921 | if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 2.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 2.0f) ) | 1921 | if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 2.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 2.0f) ) |
1922 | { | 1922 | { |
1923 | autopilot = false; // close enough | 1923 | autopilot = false; // close enough |
1924 | m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup. | 1924 | m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup. |
1925 | Not using the part's position because returning the AV to the last known standing | 1925 | Not using the part's position because returning the AV to the last known standing |
1926 | position is likely to be more friendly, isn't it? */ | 1926 | position is likely to be more friendly, isn't it? */ |
@@ -1929,7 +1929,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1929 | } // else the autopilot will get us close | 1929 | } // else the autopilot will get us close |
1930 | } | 1930 | } |
1931 | else | 1931 | else |
1932 | { // its a scripted sit | 1932 | { // its a scripted sit |
1933 | m_lastWorldPosition = part.AbsolutePosition; /* CW - This give us a position to return the avatar to if the part is killed before standup. | 1933 | m_lastWorldPosition = part.AbsolutePosition; /* CW - This give us a position to return the avatar to if the part is killed before standup. |
1934 | I *am* using the part's position this time because we have no real idea how far away | 1934 | I *am* using the part's position this time because we have no real idea how far away |
1935 | the avatar is from the sit target. */ | 1935 | the avatar is from the sit target. */ |
@@ -2357,11 +2357,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2357 | // { // single or child prim | 2357 | // { // single or child prim |
2358 | partIRot = Quaternion.Inverse(part.GetWorldRotation()); | 2358 | partIRot = Quaternion.Inverse(part.GetWorldRotation()); |
2359 | // } | 2359 | // } |
2360 | float offZ = collisionPoint.Z - m_initialSitTarget.Z; | 2360 | if (m_initialSitTarget != null) |
2361 | Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction | 2361 | { |
2362 | //Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset); | 2362 | float offZ = collisionPoint.Z - m_initialSitTarget.Z; |
2363 | m_pos += offset; | 2363 | Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction |
2364 | // ControllingClient.SendClearFollowCamProperties(part.UUID); | 2364 | //Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset); |
2365 | m_pos += offset; | ||
2366 | // ControllingClient.SendClearFollowCamProperties(part.UUID); | ||
2367 | } | ||
2365 | 2368 | ||
2366 | } | 2369 | } |
2367 | } // End SitAltitudeCallback KF. | 2370 | } // End SitAltitudeCallback KF. |