diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 1cc19c5719..b91496be2a 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs @@ -73,7 +73,18 @@ namespace OpenSim.Framework.Servers.HttpServer { if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) { - StreamReader str = new StreamReader(req.Request.Body); + StreamReader str; + try + { + str = new StreamReader(req.Request.Body); + } + catch (System.ArgumentException) + { + // Stream was not readable means a child agent + // was closed due to logout, leaving the + // Event Queue request orphaned. + continue; + } Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); m_server.DoHTTPGruntWork(responsedata, @@ -106,4 +117,4 @@ namespace OpenSim.Framework.Servers.HttpServer m_request.Enqueue(pPollServiceHttpRequest); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index 5c17b0ede6..9dd66639b2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public IJ2KDecoder J2KDecoder; public IAssetService AssetService; public UUID AgentID; - public IHyperAssetService HyperAssets; + public IInventoryAccessModule InventoryAccessModule; public OpenJPEG.J2KLayerInfo[] Layers; public bool IsDecoded; public bool HasAsset; @@ -378,14 +378,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP UUID assetID = UUID.Zero; if (asset != null) assetID = asset.FullID; - else if ((HyperAssets != null) && (sender != HyperAssets)) + else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule)) { - // Try the user's inventory, but only if it's different from the regions' - string userAssets = HyperAssets.GetUserAssetServer(AgentID); - if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer())) + // Unfortunately we need this here, there's no other way. + // This is due to the fact that textures opened directly from the agent's inventory + // don't have any distinguishing feature. As such, in order to serve those when the + // foreign user is visiting, we need to try again after the first fail to the local + // asset service. + string assetServerURL = string.Empty; + if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL)) { m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id); - AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived); + AssetService.Get(assetServerURL + "/" + id, InventoryAccessModule, AssetReceived); return; } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 4dfd5d1d14..9f29420271 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -358,7 +358,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected uint m_agentFOVCounter; protected IAssetService m_assetService; - private IHyperAssetService m_hyperAssets; private const bool m_checkPackets = true; private Timer m_propertiesPacketTimer; @@ -435,7 +434,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // m_attachmentsSent = new HashSet(); m_assetService = m_scene.RequestModuleInterface(); - m_hyperAssets = m_scene.RequestModuleInterface(); m_GroupsModule = scene.RequestModuleInterface(); m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface()); m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion()); @@ -7209,59 +7207,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else // Agent { - IInventoryService invService = m_scene.RequestModuleInterface(); - InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId); - assetRequestItem = invService.GetItem(assetRequestItem); - if (assetRequestItem == null) + IInventoryAccessModule invAccess = m_scene.RequestModuleInterface(); + if (invAccess != null) { - ILibraryService lib = m_scene.RequestModuleInterface(); - if (lib != null) - assetRequestItem = lib.LibraryRootFolder.FindItem(itemID); - if (assetRequestItem == null) - return true; - } + if (!invAccess.GetAgentInventoryItem(this, itemID, requestID)) + return false; - // At this point, we need to apply perms - // only to notecards and scripts. All - // other asset types are always available - // - if (assetRequestItem.AssetType == (int)AssetType.LSLText) - { - if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId)) - { - SendAgentAlertMessage("Insufficient permissions to view script", false); - return true; - } - } - else if (assetRequestItem.AssetType == (int)AssetType.Notecard) - { - if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId)) - { - SendAgentAlertMessage("Insufficient permissions to view notecard", false); - return true; - } } + else + return false; - if (assetRequestItem.AssetID != requestID) - { - m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}", - Name, requestID, itemID, assetRequestItem.AssetID); - return true; - } } } } - //m_assetCache.AddAssetRequest(this, transfer); - MakeAssetRequest(transfer, taskID); - /* RequestAsset = OnRequestAsset; - if (RequestAsset != null) - { - RequestAsset(this, transfer); - }*/ return true; } @@ -11498,15 +11459,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) { requestID = new UUID(transferRequest.TransferInfo.Params, 80); - //m_log.Debug("[XXX] inventory asset request " + requestID); - //if (taskID == UUID.Zero) // Agent - // if (m_scene is HGScene) - // { - // m_log.Debug("[XXX] hg asset request " + requestID); - // // We may need to fetch the asset from the user's asset server into the local asset server - // HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper; - // mapper.Get(requestID, AgentId); - // } } // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); @@ -11525,18 +11477,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected void AssetReceived(string id, Object sender, AssetBase asset) { + if (asset == null) + return; + TransferRequestPacket transferRequest = (TransferRequestPacket)sender; UUID requestID = UUID.Zero; byte source = (byte)SourceType.Asset; - if ((transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) - || (transferRequest.TransferInfo.SourceType == 2222)) + if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) { requestID = new UUID(transferRequest.TransferInfo.Params, 0); } - else if ((transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) - || (transferRequest.TransferInfo.SourceType == 3333)) + else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) { requestID = new UUID(transferRequest.TransferInfo.Params, 80); source = (byte)SourceType.SimInventoryItem; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index 938cf50468..9e0db12734 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -58,8 +58,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP private C5.IntervalHeap m_priorityQueue = new C5.IntervalHeap(10, new J2KImageComparer()); private object m_syncRoot = new object(); - private IHyperAssetService m_hyperAssets; - public LLClientView Client { get { return m_client; } } public AssetBase MissingImage { get { return m_missingImage; } } @@ -75,7 +73,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client"); m_j2kDecodeModule = pJ2kDecodeModule; - m_hyperAssets = client.Scene.RequestModuleInterface(); } /// @@ -149,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP imgrequest.J2KDecoder = m_j2kDecodeModule; imgrequest.AssetService = m_assetCache; imgrequest.AgentID = m_client.AgentId; - imgrequest.HyperAssets = m_hyperAssets; + imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface(); imgrequest.DiscardLevel = newRequest.DiscardLevel; imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); imgrequest.Priority = newRequest.Priority; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index c1e92f59a2..b13b9d8fc5 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs @@ -157,6 +157,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess Dictionary ids = new Dictionary(); HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); + if (ids.ContainsKey(assetID)) + ids.Remove(assetID); foreach (UUID uuid in ids.Keys) FetchAsset(userAssetURL, uuid); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index b0555daa3a..8ccc941c18 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return ret; } - // DO NOT OVERRIDE THIS METHOD + // DO NOT OVERRIDE THE BASE METHOD public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) { @@ -139,7 +139,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (!assetID.Equals(UUID.Zero)) { - UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); + if (remoteClient != null) + UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); } else m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); @@ -192,9 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess m_assMapper.Post(item.AssetID, receiver, userAssetServer); } - #endregion - - public bool IsForeignUser(UUID userID, out string assetServerURL) + public override bool IsForeignUser(UUID userID, out string assetServerURL) { assetServerURL = string.Empty; UserAccount account = null; @@ -217,5 +216,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return false; } + + #endregion + + protected override InventoryItemBase GetItem(UUID agentID, UUID itemID) + { + InventoryItemBase item = base.GetItem(agentID, itemID); + + string userAssetServer = string.Empty; + if (IsForeignUser(agentID, out userAssetServer)) + m_assMapper.Get(item.AssetID, agentID, userAssetServer); + + return item; + } } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 12b6aa0ba3..90b7b51f68 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -639,6 +639,57 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { } + public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID) + { + InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID); + if (assetRequestItem == null) + { + ILibraryService lib = m_Scene.RequestModuleInterface(); + if (lib != null) + assetRequestItem = lib.LibraryRootFolder.FindItem(itemID); + if (assetRequestItem == null) + return false; + } + + // At this point, we need to apply perms + // only to notecards and scripts. All + // other asset types are always available + // + if (assetRequestItem.AssetType == (int)AssetType.LSLText) + { + if (!m_Scene.Permissions.CanViewScript(itemID, UUID.Zero, remoteClient.AgentId)) + { + remoteClient.SendAgentAlertMessage("Insufficient permissions to view script", false); + return false; + } + } + else if (assetRequestItem.AssetType == (int)AssetType.Notecard) + { + if (!m_Scene.Permissions.CanViewNotecard(itemID, UUID.Zero, remoteClient.AgentId)) + { + remoteClient.SendAgentAlertMessage("Insufficient permissions to view notecard", false); + return false; + } + } + + if (assetRequestItem.AssetID != requestID) + { + m_log.WarnFormat( + "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}", + Name, requestID, itemID, assetRequestItem.AssetID); + return false; + } + + return true; + } + + + public virtual bool IsForeignUser(UUID userID, out string assetServerURL) + { + assetServerURL = string.Empty; + return false; + } + #endregion #region Misc @@ -661,6 +712,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return asset; } + protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID) + { + IInventoryService invService = m_Scene.RequestModuleInterface(); + InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID); + assetRequestItem = invService.GetItem(assetRequestItem); + return assetRequestItem; + } + #endregion } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index ebd6bbdcfa..034e69272e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs @@ -41,7 +41,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { public class HGAssetBroker : - ISharedRegionModule, IAssetService, IHyperAssetService + ISharedRegionModule, IAssetService { private static readonly ILog m_log = LogManager.GetLogger( @@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset m_aScene = scene; scene.RegisterModuleInterface(this); - scene.RegisterModuleInterface(this); } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index e09db154aa..4ec5253e58 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -202,9 +202,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } } - - // else put a null; it means that the methods should forward to local grid's inventory - m_InventoryURLs.Add(userID, null); } private void DropInventoryServiceURL(UUID userID) @@ -223,10 +220,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory if (m_InventoryURLs.ContainsKey(userID)) return m_InventoryURLs[userID]; - else - CacheInventoryServiceURL(userID); + CacheInventoryServiceURL(userID); - return m_InventoryURLs[userID]; + if (m_InventoryURLs.ContainsKey(userID)) + return m_InventoryURLs[userID]; + + return null; //it means that the methods should forward to local grid's inventory + } #endregion diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs index 976c2c1d47..70cb2053c9 100644 --- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs +++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs @@ -258,21 +258,16 @@ namespace OpenSim.Region.DataSnapshot private String GetRegionCategory(Scene scene) { - //Boolean choice between: - // "PG" - Mormontown - // "Mature" - Sodom and Gomorrah - if (scene.RegionInfo.RegionSettings.Maturity == 1) - { - return "Mature"; - } - else if (scene.RegionInfo.RegionSettings.Maturity == 0) - { + if (scene.RegionInfo.RegionSettings.Maturity == 0) return "PG"; - } - else - { - return "Unknown"; - } + + if (scene.RegionInfo.RegionSettings.Maturity == 1) + return "Mature"; + + if (scene.RegionInfo.RegionSettings.Maturity == 2) + return "Adult"; + + return "Unknown"; } private XmlNode GetGridSnapshotData(XmlDocument factory) diff --git a/OpenSim/Region/Framework/Interfaces/IHyperService.cs b/OpenSim/Region/Framework/Interfaces/IHyperService.cs deleted file mode 100644 index 51ea28afc3..0000000000 --- a/OpenSim/Region/Framework/Interfaces/IHyperService.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using OpenMetaverse; - -namespace OpenSim.Region.Framework.Interfaces -{ - public interface IHyperAssetService - { - string GetUserAssetServer(UUID userID); - string GetSimAssetServer(); - } -} diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 97f4188751..05fc2add3e 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs @@ -43,5 +43,9 @@ namespace OpenSim.Region.Framework.Interfaces UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); + bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID); + + // Must be here because of textures in user's inventory + bool IsForeignUser(UUID userID, out string assetServerURL); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index b859042c3f..38a5456d98 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1622,7 +1622,7 @@ namespace OpenSim.Region.Framework.Scenes } // Handle god perms - if (remoteClient != null && Permissions.IsGod(remoteClient.AgentId)) + if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) { permissionToTake = true; permissionToTakeCopy = true; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b335ae62a8..f996ff4c08 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -518,13 +518,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llVecNorm(LSL_Vector v) { - m_host.AddScriptLPS(1); - double mag = LSL_Vector.Mag(v); - LSL_Vector nor = new LSL_Vector(); - nor.x = v.x / mag; - nor.y = v.y / mag; - nor.z = v.z / mag; - return nor; + m_host.AddScriptLPS(1); + return LSL_Vector.Norm(v); } public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 59279735f0..01141eebe7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -259,10 +259,15 @@ namespace OpenSim.Region.ScriptEngine.Shared return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); } - public static Vector3 Norm(Vector3 vector) - { - double mag = Mag(vector); - return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); + public static Vector3 Norm(Vector3 vector) + { + double mag = Mag(vector); + if (mag > 0.0) + { + double invMag = 1.0 / mag; + return vector * invMag; + } + return new Vector3(0, 0, 0); } #endregion diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 225530f6ab..46d72dc458 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -278,7 +278,11 @@ namespace OpenSim.Services.GridService foreach (RegionData rdata in rdatas) if (rdata.RegionID != regionID) - rinfos.Add(RegionData2RegionInfo(rdata)); + { + int flags = Convert.ToInt32(rdata.Data["flags"]); + if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours + rinfos.Add(RegionData2RegionInfo(rdata)); + } } m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index 1adc2d8068..ab29018084 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini @@ -7,6 +7,9 @@ [Includes] Include-Common = "config-include/GridCommon.ini" +[Startup] + WorldMapModule = "HGWorldMap" + [Modules] AssetServices = "HGAssetBroker" InventoryServices = "HGInventoryBroker" diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index 52e30e211c..e87270d7e8 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini @@ -3,7 +3,10 @@ ;; All optional settings are in StandaloneCommon.ini.example, ;; which you can copy and change. ;; - + +[Startup] + WorldMapModule = "HGWorldMap" + [Modules] AssetServices = "HGAssetBroker" InventoryServices = "HGInventoryBroker"