diff options
author | Mike Mazur | 2008-10-14 09:40:05 +0000 |
---|---|---|
committer | Mike Mazur | 2008-10-14 09:40:05 +0000 |
commit | 3e124a3dba8ead76701a88dedeb23288d3027014 (patch) | |
tree | 5782de0c94307f6e7b89d66c5936e15d119b8d0b /OpenSim | |
parent | - move comment about assetID and 'attached' in inventory where it belongs (diff) | |
download | opensim-SC-3e124a3dba8ead76701a88dedeb23288d3027014.zip opensim-SC-3e124a3dba8ead76701a88dedeb23288d3027014.tar.gz opensim-SC-3e124a3dba8ead76701a88dedeb23288d3027014.tar.bz2 opensim-SC-3e124a3dba8ead76701a88dedeb23288d3027014.tar.xz |
- convert comments into documentation
- minor formatting adjustments
- remove some trailing whitespace
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 51a269a..b69520c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -60,11 +60,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
60 | public delegate void SynchronizeSceneHandler(Scene scene); | 60 | public delegate void SynchronizeSceneHandler(Scene scene); |
61 | public SynchronizeSceneHandler SynchronizeScene = null; | 61 | public SynchronizeSceneHandler SynchronizeScene = null; |
62 | public int splitID = 0; | 62 | public int splitID = 0; |
63 | |||
64 | 63 | ||
65 | #region Fields | 64 | #region Fields |
66 | 65 | ||
67 | |||
68 | protected Timer m_restartWaitTimer = new Timer(); | 66 | protected Timer m_restartWaitTimer = new Timer(); |
69 | 67 | ||
70 | protected SimStatsReporter m_statsReporter; | 68 | protected SimStatsReporter m_statsReporter; |
@@ -84,8 +82,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
84 | 82 | ||
85 | private int m_timePhase = 24; | 83 | private int m_timePhase = 24; |
86 | 84 | ||
87 | |||
88 | |||
89 | /// <summary> | 85 | /// <summary> |
90 | /// Are we applying physics to any of the prims in this scene? | 86 | /// Are we applying physics to any of the prims in this scene? |
91 | /// </summary> | 87 | /// </summary> |
@@ -262,7 +258,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
262 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) | 258 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) |
263 | { | 259 | { |
264 | m_config = config; | 260 | m_config = config; |
265 | 261 | ||
266 | m_moduleLoader = moduleLoader; | 262 | m_moduleLoader = moduleLoader; |
267 | m_authenticateHandler = authen; | 263 | m_authenticateHandler = authen; |
268 | CommsManager = commsMan; | 264 | CommsManager = commsMan; |
@@ -280,7 +276,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
280 | 276 | ||
281 | m_eventManager = new EventManager(); | 277 | m_eventManager = new EventManager(); |
282 | m_externalChecks = new SceneExternalChecks(this); | 278 | m_externalChecks = new SceneExternalChecks(this); |
283 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 279 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
284 | 280 | ||
285 | // Load region settings | 281 | // Load region settings |
286 | m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); | 282 | m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); |
@@ -349,18 +345,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
349 | return m_simulatorVersion; | 345 | return m_simulatorVersion; |
350 | } | 346 | } |
351 | 347 | ||
348 | /// <summary> | ||
349 | /// Another region is up. Gets called from Grid Comms: | ||
350 | /// (OGS1 -> LocalBackEnd -> RegionListened -> SceneCommunicationService) | ||
351 | /// We have to tell all our ScenePresences about it, and add it to the | ||
352 | /// neighbor list. | ||
353 | /// | ||
354 | /// We only add it to the neighbor list if it's within 1 region from here. | ||
355 | /// Agents may have draw distance values that cross two regions though, so | ||
356 | /// we add it to the notify list regardless of distance. We'll check | ||
357 | /// the agent's draw distance before notifying them though. | ||
358 | /// </summary> | ||
359 | /// <param name="otherRegion">RegionInfo handle for the new region.</param> | ||
360 | /// <returns>True after all operations complete, throws exceptions otherwise.</returns> | ||
352 | public override bool OtherRegionUp(RegionInfo otherRegion) | 361 | public override bool OtherRegionUp(RegionInfo otherRegion) |
353 | { | 362 | { |
354 | // Another region is up. | ||
355 | // Gets called from Grid Comms (SceneCommunicationService<---RegionListener<----LocalBackEnd<----OGS1) | ||
356 | // We have to tell all our ScenePresences about it.. | ||
357 | // and add it to the neighbor list. | ||
358 | |||
359 | // We only add it to the neighbor list if it's within 1 region from here. | ||
360 | // Agents may have draw distance values that cross two regions though, so | ||
361 | // we add it to the notify list regardless of distance. | ||
362 | // We'll check the agent's draw distance before notifying them though. | ||
363 | |||
364 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) | 363 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) |
365 | { | 364 | { |
366 | for (int i = 0; i < m_neighbours.Count; i++) | 365 | for (int i = 0; i < m_neighbours.Count; i++) |
@@ -391,8 +390,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
391 | //m_log.Info("[UP]: " + otherRegion.RegionHandle.ToString()); | 390 | //m_log.Info("[UP]: " + otherRegion.RegionHandle.ToString()); |
392 | } | 391 | } |
393 | } | 392 | } |
394 | // If these are cast to INT because long + negative values + abs returns invalid data | ||
395 | 393 | ||
394 | // If these are cast to INT because long + negative values + abs returns invalid data | ||
396 | int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX); | 395 | int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX); |
397 | int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY); | 396 | int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY); |
398 | if (resultX <= 1 && resultY <= 1) | 397 | if (resultX <= 1 && resultY <= 1) |
@@ -428,7 +427,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
428 | return true; | 427 | return true; |
429 | } | 428 | } |
430 | 429 | ||
431 | // Given float seconds, this will restart the region. | ||
432 | public void AddNeighborRegion(RegionInfo region) | 430 | public void AddNeighborRegion(RegionInfo region) |
433 | { | 431 | { |
434 | lock (m_neighbours) | 432 | lock (m_neighbours) |
@@ -457,6 +455,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
457 | return found; | 455 | return found; |
458 | } | 456 | } |
459 | 457 | ||
458 | /// <summary> | ||
459 | /// Given float seconds, this will restart the region. | ||
460 | /// </summary> | ||
461 | /// <param name="seconds">float indicating duration before restart.</param> | ||
460 | public virtual void Restart(float seconds) | 462 | public virtual void Restart(float seconds) |
461 | { | 463 | { |
462 | // notifications are done in 15 second increments | 464 | // notifications are done in 15 second increments |
@@ -853,7 +855,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
853 | } | 855 | } |
854 | maintc = System.Environment.TickCount - maintc; | 856 | maintc = System.Environment.TickCount - maintc; |
855 | maintc = (int)(m_timespan * 1000) - maintc; | 857 | maintc = (int)(m_timespan * 1000) - maintc; |
856 | 858 | ||
857 | if ((maintc < (m_timespan * 1000)) && maintc > 0) | 859 | if ((maintc < (m_timespan * 1000)) && maintc > 0) |
858 | Thread.Sleep(maintc); | 860 | Thread.Sleep(maintc); |
859 | } | 861 | } |
@@ -1916,9 +1918,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1916 | } | 1918 | } |
1917 | 1919 | ||
1918 | /// <summary> | 1920 | /// <summary> |
1919 | /// Move the given scene object into a new region depending on which region its absolute position has moved | 1921 | /// Move the given scene object into a new region depending on which region its absolute position has moved |
1920 | /// into. | 1922 | /// into. |
1921 | /// | 1923 | /// |
1922 | /// This method locates the new region handle and offsets the prim position for the new region | 1924 | /// This method locates the new region handle and offsets the prim position for the new region |
1923 | /// </summary> | 1925 | /// </summary> |
1924 | /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> | 1926 | /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> |
@@ -1943,7 +1945,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1943 | } | 1945 | } |
1944 | return; | 1946 | return; |
1945 | } | 1947 | } |
1946 | 1948 | ||
1947 | int thisx = (int)RegionInfo.RegionLocX; | 1949 | int thisx = (int)RegionInfo.RegionLocX; |
1948 | int thisy = (int)RegionInfo.RegionLocY; | 1950 | int thisy = (int)RegionInfo.RegionLocY; |
1949 | 1951 | ||
@@ -1953,14 +1955,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1953 | if (attemptedPosition.X > Constants.RegionSize + 0.1f) | 1955 | if (attemptedPosition.X > Constants.RegionSize + 0.1f) |
1954 | { | 1956 | { |
1955 | pos.X = ((pos.X - Constants.RegionSize)); | 1957 | pos.X = ((pos.X - Constants.RegionSize)); |
1956 | newRegionHandle | 1958 | newRegionHandle |
1957 | = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); | 1959 | = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); |
1958 | // x + 1 | 1960 | // x + 1 |
1959 | } | 1961 | } |
1960 | else if (attemptedPosition.X < -0.1f) | 1962 | else if (attemptedPosition.X < -0.1f) |
1961 | { | 1963 | { |
1962 | pos.X = ((pos.X + Constants.RegionSize)); | 1964 | pos.X = ((pos.X + Constants.RegionSize)); |
1963 | newRegionHandle | 1965 | newRegionHandle |
1964 | = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); | 1966 | = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); |
1965 | // x - 1 | 1967 | // x - 1 |
1966 | } | 1968 | } |
@@ -1968,14 +1970,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1968 | if (attemptedPosition.Y > Constants.RegionSize + 0.1f) | 1970 | if (attemptedPosition.Y > Constants.RegionSize + 0.1f) |
1969 | { | 1971 | { |
1970 | pos.Y = ((pos.Y - Constants.RegionSize)); | 1972 | pos.Y = ((pos.Y - Constants.RegionSize)); |
1971 | newRegionHandle | 1973 | newRegionHandle |
1972 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize)); | 1974 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize)); |
1973 | // y + 1 | 1975 | // y + 1 |
1974 | } | 1976 | } |
1975 | else if (attemptedPosition.Y < -0.1f) | 1977 | else if (attemptedPosition.Y < -0.1f) |
1976 | { | 1978 | { |
1977 | pos.Y = ((pos.Y + Constants.RegionSize)); | 1979 | pos.Y = ((pos.Y + Constants.RegionSize)); |
1978 | newRegionHandle | 1980 | newRegionHandle |
1979 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize)); | 1981 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize)); |
1980 | // y - 1 | 1982 | // y - 1 |
1981 | } | 1983 | } |
@@ -1986,8 +1988,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1986 | 1988 | ||
1987 | // If we fail to cross the border, then reset the position of the scene object on that border. | 1989 | // If we fail to cross the border, then reset the position of the scene object on that border. |
1988 | if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp)) | 1990 | if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp)) |
1989 | { | 1991 | { |
1990 | grp.OffsetForNewRegion(oldGroupPosition); | 1992 | grp.OffsetForNewRegion(oldGroupPosition); |
1991 | } | 1993 | } |
1992 | } | 1994 | } |
1993 | 1995 | ||
@@ -1995,16 +1997,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
1995 | /// Move the given scene object into a new region | 1997 | /// Move the given scene object into a new region |
1996 | /// </summary> | 1998 | /// </summary> |
1997 | /// <param name="newRegionHandle"></param> | 1999 | /// <param name="newRegionHandle"></param> |
1998 | /// <param name="grp">Scene Object Group that we're crossing</param> | 2000 | /// <param name="grp">Scene Object Group that we're crossing</param> |
1999 | /// <returns> | 2001 | /// <returns> |
2000 | /// true if the crossing itself was successful, false on failure | 2002 | /// true if the crossing itself was successful, false on failure |
2001 | /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region | 2003 | /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region |
2002 | /// </returns> | 2004 | /// </returns> |
2003 | public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp) | 2005 | public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp) |
2004 | { | 2006 | { |
2005 | bool successYN = false; | 2007 | bool successYN = false; |
2006 | int primcrossingXMLmethod = 0; | 2008 | int primcrossingXMLmethod = 0; |
2007 | 2009 | ||
2008 | if (newRegionHandle != 0) | 2010 | if (newRegionHandle != 0) |
2009 | { | 2011 | { |
2010 | successYN | 2012 | successYN |
@@ -2021,7 +2023,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2021 | catch (Exception e) | 2023 | catch (Exception e) |
2022 | { | 2024 | { |
2023 | m_log.ErrorFormat( | 2025 | m_log.ErrorFormat( |
2024 | "[INTERREGION]: Exception deleting the old object left behind on a border crossing for {0}, {1}", | 2026 | "[INTERREGION]: Exception deleting the old object left behind on a border crossing for {0}, {1}", |
2025 | grp, e); | 2027 | grp, e); |
2026 | } | 2028 | } |
2027 | } | 2029 | } |
@@ -2034,7 +2036,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2034 | grp.RootPart.PhysActor.CrossingFailure(); | 2036 | grp.RootPart.PhysActor.CrossingFailure(); |
2035 | } | 2037 | } |
2036 | } | 2038 | } |
2037 | 2039 | ||
2038 | m_log.ErrorFormat("[INTERREGION]: Prim crossing failed for {0}", grp); | 2040 | m_log.ErrorFormat("[INTERREGION]: Prim crossing failed for {0}", grp); |
2039 | } | 2041 | } |
2040 | } | 2042 | } |
@@ -2042,7 +2044,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2042 | { | 2044 | { |
2043 | m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()"); | 2045 | m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()"); |
2044 | } | 2046 | } |
2045 | 2047 | ||
2046 | return successYN; | 2048 | return successYN; |
2047 | } | 2049 | } |
2048 | 2050 | ||
@@ -2300,7 +2302,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2300 | 2302 | ||
2301 | m_log.DebugFormat("gesture : {0} ", gestureId.ToString()); | 2303 | m_log.DebugFormat("gesture : {0} ", gestureId.ToString()); |
2302 | } | 2304 | } |
2303 | 2305 | ||
2304 | /// <summary> | 2306 | /// <summary> |
2305 | /// Teleport an avatar to their home region | 2307 | /// Teleport an avatar to their home region |
2306 | /// </summary> | 2308 | /// </summary> |
@@ -2325,7 +2327,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2325 | return; | 2327 | return; |
2326 | } | 2328 | } |
2327 | RequestTeleportLocation( | 2329 | RequestTeleportLocation( |
2328 | client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, | 2330 | client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, |
2329 | (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); | 2331 | (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); |
2330 | } | 2332 | } |
2331 | } | 2333 | } |
@@ -3929,7 +3931,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
3929 | // } | 3931 | // } |
3930 | 3932 | ||
3931 | /// <summary> | 3933 | /// <summary> |
3932 | /// Get a named prim contained in this scene (will return the first | 3934 | /// Get a named prim contained in this scene (will return the first |
3933 | /// found, if there are more than one prim with the same name) | 3935 | /// found, if there are more than one prim with the same name) |
3934 | /// </summary> | 3936 | /// </summary> |
3935 | /// <param name="name"></param> | 3937 | /// <param name="name"></param> |