aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorUbitUmarov2015-10-08 06:27:37 +0100
committerUbitUmarov2015-10-08 06:27:37 +0100
commit2b354902b5581156fcbfecb37c5bc2abeae89c3b (patch)
treed2041ee0a6a90945ea4edb9b93c3da6977e7dd00 /OpenSim/Region/ScriptEngine
parent change opensim.ini.example to reflect the changes to npc creation options (diff)
downloadopensim-SC_OLD-2b354902b5581156fcbfecb37c5bc2abeae89c3b.zip
opensim-SC_OLD-2b354902b5581156fcbfecb37c5bc2abeae89c3b.tar.gz
opensim-SC_OLD-2b354902b5581156fcbfecb37c5bc2abeae89c3b.tar.bz2
opensim-SC_OLD-2b354902b5581156fcbfecb37c5bc2abeae89c3b.tar.xz
fix the casting to Boolean of lsl types vector,quaternion,list and rotation, so that if(variable) does compile and work. key still requires a explicit compare to NULL_KEY
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index c34aecc..d501979 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -100,6 +100,17 @@ namespace OpenSim.Region.ScriptEngine.Shared
100 100
101 #region Overriders 101 #region Overriders
102 102
103 public static implicit operator Boolean(Vector3 vec)
104 {
105 if (vec.x != 0)
106 return true;
107 if (vec.y != 0)
108 return true;
109 if (vec.z != 0)
110 return true;
111 return false;
112 }
113
103 public override string ToString() 114 public override string ToString()
104 { 115 {
105 string s = String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z); 116 string s = String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z);
@@ -397,6 +408,18 @@ namespace OpenSim.Region.ScriptEngine.Shared
397 #endregion 408 #endregion
398 409
399 #region Overriders 410 #region Overriders
411 public static implicit operator Boolean(Quaternion q)
412 {
413 if (q.x != 0)
414 return true;
415 if (q.y != 0)
416 return true;
417 if (q.z != 0)
418 return true;
419 if (q.s != 1.0f)
420 return true;
421 return false;
422 }
400 423
401 public override int GetHashCode() 424 public override int GetHashCode()
402 { 425 {
@@ -721,6 +744,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
721 Data = tmp; 744 Data = tmp;
722 } 745 }
723 746
747 public static implicit operator Boolean(list l)
748 {
749 return l.Length != 0;
750 }
751
724 public static list operator +(list a, LSLString s) 752 public static list operator +(list a, LSLString s)
725 { 753 {
726 a.ExtendAndAdd(s); 754 a.ExtendAndAdd(s);