aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJeff Ames2008-06-09 08:46:33 +0000
committerJeff Ames2008-06-09 08:46:33 +0000
commitdfb63b56230bdd3bfd897d499ce977ea9ee9891d (patch)
tree1d340aa26183382142d5df917388eacc3084033c /OpenSim
parentMantis#1469. Thank you kindly, Mikem for a patch that addresses: (diff)
downloadopensim-SC_OLD-dfb63b56230bdd3bfd897d499ce977ea9ee9891d.zip
opensim-SC_OLD-dfb63b56230bdd3bfd897d499ce977ea9ee9891d.tar.gz
opensim-SC_OLD-dfb63b56230bdd3bfd897d499ce977ea9ee9891d.tar.bz2
opensim-SC_OLD-dfb63b56230bdd3bfd897d499ce977ea9ee9891d.tar.xz
Update svn properties. Formatting cleanup.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs105
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs20
-rw-r--r--OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestList.cs202
6 files changed, 168 insertions, 166 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index a903fd8..64ea157 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -677,60 +677,61 @@ namespace OpenSim
677 return result; 677 return result;
678 } 678 }
679 679
680 /// <summary> 680 /// <summary>
681 /// Runs the best matching plugin command 681 /// Runs the best matching plugin command
682 /// 682 ///
683 /// returns true if a match was found, false otherwise. 683 /// returns true if a match was found, false otherwise.
684 /// </summary> 684 /// </summary>
685 public bool RunPluginCommands(string cmdWithParams) 685 public bool RunPluginCommands(string cmdWithParams)
686 { 686 {
687 ConsolePluginCommand bestMatch = null; 687 ConsolePluginCommand bestMatch = null;
688 int bestLength = 0; 688 int bestLength = 0;
689 foreach (ConsolePluginCommand cmdinfo in m_PluginCommandInfos) 689 foreach (ConsolePluginCommand cmdinfo in m_PluginCommandInfos)
690 { 690 {
691 int matchLen = cmdinfo.matchLength(cmdWithParams); 691 int matchLen = cmdinfo.matchLength(cmdWithParams);
692 if (matchLen > bestLength) 692 if (matchLen > bestLength)
693 { 693 {
694 bestMatch = cmdinfo; 694 bestMatch = cmdinfo;
695 bestLength = matchLen; 695 bestLength = matchLen;
696 } 696 }
697 } 697 }
698 if (bestMatch == null) return false; 698 if (bestMatch == null) return false;
699 bestMatch.Run(cmdWithParams.Substring(bestLength)); 699 bestMatch.Run(cmdWithParams.Substring(bestLength));
700 return true; 700 return true;
701 } 701 }
702 702
703 /// <summary> 703 /// <summary>
704 /// Show the matching plugins command help 704 /// Show the matching plugins command help
705 /// </summary> 705 /// </summary>
706 public void ShowPluginCommandsHelp(string cmdWithParams, ConsoleBase console) 706 public void ShowPluginCommandsHelp(string cmdWithParams, ConsoleBase console)
707 { 707 {
708 foreach (ConsolePluginCommand cmdinfo in m_PluginCommandInfos) 708 foreach (ConsolePluginCommand cmdinfo in m_PluginCommandInfos)
709 { 709 {
710 if (cmdinfo.IsHelpfull(cmdWithParams)) 710 if (cmdinfo.IsHelpfull(cmdWithParams))
711 { 711 {
712 cmdinfo.ShowHelp(console); 712 cmdinfo.ShowHelp(console);
713 } 713 }
714 } 714 }
715 } 715 }
716 716
717 /// <summary> 717 /// <summary>
718 /// Registers a new console plugin command 718 /// Registers a new console plugin command
719 /// </summary> 719 /// </summary>
720 public static void RegisterCmd(string cmd, ConsoleCommand deligate, string help) 720 public static void RegisterCmd(string cmd, ConsoleCommand deligate, string help)
721 { 721 {
722 RegisterConsolePluginCommand(new ConsolePluginCommand(cmd, deligate, help)); 722 RegisterConsolePluginCommand(new ConsolePluginCommand(cmd, deligate, help));
723 } 723 }
724 /// <summary> 724
725 /// Registers a new console plugin command 725 /// <summary>
726 /// </summary> 726 /// Registers a new console plugin command
727 public static void RegisterConsolePluginCommand(ConsolePluginCommand pluginCommand) 727 /// </summary>
728 { 728 public static void RegisterConsolePluginCommand(ConsolePluginCommand pluginCommand)
729 m_PluginCommandInfos.Add(pluginCommand); 729 {
730 } 730 m_PluginCommandInfos.Add(pluginCommand);
731 }
731 #endregion 732 #endregion
733 }
732 734
733 }
734 /// <summary> 735 /// <summary>
735 /// Holder object for a new console plugin command 736 /// Holder object for a new console plugin command
736 /// 737 ///
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index b3663b7..d7a6d5b 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -174,9 +174,10 @@ namespace OpenSim.Region.Environment.Scenes
174 174
175 foreach (EntityBase entity in moveEntities) 175 foreach (EntityBase entity in moveEntities)
176 { 176 {
177 if(entity != null)entity.UpdateMovement();
178 //cfk. This throws occaisional exceptions on a heavily used region 177 //cfk. This throws occaisional exceptions on a heavily used region
179 //and I added this null check to try to preclude the exception. 178 //and I added this null check to try to preclude the exception.
179 if (entity != null)
180 entity.UpdateMovement();
180 } 181 }
181 } 182 }
182 183
diff --git a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs b/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs
index 46c6c33..fce00e8 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs
@@ -626,7 +626,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
626 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 626 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
627 if (d == null) 627 if (d == null)
628 return new LSL_Types.LSLInteger(0); 628 return new LSL_Types.LSLInteger(0);
629 if(m_host.GroupID == d.Group) 629 if (m_host.GroupID == d.Group)
630 return new LSL_Types.LSLInteger(1); 630 return new LSL_Types.LSLInteger(1);
631 return new LSL_Types.LSLInteger(0); 631 return new LSL_Types.LSLInteger(0);
632 } 632 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs b/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
index a325629..8bd3d73 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
@@ -1414,7 +1414,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1414 1414
1415 public LSLFloat(Object o) 1415 public LSLFloat(Object o)
1416 { 1416 {
1417 if(!((o is double) || (o is float))) 1417 if (!((o is double) || (o is float)))
1418 { 1418 {
1419 value = 0.0; 1419 value = 0.0;
1420 return; 1420 return;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index a5da317..0b0ff3d 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -701,10 +701,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
701 public void Populate(Scene scene) 701 public void Populate(Scene scene)
702 { 702 {
703 SceneObjectPart part = scene.GetSceneObjectPart(Key); 703 SceneObjectPart part = scene.GetSceneObjectPart(Key);
704 if(part == null) // Avatar, maybe? 704 if (part == null) // Avatar, maybe?
705 { 705 {
706 ScenePresence presence = scene.GetScenePresence(Key); 706 ScenePresence presence = scene.GetScenePresence(Key);
707 if(presence == null) 707 if (presence == null)
708 return; 708 return;
709 709
710 Name = presence.Firstname + " " + presence.Lastname; 710 Name = presence.Firstname + " " + presence.Lastname;
@@ -724,7 +724,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
724 presence.Velocity.Z); 724 presence.Velocity.Z);
725 725
726 Type = 0x01; // Avatar 726 Type = 0x01; // Avatar
727 if(presence.Velocity != LLVector3.Zero) 727 if (presence.Velocity != LLVector3.Zero)
728 Type |= 0x02; // Active 728 Type |= 0x02; // Active
729 729
730 Group = presence.ControllingClient.ActiveGroupId; 730 Group = presence.ControllingClient.ActiveGroupId;
@@ -739,14 +739,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
739 Group = part.GroupID; 739 Group = part.GroupID;
740 Name = part.Name; 740 Name = part.Name;
741 Owner = part.OwnerID; 741 Owner = part.OwnerID;
742 if(part.Velocity == LLVector3.Zero) 742 if (part.Velocity == LLVector3.Zero)
743 Type = 0x04; // Passive 743 Type = 0x04; // Passive
744 else 744 else
745 Type = 0x02; // Passive 745 Type = 0x02; // Passive
746 746
747 foreach (SceneObjectPart p in part.ParentGroup.Children.Values) 747 foreach (SceneObjectPart p in part.ParentGroup.Children.Values)
748 { 748 {
749 if(part.ContainsScripts()) 749 if (part.ContainsScripts())
750 { 750 {
751 Type |= 0x08; // Scripted 751 Type |= 0x08; // Scripted
752 break; 752 break;
@@ -964,7 +964,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
964 964
965 m_Engine.Log.DebugFormat("[XEngine] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName); 965 m_Engine.Log.DebugFormat("[XEngine] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName);
966 966
967 if(m_RunEvents) 967 if (m_RunEvents)
968 { 968 {
969 m_RunEvents = false; 969 m_RunEvents = false;
970 Start(); 970 Start();
@@ -973,7 +973,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
973 // we get new rez events on sim restart, too 973 // we get new rez events on sim restart, too
974 // but if there is state, then we fire the change 974 // but if there is state, then we fire the change
975 // event 975 // event
976 if(stateSource == StateSource.NewRez) 976 if (stateSource == StateSource.NewRez)
977 { 977 {
978// m_Engine.Log.Debug("[XEngine] Posted changed(CHANGED_REGION_RESTART) to script"); 978// m_Engine.Log.Debug("[XEngine] Posted changed(CHANGED_REGION_RESTART) to script");
979 PostEvent(new XEventParams("changed", 979 PostEvent(new XEventParams("changed",
@@ -1315,7 +1315,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1315 { 1315 {
1316 Console.WriteLine("Unable to save xml\n"+e.ToString()); 1316 Console.WriteLine("Unable to save xml\n"+e.ToString());
1317 } 1317 }
1318 if(!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"))) 1318 if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")))
1319 { 1319 {
1320 throw new Exception("Completed persistence save, but no file was created"); 1320 throw new Exception("Completed persistence save, but no file was created");
1321 } 1321 }
@@ -1328,7 +1328,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1328 { 1328 {
1329 bool running = instance.Running; 1329 bool running = instance.Running;
1330 1330
1331 if(running) 1331 if (running)
1332 instance.Stop(50); 1332 instance.Stop(50);
1333 1333
1334 XmlDocument xmldoc = new XmlDocument(); 1334 XmlDocument xmldoc = new XmlDocument();
@@ -1455,7 +1455,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1455 1455
1456 rootElement.AppendChild(plugins); 1456 rootElement.AppendChild(plugins);
1457 1457
1458 if(running) 1458 if (running)
1459 instance.Start(); 1459 instance.Start();
1460 1460
1461 return xmldoc.InnerXml; 1461 return xmldoc.InnerXml;
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestList.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestList.cs
index cd2dadf..df07190 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestList.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestList.cs
@@ -1,101 +1,101 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using NUnit.Framework; 29using NUnit.Framework;
30using OpenSim.Tests.Common; 30using OpenSim.Tests.Common;
31using OpenSim.Region.ScriptEngine.Common; 31using OpenSim.Region.ScriptEngine.Common;
32 32
33namespace OpenSim.Region.ScriptEngine.Common.Tests 33namespace OpenSim.Region.ScriptEngine.Common.Tests
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// Tests the LSL_Types.list class. 36 /// Tests the LSL_Types.list class.
37 /// </summary> 37 /// </summary>
38 [TestFixture] 38 [TestFixture]
39 public class LSL_TypesTestList 39 public class LSL_TypesTestList
40 { 40 {
41 /// <summary> 41 /// <summary>
42 /// Tests concatenating a string to a list. 42 /// Tests concatenating a string to a list.
43 /// </summary> 43 /// </summary>
44 [Test] 44 [Test]
45 public void TestConcatenateString() 45 public void TestConcatenateString()
46 { 46 {
47 LSL_Types.list testList = new LSL_Types.list(1, 'a', "test"); 47 LSL_Types.list testList = new LSL_Types.list(1, 'a', "test");
48 testList += "addition"; 48 testList += "addition";
49 49
50 Assert.AreEqual(4, testList.Length); 50 Assert.AreEqual(4, testList.Length);
51 Assert.AreEqual("addition", testList.Data[3]); 51 Assert.AreEqual("addition", testList.Data[3]);
52 Assert.AreEqual(typeof(System.String), testList.Data[3].GetType()); 52 Assert.AreEqual(typeof(System.String), testList.Data[3].GetType());
53 53
54 LSL_Types.list secondTestList = testList + "more"; 54 LSL_Types.list secondTestList = testList + "more";
55 55
56 Assert.AreEqual(5, secondTestList.Length); 56 Assert.AreEqual(5, secondTestList.Length);
57 Assert.AreEqual("more", secondTestList.Data[4]); 57 Assert.AreEqual("more", secondTestList.Data[4]);
58 Assert.AreEqual(typeof(System.String), secondTestList.Data[4].GetType()); 58 Assert.AreEqual(typeof(System.String), secondTestList.Data[4].GetType());
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
62 /// Tests concatenating an integer to a list. 62 /// Tests concatenating an integer to a list.
63 /// </summary> 63 /// </summary>
64 [Test] 64 [Test]
65 public void TestConcatenateInteger() 65 public void TestConcatenateInteger()
66 { 66 {
67 LSL_Types.list testList = new LSL_Types.list(1, 'a', "test"); 67 LSL_Types.list testList = new LSL_Types.list(1, 'a', "test");
68 testList += 20; 68 testList += 20;
69 69
70 Assert.AreEqual(4, testList.Length); 70 Assert.AreEqual(4, testList.Length);
71 Assert.AreEqual(20, testList.Data[3]); 71 Assert.AreEqual(20, testList.Data[3]);
72 Assert.AreEqual(typeof(int), testList.Data[3].GetType()); 72 Assert.AreEqual(typeof(int), testList.Data[3].GetType());
73 73
74 LSL_Types.list secondTestList = testList + 2; 74 LSL_Types.list secondTestList = testList + 2;
75 75
76 Assert.AreEqual(5, secondTestList.Length); 76 Assert.AreEqual(5, secondTestList.Length);
77 Assert.AreEqual(2, secondTestList.Data[4]); 77 Assert.AreEqual(2, secondTestList.Data[4]);
78 Assert.AreEqual(typeof(int), secondTestList.Data[4].GetType()); 78 Assert.AreEqual(typeof(int), secondTestList.Data[4].GetType());
79 } 79 }
80 80
81 /// <summary> 81 /// <summary>
82 /// Tests concatenating an integer to a list. 82 /// Tests concatenating an integer to a list.
83 /// </summary> 83 /// </summary>
84 [Test] 84 [Test]
85 public void TestConcatenateDouble() 85 public void TestConcatenateDouble()
86 { 86 {
87 LSL_Types.list testList = new LSL_Types.list(1, 'a', "test"); 87 LSL_Types.list testList = new LSL_Types.list(1, 'a', "test");
88 testList += 2.0; 88 testList += 2.0;
89 89
90 Assert.AreEqual(4, testList.Length); 90 Assert.AreEqual(4, testList.Length);
91 Assert.AreEqual(2.0, testList.Data[3]); 91 Assert.AreEqual(2.0, testList.Data[3]);
92 Assert.AreEqual(typeof(double), testList.Data[3].GetType()); 92 Assert.AreEqual(typeof(double), testList.Data[3].GetType());
93 93
94 LSL_Types.list secondTestList = testList + 0.04; 94 LSL_Types.list secondTestList = testList + 0.04;
95 95
96 Assert.AreEqual(5, secondTestList.Length); 96 Assert.AreEqual(5, secondTestList.Length);
97 Assert.AreEqual(0.04, secondTestList.Data[4]); 97 Assert.AreEqual(0.04, secondTestList.Data[4]);
98 Assert.AreEqual(typeof(double), secondTestList.Data[4].GetType()); 98 Assert.AreEqual(typeof(double), secondTestList.Data[4].GetType());
99 } 99 }
100 } 100 }
101} 101}