aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorlbsa712009-02-12 09:53:12 +0000
committerlbsa712009-02-12 09:53:12 +0000
commit801da4346aeb3c08969c4845f5c595135a64470a (patch)
tree2f06e24c72e0d513c8e4c6aa9b75cd2c7b50f393 /OpenSim/Region/Framework/Scenes/Scene.cs
parentThanks Kitto Flora for a patch that adds automatic min fly height to ODE - Ma... (diff)
downloadopensim-SC_OLD-801da4346aeb3c08969c4845f5c595135a64470a.zip
opensim-SC_OLD-801da4346aeb3c08969c4845f5c595135a64470a.tar.gz
opensim-SC_OLD-801da4346aeb3c08969c4845f5c595135a64470a.tar.bz2
opensim-SC_OLD-801da4346aeb3c08969c4845f5c595135a64470a.tar.xz
* optimized usings.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs56
1 files changed, 26 insertions, 30 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 848b497..e2eb89e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -30,26 +30,22 @@ using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.Drawing.Imaging; 31using System.Drawing.Imaging;
32using System.IO; 32using System.IO;
33using System.Xml; 33using System.Text;
34using System.Threading; 34using System.Threading;
35using System.Timers; 35using System.Timers;
36using System.Xml;
37using Nini.Config;
36using OpenMetaverse; 38using OpenMetaverse;
37using OpenMetaverse.Imaging; 39using OpenMetaverse.Imaging;
38using OpenMetaverse.Packets;
39using OpenSim.Framework; 40using OpenSim.Framework;
40using OpenSim.Framework.Console;
41using OpenSim.Framework.Communications; 41using OpenSim.Framework.Communications;
42using OpenSim.Framework.Communications.Cache; 42using OpenSim.Framework.Communications.Cache;
43using OpenSim.Framework.Servers; 43using OpenSim.Framework.Console;
44using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Region.Framework.Scenes.Scripting; 45using OpenSim.Region.Framework.Scenes.Scripting;
46using OpenSim.Region.Physics.Manager; 46using OpenSim.Region.Physics.Manager;
47using Nini.Config; 47using Timer=System.Timers.Timer;
48using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
49using Image = System.Drawing.Image;
50using TPFlags = OpenSim.Framework.Constants.TeleportFlags; 48using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
51using Timer = System.Timers.Timer;
52using OSD = OpenMetaverse.StructuredData.OSD;
53 49
54namespace OpenSim.Region.Framework.Scenes 50namespace OpenSim.Region.Framework.Scenes
55{ 51{
@@ -776,7 +772,7 @@ namespace OpenSim.Region.Framework.Scenes
776 int maintc = 0; 772 int maintc = 0;
777 while (!shuttingdown) 773 while (!shuttingdown)
778 { 774 {
779 maintc = System.Environment.TickCount; 775 maintc = Environment.TickCount;
780 776
781 TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate; 777 TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;
782 // Aquire a lock so only one update call happens at once 778 // Aquire a lock so only one update call happens at once
@@ -802,7 +798,7 @@ namespace OpenSim.Region.Framework.Scenes
802 } 798 }
803 } 799 }
804 800
805 frameMS = System.Environment.TickCount; 801 frameMS = Environment.TickCount;
806 try 802 try
807 { 803 {
808 // Increment the frame counter 804 // Increment the frame counter
@@ -812,15 +808,15 @@ namespace OpenSim.Region.Framework.Scenes
812 if (m_frame == Int32.MaxValue) 808 if (m_frame == Int32.MaxValue)
813 m_frame = 0; 809 m_frame = 0;
814 810
815 physicsMS2 = System.Environment.TickCount; 811 physicsMS2 = Environment.TickCount;
816 if ((m_frame % m_update_physics == 0) && m_physics_enabled) 812 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
817 m_sceneGraph.UpdatePreparePhysics(); 813 m_sceneGraph.UpdatePreparePhysics();
818 physicsMS2 = System.Environment.TickCount - physicsMS2; 814 physicsMS2 = Environment.TickCount - physicsMS2;
819 815
820 if (m_frame % m_update_entitymovement == 0) 816 if (m_frame % m_update_entitymovement == 0)
821 m_sceneGraph.UpdateEntityMovement(); 817 m_sceneGraph.UpdateEntityMovement();
822 818
823 physicsMS = System.Environment.TickCount; 819 physicsMS = Environment.TickCount;
824 if ((m_frame % m_update_physics == 0) && m_physics_enabled) 820 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
825 physicsFPS = m_sceneGraph.UpdatePhysics( 821 physicsFPS = m_sceneGraph.UpdatePhysics(
826 Math.Max(SinceLastFrame.TotalSeconds, m_timespan) 822 Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
@@ -828,10 +824,10 @@ namespace OpenSim.Region.Framework.Scenes
828 if (m_frame % m_update_physics == 0 && SynchronizeScene != null) 824 if (m_frame % m_update_physics == 0 && SynchronizeScene != null)
829 SynchronizeScene(this); 825 SynchronizeScene(this);
830 826
831 physicsMS = System.Environment.TickCount - physicsMS; 827 physicsMS = Environment.TickCount - physicsMS;
832 physicsMS += physicsMS2; 828 physicsMS += physicsMS2;
833 829
834 otherMS = System.Environment.TickCount; 830 otherMS = Environment.TickCount;
835 // run through all entities looking for updates (slow) 831 // run through all entities looking for updates (slow)
836 if (m_frame % m_update_entities == 0) 832 if (m_frame % m_update_entities == 0)
837 m_sceneGraph.UpdateEntities(); 833 m_sceneGraph.UpdateEntities();
@@ -864,7 +860,7 @@ namespace OpenSim.Region.Framework.Scenes
864 860
865 if (m_frame % m_update_land == 0) 861 if (m_frame % m_update_land == 0)
866 UpdateLand(); 862 UpdateLand();
867 otherMS = System.Environment.TickCount - otherMS; 863 otherMS = Environment.TickCount - otherMS;
868 // if (m_frame%m_update_avatars == 0) 864 // if (m_frame%m_update_avatars == 0)
869 // UpdateInWorldTime(); 865 // UpdateInWorldTime();
870 StatsReporter.AddPhysicsFPS(physicsFPS); 866 StatsReporter.AddPhysicsFPS(physicsFPS);
@@ -875,7 +871,7 @@ namespace OpenSim.Region.Framework.Scenes
875 StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); 871 StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
876 StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); 872 StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
877 StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); 873 StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
878 frameMS = System.Environment.TickCount - frameMS; 874 frameMS = Environment.TickCount - frameMS;
879 StatsReporter.addFrameMS(frameMS); 875 StatsReporter.addFrameMS(frameMS);
880 StatsReporter.addPhysicsMS(physicsMS); 876 StatsReporter.addPhysicsMS(physicsMS);
881 StatsReporter.addOtherMS(otherMS); 877 StatsReporter.addOtherMS(otherMS);
@@ -919,7 +915,7 @@ namespace OpenSim.Region.Framework.Scenes
919 915
920 m_lastupdate = DateTime.Now; 916 m_lastupdate = DateTime.Now;
921 } 917 }
922 maintc = System.Environment.TickCount - maintc; 918 maintc = Environment.TickCount - maintc;
923 maintc = (int)(m_timespan * 1000) - maintc; 919 maintc = (int)(m_timespan * 1000) - maintc;
924 920
925 if ((maintc < (m_timespan * 1000)) && maintc > 0) 921 if ((maintc < (m_timespan * 1000)) && maintc > 0)
@@ -1184,7 +1180,7 @@ namespace OpenSim.Region.Framework.Scenes
1184 { 1180 {
1185 #region Fallback default maptile generation 1181 #region Fallback default maptile generation
1186 1182
1187 int tc = System.Environment.TickCount; 1183 int tc = Environment.TickCount;
1188 m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain"); 1184 m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain");
1189 Bitmap mapbmp = new Bitmap(256, 256); 1185 Bitmap mapbmp = new Bitmap(256, 256);
1190 double[,] hm = Heightmap.GetDoubles(); 1186 double[,] hm = Heightmap.GetDoubles();
@@ -1301,7 +1297,7 @@ namespace OpenSim.Region.Framework.Scenes
1301 hfdiffi = hfdiffi + Math.Abs((int)(((hfdiff % 1) * 0.5f) * 10f) - 1); 1297 hfdiffi = hfdiffi + Math.Abs((int)(((hfdiff % 1) * 0.5f) * 10f) - 1);
1302 } 1298 }
1303 } 1299 }
1304 catch (System.OverflowException) 1300 catch (OverflowException)
1305 { 1301 {
1306 m_log.Debug("[MAPTILE]: Shadow failed at value: " + hfdiff.ToString()); 1302 m_log.Debug("[MAPTILE]: Shadow failed at value: " + hfdiff.ToString());
1307 ShadowDebugContinue = false; 1303 ShadowDebugContinue = false;
@@ -1325,7 +1321,7 @@ namespace OpenSim.Region.Framework.Scenes
1325 } 1321 }
1326 } 1322 }
1327 } 1323 }
1328 catch (System.ArgumentException) 1324 catch (ArgumentException)
1329 { 1325 {
1330 if (!terraincorruptedwarningsaid) 1326 if (!terraincorruptedwarningsaid)
1331 { 1327 {
@@ -1361,7 +1357,7 @@ namespace OpenSim.Region.Framework.Scenes
1361 Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255); 1357 Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255);
1362 mapbmp.SetPixel(x, (256 - y) - 1, water); 1358 mapbmp.SetPixel(x, (256 - y) - 1, water);
1363 } 1359 }
1364 catch (System.ArgumentException) 1360 catch (ArgumentException)
1365 { 1361 {
1366 if (!terraincorruptedwarningsaid) 1362 if (!terraincorruptedwarningsaid)
1367 { 1363 {
@@ -1379,7 +1375,7 @@ namespace OpenSim.Region.Framework.Scenes
1379 //m_log.Info("[MAPTILE]: Completed One row in " + tc + " ms"); 1375 //m_log.Info("[MAPTILE]: Completed One row in " + tc + " ms");
1380 } 1376 }
1381 1377
1382 m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (System.Environment.TickCount - tc) + " ms"); 1378 m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
1383 1379
1384 bool drawPrimVolume = true; 1380 bool drawPrimVolume = true;
1385 1381
@@ -1395,7 +1391,7 @@ namespace OpenSim.Region.Framework.Scenes
1395 1391
1396 if (drawPrimVolume) 1392 if (drawPrimVolume)
1397 { 1393 {
1398 tc = System.Environment.TickCount; 1394 tc = Environment.TickCount;
1399 m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); 1395 m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
1400 List<EntityBase> objs = GetEntities(); 1396 List<EntityBase> objs = GetEntities();
1401 1397
@@ -1547,7 +1543,7 @@ namespace OpenSim.Region.Framework.Scenes
1547 } // foreach loop over entities 1543 } // foreach loop over entities
1548 } // lock entities objs 1544 } // lock entities objs
1549 1545
1550 m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (System.Environment.TickCount - tc) + " ms"); 1546 m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms");
1551 } // end if drawPrimOnMaptle 1547 } // end if drawPrimOnMaptle
1552 1548
1553 byte[] data; 1549 byte[] data;
@@ -2146,7 +2142,7 @@ namespace OpenSim.Region.Framework.Scenes
2146 string spath = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString()); 2142 string spath = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
2147 spath = Path.Combine(spath, uuid.ToString()); 2143 spath = Path.Combine(spath, uuid.ToString());
2148 FileStream sfs = File.Create(spath + ".state"); 2144 FileStream sfs = File.Create(spath + ".state");
2149 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); 2145 ASCIIEncoding enc = new ASCIIEncoding();
2150 Byte[] buf = enc.GetBytes(sdoc.InnerXml); 2146 Byte[] buf = enc.GetBytes(sdoc.InnerXml);
2151 sfs.Write(buf, 0, buf.Length); 2147 sfs.Write(buf, 0, buf.Length);
2152 sfs.Close(); 2148 sfs.Close();
@@ -2350,7 +2346,7 @@ namespace OpenSim.Region.Framework.Scenes
2350 CreateAndAddScenePresence(client); 2346 CreateAndAddScenePresence(client);
2351 } 2347 }
2352 2348
2353 m_LastLogin = System.Environment.TickCount; 2349 m_LastLogin = Environment.TickCount;
2354 EventManager.TriggerOnNewClient(client); 2350 EventManager.TriggerOnNewClient(client);
2355 } 2351 }
2356 2352
@@ -2891,7 +2887,7 @@ namespace OpenSim.Region.Framework.Scenes
2891 m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, new List<ulong>(loggingOffUser.KnownRegions.Keys)); 2887 m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, new List<ulong>(loggingOffUser.KnownRegions.Keys));
2892 loggingOffUser.ControllingClient.Kick(message); 2888 loggingOffUser.ControllingClient.Kick(message);
2893 // Give them a second to receive the message! 2889 // Give them a second to receive the message!
2894 System.Threading.Thread.Sleep(1000); 2890 Thread.Sleep(1000);
2895 loggingOffUser.ControllingClient.Close(true); 2891 loggingOffUser.ControllingClient.Close(true);
2896 } 2892 }
2897 else 2893 else
@@ -4157,7 +4153,7 @@ namespace OpenSim.Region.Framework.Scenes
4157 4153
4158 // A login in the last 4 mins? We can't be doing too badly 4154 // A login in the last 4 mins? We can't be doing too badly
4159 // 4155 //
4160 if ((System.Environment.TickCount - m_LastLogin) < 240000) 4156 if ((Environment.TickCount - m_LastLogin) < 240000)
4161 health++; 4157 health++;
4162 4158
4163 return 0; 4159 return 0;