From e5b91442822df211f9f8277aaf0c40e1339810f3 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 18 Mar 2008 15:30:38 +0000 Subject: Formatting cleanup. --- OpenSim/Region/Environment/Scenes/Scene.cs | 130 ++++++++++----------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 120 ++++++++++--------- 2 files changed, 124 insertions(+), 126 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 1204020..6984d8f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -227,6 +227,7 @@ namespace OpenSim.Region.Environment.Scenes get { return m_innerScene.RestorePresences; } set { m_innerScene.RestorePresences = value; } } + #endregion #region Constructors @@ -395,15 +396,15 @@ namespace OpenSim.Region.Environment.Scenes try { ForEachScenePresence(delegate(ScenePresence agent) + { + // If agent is a root agent. + if (!agent.IsChildAgent) { - // If agent is a root agent. - if (!agent.IsChildAgent) - { - //agent.ControllingClient.new - //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); - InformClientOfNeighbor(agent, otherRegion); - } + //agent.ControllingClient.new + //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); + InformClientOfNeighbor(agent, otherRegion); } + } ); } catch (NullReferenceException) @@ -463,7 +464,7 @@ namespace OpenSim.Region.Environment.Scenes { if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7) SendRegionMessageFromEstateTools(LLUUID.Random(), LLUUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in " + - ((8 - m_RestartTimerCounter) * 15) + " seconds"); + ((8 - m_RestartTimerCounter) * 15) + " seconds"); // SendGeneralAlert(RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter)*15) + //" seconds"); @@ -505,15 +506,15 @@ namespace OpenSim.Region.Environment.Scenes try { ForEachScenePresence(delegate(ScenePresence agent) + { + // If agent is a root agent. + if (!agent.IsChildAgent) { - // If agent is a root agent. - if (!agent.IsChildAgent) - { - //agent.ControllingClient.new - //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); - InformClientOfNeighbor(agent, region); - } + //agent.ControllingClient.new + //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); + InformClientOfNeighbor(agent, region); } + } ); } catch (NullReferenceException) @@ -580,16 +581,16 @@ namespace OpenSim.Region.Environment.Scenes m_log.Warn("[SCENE]: Closing down the single simulator: " + RegionInfo.RegionName); // Kick all ROOT agents with the message, 'The simulator is going down' ForEachScenePresence(delegate(ScenePresence avatar) - { - if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) - avatar.KnownChildRegions.Remove(RegionInfo.RegionHandle); + { + if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) + avatar.KnownChildRegions.Remove(RegionInfo.RegionHandle); - if (!avatar.IsChildAgent) - avatar.ControllingClient.Kick("The simulator is going down."); + if (!avatar.IsChildAgent) + avatar.ControllingClient.Kick("The simulator is going down."); - avatar.ControllingClient.OutPacket(PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator), - ThrottleOutPacketType.Task); - }); + avatar.ControllingClient.OutPacket(PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator), + ThrottleOutPacketType.Task); + }); // Wait here, or the kick messages won't actually get to the agents before the scene terminates. Thread.Sleep(500); @@ -793,7 +794,7 @@ namespace OpenSim.Region.Environment.Scenes { tmpval = tmpval - (tmpval - 1.0f); } - m_timedilation = tmpval; + m_timedilation = tmpval; m_lastupdate = DateTime.Now; } @@ -884,9 +885,9 @@ namespace OpenSim.Region.Environment.Scenes { List mapBlocks = m_sceneGridService.RequestNeighbourMapBlocks((int)(RegionInfo.RegionLocX - 9), - (int)(RegionInfo.RegionLocY - 9), - (int)(RegionInfo.RegionLocX + 9), - (int)(RegionInfo.RegionLocY + 9)); + (int)(RegionInfo.RegionLocY - 9), + (int)(RegionInfo.RegionLocX + 9), + (int)(RegionInfo.RegionLocY + 9)); List textures = new List(); List bitImages = new List(); @@ -1048,7 +1049,6 @@ namespace OpenSim.Region.Environment.Scenes m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); } - /// /// Returns a new unallocated primitive ID /// @@ -1134,7 +1134,7 @@ namespace OpenSim.Region.Environment.Scenes } public SceneObjectGroup AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position, - Tree treeType, bool newTree) + Tree treeType, bool newTree) { LLUUID uuid = this.RegionInfo.MasterAvatarAssignedUUID; PrimitiveBaseShape treeShape = new PrimitiveBaseShape(); @@ -1228,7 +1228,7 @@ namespace OpenSim.Region.Environment.Scenes { pos.Y = ((pos.Y - Constants.RegionSize)); newRegionHandle = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize)); - // y + 1 + // y + 1 } else if (position.Y < -1f) { @@ -1269,12 +1269,14 @@ namespace OpenSim.Region.Environment.Scenes } } } + public void IncomingInterRegionPrimGroup(ulong regionHandle, LLUUID primID, string objXMLData) { m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); m_sceneXmlLoader.LoadGroupFromXml2String(objXMLData); } + #endregion #region Add/Remove Avatar Methods @@ -1301,11 +1303,11 @@ namespace OpenSim.Region.Environment.Scenes m_innerScene.AddScenePresence(presence); - lock (m_restorePresences) - { - Monitor.PulseAll(m_restorePresences); - } - } + lock (m_restorePresences) + { + Monitor.PulseAll(m_restorePresences); + } + } else { m_log.Info("[REGION]: Add New Scene Presence"); @@ -1382,8 +1384,8 @@ namespace OpenSim.Region.Environment.Scenes client.OnMoveInventoryItem += MoveInventoryItem; client.OnRemoveInventoryItem += RemoveInventoryItem; client.OnRemoveInventoryFolder += RemoveInventoryFolder; - // client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest; - // client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer; + // client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest; + // client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer; client.OnRezScript += RezScript; client.OnRequestTaskInventory += RequestTaskInventory; @@ -1452,8 +1454,8 @@ namespace OpenSim.Region.Environment.Scenes { m_innerScene.removeUserCount(true); m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, - avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, - avatar.AbsolutePosition.Z); + avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, + avatar.AbsolutePosition.Z); List childknownRegions = new List(); List ckn = avatar.GetKnownRegionList(); for (int i = 0; i < ckn.Count; i++) @@ -1477,16 +1479,16 @@ namespace OpenSim.Region.Environment.Scenes } m_eventManager.TriggerOnRemovePresence(agentID); Broadcast(delegate(IClientAPI client) + { + try + { + client.SendKillObject(avatar.RegionHandle, avatar.LocalId); + } + catch (System.NullReferenceException) { - try - { - client.SendKillObject(avatar.RegionHandle, avatar.LocalId); - } - catch (System.NullReferenceException) - { - //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. - } - }); + //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. + } + }); ForEachScenePresence( delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); @@ -1903,8 +1905,6 @@ namespace OpenSim.Region.Environment.Scenes } } - - #endregion #region Other Methods @@ -2152,10 +2152,10 @@ namespace OpenSim.Region.Environment.Scenes { ClientManager.ForEachClient(delegate(IClientAPI controller) - { - controller.SendBlueBoxMessage(FromAvatarID, fromSessionID, FromAvatarName, Message); - } - ); + { + controller.SendBlueBoxMessage(FromAvatarID, fromSessionID, FromAvatarName, Message); + } + ); } /// @@ -2180,27 +2180,27 @@ namespace OpenSim.Region.Environment.Scenes if (agentID == kickUserID) { ClientManager.ForEachClient(delegate(IClientAPI controller) - { - if (controller.AgentId != godID) - controller.Kick(Helpers.FieldToUTF8String(reason)); + { + if (controller.AgentId != godID) + controller.Kick(Helpers.FieldToUTF8String(reason)); - } + } ); // This is a bit crude. It seems the client will be null before it actually stops the thread // The thread will kill itself eventually :/ // Is there another way to make sure *all* clients get this 'inter region' message? ClientManager.ForEachClient(delegate(IClientAPI controller) - { - ScenePresence p = GetScenePresence(controller.AgentId); - bool childagent = !p.Equals(null) && p.IsChildAgent; - if (controller.AgentId != godID && !childagent) + { + ScenePresence p = GetScenePresence(controller.AgentId); + bool childagent = !p.Equals(null) && p.IsChildAgent; + if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness? - { - controller.Close(true); - } + { + controller.Close(true); } + } ); } else diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index b00b678..050bf95 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -115,12 +115,11 @@ namespace OpenSim.Region.Environment.Scenes protected AvatarAppearance m_appearance; + //neighbouring regions we have enabled a child agent in private readonly List m_knownChildRegions = new List(); - //neighbouring regions we have enabled a child agent in private SignificantClientMovement handlerSignificantClientMovement = null; //OnSignificantClientMovement; - /// /// Implemented Control Flags /// @@ -1447,12 +1446,12 @@ namespace OpenSim.Region.Environment.Scenes m_perfMonMS=System.Environment.TickCount; m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) + { + if (scenePresence.UUID != UUID) { - if (scenePresence.UUID != UUID) - { - m_appearance.SendAppearanceToOtherAgent(scenePresence); - } - }); + m_appearance.SendAppearanceToOtherAgent(scenePresence); + } + }); m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); } @@ -1780,9 +1779,9 @@ namespace OpenSim.Region.Environment.Scenes } [SecurityPermission(SecurityAction.LinkDemand, - Flags = SecurityPermissionFlag.SerializationFormatter)] + Flags = SecurityPermissionFlag.SerializationFormatter)] public virtual void GetObjectData( - SerializationInfo info, StreamingContext context) + SerializationInfo info, StreamingContext context) { if (info == null) { @@ -1792,7 +1791,6 @@ namespace OpenSim.Region.Environment.Scenes info.AddValue("FullID", FullID.UUID); info.AddValue("LastFullUpdateTime", LastFullUpdateTime); info.AddValue("LastTerseUpdateTime", LastTerseUpdateTime); - } } @@ -1929,9 +1927,9 @@ namespace OpenSim.Region.Environment.Scenes m_requestedSitOffset = new LLVector3( - (float)info.GetValue("m_requestedSitOffset.X", typeof(float)), - (float)info.GetValue("m_requestedSitOffset.Y", typeof(float)), - (float)info.GetValue("m_requestedSitOffset.Z", typeof(float))); + (float)info.GetValue("m_requestedSitOffset.X", typeof(float)), + (float)info.GetValue("m_requestedSitOffset.Y", typeof(float)), + (float)info.GetValue("m_requestedSitOffset.Z", typeof(float))); m_sitAvatarHeight = (float)info.GetValue("m_sitAvatarHeight", typeof(float)); m_godlevel = (float)info.GetValue("m_godlevel", typeof(float)); @@ -1939,10 +1937,10 @@ namespace OpenSim.Region.Environment.Scenes m_bodyRot = new Quaternion( - (float)info.GetValue("m_bodyRot.w", typeof(float)), - (float)info.GetValue("m_bodyRot.x", typeof(float)), - (float)info.GetValue("m_bodyRot.y", typeof(float)), - (float)info.GetValue("m_bodyRot.z", typeof(float))); + (float)info.GetValue("m_bodyRot.w", typeof(float)), + (float)info.GetValue("m_bodyRot.x", typeof(float)), + (float)info.GetValue("m_bodyRot.y", typeof(float)), + (float)info.GetValue("m_bodyRot.z", typeof(float))); IsRestrictedToRegion = (bool)info.GetValue("IsRestrictedToRegion", typeof(bool)); m_newForce = (bool)info.GetValue("m_newForce", typeof(bool)); @@ -1964,33 +1962,33 @@ namespace OpenSim.Region.Environment.Scenes lastPhysPos = new LLVector3( - (float)info.GetValue("lastPhysPos.X", typeof(float)), - (float)info.GetValue("lastPhysPos.Y", typeof(float)), - (float)info.GetValue("lastPhysPos.Z", typeof(float))); + (float)info.GetValue("lastPhysPos.X", typeof(float)), + (float)info.GetValue("lastPhysPos.Y", typeof(float)), + (float)info.GetValue("lastPhysPos.Z", typeof(float))); m_CameraCenter = new Vector3( - (float)info.GetValue("m_CameraCenter.X", typeof(float)), - (float)info.GetValue("m_CameraCenter.Y", typeof(float)), - (float)info.GetValue("m_CameraCenter.Z", typeof(float))); + (float)info.GetValue("m_CameraCenter.X", typeof(float)), + (float)info.GetValue("m_CameraCenter.Y", typeof(float)), + (float)info.GetValue("m_CameraCenter.Z", typeof(float))); m_CameraAtAxis = new Vector3( - (float)info.GetValue("m_CameraAtAxis.X", typeof(float)), - (float)info.GetValue("m_CameraAtAxis.Y", typeof(float)), - (float)info.GetValue("m_CameraAtAxis.Z", typeof(float))); + (float)info.GetValue("m_CameraAtAxis.X", typeof(float)), + (float)info.GetValue("m_CameraAtAxis.Y", typeof(float)), + (float)info.GetValue("m_CameraAtAxis.Z", typeof(float))); m_CameraLeftAxis = new Vector3( - (float)info.GetValue("m_CameraLeftAxis.X", typeof(float)), - (float)info.GetValue("m_CameraLeftAxis.Y", typeof(float)), - (float)info.GetValue("m_CameraLeftAxis.Z", typeof(float))); + (float)info.GetValue("m_CameraLeftAxis.X", typeof(float)), + (float)info.GetValue("m_CameraLeftAxis.Y", typeof(float)), + (float)info.GetValue("m_CameraLeftAxis.Z", typeof(float))); m_CameraUpAxis = new Vector3( - (float)info.GetValue("m_CameraUpAxis.X", typeof(float)), - (float)info.GetValue("m_CameraUpAxis.Y", typeof(float)), - (float)info.GetValue("m_CameraUpAxis.Z", typeof(float))); + (float)info.GetValue("m_CameraUpAxis.X", typeof(float)), + (float)info.GetValue("m_CameraUpAxis.Y", typeof(float)), + (float)info.GetValue("m_CameraUpAxis.Z", typeof(float))); m_DrawDistance = (float)info.GetValue("m_DrawDistance", typeof(float)); m_appearance = (AvatarAppearance)info.GetValue("m_appearance", typeof(AvatarAppearance)); @@ -1998,9 +1996,9 @@ namespace OpenSim.Region.Environment.Scenes posLastSignificantMove = new LLVector3( - (float)info.GetValue("posLastSignificantMove.X", typeof(float)), - (float)info.GetValue("posLastSignificantMove.Y", typeof(float)), - (float)info.GetValue("posLastSignificantMove.Z", typeof(float))); + (float)info.GetValue("posLastSignificantMove.X", typeof(float)), + (float)info.GetValue("posLastSignificantMove.Y", typeof(float)), + (float)info.GetValue("posLastSignificantMove.Z", typeof(float))); // m_partsUpdateQueue = (UpdateQueue)info.GetValue("m_partsUpdateQueue", typeof(UpdateQueue)); @@ -2018,41 +2016,41 @@ namespace OpenSim.Region.Environment.Scenes m_lastname = (string)info.GetValue("m_lastname", typeof(string)); m_allowMovement = (bool)info.GetValue("m_allowMovement", typeof(bool)); m_parentPosition = new LLVector3((float)info.GetValue("m_parentPosition.X", typeof(float)), - (float)info.GetValue("m_parentPosition.Y", typeof(float)), - (float)info.GetValue("m_parentPosition.Z", typeof(float))); + (float)info.GetValue("m_parentPosition.Y", typeof(float)), + (float)info.GetValue("m_parentPosition.Z", typeof(float))); m_isChildAgent = (bool)info.GetValue("m_isChildAgent", typeof(bool)); m_parentID = (uint)info.GetValue("m_parentID", typeof(uint)); // for OpenSim_v0.5 currentParcelUUID = new LLUUID((Guid)info.GetValue("currentParcelUUID", typeof(Guid))); - + lastKnownAllowedPosition = new Vector3( - (float)info.GetValue("lastKnownAllowedPosition.X", typeof(float)), - (float)info.GetValue("lastKnownAllowedPosition.Y", typeof(float)), - (float)info.GetValue("lastKnownAllowedPosition.Z", typeof(float))); - + (float)info.GetValue("lastKnownAllowedPosition.X", typeof(float)), + (float)info.GetValue("lastKnownAllowedPosition.Y", typeof(float)), + (float)info.GetValue("lastKnownAllowedPosition.Z", typeof(float))); + sentMessageAboutRestrictedParcelFlyingDown = (bool)info.GetValue("sentMessageAboutRestrictedParcelFlyingDown", typeof(bool)); - + m_LastChildAgentUpdatePosition = new LLVector3( - (float)info.GetValue("m_LastChildAgentUpdatePosition.X", typeof(float)), - (float)info.GetValue("m_LastChildAgentUpdatePosition.Y", typeof(float)), - (float)info.GetValue("m_LastChildAgentUpdatePosition.Z", typeof(float))); - + (float)info.GetValue("m_LastChildAgentUpdatePosition.X", typeof(float)), + (float)info.GetValue("m_LastChildAgentUpdatePosition.Y", typeof(float)), + (float)info.GetValue("m_LastChildAgentUpdatePosition.Z", typeof(float))); + m_perfMonMS = (int)info.GetValue("m_perfMonMS", typeof(int)); m_AgentControlFlags = (uint)info.GetValue("m_AgentControlFlags", typeof(uint)); - + m_headrotation = new LLQuaternion( - (float)info.GetValue("m_headrotation.W", typeof(float)), - (float)info.GetValue("m_headrotation.X", typeof(float)), - (float)info.GetValue("m_headrotation.Y", typeof(float)), - (float)info.GetValue("m_headrotation.Z", typeof(float))); - + (float)info.GetValue("m_headrotation.W", typeof(float)), + (float)info.GetValue("m_headrotation.X", typeof(float)), + (float)info.GetValue("m_headrotation.Y", typeof(float)), + (float)info.GetValue("m_headrotation.Z", typeof(float))); + m_state = (byte)info.GetValue("m_state", typeof(byte)); - + List knownPrimUUID_work = (List)info.GetValue("m_knownPrimUUID", typeof(List)); foreach (Guid id in knownPrimUUID_work) @@ -2064,9 +2062,9 @@ namespace OpenSim.Region.Environment.Scenes } [SecurityPermission(SecurityAction.LinkDemand, - Flags = SecurityPermissionFlag.SerializationFormatter)] + Flags = SecurityPermissionFlag.SerializationFormatter)] public override void GetObjectData( - SerializationInfo info, StreamingContext context) + SerializationInfo info, StreamingContext context) { if (info == null) { @@ -2196,17 +2194,17 @@ namespace OpenSim.Region.Environment.Scenes info.AddValue("m_LastChildAgentUpdatePosition.X", m_LastChildAgentUpdatePosition.X); info.AddValue("m_LastChildAgentUpdatePosition.Y", m_LastChildAgentUpdatePosition.Y); info.AddValue("m_LastChildAgentUpdatePosition.Z", m_LastChildAgentUpdatePosition.Z); - + info.AddValue("m_perfMonMS", m_perfMonMS); info.AddValue("m_AgentControlFlags", m_AgentControlFlags); - + info.AddValue("m_headrotation.W", m_headrotation.W); info.AddValue("m_headrotation.X", m_headrotation.X); info.AddValue("m_headrotation.Y", m_headrotation.Y); info.AddValue("m_headrotation.Z", m_headrotation.Z); - + info.AddValue("m_state", m_state); - + List knownPrimUUID_work = new List(); foreach (LLUUID id in m_knownPrimUUID) @@ -2215,6 +2213,6 @@ namespace OpenSim.Region.Environment.Scenes } info.AddValue("m_knownPrimUUID", knownPrimUUID_work); - } + } } } -- cgit v1.1