aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-09-12 00:37:59 +0000
committerJustin Clarke Casey2008-09-12 00:37:59 +0000
commit3f1dbae8e4f47056555f9ecfaa32e959293ada48 (patch)
tree95927494337456a028446333efcabb4cf79d66db /OpenSim/Region/Environment/Scenes/Scene.cs
parentRevert 6242 because of a possible licensing issue (diff)
downloadopensim-SC_OLD-3f1dbae8e4f47056555f9ecfaa32e959293ada48.zip
opensim-SC_OLD-3f1dbae8e4f47056555f9ecfaa32e959293ada48.tar.gz
opensim-SC_OLD-3f1dbae8e4f47056555f9ecfaa32e959293ada48.tar.bz2
opensim-SC_OLD-3f1dbae8e4f47056555f9ecfaa32e959293ada48.tar.xz
* minor: various doc and tidy up, logging increase to make it clearer which prim is failing a border crossing
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs83
1 files changed, 59 insertions, 24 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index d8ce3f0..9c2dd06 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1871,13 +1871,14 @@ namespace OpenSim.Region.Environment.Scenes
1871 } 1871 }
1872 1872
1873 /// <summary> 1873 /// <summary>
1874 /// Locate New region Handle and offset the prim position for the new region 1874 /// Move the given scene object into a new region depending on which region its absolute position has moved
1875 /// 1875 /// into.
1876 ///
1877 /// This method locates the new region handle and offsets the prim position for the new region
1876 /// </summary> 1878 /// </summary>
1877 /// <param name="position">current position of Group</param> 1879 /// <param name="attemptedPosition">the attempted out of region position of the scene object</param>
1878 /// <param name="grp">Scene Object Group that we're crossing</param> 1880 /// <param name="grp">the scene object that we're crossing</param>
1879 1881 public void CrossPrimGroupIntoNewRegion(Vector3 attemptedPosition, SceneObjectGroup grp)
1880 public void CrossPrimGroupIntoNewRegion(Vector3 position, SceneObjectGroup grp)
1881 { 1882 {
1882 if (grp == null) 1883 if (grp == null)
1883 return; 1884 return;
@@ -1897,53 +1898,70 @@ namespace OpenSim.Region.Environment.Scenes
1897 } 1898 }
1898 return; 1899 return;
1899 } 1900 }
1900 1901
1901 m_log.Warn("Prim crossing: " + grp.ToString());
1902 int thisx = (int)RegionInfo.RegionLocX; 1902 int thisx = (int)RegionInfo.RegionLocX;
1903 int thisy = (int)RegionInfo.RegionLocY; 1903 int thisy = (int)RegionInfo.RegionLocY;
1904 1904
1905 ulong newRegionHandle = 0; 1905 ulong newRegionHandle = 0;
1906 Vector3 pos = position; 1906 Vector3 pos = attemptedPosition;
1907 1907
1908 if (position.X > Constants.RegionSize + 0.1f) 1908 if (attemptedPosition.X > Constants.RegionSize + 0.1f)
1909 { 1909 {
1910 pos.X = ((pos.X - Constants.RegionSize)); 1910 pos.X = ((pos.X - Constants.RegionSize));
1911 newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); 1911 newRegionHandle
1912 = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize));
1912 // x + 1 1913 // x + 1
1913 } 1914 }
1914 else if (position.X < -0.1f) 1915 else if (attemptedPosition.X < -0.1f)
1915 { 1916 {
1916 pos.X = ((pos.X + Constants.RegionSize)); 1917 pos.X = ((pos.X + Constants.RegionSize));
1917 newRegionHandle = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); 1918 newRegionHandle
1919 = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize));
1918 // x - 1 1920 // x - 1
1919 } 1921 }
1920 1922
1921 if (position.Y > Constants.RegionSize + 0.1f) 1923 if (attemptedPosition.Y > Constants.RegionSize + 0.1f)
1922 { 1924 {
1923 pos.Y = ((pos.Y - Constants.RegionSize)); 1925 pos.Y = ((pos.Y - Constants.RegionSize));
1924 newRegionHandle = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize)); 1926 newRegionHandle
1927 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize));
1925 // y + 1 1928 // y + 1
1926 } 1929 }
1927 else if (position.Y < -1f) 1930 else if (attemptedPosition.Y < -1f)
1928 { 1931 {
1929 pos.Y = ((pos.Y + Constants.RegionSize)); 1932 pos.Y = ((pos.Y + Constants.RegionSize));
1930 newRegionHandle = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize)); 1933 newRegionHandle
1934 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
1931 // y - 1 1935 // y - 1
1932 } 1936 }
1933 1937
1934 // Offset the positions for the new region across the border 1938 // Offset the positions for the new region across the border
1939 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
1935 grp.OffsetForNewRegion(pos); 1940 grp.OffsetForNewRegion(pos);
1936 1941
1937 CrossPrimGroupIntoNewRegion(newRegionHandle, grp); 1942 // If we fail to cross the border, then reset the position of the scene object on that border.
1943 if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp))
1944 {
1945 grp.OffsetForNewRegion(oldGroupPosition);
1946 }
1938 } 1947 }
1939 1948
1940 public void CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp) 1949 /// <summary>
1950 /// Move the given scene object into a new region
1951 /// </summary>
1952 /// <param name="newRegionHandle"></param>
1953 /// <param name="grp">Scene Object Group that we're crossing</param>
1954 /// <returns>
1955 /// true if the crossing itself was successful, false on failure
1956 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
1957 /// </returns>
1958 public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp)
1941 { 1959 {
1960 bool successYN = false;
1942 int primcrossingXMLmethod = 0; 1961 int primcrossingXMLmethod = 0;
1962
1943 if (newRegionHandle != 0) 1963 if (newRegionHandle != 0)
1944 { 1964 {
1945 bool successYN = false;
1946
1947 successYN 1965 successYN
1948 = m_sceneGridService.PrimCrossToNeighboringRegion( 1966 = m_sceneGridService.PrimCrossToNeighboringRegion(
1949 newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); 1967 newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod);
@@ -1955,14 +1973,15 @@ namespace OpenSim.Region.Environment.Scenes
1955 { 1973 {
1956 DeleteSceneObject(grp); 1974 DeleteSceneObject(grp);
1957 } 1975 }
1958 catch (Exception) 1976 catch (Exception e)
1959 { 1977 {
1960 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); 1978 m_log.ErrorFormat(
1979 "[INTERREGION]: Exception deleting the old object left behind on a border crossing for {0}, {1}",
1980 grp, e);
1961 } 1981 }
1962 } 1982 }
1963 else 1983 else
1964 { 1984 {
1965 m_log.Warn("[INTERREGION]: Prim Crossing Failed!");
1966 if (grp.RootPart != null) 1985 if (grp.RootPart != null)
1967 { 1986 {
1968 if (grp.RootPart.PhysActor != null) 1987 if (grp.RootPart.PhysActor != null)
@@ -1970,10 +1989,26 @@ namespace OpenSim.Region.Environment.Scenes
1970 grp.RootPart.PhysActor.CrossingFailure(); 1989 grp.RootPart.PhysActor.CrossingFailure();
1971 } 1990 }
1972 } 1991 }
1992
1993 m_log.ErrorFormat("[INTERREGION]: Prim crossing failed for {0}", grp);
1973 } 1994 }
1974 } 1995 }
1996 else
1997 {
1998 m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()");
1999 }
2000
2001 return successYN;
1975 } 2002 }
1976 2003
2004 /// <summary>
2005 /// Handle a scene object that is crossing into this region from another.
2006 /// </summary>
2007 /// <param name="regionHandle"></param>
2008 /// <param name="primID"></param>
2009 /// <param name="objXMLData"></param>
2010 /// <param name="XMLMethod"></param>
2011 /// <returns></returns>
1977 public bool IncomingInterRegionPrimGroup(ulong regionHandle, UUID primID, string objXMLData, int XMLMethod) 2012 public bool IncomingInterRegionPrimGroup(ulong regionHandle, UUID primID, string objXMLData, int XMLMethod)
1978 { 2013 {
1979 m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); 2014 m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor");