aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
diff options
context:
space:
mode:
authorDan Lake2009-10-26 07:50:25 -0700
committerJohn Hurliman2009-10-29 05:39:18 -0700
commit33448e4ba83b590e0e7e340faf3d7f2cef80c611 (patch)
tree959654ecdd83f8e78a98069b153504f92827ae12 /OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
parent* Implemented foot collision plane for avatars (diff)
downloadopensim-SC-33448e4ba83b590e0e7e340faf3d7f2cef80c611.zip
opensim-SC-33448e4ba83b590e0e7e340faf3d7f2cef80c611.tar.gz
opensim-SC-33448e4ba83b590e0e7e340faf3d7f2cef80c611.tar.bz2
opensim-SC-33448e4ba83b590e0e7e340faf3d7f2cef80c611.tar.xz
Optimizations
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs28
1 files changed, 18 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 2b858ec..37ec5df 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
93 private StateSource m_stateSource; 93 private StateSource m_stateSource;
94 private bool m_postOnRez; 94 private bool m_postOnRez;
95 private bool m_startedFromSavedState = false; 95 private bool m_startedFromSavedState = false;
96 private string m_CurrentState = String.Empty; 96 private int m_CurrentStateHash;
97 private UUID m_RegionID = UUID.Zero; 97 private UUID m_RegionID = UUID.Zero;
98 98
99 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> 99 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
@@ -252,16 +252,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
252 { 252 {
253 m_Apis[api] = am.CreateApi(api); 253 m_Apis[api] = am.CreateApi(api);
254 m_Apis[api].Initialize(engine, part, m_LocalID, itemID); 254 m_Apis[api].Initialize(engine, part, m_LocalID, itemID);
255 } 255 }
256
257 try
258 {
259 if (dom != System.AppDomain.CurrentDomain)
260 m_Script = (IScript)dom.CreateInstanceAndUnwrap(
261 Path.GetFileNameWithoutExtension(assembly),
262 "SecondLife.Script");
263 else
264 m_Script = (IScript)Assembly.Load(
265 Path.GetFileNameWithoutExtension(assembly)).CreateInstance(
266 "SecondLife.Script");
256 267
257 try
258 {
259 m_Script = (IScript)dom.CreateInstanceAndUnwrap(
260 Path.GetFileNameWithoutExtension(assembly),
261 "SecondLife.Script");
262 268
263 //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); 269 //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
264 RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); 270 //RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
265// lease.Register(this); 271// lease.Register(this);
266 } 272 }
267 catch (Exception) 273 catch (Exception)
@@ -893,7 +899,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
893 899
894 string xml = ScriptSerializer.Serialize(this); 900 string xml = ScriptSerializer.Serialize(this);
895 901
896 if (m_CurrentState != xml) 902 // Compare hash of the state we just just created with the state last written to disk
903 // If the state is different, update the disk file.
904 if(xml.GetHashCode() != m_CurrentStateHash)
897 { 905 {
898 try 906 try
899 { 907 {
@@ -911,7 +919,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
911 //{ 919 //{
912 // throw new Exception("Completed persistence save, but no file was created"); 920 // throw new Exception("Completed persistence save, but no file was created");
913 //} 921 //}
914 m_CurrentState = xml; 922 m_CurrentStateHash = xml.GetHashCode();
915 } 923 }
916 } 924 }
917 925