From 16b6738cdadc70966a93b6d025ae469738955dcb Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 26 Sep 2008 17:25:22 +0000 Subject: * Patch from JHurliman * Updates to libomv r2243, * Remove lots of unnecessary typecasts * Improves SendWindData() Thanks jhurliman. * Will update OpenSim-libs in 10 minutes.. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 110 +++++++-------------- .../ClientStack/LindenUDP/LLPacketHandler.cs | 10 +- .../Region/ClientStack/LindenUDP/LLPacketQueue.cs | 5 +- OpenSim/Region/ClientStack/LindenUDP/LLQueItem.cs | 1 + .../Communications/Local/LocalLoginService.cs | 6 +- .../Region/Environment/Interfaces/ILandObject.cs | 2 +- .../Agent/AssetDownload/AssetDownloadModule.cs | 2 +- .../Agent/TextureDownload/TextureDownloadModule.cs | 5 +- .../TextureDownload/UserTextureDownloadService.cs | 5 +- .../Currency/SampleMoney/SampleMoneyModule.cs | 4 +- .../Modules/Avatar/Groups/GroupsModule.cs | 2 +- .../Modules/InterGrid/OpenGridProtocolModule.cs | 2 +- .../Modules/World/Estate/EstateManagementModule.cs | 60 +++++------ .../Modules/World/Land/LandManagementModule.cs | 4 +- .../Environment/Modules/World/Land/LandObject.cs | 28 +++--- .../Environment/Modules/World/NPC/NPCAvatar.cs | 3 +- .../Environment/Modules/World/Wind/WindModule.cs | 44 ++------- OpenSim/Region/Environment/Scenes/InnerScene.cs | 2 +- .../Region/Environment/Scenes/Scene.Inventory.cs | 4 +- .../Region/Environment/Scenes/SceneObjectGroup.cs | 2 +- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 3 +- .../Shared/Api/Implementation/LSL_Api.cs | 36 +++---- .../Shared/Api/Implementation/OSSL_Api.cs | 12 ++- 23 files changed, 147 insertions(+), 205 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 4027377..5a48c90 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1232,43 +1232,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// Send the region heightmap to the client /// - /// heightmap - public virtual void SendWindData(float[] map) + /// 16x16 array of wind speeds + public virtual void SendWindData(Vector2[] windSpeeds) { - //ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)map); + ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)windSpeeds); } /// /// Send terrain layer information to the client. /// /// - //private void DoSendWindData(object o) - //{ - //float[] map = (float[])o; - - //try - //{ - //for (int y = 0; y < 16; y++) - //{ - // For some terrains, sending more than one terrain patch at once results in a libsecondlife exception - // see http://opensimulator.org/mantis/view.php?id=1662 - //for (int x = 0; x < 16; x += 4) - //{ - // SendLayerPacket(map, y, x); - // Thread.Sleep(150); - //} - // for (int x = 0; x < 16; x++) - //{ - //SendWindData(x, y, map); - //Thread.Sleep(35); - //} - //} - //} - //catch (Exception e) - //{ - // m_log.Warn("[CLIENT]: ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString()); - // } - //} + private void DoSendWindData(object o) + { + Vector2[] windSpeeds = (Vector2[])o; + + TerrainPatch[] patches = new TerrainPatch[2]; + patches[0] = new TerrainPatch(); + patches[0].Data = new float[16 * 16]; + patches[1] = new TerrainPatch(); + patches[1].Data = new float[16 * 16]; + + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x++) + { + patches[0].Data[y * 16 + x] = windSpeeds[y * 16 + x].X; + patches[1].Data[y * 16 + x] = windSpeeds[y * 16 + x].Y; + } + } + + LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, TerrainPatch.LayerType.Wind); + layerpack.Header.Zerocoded = true; + + OutPacket(layerpack, ThrottleOutPacketType.Wind); + } /// /// Sends a set of four patches (x, x+1, ..., x+3) to the client @@ -1289,41 +1286,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // } /// - /// Sends a specified patch to a client - /// - /// Patch coordinate (x) 0..15 - /// Patch coordinate (y) 0..15 - /// heightmap - public void SendWindData(int p1x, int p1y, int p2x, int p2y, float[] map) - { - try - { - int[] patches = new int[2]; - int patch1x, patch1y, patch2x, patch2y; - patch1x = p1x; - patch1y = p1y; - patch2x = p2x; - patch2y = p2y; - - - patches[0] = patch1x + 0 + patch1y * 16; - patches[1] = patch2x + 0 + patch2y * 16; - - LayerDataPacket layerpack = TerrainCompressor.CreateWindPacket(map, patches); - layerpack.Header.Zerocoded = true; - - OutPacket(layerpack, ThrottleOutPacketType.Wind); - - } - catch (Exception e) - { - m_log.Warn("[client]: ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString()); - } - } - - - - /// /// Tell the client that the given neighbour region is ready to receive a child agent. /// /// @@ -2940,13 +2902,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP updatePacket.ParcelData.PassPrice = landData.PassPrice; updatePacket.ParcelData.PublicCount = 0; //unemplemented - updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint)Simulator.RegionFlags.DenyAnonymous) > + updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint)RegionFlags.DenyAnonymous) > 0); - updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint)Simulator.RegionFlags.DenyIdentified) > + updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint)RegionFlags.DenyIdentified) > 0); - updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint)Simulator.RegionFlags.DenyTransacted) > + updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint)RegionFlags.DenyTransacted) > 0); - updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint)Simulator.RegionFlags.RestrictPushObject) > + updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint)RegionFlags.RestrictPushObject) > 0); updatePacket.ParcelData.RentPrice = 0; @@ -3586,7 +3548,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { string name = (string)nod.Attributes["name"].Value.ToLower(); string id = (string)nod.InnerText; - m_defaultAnimations.Add(name, id); + m_defaultAnimations.Add(name, (UUID)id); } } } @@ -4936,9 +4898,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // if (transfer.TransferInfo.SourceType == 3) { - UUID taskID = null; - UUID itemID = null; - UUID requestID = null; + UUID taskID = UUID.Zero; + UUID itemID = UUID.Zero; + UUID requestID = UUID.Zero; taskID = new UUID(transfer.TransferInfo.Params, 48); itemID = new UUID(transfer.TransferInfo.Params, 64); requestID = new UUID(transfer.TransferInfo.Params, 80); @@ -5569,7 +5531,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); entry.AgentID = block.ID; - entry.Flags = (ParcelManager.AccessList)block.Flags; + entry.Flags = (AccessList)block.Flags; entry.Time = new DateTime(); entries.Add(entry); } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index d885e3b..149fa9a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs @@ -109,6 +109,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public Packet Packet; public Object Identifier; + public int TickCount; } private Dictionary m_NeedAck = @@ -293,12 +294,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP Packet packet, ThrottleOutPacketType throttlePacketType, Object id) { - packet.TickCount = System.Environment.TickCount; - LLQueItem item = new LLQueItem(); item.Packet = packet; item.Incoming = false; item.throttleType = throttlePacketType; + item.TickCount = System.Environment.TickCount; item.Identifier = id; m_PacketQueue.Enqueue(item); @@ -341,7 +341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Packets this old get resent // - if ((now - packet.TickCount) > m_ResendTimeout) + if ((now - data.TickCount) > m_ResendTimeout) { // Resend the packet. Set the packet's tick count to // now, and keep it marked as resent. @@ -357,7 +357,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // pipes. Most likely, the client is gone // Drop the packets // - if ((now - packet.TickCount) > m_DiscardTimeout) + if ((now - data.TickCount) > m_DiscardTimeout) { if (!m_ImportantPackets.Contains(packet.Type)) m_NeedAck.Remove(packet.Header.Sequence); @@ -729,7 +729,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Packet packet = item.Packet; // Keep track of when this packet was sent out - packet.TickCount = System.Environment.TickCount; + item.TickCount = System.Environment.TickCount; // Assign sequence number here to prevent out of order packets if (packet.Header.Sequence == 0) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index 32b4bc1..81c789a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs @@ -36,6 +36,7 @@ using OpenSim.Framework.Statistics; using OpenSim.Framework.Statistics.Interfaces; using Timer=System.Timers.Timer; + namespace OpenSim.Region.ClientStack.LindenUDP { public class LLPacketQueue : IPullStatsProvider @@ -45,7 +46,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool m_enabled = true; - private BlockingQueue SendQueue; + private OpenSim.Framework.BlockingQueue SendQueue; private Queue IncomingPacketQueue; private Queue OutgoingPacketQueue; @@ -91,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // in it to process. it's an on-purpose threadlock though because // without it, the clientloop will suck up all sim resources. - SendQueue = new BlockingQueue(); + SendQueue = new OpenSim.Framework.BlockingQueue(); IncomingPacketQueue = new Queue(); OutgoingPacketQueue = new Queue(); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLQueItem.cs b/OpenSim/Region/ClientStack/LindenUDP/LLQueItem.cs index 3bb0b7a..494d62b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLQueItem.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLQueItem.cs @@ -40,6 +40,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public Packet Packet; public bool Incoming; public ThrottleOutPacketType throttleType; + public int TickCount; public Object Identifier; } } diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 3d09729..2d5c92e 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -311,11 +311,11 @@ namespace OpenSim.Region.Communications.Local user.CurrentAgent.Handle = regionInfo.RegionHandle; // Prepare notification Login loginParams = new Login(); - loginParams.Session = user.CurrentAgent.SessionID.ToString(); - loginParams.SecureSession = user.CurrentAgent.SecureSessionID.ToString(); + loginParams.Session = user.CurrentAgent.SessionID; + loginParams.SecureSession = user.CurrentAgent.SecureSessionID; loginParams.First = user.FirstName; loginParams.Last = user.SurName; - loginParams.Agent = user.ID.ToString(); + loginParams.Agent = user.ID; loginParams.CircuitCode = Convert.ToUInt32(response.CircuitCode); loginParams.StartPos = user.CurrentAgent.Position; loginParams.CapsPath = capsPath; diff --git a/OpenSim/Region/Environment/Interfaces/ILandObject.cs b/OpenSim/Region/Environment/Interfaces/ILandObject.cs index 96fa378..85da000 100644 --- a/OpenSim/Region/Environment/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Environment/Interfaces/ILandObject.cs @@ -54,7 +54,7 @@ namespace OpenSim.Region.Environment.Interfaces bool isBannedFromLand(UUID avatar); bool isRestrictedFromLand(UUID avatar); void sendLandUpdateToClient(IClientAPI remote_client); - List createAccessListArrayByFlag(ParcelManager.AccessList flag); + List createAccessListArrayByFlag(AccessList flag); void sendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); void updateAccessList(uint flags, List entries, IClientAPI remote_client); void updateLandBitmapByteArray(); diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetDownload/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/Agent/AssetDownload/AssetDownloadModule.cs index 3b521c3..f907ecd 100644 --- a/OpenSim/Region/Environment/Modules/Agent/AssetDownload/AssetDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/Agent/AssetDownload/AssetDownloadModule.cs @@ -109,7 +109,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload /// public void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest) { - UUID requestID = null; + UUID requestID = UUID.Zero; byte source = 2; if (transferRequest.TransferInfo.SourceType == 2) { diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs index 813d271..ed714ba 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs @@ -33,6 +33,7 @@ using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; +using BlockingQueue = OpenSim.Framework.BlockingQueue; namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload { @@ -44,8 +45,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload /// /// There is one queue for all textures waiting to be sent, regardless of the requesting user. /// - private readonly BlockingQueue m_queueSenders - = new BlockingQueue(); + private readonly OpenSim.Framework.BlockingQueue m_queueSenders + = new OpenSim.Framework.BlockingQueue(); /// /// Each user has their own texture download service. diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs index c38bc62..93f4d1b 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs @@ -35,6 +35,7 @@ using OpenSim.Framework.Statistics; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; + namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload { /// @@ -75,7 +76,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload /// Texture Senders are placed in this queue once they have received their texture from the asset /// cache. Another module actually invokes the send. /// - private readonly BlockingQueue m_sharedSendersQueue; + private readonly OpenSim.Framework.BlockingQueue m_sharedSendersQueue; /// /// Holds texture senders before they have received the appropriate texture from the asset cache. @@ -91,7 +92,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload = new RepeatLimitStrategy(MAX_ALLOWED_TEXTURE_REQUESTS); public UserTextureDownloadService( - IClientAPI client, Scene scene, BlockingQueue sharedQueue) + IClientAPI client, Scene scene, OpenSim.Framework.BlockingQueue sharedQueue) { m_client = client; m_scene = scene; diff --git a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs index 8b7df9e..ea2fc04 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs @@ -298,7 +298,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney int funds = 0; Hashtable hbinfo = - GetBalanceForUserFromMoneyServer(client.AgentId, client.SecureSessionId, s.RegionInfo.originRegionID.ToString(), + GetBalanceForUserFromMoneyServer(client.AgentId, client.SecureSessionId, s.RegionInfo.originRegionID, s.RegionInfo.regionSecret); if ((bool) hbinfo["success"] == true) { @@ -722,7 +722,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney if (m_MoneyAddress.Length > 0) { Hashtable hbinfo = - GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), + GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID, s.RegionInfo.regionSecret); if ((bool) hbinfo["success"] == true) { diff --git a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs index ad0cac0..053eeef 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs @@ -67,7 +67,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups OpenSimulatorGroup.ActiveGroupTitle = "OpenSimulator Tester"; OpenSimulatorGroup.GroupID = opensimulatorGroupID; OpenSimulatorGroup.groupName = "OpenSimulator Testing"; - OpenSimulatorGroup.ActiveGroupPowers = GroupPowers.LandAllowSetHome; + OpenSimulatorGroup.ActiveGroupPowers = GroupPowers.AllowSetHome; OpenSimulatorGroup.GroupTitles.Add("OpenSimulator Tester"); if (!m_groupUUIDGroup.ContainsKey(opensimulatorGroupID)) m_groupUUIDGroup.Add(opensimulatorGroupID, OpenSimulatorGroup); diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs index eeff62d..cb525cc 100644 --- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs @@ -787,7 +787,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid UUID userUUID = UUID.Zero; if (UUID.TryParse(uuidString, out userUUID)) { - UUID RemoteID = uuidString; + UUID RemoteID = (UUID)uuidString; UUID LocalID = RemoteID; // FIXME: TODO: Routine to map RemoteUUIDs to LocalUUIds // would be done already.. but the client connects with the Aditi UUID diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index bec1300..3dddc2b 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs @@ -732,40 +732,40 @@ namespace OpenSim.Region.Environment.Modules.World.Estate public uint GetRegionFlags() { - Simulator.RegionFlags flags = Simulator.RegionFlags.None; + RegionFlags flags = RegionFlags.None; // Fully implemented // if (m_scene.RegionInfo.RegionSettings.AllowDamage) - flags |= Simulator.RegionFlags.AllowDamage; + flags |= RegionFlags.AllowDamage; if (m_scene.RegionInfo.RegionSettings.BlockTerraform) - flags |= Simulator.RegionFlags.BlockTerraform; + flags |= RegionFlags.BlockTerraform; if (!m_scene.RegionInfo.RegionSettings.AllowLandResell) - flags |= Simulator.RegionFlags.BlockLandResell; + flags |= RegionFlags.BlockLandResell; if (m_scene.RegionInfo.RegionSettings.DisableCollisions) - flags |= Simulator.RegionFlags.SkipCollisions; + flags |= RegionFlags.SkipCollisions; if (m_scene.RegionInfo.RegionSettings.DisableScripts) - flags |= Simulator.RegionFlags.SkipScripts; + flags |= RegionFlags.SkipScripts; if (m_scene.RegionInfo.RegionSettings.DisablePhysics) - flags |= Simulator.RegionFlags.SkipPhysics; + flags |= RegionFlags.SkipPhysics; if (m_scene.RegionInfo.RegionSettings.BlockFly) - flags |= Simulator.RegionFlags.NoFly; + flags |= RegionFlags.NoFly; if (m_scene.RegionInfo.RegionSettings.RestrictPushing) - flags |= Simulator.RegionFlags.RestrictPushObject; + flags |= RegionFlags.RestrictPushObject; if (m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide) - flags |= Simulator.RegionFlags.AllowParcelChanges; + flags |= RegionFlags.AllowParcelChanges; if (m_scene.RegionInfo.RegionSettings.BlockShowInSearch) - flags |= (Simulator.RegionFlags)(1 << 29); + flags |= (RegionFlags)(1 << 29); if (m_scene.RegionInfo.RegionSettings.FixedSun) - flags |= Simulator.RegionFlags.SunFixed; + flags |= RegionFlags.SunFixed; if (m_scene.RegionInfo.RegionSettings.Sandbox) - flags |= Simulator.RegionFlags.Sandbox; + flags |= RegionFlags.Sandbox; // Fudge these to always on, so the menu options activate // - flags |= Simulator.RegionFlags.AllowLandmark; - flags |= Simulator.RegionFlags.AllowSetHome; + flags |= RegionFlags.AllowLandmark; + flags |= RegionFlags.AllowSetHome; // TODO: SkipUpdateInterestList @@ -779,35 +779,35 @@ namespace OpenSim.Region.Environment.Modules.World.Estate public uint GetEstateFlags() { - Simulator.RegionFlags flags = Simulator.RegionFlags.None; + RegionFlags flags = RegionFlags.None; if (m_scene.RegionInfo.EstateSettings.FixedSun) - flags |= Simulator.RegionFlags.SunFixed; + flags |= RegionFlags.SunFixed; if (m_scene.RegionInfo.EstateSettings.PublicAccess) - flags |= (Simulator.RegionFlags.PublicAllowed | - Simulator.RegionFlags.ExternallyVisible); + flags |= (RegionFlags.PublicAllowed | + RegionFlags.ExternallyVisible); if (m_scene.RegionInfo.EstateSettings.AllowVoice) - flags |= Simulator.RegionFlags.AllowVoice; + flags |= RegionFlags.AllowVoice; if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) - flags |= Simulator.RegionFlags.AllowDirectTeleport; + flags |= RegionFlags.AllowDirectTeleport; if (m_scene.RegionInfo.EstateSettings.DenyAnonymous) - flags |= Simulator.RegionFlags.DenyAnonymous; + flags |= RegionFlags.DenyAnonymous; if (m_scene.RegionInfo.EstateSettings.DenyIdentified) - flags |= Simulator.RegionFlags.DenyIdentified; + flags |= RegionFlags.DenyIdentified; if (m_scene.RegionInfo.EstateSettings.DenyTransacted) - flags |= Simulator.RegionFlags.DenyTransacted; + flags |= RegionFlags.DenyTransacted; if (m_scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner) - flags |= Simulator.RegionFlags.AbuseEmailToEstateOwner; + flags |= RegionFlags.AbuseEmailToEstateOwner; if (m_scene.RegionInfo.EstateSettings.BlockDwell) - flags |= Simulator.RegionFlags.BlockDwell; + flags |= RegionFlags.BlockDwell; if (m_scene.RegionInfo.EstateSettings.EstateSkipScripts) - flags |= Simulator.RegionFlags.EstateSkipScripts; + flags |= RegionFlags.EstateSkipScripts; if (m_scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) - flags |= Simulator.RegionFlags.ResetHomeOnTeleport; + flags |= RegionFlags.ResetHomeOnTeleport; if (m_scene.RegionInfo.EstateSettings.TaxFree) - flags |= Simulator.RegionFlags.TaxFree; + flags |= RegionFlags.TaxFree; if (m_scene.RegionInfo.EstateSettings.DenyMinors) - flags |= (Simulator.RegionFlags)(1 << 30); + flags |= (RegionFlags)(1 << 30); return (uint)flags; } diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index bf51edb..6ab5a57 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs @@ -263,12 +263,12 @@ namespace OpenSim.Region.Environment.Modules.World.Land { if (checkBan.isBannedFromLand(avatar.AgentId)) { - checkBan.sendLandProperties(-30000, false, (int)ParcelManager.ParcelResult.Single, avatar); + checkBan.sendLandProperties(-30000, false, (int)ParcelResult.Single, avatar); return; //Only send one } if (checkBan.isRestrictedFromLand(avatar.AgentId)) { - checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar); + checkBan.sendLandProperties(-40000, false, (int)ParcelResult.Single, avatar); return; //Only send one } } diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs index 640b665..89d7b69 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs @@ -162,16 +162,16 @@ namespace OpenSim.Region.Environment.Modules.World.Land public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) { IEstateModule estateModule = m_scene.RequestModuleInterface(); - uint regionFlags = 336723974 & ~((uint)(Simulator.RegionFlags.AllowLandmark | Simulator.RegionFlags.AllowSetHome)); + uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); if (estateModule != null) regionFlags = estateModule.GetRegionFlags(); // In a perfect world, this would have worked. // // if ((landData.Flags & (uint)Parcel.ParcelFlags.AllowLandmark) != 0) -// regionFlags |= (uint)Simulator.RegionFlags.AllowLandmark; +// regionFlags |= (uint)RegionFlags.AllowLandmark; // if (landData.OwnerID == remote_client.AgentId) -// regionFlags |= (uint)Simulator.RegionFlags.AllowSetHome; +// regionFlags |= (uint)RegionFlags.AllowSetHome; remote_client.SendLandProperties(remote_client, sequence_id, snap_selection, request_result, landData, (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, @@ -252,7 +252,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); entry.AgentID = avatar; - entry.Flags = ParcelManager.AccessList.Ban; + entry.Flags = AccessList.Ban; entry.Time = new DateTime(); if (landData.ParcelAccessList.Contains(entry)) { @@ -269,7 +269,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); entry.AgentID = avatar; - entry.Flags = ParcelManager.AccessList.Access; + entry.Flags = AccessList.Access; entry.Time = new DateTime(); if (!landData.ParcelAccessList.Contains(entry)) { @@ -322,7 +322,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land #region AccessList Functions - public List createAccessListArrayByFlag(ParcelManager.AccessList flag) + public List createAccessListArrayByFlag(AccessList flag) { List list = new List(); foreach (ParcelManager.ParcelAccessEntry entry in landData.ParcelAccessList) @@ -344,16 +344,16 @@ namespace OpenSim.Region.Environment.Modules.World.Land IClientAPI remote_client) { - if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) + if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) { - List avatars = createAccessListArrayByFlag(ParcelManager.AccessList.Access); - remote_client.SendLandAccessListData(avatars,(uint) ParcelManager.AccessList.Access,landData.LocalID); + List avatars = createAccessListArrayByFlag(AccessList.Access); + remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,landData.LocalID); } - if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) + if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) { - List avatars = createAccessListArrayByFlag(ParcelManager.AccessList.Ban); - remote_client.SendLandAccessListData(avatars, (uint)ParcelManager.AccessList.Ban, landData.LocalID); + List avatars = createAccessListArrayByFlag(AccessList.Ban); + remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, landData.LocalID); } } @@ -369,7 +369,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land List toRemove = new List(); foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) { - if (entry.Flags == (ParcelManager.AccessList) flags) + if (entry.Flags == (AccessList) flags) { toRemove.Add(entry); } @@ -384,7 +384,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); temp.AgentID = entry.AgentID; temp.Time = new DateTime(); //Pointless? Yes. - temp.Flags = (ParcelManager.AccessList) flags; + temp.Flags = (AccessList) flags; if (!newData.ParcelAccessList.Contains(temp)) { diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index a8ed498..92214b9 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -482,8 +482,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC { } - public virtual void SendWindData(float[] map) { } - public virtual void SendWindData(int p1x, int p1y, int p2x, int p2y, float[] map) { } + public virtual void SendWindData(Vector2[] windSpeeds) { } public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) { diff --git a/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs b/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs index fced389..5495c1d 100644 --- a/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.Environment.Modules private Random rndnums = new Random(System.Environment.TickCount); private Scene m_scene = null; private bool ready = false; - private float[] windarr = new float[256*256]; + private Vector2[] windSpeeds = new Vector2[16 * 16]; private Dictionary m_rootAgents = new Dictionary(); @@ -54,7 +54,6 @@ namespace OpenSim.Region.Environment.Modules public void Initialise(Scene scene, IConfigSource config) { - m_log.Debug("[WIND] Initializing"); m_scene = scene; @@ -120,15 +119,13 @@ namespace OpenSim.Region.Environment.Modules public void WindToClient(IClientAPI client) { - if (ready) { //if (!sunFixed) //GenWindPos(); // Generate shared values once - client.SendWindData(windarr); + client.SendWindData(windSpeeds); m_log.Debug("[WIND] Initial update for new client"); } - } public void WindUpdate() @@ -149,11 +146,7 @@ namespace OpenSim.Region.Environment.Modules { if (!avatar.IsChildAgent) { - - avatar.ControllingClient.SendWindData( - 0, - 0,0,1, - windarr); + avatar.ControllingClient.SendWindData(windSpeeds); } } @@ -169,7 +162,7 @@ namespace OpenSim.Region.Environment.Modules foreach (ScenePresence avatar in avatars) { if (!avatar.IsChildAgent) - avatar.ControllingClient.SendWindData(windarr); + avatar.ControllingClient.SendWindData(windSpeeds); } // set estate settings for region access to sun position @@ -182,35 +175,14 @@ namespace OpenSim.Region.Environment.Modules private void GenWindPos() { - //windarr = new float[256*256]; - - Array.Clear(windarr, 0, 256 * 256); - //float i = 0f; - //float i2 = 2f; - - for (int x = 0; x < 16; x++) + for (int y = 0; y < 16; y++) { - for (int y = 0; y < 16; y++) + for (int x = 0; x < 16; x++) { - - windarr[x * 256 + y] = (float)(rndnums.NextDouble() * 2d - 1d); - + windSpeeds[y * 16 + x].X = (float)(rndnums.NextDouble() * 2d - 1d); + windSpeeds[y * 16 + x].Y = (float)(rndnums.NextDouble() * 2d - 1d); } - } - for (int x = 16; x < 32; x++) - { - for (int y = 0; y < 16; y++) - { - - windarr[x * 256 + y] = (float)(rndnums.NextDouble() * 2d - 1d); - - } - - } - - - // m_log.Debug("[SUN] Velocity("+Velocity.X+","+Velocity.Y+","+Velocity.Z+")"); } private void ClientLoggedOut(UUID AgentId) diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 50122f5..1c421b7 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -1494,7 +1494,7 @@ namespace OpenSim.Region.Environment.Scenes protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID) { UUID user = remoteClient.AgentId; - UUID objid = null; + UUID objid = UUID.Zero; SceneObjectPart obj = null; List EntityList = GetEntities(); diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 186e13e..560e17e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -1371,7 +1371,7 @@ namespace OpenSim.Region.Environment.Scenes taskItem.Flags = itemBase.Flags; taskItem.PermsGranter = UUID.Zero; taskItem.PermsMask = 0; - taskItem.AssetID = asset.ID; + taskItem.AssetID = asset.FullID; part.AddInventoryItem(taskItem); part.GetProperties(remoteClient); @@ -1616,7 +1616,7 @@ namespace OpenSim.Region.Environment.Scenes // FIXME: This needs to be fixed. m_log.ErrorFormat( "[AGENT INVENTORY]: Queued deletion of scene object to agent {0} {1} failed: {2}", - (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId : "unavailable"), e.ToString()); + (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString()); } m_log.Info("No objects left in inventory delete queue."); diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 08de087..f08f4a4 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -915,7 +915,7 @@ namespace OpenSim.Region.Environment.Scenes { return part.UUID; } - return null; + return UUID.Zero; } public void ObjectGrabHandler(uint localId, Vector3 offsetPos, IClientAPI remoteClient) diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index a3f6763..3f1823a 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -396,8 +396,7 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public virtual void SendWindData(float[] map) { } - public virtual void SendWindData(int p1x, int p1y, int p2x, int p2y, float[] map) { } + public virtual void SendWindData(Vector2[] windSpeeds) { } public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5a265d1..6215710 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -269,7 +269,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (inv.Value.Type != type) return UUID.Zero; - return inv.Value.AssetID.ToString(); + return inv.Value.AssetID; } } return UUID.Zero; @@ -282,7 +282,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (inv.Value.Name == name) { - return inv.Value.AssetID.ToString(); + return inv.Value.AssetID; } } return UUID.Zero; @@ -2766,7 +2766,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); - if (m_host.ParentGroup.RootPart.IsAttachment && agent == m_host.ParentGroup.RootPart.AttachedAvatar) + if (m_host.ParentGroup.RootPart.IsAttachment && (UUID)agent == m_host.ParentGroup.RootPart.AttachedAvatar) { // When attached, certain permissions are implicit if requested from owner int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS | @@ -2919,7 +2919,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } IClientAPI client = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter).ControllingClient; - SceneObjectPart targetPart = World.GetSceneObjectPart(target); + SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)target); SceneObjectGroup parentPrim = null, childPrim = null; if (targetPart != null) { @@ -3131,7 +3131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (World.GetScenePresence(destId) != null) { // destination is an avatar - World.MoveTaskInventoryItem(destId, null, m_host, objId); + World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); } else { @@ -3180,11 +3180,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); + UUID uuid = (UUID)id; + UserProfileData userProfile = - World.CommsManager.UserService.GetUserProfile(id); + World.CommsManager.UserService.GetUserProfile(uuid); UserAgentData userAgent = - World.CommsManager.UserService.GetAgentByUUID(id); + World.CommsManager.UserService.GetAgentByUUID(uuid); if (userProfile == null || userAgent == null) return UUID.Zero.ToString(); @@ -3503,7 +3505,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local) { m_host.AddScriptLPS(1); - SceneObjectPart targ = World.GetSceneObjectPart(target); + SceneObjectPart targ = World.GetSceneObjectPart((UUID)target); if (targ == null) return; targ.ApplyImpulse(new Vector3((float)impulse.x, (float)impulse.y, (float)impulse.z), local != 0); @@ -4683,7 +4685,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llGetAgentSize(string id) { m_host.AddScriptLPS(1); - ScenePresence avatar = World.GetScenePresence(id); + ScenePresence avatar = World.GetScenePresence((UUID)id); LSL_Vector agentSize; if (avatar == null) { @@ -5164,7 +5166,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (UUID.TryParse(avatar, out key)) { entry.AgentID = key; - entry.Flags = ParcelManager.AccessList.Access; + entry.Flags = AccessList.Access; entry.Time = DateTime.Now.AddHours(hours); land.ParcelAccessList.Add(entry); } @@ -5365,7 +5367,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); - xmlrpcMod.CloseXMLRPCChannel(channel); + xmlrpcMod.CloseXMLRPCChannel((UUID)channel); // ScriptSleep(1000); } @@ -6081,7 +6083,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); LSL_List l = new LSL_List(); - ScenePresence av = World.GetScenePresence(id); + ScenePresence av = World.GetScenePresence((UUID)id); if (av == null) return l; UUID[] anims; @@ -7544,7 +7546,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (UUID.TryParse(avatar, out key)) { entry.AgentID = key; - entry.Flags = ParcelManager.AccessList.Ban; + entry.Flags = AccessList.Ban; entry.Time = DateTime.Now.AddHours(hours); land.ParcelAccessList.Add(entry); } @@ -7563,7 +7565,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) { - if (entry.AgentID == key && entry.Flags == ParcelManager.AccessList.Access) + if (entry.AgentID == key && entry.Flags == AccessList.Access) { land.ParcelAccessList.Remove(entry); break; @@ -7585,7 +7587,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) { - if (entry.AgentID == key && entry.Flags == ParcelManager.AccessList.Ban) + if (entry.AgentID == key && entry.Flags == AccessList.Ban) { land.ParcelAccessList.Remove(entry); break; @@ -7795,7 +7797,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) { - if (entry.Flags == ParcelManager.AccessList.Ban) + if (entry.Flags == AccessList.Ban) { land.ParcelAccessList.Remove(entry); } @@ -7812,7 +7814,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) { - if (entry.Flags == ParcelManager.AccessList.Access) + if (entry.Flags == AccessList.Access) { land.ParcelAccessList.Remove(entry); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7888a63..536bdd2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -496,10 +496,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation"); + UUID avatarID = (UUID)avatar; + m_host.AddScriptLPS(1); - if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence) + if (World.Entities.ContainsKey((UUID)avatar) && World.Entities[avatarID] is ScenePresence) { - ScenePresence target = (ScenePresence)World.Entities[avatar]; + ScenePresence target = (ScenePresence)World.Entities[avatarID]; target.AddAnimation(animation); } } @@ -508,10 +510,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation"); + UUID avatarID = (UUID)avatar; + m_host.AddScriptLPS(1); - if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence) + if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) { - ScenePresence target = (ScenePresence)World.Entities[avatar]; + ScenePresence target = (ScenePresence)World.Entities[avatarID]; target.RemoveAnimation(animation); } } -- cgit v1.1