aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2007-12-11 03:15:13 +0000
committerSean Dague2007-12-11 03:15:13 +0000
commitb7178ec2412b9defe4868330aacb4fdb2fe53db1 (patch)
tree6a92486877fd09382fcfed6e8ceb984b4522fc38 /OpenSim
parentadded copyright notices (diff)
downloadopensim-SC_OLD-b7178ec2412b9defe4868330aacb4fdb2fe53db1.zip
opensim-SC_OLD-b7178ec2412b9defe4868330aacb4fdb2fe53db1.tar.gz
opensim-SC_OLD-b7178ec2412b9defe4868330aacb4fdb2fe53db1.tar.bz2
opensim-SC_OLD-b7178ec2412b9defe4868330aacb4fdb2fe53db1.tar.xz
refactor SunModule a bit to make more sensible
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/SunModule.cs19
1 files changed, 12 insertions, 7 deletions
diff --git a/OpenSim/Region/Environment/Modules/SunModule.cs b/OpenSim/Region/Environment/Modules/SunModule.cs
index 6b5488d..233c83c 100644
--- a/OpenSim/Region/Environment/Modules/SunModule.cs
+++ b/OpenSim/Region/Environment/Modules/SunModule.cs
@@ -40,8 +40,9 @@ namespace OpenSim.Region.Environment.Modules
40{ 40{
41 public class SunModule : IRegionModule 41 public class SunModule : IRegionModule
42 { 42 {
43 private static double m_real_day = 24.0; 43 private const double m_real_day = 24.0;
44 private int m_frame_mod = 100; 44 private const int m_default_frame = 100;
45 private int m_frame_mod;
45 private double m_day_length; 46 private double m_day_length;
46 private int m_dilation; 47 private int m_dilation;
47 private int m_frame; 48 private int m_frame;
@@ -57,11 +58,11 @@ namespace OpenSim.Region.Environment.Modules
57 58
58 // Just in case they don't have the stanzas 59 // Just in case they don't have the stanzas
59 try { 60 try {
60 m_day_length = config.Configs["Sun"].GetDouble("day_length", 24.0); 61 m_day_length = config.Configs["Sun"].GetDouble("day_length", m_real_day);
61 m_frame_mod = config.Configs["Sun"].GetInt("frame_rate", 100); 62 m_frame_mod = config.Configs["Sun"].GetInt("frame_rate", m_default_frame);
62 } catch (Exception) { 63 } catch (Exception) {
63 m_day_length = 0.5; 64 m_day_length = m_real_day;
64 m_frame_mod = 100; 65 m_frame_mod = m_default_frame;
65 } 66 }
66 67
67 m_dilation = (int)(m_real_day / m_day_length); 68 m_dilation = (int)(m_real_day / m_day_length);
@@ -109,7 +110,11 @@ namespace OpenSim.Region.Environment.Modules
109 m_frame = 0; 110 m_frame = 0;
110 } 111 }
111 112
112 // Hour of the Day figures out the hour of the day as a float. The intent here is that we seed hour of the day with real time when the simulator starts, then run time forward faster based on time dilation factor. This means that ticks don't get out of hand 113 // Hour of the Day figures out the hour of the day as a float.
114 // The intent here is that we seed hour of the day with real
115 // time when the simulator starts, then run time forward
116 // faster based on time dilation factor. This means that
117 // ticks don't get out of hand
113 private double HourOfTheDay() 118 private double HourOfTheDay()
114 { 119 {
115 long m_addticks = (DateTime.Now.Ticks - m_start) * m_dilation; 120 long m_addticks = (DateTime.Now.Ticks - m_start) * m_dilation;