aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorSignpostMarv2012-10-26 11:22:00 +0100
committerJustin Clark-Casey (justincc)2013-01-03 00:18:33 +0000
commitaa78df4a79e4e357f8424a0163525c3254b2c146 (patch)
tree5adea9dade9f1c1e823948af38fbe5d004363620 /OpenSim/Region
parentImproving documentation of AttachToAvatar and GetLine methods in LSL_Api.cs b... (diff)
downloadopensim-SC_OLD-aa78df4a79e4e357f8424a0163525c3254b2c146.zip
opensim-SC_OLD-aa78df4a79e4e357f8424a0163525c3254b2c146.tar.gz
opensim-SC_OLD-aa78df4a79e4e357f8424a0163525c3254b2c146.tar.bz2
opensim-SC_OLD-aa78df4a79e4e357f8424a0163525c3254b2c146.tar.xz
Scipt modules get the OpenMetaverse types, so lists passed as arguments to script module functions which then later call LSL_Types.list.GetVector3Item() or LSL_Types.list.GetQuaternionItem() methods would then trigger an InvalidCastException, which is now avoided.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs29
1 files changed, 27 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index fcb98a5..44fdd1a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -631,19 +631,44 @@ namespace OpenSim.Region.ScriptEngine.Shared
631 631
632 public LSL_Types.Vector3 GetVector3Item(int itemIndex) 632 public LSL_Types.Vector3 GetVector3Item(int itemIndex)
633 { 633 {
634 if(m_data[itemIndex] is LSL_Types.Vector3) 634 if (m_data[itemIndex] is LSL_Types.Vector3)
635 {
635 return (LSL_Types.Vector3)m_data[itemIndex]; 636 return (LSL_Types.Vector3)m_data[itemIndex];
637 }
638 else if(m_data[itemIndex] is OpenMetaverse.Vector3)
639 {
640 return new LSL_Types.Vector3(
641 (OpenMetaverse.Vector3)m_data[itemIndex]);
642 }
636 else 643 else
644 {
637 throw new InvalidCastException(string.Format( 645 throw new InvalidCastException(string.Format(
638 "{0} expected but {1} given", 646 "{0} expected but {1} given",
639 typeof(LSL_Types.Vector3).Name, 647 typeof(LSL_Types.Vector3).Name,
640 m_data[itemIndex] != null ? 648 m_data[itemIndex] != null ?
641 m_data[itemIndex].GetType().Name : "null")); 649 m_data[itemIndex].GetType().Name : "null"));
650 }
642 } 651 }
643 652
644 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) 653 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)
645 { 654 {
646 return (LSL_Types.Quaternion)m_data[itemIndex]; 655 if (m_data[itemIndex] is LSL_Types.Quaternion)
656 {
657 return (LSL_Types.Quaternion)m_data[itemIndex];
658 }
659 else if(m_data[itemIndex] is OpenMetaverse.Quaternion)
660 {
661 return new LSL_Types.Quaternion(
662 (OpenMetaverse.Quaternion)m_data[itemIndex]);
663 }
664 else
665 {
666 throw new InvalidCastException(string.Format(
667 "{0} expected but {1} given",
668 typeof(LSL_Types.Quaternion).Name,
669 m_data[itemIndex] != null ?
670 m_data[itemIndex].GetType().Name : "null"));
671 }
647 } 672 }
648 673
649 public LSL_Types.key GetKeyItem(int itemIndex) 674 public LSL_Types.key GetKeyItem(int itemIndex)