aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-07-12 21:03:12 +0000
committerJustin Clarke Casey2008-07-12 21:03:12 +0000
commit000d5e8b93c865f7be21717a52a5a897b0ce3344 (patch)
tree742cb284ff2fb3f20fa158fc0258fdd4e9b9e41f
parent* refactor: Move xml/archive loading and saving code into separate methods re... (diff)
downloadopensim-SC_OLD-000d5e8b93c865f7be21717a52a5a897b0ce3344.zip
opensim-SC_OLD-000d5e8b93c865f7be21717a52a5a897b0ce3344.tar.gz
opensim-SC_OLD-000d5e8b93c865f7be21717a52a5a897b0ce3344.tar.bz2
opensim-SC_OLD-000d5e8b93c865f7be21717a52a5a897b0ce3344.tar.xz
* minor: just some null guards and name changes to make it clearer that prim count is actually a prim local id dispenser
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs25
4 files changed, 28 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index d6bbb1f..a0df9a1 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -72,8 +72,12 @@ namespace OpenSim.Region.Environment.Scenes
72 72
73 public InnerScene m_innerScene; 73 public InnerScene m_innerScene;
74 74
75 // private Random Rand = new Random(); 75 /// <summary>
76 private uint _primCount = 720000; 76 /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is
77 /// dispenced.
78 /// </summary>
79 private uint m_localId = 720000;
80
77 private readonly Mutex _primAllocateMutex = new Mutex(false); 81 private readonly Mutex _primAllocateMutex = new Mutex(false);
78 82
79 private int m_timePhase = 24; 83 private int m_timePhase = 24;
@@ -1493,16 +1497,15 @@ namespace OpenSim.Region.Environment.Scenes
1493 } 1497 }
1494 1498
1495 /// <summary> 1499 /// <summary>
1496 /// Returns a new unallocated primitive ID 1500 /// Returns a new unallocated local primitive ID
1497 /// </summary> 1501 /// </summary>
1498 /// <returns>A brand new primitive ID</returns> 1502 /// <returns>A brand new local primitive ID</returns>
1499 public uint PrimIDAllocate() 1503 public uint PrimIDAllocate()
1500 { 1504 {
1501 uint myID; 1505 uint myID;
1502 1506
1503 _primAllocateMutex.WaitOne(); 1507 _primAllocateMutex.WaitOne();
1504 ++_primCount; 1508 myID = ++m_localId;
1505 myID = _primCount;
1506 _primAllocateMutex.ReleaseMutex(); 1509 _primAllocateMutex.ReleaseMutex();
1507 1510
1508 return myID; 1511 return myID;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 0b48464..005d872 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -182,10 +182,10 @@ namespace OpenSim.Region.Environment.Scenes
182 } 182 }
183 else 183 else
184 { 184 {
185 m_taskInventory[item.ItemID].PermsMask = 0; 185 m_taskInventory[item.ItemID].PermsMask = 0;
186 m_taskInventory[item.ItemID].PermsGranter = LLUUID.Zero; 186 m_taskInventory[item.ItemID].PermsGranter = LLUUID.Zero;
187 string script = Helpers.FieldToUTF8String(asset.Data); 187 string script = Helpers.FieldToUTF8String(asset.Data);
188 m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId,item.ItemID,script, startParam, postOnRez); 188 m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID,script, startParam, postOnRez);
189 m_parentGroup.AddActiveScriptCount(1); 189 m_parentGroup.AddActiveScriptCount(1);
190 ScheduleFullUpdate(); 190 ScheduleFullUpdate();
191 } 191 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 685a3d5..8bf8575 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -141,7 +141,6 @@ namespace OpenSim.Region.Environment.Scenes
141 public uint m_attachmentPoint = (byte)0; 141 public uint m_attachmentPoint = (byte)0;
142 [XmlIgnore] 142 [XmlIgnore]
143 public PhysicsVector m_rotationAxis = new PhysicsVector(1f,1f,1f); 143 public PhysicsVector m_rotationAxis = new PhysicsVector(1f,1f,1f);
144
145 144
146 [XmlIgnore] 145 [XmlIgnore]
147 public bool m_undoing = false; 146 public bool m_undoing = false;
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 4e781e6..016d045 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -38,16 +38,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
38{ 38{
39 public class ScriptManager : Common.ScriptEngineBase.ScriptManager 39 public class ScriptManager : Common.ScriptEngineBase.ScriptManager
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
41 public ScriptManager(Common.ScriptEngineBase.ScriptEngine scriptEngine) 43 public ScriptManager(Common.ScriptEngineBase.ScriptEngine scriptEngine)
42 : base(scriptEngine) 44 : base(scriptEngine)
43 { 45 {
44 base.m_scriptEngine = scriptEngine; 46 base.m_scriptEngine = scriptEngine;
45 } 47 }
46 private Compiler.LSL.Compiler LSLCompiler; 48 private Compiler.LSL.Compiler LSLCompiler;
47
48 private static readonly ILog m_log
49 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 49
52 public override void Initialize() 50 public override void Initialize()
53 { 51 {
@@ -64,8 +62,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
64 62
65 public override void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez) 63 public override void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez)
66 { 64 {
67 m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); 65 m_log.DebugFormat(
68 66 "[{0}]: ScriptManager StartScript: localID: {1}, itemID: {2}",
67 m_scriptEngine.ScriptEngineName, localID, itemID);
69 68
70 //IScriptHost root = host.GetRoot(); 69 //IScriptHost root = host.GetRoot();
71 70
@@ -74,14 +73,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
74 string CompiledScriptFile = String.Empty; 73 string CompiledScriptFile = String.Empty;
75 74
76 SceneObjectPart m_host = World.GetSceneObjectPart(localID); 75 SceneObjectPart m_host = World.GetSceneObjectPart(localID);
76
77 if (null == m_host)
78 {
79 m_log.ErrorFormat(
80 "[{0}]: Could not get scene object part corresponding to localID {1} to start script",
81 m_scriptEngine.ScriptEngineName, localID);
82
83 return;
84 }
77 85
78 // Xantor 20080525: I need assetID here to see if we already compiled this one previously 86 // Xantor 20080525: I need assetID here to see if we already compiled this one previously
79 LLUUID assetID = LLUUID.Zero; 87 LLUUID assetID = LLUUID.Zero;
80 TaskInventoryItem taskInventoryItem = new TaskInventoryItem(); 88 TaskInventoryItem taskInventoryItem = new TaskInventoryItem();
81 if (m_host.TaskInventory.TryGetValue(itemID,out taskInventoryItem)) 89 if (m_host.TaskInventory.TryGetValue(itemID, out taskInventoryItem))
82 assetID = taskInventoryItem.AssetID; 90 assetID = taskInventoryItem.AssetID;
83 91
84
85 try 92 try
86 { 93 {
87 // Xantor 20080525 see if we already compiled this script this session, stop incessant recompiling on 94 // Xantor 20080525 see if we already compiled this script this session, stop incessant recompiling on