diff options
author | Jeff Ames | 2008-05-14 05:11:23 +0000 |
---|---|---|
committer | Jeff Ames | 2008-05-14 05:11:23 +0000 |
commit | c995d60d37032db3198b8496e186aa7a892dc7a8 (patch) | |
tree | 826147e66f61c812897d9b0acdb16ebfeb30d4d3 /OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |
parent | * Added 3 warnings in response to the warnings. Adam, read the warnings. (diff) | |
download | opensim-SC-c995d60d37032db3198b8496e186aa7a892dc7a8.zip opensim-SC-c995d60d37032db3198b8496e186aa7a892dc7a8.tar.gz opensim-SC-c995d60d37032db3198b8496e186aa7a892dc7a8.tar.bz2 opensim-SC-c995d60d37032db3198b8496e186aa7a892dc7a8.tar.xz |
Formatting cleanup.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 4050f36..61b577e 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
137 | 137 | ||
138 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | 138 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) |
139 | { | 139 | { |
140 | if(inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) | 140 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) |
141 | { | 141 | { |
142 | invItemID=inv.Key; | 142 | invItemID=inv.Key; |
143 | break; | 143 | break; |
@@ -152,9 +152,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
152 | m_host.AddScriptLPS(1); | 152 | m_host.AddScriptLPS(1); |
153 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | 153 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) |
154 | { | 154 | { |
155 | if(inv.Value.Name == name) | 155 | if (inv.Value.Name == name) |
156 | { | 156 | { |
157 | if(inv.Value.Type != type) | 157 | if (inv.Value.Type != type) |
158 | return LLUUID.Zero; | 158 | return LLUUID.Zero; |
159 | 159 | ||
160 | return inv.Value.AssetID.ToString(); | 160 | return inv.Value.AssetID.ToString(); |
@@ -168,7 +168,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
168 | m_host.AddScriptLPS(1); | 168 | m_host.AddScriptLPS(1); |
169 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | 169 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) |
170 | { | 170 | { |
171 | if(inv.Value.Name == name) | 171 | if (inv.Value.Name == name) |
172 | { | 172 | { |
173 | return inv.Value.AssetID.ToString(); | 173 | return inv.Value.AssetID.ToString(); |
174 | } | 174 | } |
@@ -362,11 +362,11 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
362 | double x,y,z,s; | 362 | double x,y,z,s; |
363 | 363 | ||
364 | double c1 = Math.Cos(v.y / 2); | 364 | double c1 = Math.Cos(v.y / 2); |
365 | double s1 = Math.Sin(v.y / 2 ); | 365 | double s1 = Math.Sin(v.y / 2); |
366 | double c2 = Math.Cos(v.z / 2 ); | 366 | double c2 = Math.Cos(v.z / 2); |
367 | double s2 = Math.Sin(v.z / 2 ); | 367 | double s2 = Math.Sin(v.z / 2); |
368 | double c3 = Math.Cos(v.x / 2 ); | 368 | double c3 = Math.Cos(v.x / 2); |
369 | double s3 = Math.Sin(v.x / 2 ); | 369 | double s3 = Math.Sin(v.x / 2); |
370 | 370 | ||
371 | double c1c2 = c1 * c2; | 371 | double c1c2 = c1 * c2; |
372 | double s1s2 = s1 * s2; | 372 | double s1s2 = s1 * s2; |
@@ -2900,7 +2900,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2900 | { | 2900 | { |
2901 | rotation rot = llEuler2Rot(<0,70,0> * DEG_TO_RAD); | 2901 | rotation rot = llEuler2Rot(<0,70,0> * DEG_TO_RAD); |
2902 | 2902 | ||
2903 | llOwnerSay("to get here, we rotate over: "+ (string) llRot2Axis(rot) ); | 2903 | llOwnerSay("to get here, we rotate over: "+ (string) llRot2Axis(rot)); |
2904 | llOwnerSay("and we rotate for: "+ (llRot2Angle(rot) * RAD_TO_DEG)); | 2904 | llOwnerSay("and we rotate for: "+ (llRot2Angle(rot) * RAD_TO_DEG)); |
2905 | 2905 | ||
2906 | // convert back and forth between quaternion <-> vector and angle | 2906 | // convert back and forth between quaternion <-> vector and angle |
@@ -3339,14 +3339,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3339 | if (src.Data.Length > 0) | 3339 | if (src.Data.Length > 0) |
3340 | { | 3340 | { |
3341 | ret = src.Data[x++].ToString(); | 3341 | ret = src.Data[x++].ToString(); |
3342 | for(;x<src.Data.Length;x++) | 3342 | for (; x < src.Data.Length; x++) |
3343 | { | 3343 | { |
3344 | ret += ", "+src.Data[x].ToString(); | 3344 | ret += ", "+src.Data[x].ToString(); |
3345 | } | 3345 | } |
3346 | } | 3346 | } |
3347 | 3347 | ||
3348 | return ret; | 3348 | return ret; |
3349 | |||
3350 | } | 3349 | } |
3351 | 3350 | ||
3352 | /// <summary> | 3351 | /// <summary> |
@@ -3367,9 +3366,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3367 | 3366 | ||
3368 | m_host.AddScriptLPS(1); | 3367 | m_host.AddScriptLPS(1); |
3369 | 3368 | ||
3370 | for(int i=0; i<src.Length; i++) | 3369 | for (int i = 0; i < src.Length; i++) |
3371 | { | 3370 | { |
3372 | switch(src[i]) | 3371 | switch (src[i]) |
3373 | { | 3372 | { |
3374 | case '<' : | 3373 | case '<' : |
3375 | parens++; | 3374 | parens++; |
@@ -3435,15 +3434,14 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3435 | 3434 | ||
3436 | if (src.Length != stride && src.Length%stride == 0) | 3435 | if (src.Length != stride && src.Length%stride == 0) |
3437 | { | 3436 | { |
3438 | |||
3439 | chunkk = src.Length/stride; | 3437 | chunkk = src.Length/stride; |
3440 | 3438 | ||
3441 | chunks = new int[chunkk]; | 3439 | chunks = new int[chunkk]; |
3442 | 3440 | ||
3443 | for(int i=0;i<chunkk;i++) | 3441 | for (int i = 0; i < chunkk; i++) |
3444 | chunks[i] = i; | 3442 | chunks[i] = i; |
3445 | 3443 | ||
3446 | for(int i=0; i<chunkk-1; i++) | 3444 | for (int i = 0; i < chunkk - 1; i++) |
3447 | { | 3445 | { |
3448 | // randomly select 2 chunks | 3446 | // randomly select 2 chunks |
3449 | index1 = rand.Next(rand.Next(65536)); | 3447 | index1 = rand.Next(rand.Next(65536)); |
@@ -3461,10 +3459,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3461 | 3459 | ||
3462 | result = new LSL_Types.list(); | 3460 | result = new LSL_Types.list(); |
3463 | 3461 | ||
3464 | for(int i=0; i<chunkk; i++) | 3462 | for (int i = 0; i < chunkk; i++) |
3465 | for(int j=0;j<stride;j++) | 3463 | { |
3464 | for (int j = 0; j < stride; j++) | ||
3465 | { | ||
3466 | result.Add(src.Data[chunks[i]*stride+j]); | 3466 | result.Add(src.Data[chunks[i]*stride+j]); |
3467 | 3467 | } | |
3468 | } | ||
3468 | } | 3469 | } |
3469 | else { | 3470 | else { |
3470 | object[] array = new object[src.Length]; | 3471 | object[] array = new object[src.Length]; |
@@ -3540,25 +3541,28 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3540 | stride = 1; | 3541 | stride = 1; |
3541 | 3542 | ||
3542 | if (stride > 0) | 3543 | if (stride > 0) |
3543 | for(int i=0;i<src.Length;i+=stride) | 3544 | { |
3545 | for (int i = 0; i < src.Length; i += stride) | ||
3544 | { | 3546 | { |
3545 | if (i<=ei[0] && i>=si[0]) | 3547 | if (i<=ei[0] && i>=si[0]) |
3546 | result.Add(src.Data[i]); | 3548 | result.Add(src.Data[i]); |
3547 | if (twopass && i>=si[1] && i<=ei[1]) | 3549 | if (twopass && i>=si[1] && i<=ei[1]) |
3548 | result.Add(src.Data[i]); | 3550 | result.Add(src.Data[i]); |
3549 | } | 3551 | } |
3552 | } | ||
3550 | else if (stride < 0) | 3553 | else if (stride < 0) |
3551 | for(int i=src.Length-1;i>=0;i+=stride) | 3554 | { |
3555 | for (int i = src.Length - 1; i >= 0; i += stride) | ||
3552 | { | 3556 | { |
3553 | if (i<=ei[0] && i>=si[0]) | 3557 | if (i <= ei[0] && i >= si[0]) |
3554 | result.Add(src.Data[i]); | 3558 | result.Add(src.Data[i]); |
3555 | if (twopass && i>=si[1] && i<=ei[1]) | 3559 | if (twopass && i >= si[1] && i <= ei[1]) |
3556 | result.Add(src.Data[i]); | 3560 | result.Add(src.Data[i]); |
3557 | } | 3561 | } |
3562 | } | ||
3558 | } | 3563 | } |
3559 | 3564 | ||
3560 | return result; | 3565 | return result; |
3561 | |||
3562 | } | 3566 | } |
3563 | 3567 | ||
3564 | public LSL_Types.Vector3 llGetRegionCorner() | 3568 | public LSL_Types.Vector3 llGetRegionCorner() |
@@ -3635,12 +3639,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3635 | 3639 | ||
3636 | if (src.Length != 0 && test.Length != 0) | 3640 | if (src.Length != 0 && test.Length != 0) |
3637 | { | 3641 | { |
3638 | for(int i=0; i< length; i++) | 3642 | for (int i = 0; i < length; i++) |
3639 | { | 3643 | { |
3640 | if (src.Data[i].Equals(test.Data[0])) | 3644 | if (src.Data[i].Equals(test.Data[0])) |
3641 | { | 3645 | { |
3642 | int j; | 3646 | int j; |
3643 | for(j=1;j<test.Length;j++) | 3647 | for (j = 1; j < test.Length; j++) |
3644 | if (!src.Data[i+j].Equals(test.Data[j])) | 3648 | if (!src.Data[i+j].Equals(test.Data[j])) |
3645 | break; | 3649 | break; |
3646 | if (j == test.Length) | 3650 | if (j == test.Length) |
@@ -4328,7 +4332,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4328 | return; | 4332 | return; |
4329 | } | 4333 | } |
4330 | string[] buts = new string[buttons.Length]; | 4334 | string[] buts = new string[buttons.Length]; |
4331 | for(int i = 0; i < buttons.Length; i++) | 4335 | for (int i = 0; i < buttons.Length; i++) |
4332 | { | 4336 | { |
4333 | if (buttons.Data[i].ToString() == String.Empty) | 4337 | if (buttons.Data[i].ToString() == String.Empty) |
4334 | { | 4338 | { |
@@ -4516,7 +4520,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4516 | int face; | 4520 | int face; |
4517 | LSL_Types.Vector3 v; | 4521 | LSL_Types.Vector3 v; |
4518 | 4522 | ||
4519 | switch(code) | 4523 | switch (code) |
4520 | { | 4524 | { |
4521 | case 6: // PRIM_POSITION | 4525 | case 6: // PRIM_POSITION |
4522 | if (remain < 1) | 4526 | if (remain < 1) |
@@ -4826,12 +4830,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4826 | 4830 | ||
4827 | LSL_Types.list res = new LSL_Types.list(); | 4831 | LSL_Types.list res = new LSL_Types.list(); |
4828 | int idx=0; | 4832 | int idx=0; |
4829 | while(idx < rules.Length) | 4833 | while (idx < rules.Length) |
4830 | { | 4834 | { |
4831 | int code=Convert.ToInt32(rules.Data[idx++]); | 4835 | int code=Convert.ToInt32(rules.Data[idx++]); |
4832 | int remain=rules.Length-idx; | 4836 | int remain=rules.Length-idx; |
4833 | 4837 | ||
4834 | switch(code) | 4838 | switch (code) |
4835 | { | 4839 | { |
4836 | case 2: // PRIM_MATERIAL | 4840 | case 2: // PRIM_MATERIAL |
4837 | res.Add(new LSL_Types.LSLInteger(m_host.Material)); | 4841 | res.Add(new LSL_Types.LSLInteger(m_host.Material)); |
@@ -5339,19 +5343,20 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5339 | 5343 | ||
5340 | // All entries are initially valid | 5344 | // All entries are initially valid |
5341 | 5345 | ||
5342 | for(int i=0; i<mlen; i++) active[i] = true; | 5346 | for (int i = 0; i < mlen; i++) |
5347 | active[i] = true; | ||
5343 | 5348 | ||
5344 | offset[mlen] = srclen; | 5349 | offset[mlen] = srclen; |
5345 | 5350 | ||
5346 | while(beginning<srclen) | 5351 | while (beginning < srclen) |
5347 | { | 5352 | { |
5348 | 5353 | ||
5349 | best = mlen; // as bad as it gets | 5354 | best = mlen; // as bad as it gets |
5350 | 5355 | ||
5351 | // Scan for separators | 5356 | // Scan for separators |
5352 | 5357 | ||
5353 | for(j=0; j<seplen; j++) | 5358 | for (j = 0; j < seplen; j++) |
5354 | { | 5359 | { |
5355 | if (active[j]) | 5360 | if (active[j]) |
5356 | { | 5361 | { |
5357 | // scan all of the markers | 5362 | // scan all of the markers |
@@ -5359,7 +5364,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5359 | { | 5364 | { |
5360 | // not present at all | 5365 | // not present at all |
5361 | active[j] = false; | 5366 | active[j] = false; |
5362 | } else | 5367 | } |
5368 | else | ||
5363 | { | 5369 | { |
5364 | // present and correct | 5370 | // present and correct |
5365 | if (offset[j] < offset[best]) | 5371 | if (offset[j] < offset[best]) |
@@ -5377,7 +5383,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5377 | 5383 | ||
5378 | if (offset[best] != beginning) | 5384 | if (offset[best] != beginning) |
5379 | { | 5385 | { |
5380 | for(j=seplen; (j<mlen) && (offset[best] > beginning); j++) | 5386 | for (j = seplen; (j < mlen) && (offset[best] > beginning); j++) |
5381 | { | 5387 | { |
5382 | if (active[j]) | 5388 | if (active[j]) |
5383 | { | 5389 | { |
@@ -6174,7 +6180,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6174 | { | 6180 | { |
6175 | foreach (object o in args.Data) | 6181 | foreach (object o in args.Data) |
6176 | { | 6182 | { |
6177 | switch(o.ToString()) | 6183 | switch (o.ToString()) |
6178 | { | 6184 | { |
6179 | case "1": | 6185 | case "1": |
6180 | ret.Add(av.Firstname + " " + av.Lastname); | 6186 | ret.Add(av.Firstname + " " + av.Lastname); |
@@ -6207,9 +6213,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6207 | SceneObjectPart obj = World.GetSceneObjectPart(key); | 6213 | SceneObjectPart obj = World.GetSceneObjectPart(key); |
6208 | if (obj != null) | 6214 | if (obj != null) |
6209 | { | 6215 | { |
6210 | foreach(object o in args.Data) | 6216 | foreach (object o in args.Data) |
6211 | { | 6217 | { |
6212 | switch(o.ToString()) | 6218 | switch (o.ToString()) |
6213 | { | 6219 | { |
6214 | case "1": | 6220 | case "1": |
6215 | ret.Add(obj.Name); | 6221 | ret.Add(obj.Name); |