From cfab010b10c19f68c67c8ff6c4f1e34ed2a127ea Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 27 Jan 2011 11:01:48 -0800 Subject: [PATCH] Add IClientCore to RegionSyncAvatar to fix cast error on teleport --- .../RegionSyncModule/RegionSyncAvatar.cs | 54 ++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncAvatar.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncAvatar.cs index 4fc3593a67..55b1f4b837 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncAvatar.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncAvatar.cs @@ -34,11 +34,12 @@ using OpenMetaverse; using OpenMetaverse.Packets; using OpenMetaverse.StructuredData; using OpenSim.Framework; +using OpenSim.Framework.Client; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { - public class RegionSyncAvatar : IClientAPI + public class RegionSyncAvatar : IClientAPI, IClientCore { private uint movementFlag = 0; private short flyState = 0; @@ -600,7 +601,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) { - m_log.Error("[REGION SYNC AVATAR] SendPrimUpdate"); + m_log.Debug("[REGION SYNC AVATAR] SendPrimUpdate"); } public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID) @@ -1268,5 +1269,54 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { throw new System.NotImplementedException(); } + + #region IClientCore + + private readonly Dictionary m_clientInterfaces = new Dictionary(); + + /// + /// Register an interface on this client, should only be called in the constructor. + /// + /// + /// + protected void RegisterInterface(T iface) + { + lock (m_clientInterfaces) + { + if (!m_clientInterfaces.ContainsKey(typeof(T))) + { + m_clientInterfaces.Add(typeof(T), iface); + } + } + } + + public bool TryGet(out T iface) + { + if (m_clientInterfaces.ContainsKey(typeof(T))) + { + iface = (T)m_clientInterfaces[typeof(T)]; + return true; + } + iface = default(T); + return false; + } + + public T Get() + { + return (T)m_clientInterfaces[typeof(T)]; + } + + public void Disconnect(string reason) + { + Close(); + } + + public void Disconnect() + { + Close(); + } + + #endregion + } }