aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-09 04:16:52 +0000
committerMelanie Thielker2008-09-09 04:16:52 +0000
commit4f85a9aa726b5e2ee700dacef34ee8fa24ff0fcc (patch)
tree3c9b1c0b1de553878afd7c7bc0c5d95d02149f69 /OpenSim/Region/ScriptEngine/Shared
parentPreserve link numbers when items are taken into inventory and re-rezzed. (diff)
downloadopensim-SC_OLD-4f85a9aa726b5e2ee700dacef34ee8fa24ff0fcc.zip
opensim-SC_OLD-4f85a9aa726b5e2ee700dacef34ee8fa24ff0fcc.tar.gz
opensim-SC_OLD-4f85a9aa726b5e2ee700dacef34ee8fa24ff0fcc.tar.bz2
opensim-SC_OLD-4f85a9aa726b5e2ee700dacef34ee8fa24ff0fcc.tar.xz
Fix llResetScript() and the reset button to actually restore global
variables to their initializer values, rather then zeroing them. Also handles lists properly now.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs37
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs2
2 files changed, 32 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
index 9f0dd27..0a1f2cf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
@@ -89,6 +89,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
89 return apis; 89 return apis;
90 } 90 }
91 91
92 private Dictionary<string, object> m_InitialValues =
93 new Dictionary<string, object>();
94 private Dictionary<string, FieldInfo> m_Fields =
95 new Dictionary<string, FieldInfo>();
96
92 public void InitApi(string api, IScriptApi data) 97 public void InitApi(string api, IScriptApi data)
93 { 98 {
94 if (!inits.ContainsKey(api)) 99 if (!inits.ContainsKey(api))
@@ -100,12 +105,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
100 args[0] = data; 105 args[0] = data;
101 106
102 mi.Invoke(this, args); 107 mi.Invoke(this, args);
103 }
104 108
105 private Dictionary<string, object> m_InitialValues = 109 m_InitialValues = GetVars();
106 new Dictionary<string, object>(); 110 }
107 private Dictionary<string, FieldInfo> m_Fields =
108 new Dictionary<string, FieldInfo>();
109 111
110 public Dictionary<string, object> GetVars() 112 public Dictionary<string, object> GetVars()
111 { 113 {
@@ -127,7 +129,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
127 { 129 {
128 m_Fields[field.Name]=field; 130 m_Fields[field.Name]=field;
129 131
130 vars[field.Name]=field.GetValue(this); 132 if(field.FieldType is LSL_Types.list) // ref type, copy
133 {
134 LSL_Types.list v = (LSL_Types.list)field.GetValue(this);
135 Object[] data = new Object[v.Data.Length];
136 Array.Copy(data, 0, v.Data, 0, v.Data.Length);
137 vars[field.Name] = data;
138 }
139 else
140 {
141 vars[field.Name] = field.GetValue(this);
142 }
131 } 143 }
132 144
133 return vars; 145 return vars;
@@ -139,7 +151,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
139 { 151 {
140 if (m_Fields.ContainsKey(var.Key)) 152 if (m_Fields.ContainsKey(var.Key))
141 { 153 {
142 m_Fields[var.Key].SetValue(this, var.Value); 154 if (m_Fields[var.Key].FieldType is LSL_Types.list)
155 {
156 LSL_Types.list v = (LSL_Types.list)m_Fields[var.Key].GetValue(this);
157 Object[] data = (Object[])var.Value;
158 v.Data = new Object[data.Length];
159 Array.Copy(v.Data, 0, data, 0, data.Length);
160 m_Fields[var.Key].SetValue(this, v);
161 }
162 else
163 {
164 m_Fields[var.Key].SetValue(this, var.Value);
165 }
143 } 166 }
144 } 167 }
145 } 168 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 481f671..004b53e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -419,6 +419,8 @@ namespace OpenSim.Region.ScriptEngine.Shared
419 m_data=new Object[0]; 419 m_data=new Object[0];
420 return m_data; 420 return m_data;
421 } 421 }
422
423 set {m_data = value; }
422 } 424 }
423 425
424 // Member functions to obtain item as specific types. 426 // Member functions to obtain item as specific types.