* minor: just some null guards and name changes to make it clearer that prim count is actually a prim local id dispenser

0.6.0-stable
Justin Clarke Casey 2008-07-12 21:03:12 +00:00
parent e30ca523ae
commit 000d5e8b93
4 changed files with 28 additions and 19 deletions

View File

@ -72,8 +72,12 @@ namespace OpenSim.Region.Environment.Scenes
public InnerScene m_innerScene; public InnerScene m_innerScene;
// private Random Rand = new Random(); /// <summary>
private uint _primCount = 720000; /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is
/// dispenced.
/// </summary>
private uint m_localId = 720000;
private readonly Mutex _primAllocateMutex = new Mutex(false); private readonly Mutex _primAllocateMutex = new Mutex(false);
private int m_timePhase = 24; private int m_timePhase = 24;
@ -1493,16 +1497,15 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// Returns a new unallocated primitive ID /// Returns a new unallocated local primitive ID
/// </summary> /// </summary>
/// <returns>A brand new primitive ID</returns> /// <returns>A brand new local primitive ID</returns>
public uint PrimIDAllocate() public uint PrimIDAllocate()
{ {
uint myID; uint myID;
_primAllocateMutex.WaitOne(); _primAllocateMutex.WaitOne();
++_primCount; myID = ++m_localId;
myID = _primCount;
_primAllocateMutex.ReleaseMutex(); _primAllocateMutex.ReleaseMutex();
return myID; return myID;

View File

@ -182,10 +182,10 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
m_taskInventory[item.ItemID].PermsMask = 0; m_taskInventory[item.ItemID].PermsMask = 0;
m_taskInventory[item.ItemID].PermsGranter = LLUUID.Zero; m_taskInventory[item.ItemID].PermsGranter = LLUUID.Zero;
string script = Helpers.FieldToUTF8String(asset.Data); string script = Helpers.FieldToUTF8String(asset.Data);
m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId,item.ItemID,script, startParam, postOnRez); m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID,script, startParam, postOnRez);
m_parentGroup.AddActiveScriptCount(1); m_parentGroup.AddActiveScriptCount(1);
ScheduleFullUpdate(); ScheduleFullUpdate();
} }

View File

@ -141,7 +141,6 @@ namespace OpenSim.Region.Environment.Scenes
public uint m_attachmentPoint = (byte)0; public uint m_attachmentPoint = (byte)0;
[XmlIgnore] [XmlIgnore]
public PhysicsVector m_rotationAxis = new PhysicsVector(1f,1f,1f); public PhysicsVector m_rotationAxis = new PhysicsVector(1f,1f,1f);
[XmlIgnore] [XmlIgnore]
public bool m_undoing = false; public bool m_undoing = false;

View File

@ -38,16 +38,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{ {
public class ScriptManager : Common.ScriptEngineBase.ScriptManager public class ScriptManager : Common.ScriptEngineBase.ScriptManager
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public ScriptManager(Common.ScriptEngineBase.ScriptEngine scriptEngine) public ScriptManager(Common.ScriptEngineBase.ScriptEngine scriptEngine)
: base(scriptEngine) : base(scriptEngine)
{ {
base.m_scriptEngine = scriptEngine; base.m_scriptEngine = scriptEngine;
} }
private Compiler.LSL.Compiler LSLCompiler; private Compiler.LSL.Compiler LSLCompiler;
private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public override void Initialize() public override void Initialize()
{ {
@ -64,8 +62,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
public override void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez) public override void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez)
{ {
m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); m_log.DebugFormat(
"[{0}]: ScriptManager StartScript: localID: {1}, itemID: {2}",
m_scriptEngine.ScriptEngineName, localID, itemID);
//IScriptHost root = host.GetRoot(); //IScriptHost root = host.GetRoot();
@ -74,14 +73,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
string CompiledScriptFile = String.Empty; string CompiledScriptFile = String.Empty;
SceneObjectPart m_host = World.GetSceneObjectPart(localID); SceneObjectPart m_host = World.GetSceneObjectPart(localID);
if (null == m_host)
{
m_log.ErrorFormat(
"[{0}]: Could not get scene object part corresponding to localID {1} to start script",
m_scriptEngine.ScriptEngineName, localID);
return;
}
// Xantor 20080525: I need assetID here to see if we already compiled this one previously // Xantor 20080525: I need assetID here to see if we already compiled this one previously
LLUUID assetID = LLUUID.Zero; LLUUID assetID = LLUUID.Zero;
TaskInventoryItem taskInventoryItem = new TaskInventoryItem(); TaskInventoryItem taskInventoryItem = new TaskInventoryItem();
if (m_host.TaskInventory.TryGetValue(itemID,out taskInventoryItem)) if (m_host.TaskInventory.TryGetValue(itemID, out taskInventoryItem))
assetID = taskInventoryItem.AssetID; assetID = taskInventoryItem.AssetID;
try try
{ {
// Xantor 20080525 see if we already compiled this script this session, stop incessant recompiling on // Xantor 20080525 see if we already compiled this script this session, stop incessant recompiling on