diff options
author | Melanie | 2010-10-27 20:49:27 +0100 |
---|---|---|
committer | Melanie | 2010-10-27 20:49:27 +0100 |
commit | 05dbe4f2c4a58017ce6b59de45c2764f7ede4bd3 (patch) | |
tree | 22f6354b59a944d16aa9d0cab39fdb43ffb20667 /OpenSim/Region/CoreModules/World | |
parent | Merge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff) | |
parent | Prevent nullrefs in scene object deletion. Mantis #5156 (diff) | |
download | opensim-SC-05dbe4f2c4a58017ce6b59de45c2764f7ede4bd3.zip opensim-SC-05dbe4f2c4a58017ce6b59de45c2764f7ede4bd3.tar.gz opensim-SC-05dbe4f2c4a58017ce6b59de45c2764f7ede4bd3.tar.bz2 opensim-SC-05dbe4f2c4a58017ce6b59de45c2764f7ede4bd3.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 57 |
2 files changed, 20 insertions, 43 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 1687d06..3182079 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -199,13 +199,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
199 | { | 199 | { |
200 | majorVersion = 1; | 200 | majorVersion = 1; |
201 | minorVersion = 0; | 201 | minorVersion = 0; |
202 | } | 202 | } |
203 | */ | 203 | */ |
204 | 204 | ||
205 | m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); | 205 | m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); |
206 | // if (majorVersion == 1) | 206 | // if (majorVersion == 1) |
207 | // { | 207 | // { |
208 | // m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); | 208 | // m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); |
209 | // } | 209 | // } |
210 | 210 | ||
211 | 211 | ||
@@ -232,6 +232,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
232 | sw.Close(); | 232 | sw.Close(); |
233 | 233 | ||
234 | return s; | 234 | return s; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | } | 237 | } |
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index a6dc2ec..cea7c78 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs | |||
@@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules | |||
44 | /// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise. | 44 | /// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise. |
45 | /// </summary> | 45 | /// </summary> |
46 | 46 | ||
47 | |||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 48 | ||
50 | |||
51 | // | 49 | // |
52 | // Global Constants used to determine where in the sky the sun is | 50 | // Global Constants used to determine where in the sky the sun is |
53 | // | 51 | // |
@@ -108,26 +106,25 @@ namespace OpenSim.Region.CoreModules | |||
108 | private Scene m_scene = null; | 106 | private Scene m_scene = null; |
109 | 107 | ||
110 | // Calculated Once in the lifetime of a region | 108 | // Calculated Once in the lifetime of a region |
111 | private long TicksToEpoch; // Elapsed time for 1/1/1970 | 109 | private long TicksToEpoch; // Elapsed time for 1/1/1970 |
112 | private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds | 110 | private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds |
113 | private uint SecondsPerYear; // Length of a virtual year in RW seconds | 111 | private uint SecondsPerYear; // Length of a virtual year in RW seconds |
114 | private double SunSpeed; // Rate of passage in radians/second | 112 | private double SunSpeed; // Rate of passage in radians/second |
115 | private double SeasonSpeed; // Rate of change for seasonal effects | 113 | private double SeasonSpeed; // Rate of change for seasonal effects |
116 | // private double HoursToRadians; // Rate of change for seasonal effects | 114 | // private double HoursToRadians; // Rate of change for seasonal effects |
117 | private long TicksUTCOffset = 0; // seconds offset from UTC | 115 | private long TicksUTCOffset = 0; // seconds offset from UTC |
118 | // Calculated every update | 116 | // Calculated every update |
119 | private float OrbitalPosition; // Orbital placement at a point in time | 117 | private float OrbitalPosition; // Orbital placement at a point in time |
120 | private double HorizonShift; // Axis offset to skew day and night | 118 | private double HorizonShift; // Axis offset to skew day and night |
121 | private double TotalDistanceTravelled; // Distance since beginning of time (in radians) | 119 | private double TotalDistanceTravelled; // Distance since beginning of time (in radians) |
122 | private double SeasonalOffset; // Seaonal variation of tilt | 120 | private double SeasonalOffset; // Seaonal variation of tilt |
123 | private float Magnitude; // Normal tilt | 121 | private float Magnitude; // Normal tilt |
124 | // private double VWTimeRatio; // VW time as a ratio of real time | 122 | // private double VWTimeRatio; // VW time as a ratio of real time |
125 | 123 | ||
126 | // Working values | 124 | // Working values |
127 | private Vector3 Position = Vector3.Zero; | 125 | private Vector3 Position = Vector3.Zero; |
128 | private Vector3 Velocity = Vector3.Zero; | 126 | private Vector3 Velocity = Vector3.Zero; |
129 | private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f); | 127 | private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f); |
130 | |||
131 | 128 | ||
132 | // Used to fix the sun in the sky so it doesn't move based on current time | 129 | // Used to fix the sun in the sky so it doesn't move based on current time |
133 | private bool m_SunFixed = false; | 130 | private bool m_SunFixed = false; |
@@ -135,8 +132,6 @@ namespace OpenSim.Region.CoreModules | |||
135 | 132 | ||
136 | private const int TICKS_PER_SECOND = 10000000; | 133 | private const int TICKS_PER_SECOND = 10000000; |
137 | 134 | ||
138 | |||
139 | |||
140 | // Current time in elapsed seconds since Jan 1st 1970 | 135 | // Current time in elapsed seconds since Jan 1st 1970 |
141 | private ulong CurrentTime | 136 | private ulong CurrentTime |
142 | { | 137 | { |
@@ -149,8 +144,6 @@ namespace OpenSim.Region.CoreModules | |||
149 | // Time in seconds since UTC to use to calculate sun position. | 144 | // Time in seconds since UTC to use to calculate sun position. |
150 | ulong PosTime = 0; | 145 | ulong PosTime = 0; |
151 | 146 | ||
152 | |||
153 | |||
154 | /// <summary> | 147 | /// <summary> |
155 | /// Calculate the sun's orbital position and its velocity. | 148 | /// Calculate the sun's orbital position and its velocity. |
156 | /// </summary> | 149 | /// </summary> |
@@ -202,7 +195,6 @@ namespace OpenSim.Region.CoreModules | |||
202 | PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds); | 195 | PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds); |
203 | } | 196 | } |
204 | } | 197 | } |
205 | |||
206 | } | 198 | } |
207 | 199 | ||
208 | TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians | 200 | TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians |
@@ -251,7 +243,6 @@ namespace OpenSim.Region.CoreModules | |||
251 | Velocity.X = 0; | 243 | Velocity.X = 0; |
252 | Velocity.Y = 0; | 244 | Velocity.Y = 0; |
253 | Velocity.Z = 0; | 245 | Velocity.Z = 0; |
254 | |||
255 | } | 246 | } |
256 | else | 247 | else |
257 | { | 248 | { |
@@ -271,9 +262,7 @@ namespace OpenSim.Region.CoreModules | |||
271 | private float GetCurrentTimeAsLindenSunHour() | 262 | private float GetCurrentTimeAsLindenSunHour() |
272 | { | 263 | { |
273 | if (m_SunFixed) | 264 | if (m_SunFixed) |
274 | { | ||
275 | return m_SunFixedHour + 6; | 265 | return m_SunFixedHour + 6; |
276 | } | ||
277 | 266 | ||
278 | return GetCurrentSunHour() + 6.0f; | 267 | return GetCurrentSunHour() + 6.0f; |
279 | } | 268 | } |
@@ -297,8 +286,6 @@ namespace OpenSim.Region.CoreModules | |||
297 | m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); | 286 | m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); |
298 | } | 287 | } |
299 | 288 | ||
300 | |||
301 | |||
302 | TimeZone local = TimeZone.CurrentTimeZone; | 289 | TimeZone local = TimeZone.CurrentTimeZone; |
303 | TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; | 290 | TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; |
304 | m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); | 291 | m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); |
@@ -325,13 +312,11 @@ namespace OpenSim.Region.CoreModules | |||
325 | // must hard code to ~.5 to match sun position in LL based viewers | 312 | // must hard code to ~.5 to match sun position in LL based viewers |
326 | m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night); | 313 | m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night); |
327 | 314 | ||
328 | |||
329 | // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours | 315 | // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours |
330 | m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale); | 316 | m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale); |
331 | 317 | ||
332 | // Update frequency in frames | 318 | // Update frequency in frames |
333 | m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod); | 319 | m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod); |
334 | |||
335 | } | 320 | } |
336 | catch (Exception e) | 321 | catch (Exception e) |
337 | { | 322 | { |
@@ -391,10 +376,8 @@ namespace OpenSim.Region.CoreModules | |||
391 | } | 376 | } |
392 | 377 | ||
393 | scene.RegisterModuleInterface<ISunModule>(this); | 378 | scene.RegisterModuleInterface<ISunModule>(this); |
394 | |||
395 | } | 379 | } |
396 | 380 | ||
397 | |||
398 | public void PostInitialise() | 381 | public void PostInitialise() |
399 | { | 382 | { |
400 | } | 383 | } |
@@ -402,7 +385,7 @@ namespace OpenSim.Region.CoreModules | |||
402 | public void Close() | 385 | public void Close() |
403 | { | 386 | { |
404 | ready = false; | 387 | ready = false; |
405 | 388 | ||
406 | // Remove our hooks | 389 | // Remove our hooks |
407 | m_scene.EventManager.OnFrame -= SunUpdate; | 390 | m_scene.EventManager.OnFrame -= SunUpdate; |
408 | m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; | 391 | m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; |
@@ -419,6 +402,7 @@ namespace OpenSim.Region.CoreModules | |||
419 | { | 402 | { |
420 | get { return false; } | 403 | get { return false; } |
421 | } | 404 | } |
405 | |||
422 | #endregion | 406 | #endregion |
423 | 407 | ||
424 | #region EventManager Events | 408 | #region EventManager Events |
@@ -446,9 +430,7 @@ namespace OpenSim.Region.CoreModules | |||
446 | public void SunUpdate() | 430 | public void SunUpdate() |
447 | { | 431 | { |
448 | if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate) | 432 | if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate) |
449 | { | ||
450 | return; | 433 | return; |
451 | } | ||
452 | 434 | ||
453 | GenSunPos(); // Generate shared values once | 435 | GenSunPos(); // Generate shared values once |
454 | 436 | ||
@@ -467,7 +449,7 @@ namespace OpenSim.Region.CoreModules | |||
467 | } | 449 | } |
468 | 450 | ||
469 | /// <summary> | 451 | /// <summary> |
470 | /// | 452 | /// |
471 | /// </summary> | 453 | /// </summary> |
472 | /// <param name="regionHandle"></param> | 454 | /// <param name="regionHandle"></param> |
473 | /// <param name="FixedTime">Is the sun's position fixed?</param> | 455 | /// <param name="FixedTime">Is the sun's position fixed?</param> |
@@ -484,7 +466,6 @@ namespace OpenSim.Region.CoreModules | |||
484 | while (FixedSunHour < 0) | 466 | while (FixedSunHour < 0) |
485 | FixedSunHour += 24; | 467 | FixedSunHour += 24; |
486 | 468 | ||
487 | |||
488 | m_SunFixedHour = FixedSunHour; | 469 | m_SunFixedHour = FixedSunHour; |
489 | m_SunFixed = FixedSun; | 470 | m_SunFixed = FixedSun; |
490 | 471 | ||
@@ -499,14 +480,12 @@ namespace OpenSim.Region.CoreModules | |||
499 | // When sun settings are updated, we should update all clients with new settings. | 480 | // When sun settings are updated, we should update all clients with new settings. |
500 | SunUpdateToAllClients(); | 481 | SunUpdateToAllClients(); |
501 | 482 | ||
502 | |||
503 | m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); | 483 | m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); |
504 | } | 484 | } |
505 | } | 485 | } |
506 | 486 | ||
507 | #endregion | 487 | #endregion |
508 | 488 | ||
509 | |||
510 | private void SunUpdateToAllClients() | 489 | private void SunUpdateToAllClients() |
511 | { | 490 | { |
512 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 491 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -553,7 +532,6 @@ namespace OpenSim.Region.CoreModules | |||
553 | { | 532 | { |
554 | float ticksleftover = CurrentTime % SecondsPerSunCycle; | 533 | float ticksleftover = CurrentTime % SecondsPerSunCycle; |
555 | 534 | ||
556 | |||
557 | return (24.0f * (ticksleftover / SecondsPerSunCycle)); | 535 | return (24.0f * (ticksleftover / SecondsPerSunCycle)); |
558 | } | 536 | } |
559 | 537 | ||
@@ -666,7 +644,6 @@ namespace OpenSim.Region.CoreModules | |||
666 | 644 | ||
667 | // When sun settings are updated, we should update all clients with new settings. | 645 | // When sun settings are updated, we should update all clients with new settings. |
668 | SunUpdateToAllClients(); | 646 | SunUpdateToAllClients(); |
669 | |||
670 | } | 647 | } |
671 | 648 | ||
672 | return Output; | 649 | return Output; |