aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
diff options
context:
space:
mode:
authorRobert Adams2013-03-23 11:03:59 -0700
committerRobert Adams2013-03-25 15:40:44 -0700
commitc96a6f1de6d5e66dd2055365c26144d7a92f2fc5 (patch)
treeaed79404c68c35758e10cd324c8088641b677cc1 /OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
parentBulletSim: fix possible race condition where an prim's asset can be requested... (diff)
downloadopensim-SC_OLD-c96a6f1de6d5e66dd2055365c26144d7a92f2fc5.zip
opensim-SC_OLD-c96a6f1de6d5e66dd2055365c26144d7a92f2fc5.tar.gz
opensim-SC_OLD-c96a6f1de6d5e66dd2055365c26144d7a92f2fc5.tar.bz2
opensim-SC_OLD-c96a6f1de6d5e66dd2055365c26144d7a92f2fc5.tar.xz
BulletSim: small tweaks and formatting in the parameter fetching code.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs21
1 files changed, 16 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 26d2d60..f3454c8 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -203,10 +203,10 @@ public static class BSParam
203 public delegate void PSetOnObject<T>(BSScene scene, BSPhysObject obj); 203 public delegate void PSetOnObject<T>(BSScene scene, BSPhysObject obj);
204 public sealed class ParameterDefn<T> : ParameterDefnBase 204 public sealed class ParameterDefn<T> : ParameterDefnBase
205 { 205 {
206 T defaultValue; 206 private T defaultValue;
207 PSetValue<T> setter; 207 private PSetValue<T> setter;
208 PGetValue<T> getter; 208 private PGetValue<T> getter;
209 PSetOnObject<T> objectSet; 209 private PSetOnObject<T> objectSet;
210 public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue<T> pGetter, PSetValue<T> pSetter) 210 public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue<T> pGetter, PSetValue<T> pSetter)
211 : base(pName, pDesc) 211 : base(pName, pDesc)
212 { 212 {
@@ -223,13 +223,23 @@ public static class BSParam
223 getter = pGetter; 223 getter = pGetter;
224 objectSet = pObjSetter; 224 objectSet = pObjSetter;
225 } 225 }
226 /* Wish I could simplify using this definition but CLR doesn't store references so closure around delegates of references won't work
227 public ParameterDefn(string pName, string pDesc, T pDefault, ref T loc)
228 : base(pName, pDesc)
229 {
230 defaultValue = pDefault;
231 setter = (s, v) => { loc = v; };
232 getter = (s) => { return loc; };
233 objectSet = null;
234 }
235 */
226 public override void AssignDefault(BSScene s) 236 public override void AssignDefault(BSScene s)
227 { 237 {
228 setter(s, defaultValue); 238 setter(s, defaultValue);
229 } 239 }
230 public override string GetValue(BSScene s) 240 public override string GetValue(BSScene s)
231 { 241 {
232 return String.Format("{0}", getter(s)); 242 return getter(s).ToString();
233 } 243 }
234 public override void SetValue(BSScene s, string valAsString) 244 public override void SetValue(BSScene s, string valAsString)
235 { 245 {
@@ -252,6 +262,7 @@ public static class BSParam
252 try 262 try
253 { 263 {
254 T setValue = (T)parser.Invoke(genericType, new Object[] { valAsString }); 264 T setValue = (T)parser.Invoke(genericType, new Object[] { valAsString });
265 // Store the parsed value
255 setter(s, setValue); 266 setter(s, setValue);
256 // s.Logger.DebugFormat("{0} Parameter {1} = {2}", LogHeader, name, setValue); 267 // s.Logger.DebugFormat("{0} Parameter {1} = {2}", LogHeader, name, setValue);
257 } 268 }