From bfeb3881f2f5ea52b38864bcc679390623613da0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 1 Sep 2008 21:54:04 +0000 Subject: [PATCH] Another attempt at fixing XEngine llSetPrimitiveParams: Make it accept LSLIntegers in lists, and attempt to address the scope issue on TRUE and FALSE with readonly static linkage --- .../Shared/Api/Implementation/LSL_Api.cs | 48 +++++++++---------- .../Shared/Api/Runtime/LSL_Constants.cs | 4 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b5ca1671ae..a8c74acb56 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5509,7 +5509,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api while (idx < rules.Length) { - int code = Convert.ToInt32(rules.Data[idx++]); + int code = Convert.ToInt32(rules.Data[idx++].ToString()); int remain = rules.Length - idx; @@ -5547,7 +5547,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 3) return; - code = Convert.ToInt32(rules.Data[idx++]); + code = Convert.ToInt32(rules.Data[idx++].ToString()); remain = rules.Length - idx; float hollow; @@ -5566,7 +5566,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 6) return; - face = Convert.ToInt32(rules.Data[idx++]); // holeshape + face = Convert.ToInt32(rules.Data[idx++].ToString()); // holeshape v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // cut hollow = (float)Convert.ToDouble(rules.Data[idx++]); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); @@ -5580,7 +5580,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 6) return; - face = Convert.ToInt32(rules.Data[idx++]); // holeshape + face = Convert.ToInt32(rules.Data[idx++].ToString()); // holeshape v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // cut hollow = (float)Convert.ToDouble(rules.Data[idx++]); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); @@ -5595,7 +5595,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 6) return; - face = Convert.ToInt32(rules.Data[idx++]); // holeshape + face = Convert.ToInt32(rules.Data[idx++].ToString()); // holeshape v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut hollow = (float)Convert.ToDouble(rules.Data[idx++]); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); @@ -5609,7 +5609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 5) return; - face = Convert.ToInt32(rules.Data[idx++]); // holeshape + face = Convert.ToInt32(rules.Data[idx++].ToString()); // holeshape v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // cut hollow = (float)Convert.ToDouble(rules.Data[idx++]); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); @@ -5622,7 +5622,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 11) return; - face = Convert.ToInt32(rules.Data[idx++]); // holeshape + face = Convert.ToInt32(rules.Data[idx++].ToString()); // holeshape v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut hollow = (float)Convert.ToDouble(rules.Data[idx++]); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); @@ -5641,7 +5641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 11) return; - face = Convert.ToInt32(rules.Data[idx++]); // holeshape + face = Convert.ToInt32(rules.Data[idx++].ToString()); // holeshape v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut hollow = (float)Convert.ToDouble(rules.Data[idx++]); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); @@ -5660,7 +5660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 11) return; - face = Convert.ToInt32(rules.Data[idx++]); // holeshape + face = Convert.ToInt32(rules.Data[idx++].ToString()); // holeshape v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut hollow = (float)Convert.ToDouble(rules.Data[idx++]); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); @@ -5680,7 +5680,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; string map = rules.Data[idx++].ToString(); - face = Convert.ToInt32(rules.Data[idx++]); // type + face = Convert.ToInt32(rules.Data[idx++].ToString()); // type m_host.Shape.PathCurve = (byte) Extrusion.Curve1; SetPrimitiveShapeParams(map, face); break; @@ -5692,7 +5692,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 5) return; - face=Convert.ToInt32(rules.Data[idx++]); + face=Convert.ToInt32(rules.Data[idx++].ToString()); string tex=rules.Data[idx++].ToString(); LSL_Types.Vector3 repeats=new LSL_Types.Vector3(rules.Data[idx++].ToString()); LSL_Types.Vector3 offsets=new LSL_Types.Vector3(rules.Data[idx++].ToString()); @@ -5709,7 +5709,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 3) return; - face=Convert.ToInt32(rules.Data[idx++]); + face=Convert.ToInt32(rules.Data[idx++].ToString()); LSL_Types.Vector3 color=new LSL_Types.Vector3(rules.Data[idx++].ToString()); double alpha=Convert.ToDouble(rules.Data[idx++]); @@ -5721,8 +5721,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 7) return; - int flexi = Convert.ToInt32(rules.Data[idx++]); - int softness = Convert.ToInt32(rules.Data[idx++]); + int flexi = Convert.ToInt32(rules.Data[idx++].ToString()); + int softness = Convert.ToInt32(rules.Data[idx++].ToString()); float gravity = (float)Convert.ToDouble(rules.Data[idx++]); float friction = (float)Convert.ToDouble(rules.Data[idx++]); float wind = (float)Convert.ToDouble(rules.Data[idx++]); @@ -5747,7 +5747,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 2) return; - face = Convert.ToInt32(rules.Data[idx++]); + face = Convert.ToInt32(rules.Data[idx++].ToString()); float glow = (float)Convert.ToDouble(rules.Data[idx++]); SetGlow(part, face, glow); @@ -5756,8 +5756,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 3) return; - face = Convert.ToInt32(rules.Data[idx++]); - int shiny = Convert.ToInt32(rules.Data[idx++]); + face = Convert.ToInt32(rules.Data[idx++].ToString()); + int shiny = Convert.ToInt32(rules.Data[idx++].ToString()); Bumpiness bump = (Bumpiness)Convert.ToByte(rules.Data[idx++]); SetShiny(part, face, shiny, bump); @@ -5766,7 +5766,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 2) return; - face = Convert.ToInt32(rules.Data[idx++]); + face = Convert.ToInt32(rules.Data[idx++].ToString()); string bv = rules.Data[idx++].ToString(); bool st; if (bv.Equals("1")) @@ -6071,7 +6071,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int idx=0; while (idx < rules.Length) { - int code=Convert.ToInt32(rules.Data[idx++]); + int code=Convert.ToInt32(rules.Data[idx++].ToString()); int remain=rules.Length-idx; switch (code) @@ -6236,7 +6236,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return res; - face=Convert.ToInt32(rules.Data[idx++]); + face=Convert.ToInt32(rules.Data[idx++].ToString()); res.Add(new LSL_Types.LSLInteger(0)); res.Add(new LSL_Types.LSLInteger(0)); @@ -6247,7 +6247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return res; - face=Convert.ToInt32(rules.Data[idx++]); + face=Convert.ToInt32(rules.Data[idx++].ToString()); res.Add(new LSL_Types.LSLInteger(0)); break; @@ -6275,7 +6275,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return res; - face=Convert.ToInt32(rules.Data[idx++]); + face=Convert.ToInt32(rules.Data[idx++].ToString()); res.Add(new LSL_Types.LSLInteger(0)); break; @@ -6300,7 +6300,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return res; - face=Convert.ToInt32(rules.Data[idx++]); + face=Convert.ToInt32(rules.Data[idx++].ToString()); res.Add(new LSL_Types.LSLFloat(0)); break; @@ -7387,7 +7387,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SortedDictionary parameters = new SortedDictionary(); object[] data = rules.Data; for (int i = 0; i < data.Length; ++i) { - int type = Convert.ToInt32(data[i++]); + int type = Convert.ToInt32(data[i++].ToString()); if (i >= data.Length) break; // odd number of entries => ignore the last // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 739e168e27..e3b81b7633 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -35,8 +35,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public partial class ScriptBaseClass : MarshalByRefObject { // LSL CONSTANTS - public LSLInteger TRUE = new LSLInteger(1); - public LSLInteger FALSE = new LSLInteger(0); + public static readonly LSLInteger TRUE = new LSLInteger(1); + public static readonly LSLInteger FALSE = new LSLInteger(0); public const int STATUS_PHYSICS = 1; public const int STATUS_ROTATE_X = 2;