* minor refactoring for readability (and to lessen greed)

zircon^2
lbsa71 2007-05-21 00:11:55 +00:00
parent b2fe47ecb1
commit 4d5c9499f8
3 changed files with 30 additions and 25 deletions

View File

@ -328,7 +328,7 @@ namespace OpenSim.world
this.dirtyFlag = true; this.dirtyFlag = true;
} }
public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
{ {
ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = m_regionHandle; objupdate.RegionData.RegionHandle = m_regionHandle;
@ -356,7 +356,7 @@ namespace OpenSim.world
this.primData.Texture = objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); this.primData.Texture = objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
objupdate.ObjectData[0].State = 0; objupdate.ObjectData[0].State = 0;
objupdate.ObjectData[0].Data = new byte[0]; objupdate.ObjectData[0].Data = new byte[0];
PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID; PData.OwnerID = objupdate.ObjectData[0].OwnerID = ownerID;
PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode; PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode;
PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin; PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin;
PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd; PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd;

View File

@ -287,13 +287,13 @@ namespace OpenSim.world
#region Create Methods #region Create Methods
public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
{ {
PrimData PData = new PrimData(); PrimData PData = new PrimData();
this.primData = PData; this.primData = PData;
this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
PData.OwnerID = agentID; PData.OwnerID = ownerID;
PData.PCode = addPacket.ObjectData.PCode; PData.PCode = addPacket.ObjectData.PCode;
PData.PathBegin = addPacket.ObjectData.PathBegin; PData.PathBegin = addPacket.ObjectData.PathBegin;
PData.PathEnd = addPacket.ObjectData.PathEnd; PData.PathEnd = addPacket.ObjectData.PathEnd;

View File

@ -70,12 +70,12 @@ namespace OpenSim.world
m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>(); m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>();
m_scripts = new Dictionary<string, ScriptFactory>(); m_scripts = new Dictionary<string, ScriptFactory>();
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs - creating new entitities instance"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs - creating new entitities instance");
Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
Avatars = new Dictionary<LLUUID, Avatar>(); Avatars = new Dictionary<LLUUID, Avatar>();
Prims = new Dictionary<LLUUID, Primitive>(); Prims = new Dictionary<LLUUID, Primitive>();
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs - creating LandMap"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs - creating LandMap");
TerrainManager = new TerrainManager(new SecondLife()); TerrainManager = new TerrainManager(new SecondLife());
Terrain = new TerrainEngine(); Terrain = new TerrainEngine();
Avatar.SetupTemplate("avatar-texture.dat"); Avatar.SetupTemplate("avatar-texture.dat");
@ -88,7 +88,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL,"World.cs: Constructor failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "World.cs: Constructor failed with exception " + e.ToString());
} }
} }
#endregion #endregion
@ -108,7 +108,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: AddScript() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddScript() - Failed with exception " + e.ToString());
} }
} }
@ -160,7 +160,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: AddScript() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddScript() - Failed with exception " + e.ToString());
} }
} }
@ -214,7 +214,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: Update() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: Update() - Failed with exception " + e.ToString());
} }
updateLock.ReleaseMutex(); updateLock.ReleaseMutex();
} }
@ -292,7 +292,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: LoadStorageDLL() - Failed with exception " + e.ToString());
return false; return false;
} }
} }
@ -336,7 +336,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
} }
} }
@ -367,7 +367,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
} }
} }
@ -397,7 +397,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
} }
} }
@ -426,7 +426,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: LoadWorldMap() - Failed with exception " + e.ToString());
} }
} }
#endregion #endregion
@ -463,12 +463,12 @@ namespace OpenSim.world
{ {
try try
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs: LoadPrimsFromStorage() - Loading primitives"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: LoadPrimsFromStorage() - Loading primitives");
this.localStorage.LoadPrimitives(this); this.localStorage.LoadPrimitives(this);
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString());
} }
} }
@ -484,24 +484,29 @@ namespace OpenSim.world
{ {
_primCount = prim.LocalID + 1; _primCount = prim.LocalID + 1;
} }
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs: PrimFromStorage() - Reloading prim (localId " + prim.LocalID + " ) from storage"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: PrimFromStorage() - Reloading prim (localId " + prim.LocalID + " ) from storage");
Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
nPrim.CreateFromStorage(prim); nPrim.CreateFromStorage(prim);
this.Entities.Add(nPrim.uuid, nPrim); this.Entities.Add(nPrim.uuid, nPrim);
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: PrimFromStorage() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: PrimFromStorage() - Failed with exception " + e.ToString());
} }
} }
public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient) public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
{
AddNewPrim(addPacket, AgentClient.AgentID);
}
public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID)
{ {
try try
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: AddNewPrim() - Creating new prim"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: AddNewPrim() - Creating new prim");
Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this); Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this);
prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); prim.CreateFromPacket(addPacket, ownerID, this._primCount);
PhysicsVector pVec = new PhysicsVector(prim.Pos.X, prim.Pos.Y, prim.Pos.Z); PhysicsVector pVec = new PhysicsVector(prim.Pos.X, prim.Pos.Y, prim.Pos.Z);
PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f); PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f);
if (OpenSim.world.Avatar.PhysicsEngineFlying) if (OpenSim.world.Avatar.PhysicsEngineFlying)
@ -529,10 +534,10 @@ namespace OpenSim.world
{ {
try try
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
Avatar newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20); Avatar newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20);
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs:AddViewerAgent() - Adding new avatar to world"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world");
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"World.cs:AddViewerAgent() - Starting RegionHandshake "); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake ");
newAvatar.SendRegionHandshake(this); newAvatar.SendRegionHandshake(this);
if (!agentClient.m_child) if (!agentClient.m_child)
{ {
@ -567,7 +572,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddViewerAgent() - Failed with exception " + e.ToString());
} }
} }
@ -590,7 +595,7 @@ namespace OpenSim.world
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"World.cs: RemoveViewerAgent() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RemoveViewerAgent() - Failed with exception " + e.ToString());
} }
} }
#endregion #endregion