diff options
author | Justin Clark-Casey (justincc) | 2011-07-16 00:08:11 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-07-16 00:08:11 +0100 |
commit | 7247ca16447e962d0f8281e0ed4f163ea4e06b96 (patch) | |
tree | f94824b2f64c41db7f198fe2bb505ef296299142 /OpenSim/Region/ScriptEngine/Shared | |
parent | change async parameter name in AddLocalPacketHandler since it becomes a reser... (diff) | |
download | opensim-SC-7247ca16447e962d0f8281e0ed4f163ea4e06b96.zip opensim-SC-7247ca16447e962d0f8281e0ed4f163ea4e06b96.tar.gz opensim-SC-7247ca16447e962d0f8281e0ed4f163ea4e06b96.tar.bz2 opensim-SC-7247ca16447e962d0f8281e0ed4f163ea4e06b96.tar.xz |
use constants in llGetObjectDetails() rather than magic numbers
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7759b0a..26969a5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2523,10 +2523,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2523 | /// negative (indicating end-relative) and may be inverted, | 2523 | /// negative (indicating end-relative) and may be inverted, |
2524 | /// i.e. end < start. | 2524 | /// i.e. end < start. |
2525 | /// </summary> | 2525 | /// </summary> |
2526 | |||
2527 | public LSL_String llDeleteSubString(string src, int start, int end) | 2526 | public LSL_String llDeleteSubString(string src, int start, int end) |
2528 | { | 2527 | { |
2529 | |||
2530 | m_host.AddScriptLPS(1); | 2528 | m_host.AddScriptLPS(1); |
2531 | 2529 | ||
2532 | // Normalize indices (if negative). | 2530 | // Normalize indices (if negative). |
@@ -2606,10 +2604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2606 | /// which case it is end-relative. The index may exceed either | 2604 | /// which case it is end-relative. The index may exceed either |
2607 | /// string bound, with the result being a concatenation. | 2605 | /// string bound, with the result being a concatenation. |
2608 | /// </summary> | 2606 | /// </summary> |
2609 | |||
2610 | public LSL_String llInsertString(string dest, int index, string src) | 2607 | public LSL_String llInsertString(string dest, int index, string src) |
2611 | { | 2608 | { |
2612 | |||
2613 | m_host.AddScriptLPS(1); | 2609 | m_host.AddScriptLPS(1); |
2614 | 2610 | ||
2615 | // Normalize indices (if negative). | 2611 | // Normalize indices (if negative). |
@@ -9996,6 +9992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9996 | public LSL_List llGetObjectDetails(string id, LSL_List args) | 9992 | public LSL_List llGetObjectDetails(string id, LSL_List args) |
9997 | { | 9993 | { |
9998 | m_host.AddScriptLPS(1); | 9994 | m_host.AddScriptLPS(1); |
9995 | |||
9999 | LSL_List ret = new LSL_List(); | 9996 | LSL_List ret = new LSL_List(); |
10000 | UUID key = new UUID(); | 9997 | UUID key = new UUID(); |
10001 | if (UUID.TryParse(id, out key)) | 9998 | if (UUID.TryParse(id, out key)) |
@@ -10006,30 +10003,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10006 | { | 10003 | { |
10007 | foreach (object o in args.Data) | 10004 | foreach (object o in args.Data) |
10008 | { | 10005 | { |
10009 | switch (o.ToString()) | 10006 | switch (int.Parse(o.ToString())) |
10010 | { | 10007 | { |
10011 | case "1": | 10008 | case ScriptBaseClass.OBJECT_NAME: |
10012 | ret.Add(new LSL_String(av.Firstname + " " + av.Lastname)); | 10009 | ret.Add(new LSL_String(av.Firstname + " " + av.Lastname)); |
10013 | break; | 10010 | break; |
10014 | case "2": | 10011 | case ScriptBaseClass.OBJECT_DESC: |
10015 | ret.Add(new LSL_String("")); | 10012 | ret.Add(new LSL_String("")); |
10016 | break; | 10013 | break; |
10017 | case "3": | 10014 | case ScriptBaseClass.OBJECT_POS: |
10018 | ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); | 10015 | ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); |
10019 | break; | 10016 | break; |
10020 | case "4": | 10017 | case ScriptBaseClass.OBJECT_ROT: |
10021 | ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); | 10018 | ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); |
10022 | break; | 10019 | break; |
10023 | case "5": | 10020 | case ScriptBaseClass.OBJECT_VELOCITY: |
10024 | ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); | 10021 | ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); |
10025 | break; | 10022 | break; |
10026 | case "6": | 10023 | case ScriptBaseClass.OBJECT_OWNER: |
10027 | ret.Add(new LSL_String(id)); | 10024 | ret.Add(new LSL_String(id)); |
10028 | break; | 10025 | break; |
10029 | case "7": | 10026 | case ScriptBaseClass.OBJECT_GROUP: |
10030 | ret.Add(new LSL_String(UUID.Zero.ToString())); | 10027 | ret.Add(new LSL_String(UUID.Zero.ToString())); |
10031 | break; | 10028 | break; |
10032 | case "8": | 10029 | case ScriptBaseClass.OBJECT_CREATOR: |
10033 | ret.Add(new LSL_String(UUID.Zero.ToString())); | 10030 | ret.Add(new LSL_String(UUID.Zero.ToString())); |
10034 | break; | 10031 | break; |
10035 | } | 10032 | } |
@@ -10043,37 +10040,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10043 | { | 10040 | { |
10044 | foreach (object o in args.Data) | 10041 | foreach (object o in args.Data) |
10045 | { | 10042 | { |
10046 | switch (o.ToString()) | 10043 | switch (int.Parse(o.ToString())) |
10047 | { | 10044 | { |
10048 | case "1": | 10045 | case ScriptBaseClass.OBJECT_NAME: |
10049 | ret.Add(new LSL_String(obj.Name)); | 10046 | ret.Add(new LSL_String(obj.Name)); |
10050 | break; | 10047 | break; |
10051 | case "2": | 10048 | case ScriptBaseClass.OBJECT_DESC: |
10052 | ret.Add(new LSL_String(obj.Description)); | 10049 | ret.Add(new LSL_String(obj.Description)); |
10053 | break; | 10050 | break; |
10054 | case "3": | 10051 | case ScriptBaseClass.OBJECT_POS: |
10055 | ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); | 10052 | ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); |
10056 | break; | 10053 | break; |
10057 | case "4": | 10054 | case ScriptBaseClass.OBJECT_ROT: |
10058 | ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); | 10055 | ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); |
10059 | break; | 10056 | break; |
10060 | case "5": | 10057 | case ScriptBaseClass.OBJECT_VELOCITY: |
10061 | ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); | 10058 | ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); |
10062 | break; | 10059 | break; |
10063 | case "6": | 10060 | case ScriptBaseClass.OBJECT_OWNER: |
10064 | ret.Add(new LSL_String(obj.OwnerID.ToString())); | 10061 | ret.Add(new LSL_String(obj.OwnerID.ToString())); |
10065 | break; | 10062 | break; |
10066 | case "7": | 10063 | case ScriptBaseClass.OBJECT_GROUP: |
10067 | ret.Add(new LSL_String(obj.GroupID.ToString())); | 10064 | ret.Add(new LSL_String(obj.GroupID.ToString())); |
10068 | break; | 10065 | break; |
10069 | case "8": | 10066 | case ScriptBaseClass.OBJECT_CREATOR: |
10070 | ret.Add(new LSL_String(obj.CreatorID.ToString())); | 10067 | ret.Add(new LSL_String(obj.CreatorID.ToString())); |
10071 | break; | 10068 | break; |
10072 | } | 10069 | } |
10073 | } | 10070 | } |
10071 | |||
10074 | return ret; | 10072 | return ret; |
10075 | } | 10073 | } |
10076 | } | 10074 | } |
10075 | |||
10077 | return new LSL_List(); | 10076 | return new LSL_List(); |
10078 | } | 10077 | } |
10079 | 10078 | ||