From 5e805656db1215518a344d6d5364629a4997fd47 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 13:17:27 +0000 Subject: Fixed SimpleApp - aka thankgoditssundaycommit * Updated SimpleApp with various introduced dependencies * Extracted ScenePrescence creation in Scene * removed try-catchall from UserManagerBase (that actually hid a bug) * Refactored RegionInfo * handle is calculated * it will explode upon accessing x,y,ip,port,externalip if not explicitly initialized * Removed superfluous 'ref' keywords * Removed a shitload of 'catch Exception e' that causes build warnings * Lots of small refactorings, renames et c * Ignored some bins --- .../Environment/OpenSim.Region.Environment.csproj | 28 +++++----- .../OpenSim.Region.Environment.dll.build | 20 +++---- OpenSim/Region/Environment/Scenes/Scene.cs | 61 ++++++++++------------ OpenSim/Region/Environment/Scenes/SceneBase.cs | 2 +- 4 files changed, 53 insertions(+), 58 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 6dabd05..428f381 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj @@ -144,55 +144,55 @@ - - Code - Code Code + + Code + Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code - + Code Code - + Code diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build index eb26ea0..2fa5e76 100644 --- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build @@ -11,23 +11,23 @@ - + + + - - - - - - - - - + + + + + + + diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 8c912d0..d5406b6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -493,19 +493,19 @@ namespace OpenSim.Region.Environment.Scenes /// /// - public override void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child) + public override void AddNewClient(IClientAPI client, bool child) { - remoteClient.OnRegionHandShakeReply += this.SendLayerData; + client.OnRegionHandShakeReply += this.SendLayerData; //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); - remoteClient.OnChatFromViewer += this.SimChat; - remoteClient.OnRequestWearables += this.InformClientOfNeighbours; - remoteClient.OnAddPrim += this.AddNewPrim; - remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition; - remoteClient.OnRequestMapBlocks += this.RequestMapBlocks; - remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; + client.OnChatFromViewer += this.SimChat; + client.OnRequestWearables += this.InformClientOfNeighbours; + client.OnAddPrim += this.AddNewPrim; + client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnRequestMapBlocks += this.RequestMapBlocks; + client.OnTeleportLocationRequest += this.RequestTeleportLocation; //remoteClient.OnObjectSelect += this.SelectPrim; - remoteClient.OnGrapUpdate += this.MoveObject; - remoteClient.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; + client.OnGrapUpdate += this.MoveObject; + client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); @@ -513,19 +513,21 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); */ - + this.estateManager.sendRegionHandshake(client); + + CreateAndAddScenePresence(client); + return; + } + + protected void CreateAndAddScenePresence(IClientAPI client) + { ScenePresence newAvatar = null; - try - { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); - newAvatar = new ScenePresence(remoteClient, this, this.m_regInfo); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + newAvatar = new ScenePresence(client, this, this.m_regInfo); OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); - //newAvatar.SendRegionHandshake(); - this.estateManager.sendRegionHandshake(remoteClient); - PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); lock (this.m_syncRoot) { @@ -534,36 +536,29 @@ namespace OpenSim.Region.Environment.Scenes lock (Entities) { - if (!Entities.ContainsKey(agentID)) + if (!Entities.ContainsKey(client.AgentId)) { - this.Entities.Add(agentID, newAvatar); + this.Entities.Add(client.AgentId, newAvatar); } else { - Entities[agentID] = newAvatar; + Entities[client.AgentId] = newAvatar; } } lock (Avatars) { - if (Avatars.ContainsKey(agentID)) + if (Avatars.ContainsKey(client.AgentId)) { - Avatars[agentID] = newAvatar; + Avatars[client.AgentId] = newAvatar; } else { - this.Avatars.Add(agentID, newAvatar); + this.Avatars.Add(client.AgentId, newAvatar); } } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); - } - return; } - /// /// /// @@ -642,8 +637,8 @@ namespace OpenSim.Region.Environment.Scenes this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); if (this.regionCommsHost != null) { - this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection); - this.regionCommsHost.OnAvatarCrossingIntoRegion += new AgentCrossing(this.AgentCrossing); + this.regionCommsHost.OnExpectUser += this.NewUserConnection; + this.regionCommsHost.OnAvatarCrossingIntoRegion += this.AgentCrossing; } } diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 50d3b82..e06acbd 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -148,7 +148,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public abstract void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child); + public abstract void AddNewClient(IClientAPI client, bool child); /// /// -- cgit v1.1