From 02a4298b02bbc8439eaafb3c39cdefd5761317f9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 20 May 2017 21:29:33 +0100 Subject: mantis 8172: fix llList2Json() in case of vector or rotation types --- .../Shared/Api/Implementation/LSL_Api.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d5f2e78..86ea437 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -16794,7 +16794,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case LitJson.JsonType.Boolean: return ((bool)elem ? (LSL_String)ScriptBaseClass.JSON_TRUE : (LSL_String)ScriptBaseClass.JSON_FALSE); case LitJson.JsonType.Double: - return (new LSL_Float((float)elem)); + return (new LSL_Float((double)elem)); case LitJson.JsonType.None: return ((LSL_String)ScriptBaseClass.JSON_NULL); case LitJson.JsonType.String: @@ -16804,7 +16804,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string s = LitJson.JsonMapper.ToJson(elem); return (LSL_String)s; default: - throw new Exception(ScriptBaseClass.JSON_INVALID); + throw new Exception(ScriptBaseClass.JSON_INVALID); } } @@ -16879,9 +16879,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return i.ToString(); } if (o is LSL_Rotation) - return ((LSL_Rotation)o).ToString(); + { + StringBuilder sb = new StringBuilder(128); + sb.Append("\""); + LSL_Rotation r = (LSL_Rotation)o; + sb.Append(r.ToString()); + sb.Append("\""); + return sb.ToString(); + } if (o is LSL_Vector) - return ((LSL_Vector)o).ToString(); + { + StringBuilder sb = new StringBuilder(128); + sb.Append("\""); + LSL_Vector v = (LSL_Vector)o; + sb.Append(v.ToString()); + sb.Append("\""); + return sb.ToString(); + } if (o is LSL_String || o is string) { string str; -- cgit v1.1 From 046ec66ff9f5a3721d7135c8a472a36293940912 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 20 May 2017 22:21:27 +0100 Subject: fix a cast that makes LitJson unhappy --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 86ea437..af88e4f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -16756,7 +16756,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api retl.Add((LSL_String)((bool)elem ? ScriptBaseClass.JSON_TRUE : ScriptBaseClass.JSON_FALSE)); return retl; case LitJson.JsonType.Double: - retl.Add(new LSL_Float((float)elem)); + retl.Add(new LSL_Float((double)elem)); return retl; case LitJson.JsonType.None: retl.Add((LSL_String)ScriptBaseClass.JSON_NULL); -- cgit v1.1