From c98c6a2930af5112fe2afdedcb0ccbb76e59d218 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 11 Aug 2010 20:38:10 -0700 Subject: File wants to be committed --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 74b10c3..33aa8ee 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3313,7 +3313,7 @@ namespace OpenSim.Region.Framework.Scenes texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); tex.FaceTextures[face].RGBA = texcolor; UpdateTexture(tex); - TriggerScriptChangedEvent(Changed.COLOR); + TriggerScriptChangedEvent(Changed.COLOR); return; } else if (face == ALL_SIDES) @@ -3335,7 +3335,7 @@ namespace OpenSim.Region.Framework.Scenes tex.DefaultTexture.RGBA = texcolor; } UpdateTexture(tex); - TriggerScriptChangedEvent(Changed.COLOR); + TriggerScriptChangedEvent(Changed.COLOR); return; } } -- cgit v1.1 From 39a748b47a5eb8020f167287c84a91bee0881cca Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 20:23:53 +0100 Subject: refactor: Use SOP.Flags rather than SOP.ObjectFlags --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +++--- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 +++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0eb28f4..afdb95b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1897,7 +1897,7 @@ namespace OpenSim.Region.Framework.Scenes AddRestoredSceneObject(group, true, true); SceneObjectPart rootPart = group.GetChildPart(group.UUID); - rootPart.ObjectFlags &= ~(uint)PrimFlags.Scripted; + rootPart.Flags &= ~PrimFlags.Scripted; rootPart.TrimPermissions(); group.CheckSculptAndLoad(); //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); @@ -2184,7 +2184,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectPart part in group.Children.Values) { - if (part.IsJoint() && ((part.ObjectFlags&(uint)PrimFlags.Physics) != 0)) + if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) { PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? } @@ -4852,7 +4852,7 @@ namespace OpenSim.Region.Framework.Scenes } // turn the proxy non-physical, which also stops its client-side interpolation - bool wasUsingPhysics = ((jointProxyObject.ObjectFlags & (uint)PrimFlags.Physics) != 0); + bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); if (wasUsingPhysics) { jointProxyObject.UpdatePrimFlags(false, false, true, false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3670080..117f869 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1322,9 +1322,9 @@ namespace OpenSim.Region.Framework.Scenes public void aggregateScriptEvents() { - uint objectflagupdate=(uint)RootPart.GetEffectiveObjectFlags(); + PrimFlags objectflagupdate = (PrimFlags)RootPart.GetEffectiveObjectFlags(); - scriptEvents aggregateScriptEvents=0; + scriptEvents aggregateScriptEvents = 0; lock (m_parts) { @@ -1333,7 +1333,7 @@ namespace OpenSim.Region.Framework.Scenes if (part == null) continue; if (part != RootPart) - part.ObjectFlags = objectflagupdate; + part.Flags = objectflagupdate; aggregateScriptEvents |= part.AggregateScriptEvents; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 33aa8ee..2ad4223 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1324,7 +1324,7 @@ namespace OpenSim.Region.Framework.Scenes public void AddFlag(PrimFlags flag) { // PrimFlags prevflag = Flags; - if ((ObjectFlags & (uint) flag) == 0) + if ((Flags & flag) == 0) { //m_log.Debug("Adding flag: " + ((PrimFlags) flag).ToString()); Flags |= flag; @@ -1607,7 +1607,7 @@ namespace OpenSim.Region.Framework.Scenes dupe.Velocity = new Vector3(0, 0, 0); dupe.Acceleration = new Vector3(0, 0, 0); dupe.AngularVelocity = new Vector3(0, 0, 0); - dupe.ObjectFlags = ObjectFlags; + dupe.Flags = Flags; dupe._ownershipCost = _ownershipCost; dupe._objectSaleType = _objectSaleType; @@ -1644,7 +1644,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.AssetService.Get(dupe.m_shape.SculptTexture.ToString(), dupe, AssetReceived); } - bool UsePhysics = ((dupe.ObjectFlags & (uint)PrimFlags.Physics) != 0); + bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); dupe.DoPhysicsPropertyUpdate(UsePhysics, true); } @@ -4271,9 +4271,9 @@ namespace OpenSim.Region.Framework.Scenes public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom, bool IsVD) { - bool wasUsingPhysics = ((ObjectFlags & (uint) PrimFlags.Physics) != 0); - bool wasTemporary = ((ObjectFlags & (uint)PrimFlags.TemporaryOnRez) != 0); - bool wasPhantom = ((ObjectFlags & (uint)PrimFlags.Phantom) != 0); + bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); + bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); + bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0); bool wasVD = VolumeDetectActive; if ((UsePhysics == wasUsingPhysics) && (wasTemporary == IsTemporary) && (wasPhantom == IsPhantom) && (IsVD==wasVD)) -- cgit v1.1 From 5f5c65e4bae1f2a84d6972697d0413137f6b1da1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 20:34:46 +0100 Subject: refactor: move more map tile generation code from scene to IWorldMapModule --- .../Region/Framework/Interfaces/IWorldMapModule.cs | 5 +++- OpenSim/Region/Framework/Scenes/Scene.cs | 27 ---------------------- 2 files changed, 4 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs index ac6afed..d6e31f4 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs @@ -29,6 +29,9 @@ namespace OpenSim.Region.Framework.Interfaces { public interface IWorldMapModule { - void RegenerateMaptile(byte[] data); + /// + /// Generate a map tile for the scene. a terrain texture for this scene + /// + void GenerateMaptile(); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index afdb95b..4d5c1e7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1812,33 +1812,6 @@ namespace OpenSim.Region.Framework.Scenes } - /// - /// Create a terrain texture for this scene - /// - public void CreateTerrainTexture() - { - //create a texture asset of the terrain - IMapImageGenerator terrain = RequestModuleInterface(); - - // Cannot create a map for a nonexistant heightmap yet. - if (Heightmap == null) - return; - - if (terrain == null) - return; - - byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png"); - if (data != null) - { - IWorldMapModule mapModule = RequestModuleInterface(); - - if (mapModule != null) - mapModule.RegenerateMaptile(data); - else - m_log.DebugFormat("[SCENE]: MapModule is null, can't save maptile"); - } - } - #endregion #region Load Land -- cgit v1.1 From fd23f270c6914b7aa628f96daa9608745d3a20b3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 21:01:10 +0100 Subject: refactor: remove Scene.SetRootAgentScene() in favour of existing event with same name --- .../Region/Framework/Interfaces/IInventoryTransferModule.cs | 3 +-- OpenSim/Region/Framework/Scenes/Scene.cs | 11 ----------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs index 2390ff4..1e92fde 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs @@ -35,7 +35,6 @@ namespace OpenSim.Region.Framework.Interfaces /// public interface IInventoryTransferModule { - void SetRootAgentScene(UUID agentID, Scene scene); bool NeedSceneCacheClear(UUID agentID, Scene scene); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4d5c1e7..631046a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4487,17 +4487,6 @@ namespace OpenSim.Region.Framework.Scenes client.SendLayerData(patchX, patchY, Heightmap.GetFloatsSerialised()); } - public void SetRootAgentScene(UUID agentID) - { - IInventoryTransferModule inv = RequestModuleInterface(); - if (inv == null) - return; - - inv.SetRootAgentScene(agentID, this); - - EventManager.TriggerSetRootAgentScene(agentID, this); - } - public bool NeedSceneCacheClear(UUID agentID) { IInventoryTransferModule inv = RequestModuleInterface(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 14d7d6a..08c6e27 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -821,7 +821,7 @@ namespace OpenSim.Region.Framework.Scenes m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; - m_scene.SetRootAgentScene(m_uuid); + m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); // Moved this from SendInitialData to ensure that m_appearance is initialized // before the inventory is processed in MakeRootAgent. This fixes a race condition -- cgit v1.1 From 5d20f04e08c65b37bbdda187c30ce038872307ab Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 21:18:26 +0100 Subject: refactor: move Scene.TerrainUnAcked() handling into TerrainModule --- OpenSim/Region/Framework/Scenes/Scene.cs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 631046a..50f6b71 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2770,7 +2770,6 @@ namespace OpenSim.Region.Framework.Scenes public virtual void SubscribeToClientTerrainEvents(IClientAPI client) { client.OnRegionHandShakeReply += SendLayerData; - client.OnUnackedTerrain += TerrainUnAcked; } public virtual void SubscribeToClientPrimEvents(IClientAPI client) @@ -2901,7 +2900,6 @@ namespace OpenSim.Region.Framework.Scenes public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client) { client.OnRegionHandShakeReply -= SendLayerData; - client.OnUnackedTerrain -= TerrainUnAcked; } public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) @@ -4481,12 +4479,6 @@ namespace OpenSim.Region.Framework.Scenes client.SendRegionHandle(regionID, handle); } - public void TerrainUnAcked(IClientAPI client, int patchX, int patchY) - { - //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); - client.SendLayerData(patchX, patchY, Heightmap.GetFloatsSerialised()); - } - public bool NeedSceneCacheClear(UUID agentID) { IInventoryTransferModule inv = RequestModuleInterface(); -- cgit v1.1 From b30635a454a2d4c8753023efaeb41118be1ef40e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 21:39:43 +0100 Subject: Establish new Objects/BuySellModule Move Scene.ObjectSaleInfo() to this --- OpenSim/Region/Framework/Scenes/Scene.cs | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 50f6b71..b6def14 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2809,8 +2809,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnUndo += m_sceneGraph.HandleUndo; client.OnRedo += m_sceneGraph.HandleRedo; client.OnObjectDescription += m_sceneGraph.PrimDescription; - client.OnObjectDrop += m_sceneGraph.DropObject; - client.OnObjectSaleInfo += ObjectSaleInfo; + client.OnObjectDrop += m_sceneGraph.DropObject; client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; client.OnObjectOwner += ObjectOwner; } @@ -2938,7 +2937,6 @@ namespace OpenSim.Region.Framework.Scenes client.OnRedo -= m_sceneGraph.HandleRedo; client.OnObjectDescription -= m_sceneGraph.PrimDescription; client.OnObjectDrop -= m_sceneGraph.DropObject; - client.OnObjectSaleInfo -= ObjectSaleInfo; client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable; client.OnObjectOwner -= ObjectOwner; } @@ -4488,25 +4486,6 @@ namespace OpenSim.Region.Framework.Scenes return inv.NeedSceneCacheClear(agentID, this); } - public void ObjectSaleInfo(IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) - { - SceneObjectPart part = GetSceneObjectPart(localID); - if (part == null || part.ParentGroup == null) - return; - - if (part.ParentGroup.IsDeleted) - return; - - part = part.ParentGroup.RootPart; - - part.ObjectSaleType = saleType; - part.SalePrice = salePrice; - - part.ParentGroup.HasGroupChanged = true; - - part.GetProperties(client); - } - public bool PerformObjectBuy(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) { -- cgit v1.1 From e89f0b3f71dc8bd439fcfc23d12b305369eac36b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 22:29:42 +0100 Subject: refactor: move Scene.PerformObjectBuy into BuySellModule --- .../Region/Framework/Interfaces/IBuySellModule.cs | 47 ++++++ .../Region/Framework/Interfaces/ICloudModule.cs | 3 +- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 159 --------------------- 4 files changed, 49 insertions(+), 162 deletions(-) create mode 100644 OpenSim/Region/Framework/Interfaces/IBuySellModule.cs (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IBuySellModule.cs b/OpenSim/Region/Framework/Interfaces/IBuySellModule.cs new file mode 100644 index 0000000..0132bae --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IBuySellModule.cs @@ -0,0 +1,47 @@ +/* + * 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 OpenMetaverse; +using OpenSim.Framework; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface IBuySellModule + { + /// + /// Try to buy an object + /// + /// + /// + /// + /// + /// + /// True on a successful purchase, false on failure + /// + bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType); + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs index f8a5bad..7296ac3 100644 --- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs @@ -25,7 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - namespace OpenSim.Region.Framework.Interfaces { public interface ICloudModule : IRegionModule @@ -35,4 +34,4 @@ namespace OpenSim.Region.Framework.Interfaces /// float CloudCover(int x, int y, int z); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 01edf51..4f5a65e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -670,7 +670,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Create a new asset data structure. /// - private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID) + public AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID) { AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID.ToString()); asset.Description = description; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b6def14..5f6748e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4486,165 +4486,6 @@ namespace OpenSim.Region.Framework.Scenes return inv.NeedSceneCacheClear(agentID, this); } - public bool PerformObjectBuy(IClientAPI remoteClient, UUID categoryID, - uint localID, byte saleType) - { - SceneObjectPart part = GetSceneObjectPart(localID); - - if (part == null) - return false; - - if (part.ParentGroup == null) - return false; - - SceneObjectGroup group = part.ParentGroup; - - switch (saleType) - { - case 1: // Sell as original (in-place sale) - uint effectivePerms=group.GetEffectivePermissions(); - - if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) - { - m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); - return false; - } - - group.SetOwnerId(remoteClient.AgentId); - group.SetRootPartOwner(part, remoteClient.AgentId, - remoteClient.ActiveGroupId); - - List partList = - new List(group.Children.Values); - - if (Permissions.PropagatePermissions()) - { - foreach (SceneObjectPart child in partList) - { - child.Inventory.ChangeInventoryOwner(remoteClient.AgentId); - child.TriggerScriptChangedEvent(Changed.OWNER); - child.ApplyNextOwnerPermissions(); - } - } - - part.ObjectSaleType = 0; - part.SalePrice = 10; - - group.HasGroupChanged = true; - part.GetProperties(remoteClient); - part.TriggerScriptChangedEvent(Changed.OWNER); - group.ResumeScripts(); - part.ScheduleFullUpdate(); - - break; - - case 2: // Sell a copy - - - Vector3 inventoryStoredPosition = new Vector3 - (((group.AbsolutePosition.X > (int)Constants.RegionSize) - ? 250 - : group.AbsolutePosition.X) - , - (group.AbsolutePosition.X > (int)Constants.RegionSize) - ? 250 - : group.AbsolutePosition.X, - group.AbsolutePosition.Z); - - Vector3 originalPosition = group.AbsolutePosition; - - group.AbsolutePosition = inventoryStoredPosition; - - string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); - group.AbsolutePosition = originalPosition; - - uint perms=group.GetEffectivePermissions(); - - if ((perms & (uint)PermissionMask.Transfer) == 0) - { - m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); - return false; - } - - AssetBase asset = CreateAsset( - group.GetPartName(localID), - group.GetPartDescription(localID), - (sbyte)AssetType.Object, - Utils.StringToBytes(sceneObjectXml), - group.OwnerID); - AssetService.Store(asset); - - InventoryItemBase item = new InventoryItemBase(); - item.CreatorId = part.CreatorID.ToString(); - - item.ID = UUID.Random(); - item.Owner = remoteClient.AgentId; - item.AssetID = asset.FullID; - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; - item.InvType = (int)InventoryType.Object; - item.Folder = categoryID; - - uint nextPerms=(perms & 7) << 13; - if ((nextPerms & (uint)PermissionMask.Copy) == 0) - perms &= ~(uint)PermissionMask.Copy; - if ((nextPerms & (uint)PermissionMask.Transfer) == 0) - perms &= ~(uint)PermissionMask.Transfer; - if ((nextPerms & (uint)PermissionMask.Modify) == 0) - perms &= ~(uint)PermissionMask.Modify; - - item.BasePermissions = perms & part.NextOwnerMask; - item.CurrentPermissions = perms & part.NextOwnerMask; - item.NextPermissions = part.NextOwnerMask; - item.EveryOnePermissions = part.EveryoneMask & - part.NextOwnerMask; - item.GroupPermissions = part.GroupMask & - part.NextOwnerMask; - item.CurrentPermissions |= 16; // Slam! - item.CreationDate = Util.UnixTimeSinceEpoch(); - - if (InventoryService.AddItem(item)) - remoteClient.SendInventoryItemCreateUpdate(item, 0); - else - { - m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); - return false; - } - break; - - case 3: // Sell contents - List invList = part.Inventory.GetInventoryList(); - - bool okToSell = true; - - foreach (UUID invID in invList) - { - TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID); - if ((item1.CurrentPermissions & - (uint)PermissionMask.Transfer) == 0) - { - okToSell = false; - break; - } - } - - if (!okToSell) - { - m_dialogModule.SendAlertToUser( - remoteClient, "This item's inventory doesn't appear to be for sale"); - return false; - } - - if (invList.Count > 0) - MoveTaskInventoryItems(remoteClient.AgentId, part.Name, - part, invList); - break; - } - - return true; - } - public void CleanTempObjects() { List objs = GetEntities(); -- cgit v1.1 From ab6dc478188e1609d9656e65d410d08270066bf0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 23:15:11 +0100 Subject: refactor: move binary statistics logging from scene into separate region module --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 9 +- OpenSim/Region/Framework/Scenes/Scene.cs | 113 ++------------------- 2 files changed, 12 insertions(+), 110 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4f5a65e..9963225 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -834,7 +834,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence presence; if (TryGetScenePresence(remoteClient.AgentId, out presence)) { - byte[] data = null; +// byte[] data = null; AssetBase asset = new AssetBase(); asset.FullID = olditemID; @@ -842,8 +842,10 @@ namespace OpenSim.Region.Framework.Scenes asset.Name = name; asset.Description = description; - CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); - + CreateNewInventoryItem( + remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType, + (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, + (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); } else { @@ -876,7 +878,6 @@ namespace OpenSim.Region.Framework.Scenes InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs); } - /// /// Send the details of a prim's inventory to the client. /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5f6748e..f62851a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -481,73 +481,6 @@ namespace OpenSim.Region.Framework.Scenes #endregion - #region BinaryStats - - public class StatLogger - { - public DateTime StartTime; - public string Path; - public System.IO.BinaryWriter Log; - } - static StatLogger m_statLog = null; - static TimeSpan m_statLogPeriod = TimeSpan.FromSeconds(300); - static string m_statsDir = String.Empty; - static Object m_statLockObject = new Object(); - private void LogSimStats(SimStats stats) - { - SimStatsPacket pack = new SimStatsPacket(); - pack.Region = new SimStatsPacket.RegionBlock(); - pack.Region.RegionX = stats.RegionX; - pack.Region.RegionY = stats.RegionY; - pack.Region.RegionFlags = stats.RegionFlags; - pack.Region.ObjectCapacity = stats.ObjectCapacity; - //pack.Region = //stats.RegionBlock; - pack.Stat = stats.StatsBlock; - pack.Header.Reliable = false; - - // note that we are inside the reporter lock when called - DateTime now = DateTime.Now; - - // hide some time information into the packet - pack.Header.Sequence = (uint)now.Ticks; - - lock (m_statLockObject) // m_statLog is shared so make sure there is only executer here - { - try - { - if (m_statLog == null || now > m_statLog.StartTime + m_statLogPeriod) - { - // First log file or time has expired, start writing to a new log file - if (m_statLog != null && m_statLog.Log != null) - { - m_statLog.Log.Close(); - } - m_statLog = new StatLogger(); - m_statLog.StartTime = now; - m_statLog.Path = (m_statsDir.Length > 0 ? m_statsDir + System.IO.Path.DirectorySeparatorChar.ToString() : "") - + String.Format("stats-{0}.log", now.ToString("yyyyMMddHHmmss")); - m_statLog.Log = new BinaryWriter(File.Open(m_statLog.Path, FileMode.Append, FileAccess.Write)); - } - - // Write the serialized data to disk - if (m_statLog != null && m_statLog.Log != null) - m_statLog.Log.Write(pack.ToBytes()); - } - catch (Exception ex) - { - m_log.Error("statistics gathering failed: " + ex.Message, ex); - if (m_statLog != null && m_statLog.Log != null) - { - m_statLog.Log.Close(); - } - m_statLog = null; - } - } - return; - } - - #endregion - #region Constructors public Scene(RegionInfo regInfo, AgentCircuitManager authen, @@ -752,38 +685,6 @@ namespace OpenSim.Region.Framework.Scenes } m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); - - #region BinaryStats - - try - { - IConfig statConfig = m_config.Configs["Statistics.Binary"]; - if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled")) - { - if (statConfig.Contains("collect_region_stats")) - { - if (statConfig.GetBoolean("collect_region_stats")) - { - // if enabled, add us to the event. If not enabled, I won't get called - StatsReporter.OnSendStatsResult += LogSimStats; - } - } - if (statConfig.Contains("region_stats_period_seconds")) - { - m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds")); - } - if (statConfig.Contains("stats_dir")) - { - m_statsDir = statConfig.GetString("stats_dir"); - } - } - } - catch - { - // if it doesn't work, we don't collect anything - } - - #endregion BinaryStats } catch { @@ -2652,7 +2553,7 @@ namespace OpenSim.Region.Framework.Scenes if (!VerifyClient(aCircuit, ep, out vialogin)) { // uh-oh, this is fishy - m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", + m_log.WarnFormat("[SCENE]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", client.AgentId, client.SessionId, ep.ToString()); try { @@ -2660,13 +2561,13 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); + m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace); } return; } } - m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); + m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); ScenePresence sp = CreateAndAddScenePresence(client); if (aCircuit != null) @@ -2695,7 +2596,7 @@ namespace OpenSim.Region.Framework.Scenes // Do the verification here if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) { - m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); + m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); vialogin = true; IUserAgentVerificationModule userVerification = RequestModuleInterface(); if (userVerification != null && ep != null) @@ -2705,11 +2606,11 @@ namespace OpenSim.Region.Framework.Scenes if (!userVerification.VerifyClient(aCircuit, /*ep.Address.ToString() */ addr.ToString())) { // uh-oh, this is fishy - m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); + m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); return false; } else - m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); + m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); } } @@ -2740,7 +2641,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); + m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace); } } else -- cgit v1.1 From 8eeb3f2fd21c05f0bfd141e333f34c4c69e8865b Mon Sep 17 00:00:00 2001 From: randomhuman Date: Fri, 13 Aug 2010 16:08:43 +0100 Subject: Updated the create_region command in the RemoteAdmin plugin to properly support estates without seeking further input on the console. --- OpenSim/Region/Framework/Scenes/Scene.cs | 39 -------------------------------- 1 file changed, 39 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f62851a..18705a8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -544,45 +544,6 @@ namespace OpenSim.Region.Framework.Scenes if (m_storageManager.EstateDataStore != null) { m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); - if (m_regInfo.EstateSettings.EstateID == 0) // No record at all - { - MainConsole.Instance.Output("Your region is not part of an estate."); - while (true) - { - string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List() {"yes", "no"}); - if (response == "no") - { - // Create a new estate - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true); - - m_regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", m_regInfo.EstateSettings.EstateName); - m_regInfo.EstateSettings.Save(); - break; - } - else - { - response = MainConsole.Instance.CmdPrompt("Estate name to join", "None"); - if (response == "None") - continue; - - List estateIDs = m_storageManager.EstateDataStore.GetEstates(response); - if (estateIDs.Count < 1) - { - MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); - continue; - } - - int estateID = estateIDs[0]; - - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID); - - if (m_storageManager.EstateDataStore.LinkRegion(m_regInfo.RegionID, estateID)) - break; - - MainConsole.Instance.Output("Joining the estate failed. Please try again."); - } - } - } } #endregion Region Settings -- cgit v1.1 From a32b0ce0ae28ff42d30e25530dc286401188b89c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 14 Aug 2010 13:59:36 +0200 Subject: Fix a possible nullref in BestAvatarResponsiveness policy --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 8cd0160..7c3746b 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -186,9 +186,9 @@ namespace OpenSim.Region.Framework.Scenes return 0.0; // Use group position for child prims - Vector3 entityPos = entity.AbsolutePosition; + Vector3 entityPos; if (entity is SceneObjectPart) - entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; + entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; else entityPos = entity.AbsolutePosition; -- cgit v1.1