From a2b1a1787d620f70c10221545414b41ffdfe27da Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Wed, 25 Jun 2008 14:30:28 +0000 Subject: Minor formatting cleanup. --- OpenSim/Data/NHibernate/NHibernateUserData.cs | 25 +++-- OpenSim/Region/Application/OpenSim.cs | 14 +-- .../Modules/World/Terrain/TerrainModule.cs | 5 +- OpenSim/Region/Environment/Scenes/InnerScene.cs | 2 +- .../Region/Environment/Scenes/Scene.Inventory.cs | 122 ++++++++++----------- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 11 +- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 33 +++--- .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 62 +++++------ .../Shared/Api/Implementation/ApiManager.cs | 8 +- .../Api/Implementation/AsyncCommandManager.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 2 +- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 2 +- .../ScriptEngine/Shared/Api/Runtime/ScriptBase.cs | 6 +- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 2 +- 15 files changed, 152 insertions(+), 146 deletions(-) diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index 0fb297f..3b67d6e 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs @@ -91,7 +91,9 @@ namespace OpenSim.Data.NHibernate { user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; } - catch (Exception) {} + catch (Exception) + { + } return (user != null); } @@ -161,10 +163,13 @@ namespace OpenSim.Data.NHibernate { UserAgentData old = session.Load(typeof(UserAgentData), agent.ProfileID) as UserAgentData; - if (old == null) { + if (old == null) + { session.Save(agent); session.Transaction.Commit(); - } else { + } + else + { UpdateUserAgent(agent); } } @@ -235,13 +240,13 @@ namespace OpenSim.Data.NHibernate // TODO: actually implement these public override void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) { return; } - public override void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) {return;} - public override void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) {return;} - public override void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) {return;} - public override void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) {return;} - public override List GetUserFriendList(LLUUID friendlistowner) {return new List();} - public override bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) {return true;} - public override bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory) {return true;} + public override void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) { return; } + public override void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) { return; } + public override void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) { return; } + public override void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) { return; } + public override List GetUserFriendList(LLUUID friendlistowner) { return new List(); } + public override bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) { return true; } + public override bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory) { return true; } /// Appearance /// TODO: stubs for now to get us to a compiling state gently diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 714d8eb..6f1a3cb 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -136,13 +136,13 @@ namespace OpenSim #region Console Commands - private void RunEchoTest(string[] cmdparams) - { - for (int i = 0; i < cmdparams.Length; i++) - { - m_log.Info("[EchoTest]: "+cmdparams[i]+""); - } - } + private void RunEchoTest(string[] cmdparams) + { + for (int i = 0; i < cmdparams.Length; i++) + { + m_log.Info("[EchoTest]: "+cmdparams[i]+""); + } + } private void KickUserCommand(string[] cmdparams) { diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index 49347b2..1bda2a0 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs @@ -470,7 +470,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain } } - /// /// Checks to see height deltas in the tainted terrain patch at xStart ,yStart /// are all within the current estate limits @@ -493,7 +492,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain double bakedHeight = m_revert[x, y]; double requestedDelta = requestedHeight - bakedHeight; - if (requestedDelta > maxDelta ) + if (requestedDelta > maxDelta) { m_channel[x, y] = bakedHeight + maxDelta; changesLimited = true; @@ -509,7 +508,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain return changesLimited; } - /// /// Sends a copy of the current terrain to the scenes clients /// @@ -589,7 +587,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain } } - #region Console Commands private void InterfaceLoadFile(Object[] args) diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 5acad88..37da33d 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -849,7 +849,7 @@ namespace OpenSim.Region.Environment.Scenes /// protected internal List GetEntities() { - lock(Entities) + lock (Entities) { if (0 == Entities.Count) return null; return new List(Entities.Values); diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index d779dd7..b076855 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -918,7 +918,7 @@ namespace OpenSim.Region.Environment.Scenes } } - + /// /// ClientMoveTaskInventoryItem /// @@ -927,7 +927,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// public void ClientMoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId) - { + { SceneObjectPart part = GetSceneObjectPart(primLocalId); if (null == part) @@ -948,19 +948,19 @@ namespace OpenSim.Region.Environment.Scenes return; } - MoveTaskInventoryItem(remoteClient, folderId, part, itemId); - } - - /// - /// MoveTaskInventoryItem - /// + MoveTaskInventoryItem(remoteClient, folderId, part, itemId); + } + + /// + /// MoveTaskInventoryItem + /// /// /// /// /// - public void MoveTaskInventoryItem(LLUUID avatarId, LLUUID folderId, SceneObjectPart part, LLUUID itemId) - { - ScenePresence avatar; + public void MoveTaskInventoryItem(LLUUID avatarId, LLUUID folderId, SceneObjectPart part, LLUUID itemId) + { + ScenePresence avatar; if (TryGetAvatar(avatarId, out avatar)) { @@ -973,53 +973,53 @@ namespace OpenSim.Region.Environment.Scenes "Avatar {0} cannot be found to update its prim item asset", avatarId); } - } - - /// - /// Copy a task (prim) inventory item to another task (prim) - /// - /// - /// - /// + } + + /// + /// Copy a task (prim) inventory item to another task (prim) + /// + /// + /// + /// public void MoveTaskInventoryItem(LLUUID destId, SceneObjectPart part, LLUUID itemId) - { - TaskInventoryItem srcTaskItem = part.GetInventoryItem(itemId); - - if(srcTaskItem == null) - { - // error was already logged - return; - } - - SceneObjectPart destPart = GetSceneObjectPart(destId); - - if(destPart == null) - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Could not find prim for ID {0}", - destId); - return; - } - - TaskInventoryItem destTaskItem = new TaskInventoryItem(); - - destTaskItem.ItemID = LLUUID.Random(); - destTaskItem.CreatorID = srcTaskItem.CreatorID; - destTaskItem.AssetID = srcTaskItem.AssetID; + { + TaskInventoryItem srcTaskItem = part.GetInventoryItem(itemId); + + if (srcTaskItem == null) + { + // error was already logged + return; + } + + SceneObjectPart destPart = GetSceneObjectPart(destId); + + if (destPart == null) + { + m_log.ErrorFormat( + "[PRIM INVENTORY]: " + + "Could not find prim for ID {0}", + destId); + return; + } + + TaskInventoryItem destTaskItem = new TaskInventoryItem(); + + destTaskItem.ItemID = LLUUID.Random(); + destTaskItem.CreatorID = srcTaskItem.CreatorID; + destTaskItem.AssetID = srcTaskItem.AssetID; destTaskItem.GroupID = destPart.GroupID; destTaskItem.OwnerID = destPart.OwnerID; destTaskItem.ParentID = destPart.UUID; destTaskItem.ParentPartID = destPart.UUID; - destTaskItem.BaseMask = srcTaskItem.BaseMask; - destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask; - destTaskItem.GroupMask = srcTaskItem.GroupMask; - destTaskItem.OwnerMask = srcTaskItem.OwnerMask; + destTaskItem.BaseMask = srcTaskItem.BaseMask; + destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask; + destTaskItem.GroupMask = srcTaskItem.GroupMask; + destTaskItem.OwnerMask = srcTaskItem.OwnerMask; destTaskItem.NextOwnerMask = srcTaskItem.NextOwnerMask; - destTaskItem.Flags = srcTaskItem.Flags; - - if(destPart.OwnerID != part.OwnerID) + destTaskItem.Flags = srcTaskItem.Flags; + + if (destPart.OwnerID != part.OwnerID) { if (ExternalChecks.ExternalChecksPropagatePermissions()) { @@ -1035,18 +1035,18 @@ namespace OpenSim.Region.Environment.Scenes } } - destTaskItem.Description = srcTaskItem.Description; - destTaskItem.Name = srcTaskItem.Name; - destTaskItem.InvType = srcTaskItem.InvType; - destTaskItem.Type = srcTaskItem.Type; - - destPart.AddInventoryItem(destTaskItem); + destTaskItem.Description = srcTaskItem.Description; + destTaskItem.Name = srcTaskItem.Name; + destTaskItem.InvType = srcTaskItem.InvType; + destTaskItem.Type = srcTaskItem.Type; + + destPart.AddInventoryItem(destTaskItem); - if((srcTaskItem.OwnerMask & (uint)PermissionMask.Copy) == 0) + if ((srcTaskItem.OwnerMask & (uint)PermissionMask.Copy) == 0) part.RemoveInventoryItem(itemId); - - } - + + } + /// /// Update an item in a prim (task) inventory. /// This method does not handle scripts, RezScript(IClientAPI, LLUUID, unit) diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 72c5d7f..5a04a8e 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -1530,7 +1530,7 @@ namespace OpenSim.Region.Physics.Meshing ) { #if SPAM - System.Console.WriteLine( "reverting to geodesic sphere for prim: " + primName ); + System.Console.WriteLine("reverting to geodesic sphere for prim: " + primName); #endif return CreateSphereMesh(primName, primShape, size); } @@ -1802,10 +1802,13 @@ namespace OpenSim.Region.Physics.Meshing #if SPAM int vCount = 0; - foreach ( Vertex v in result.vertices ) - if ( v != null ) + foreach (Vertex v in result.vertices) + { + if (v != null) vCount++; - System.Console.WriteLine( "Mesh vertex count: " + vCount.ToString()); + } + + System.Console.WriteLine("Mesh vertex count: " + vCount.ToString()); #endif return result; diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index edb6375..876629e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -1773,22 +1773,23 @@ namespace OpenSim.Region.Physics.OdePlugin } } - - // Finished with all sim stepping. If requested, dump world state to file for debugging. - // TODO: This call to the export function is already inside lock(OdeLock) - but is an extra lock needed? - // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots? - if(physics_logging && (physics_logging_interval>0) && (framecount % physics_logging_interval == 0) ) { - string fname = "state-" + world.ToString() + ".DIF"; // give each physics world a separate filename - string prefix = "world" + world.ToString(); // prefix for variable names in exported .DIF file - - if(physics_logging_append_existing_logfile) { - string header = "-------------- START OF PHYSICS FRAME " + framecount.ToString() + " --------------"; - TextWriter fwriter = File.AppendText(fname); - fwriter.WriteLine(header); - fwriter.Close(); - } - d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); - } + // Finished with all sim stepping. If requested, dump world state to file for debugging. + // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed? + // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots? + if (physics_logging && (physics_logging_interval>0) && (framecount % physics_logging_interval == 0)) + { + string fname = "state-" + world.ToString() + ".DIF"; // give each physics world a separate filename + string prefix = "world" + world.ToString(); // prefix for variable names in exported .DIF file + + if (physics_logging_append_existing_logfile) + { + string header = "-------------- START OF PHYSICS FRAME " + framecount.ToString() + " --------------"; + TextWriter fwriter = File.AppendText(fname); + fwriter.WriteLine(header); + fwriter.Close(); + } + d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); + } } return fps; diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 08cf4a7..a9d1309 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -2697,40 +2697,40 @@ namespace OpenSim.Region.ScriptEngine.Common public void llGiveInventory(string destination, string inventory) { m_host.AddScriptLPS(1); - bool found = false; - LLUUID destId = LLUUID.Zero; - LLUUID objId = LLUUID.Zero; - - if(!LLUUID.TryParse(destination, out destId)) - { - llSay(0, "Could not parse key " + destination); - return; - } - - // move the first object found with this inventory name - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == inventory) - { - found = true; - objId = inv.Key; - break; - } - } - - // check if destination is an avatar - if (World.GetScenePresence(destId) != null) - { - // destination is an avatar + bool found = false; + LLUUID destId = LLUUID.Zero; + LLUUID objId = LLUUID.Zero; + + if (!LLUUID.TryParse(destination, out destId)) + { + llSay(0, "Could not parse key " + destination); + return; + } + + // move the first object found with this inventory name + foreach (KeyValuePair inv in m_host.TaskInventory) + { + if (inv.Value.Name == inventory) + { + found = true; + objId = inv.Key; + break; + } + } + + // check if destination is an avatar + if (World.GetScenePresence(destId) != null) + { + // destination is an avatar World.MoveTaskInventoryItem(destId, null, m_host, objId); - } - else - { - // destination is an object + } + else + { + // destination is an object World.MoveTaskInventoryItem(destId, m_host, objId); - } + } - if (!found) + if (!found) llSay(0, "Could not find object " + inventory); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs index f7f2676..c57e72e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs @@ -39,7 +39,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public string[] GetApis() { - if(m_Apis.Count > 0) + if (m_Apis.Count > 0) { List l = new List(m_Apis.Keys); return l.ToArray(); @@ -53,10 +53,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { string name = t.ToString(); int idx = name.LastIndexOf('.'); - if(idx != -1) + if (idx != -1) name = name.Substring(idx+1); - if(name.EndsWith("_Api")) + if (name.EndsWith("_Api")) { name = name.Substring(0, name.Length - 4); m_Apis[name] = t; @@ -69,7 +69,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public IScriptApi CreateApi(string api) { - if(!m_Apis.ContainsKey(api)) + if (!m_Apis.ContainsKey(api)) return null; IScriptApi ret = (IScriptApi)(Activator.CreateInstance(m_Apis[api])); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 8c967a2..fcd1df8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public AsyncCommandManager(IScriptEngine _ScriptEngine) { m_ScriptEngine = _ScriptEngine; - if(!m_Managers.Contains(this)) + if (!m_Managers.Contains(this)) m_Managers.Add(this); ReadConfig(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 202fce7..57c1e02 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2553,7 +2553,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LLUUID destId = LLUUID.Zero; LLUUID objId = LLUUID.Zero; - if(!LLUUID.TryParse(destination, out destId)) + if (!LLUUID.TryParse(destination, out destId)) { llSay(0, "Could not parse key " + destination); return; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 7b3907f..08ee203 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public void ApiTypeLSL(IScriptApi api) { - if(!(api is ILSL_Api)) + if (!(api is ILSL_Api)) return; m_LSL_Functions = (ILSL_Api)api; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 168804d..34e2fb1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public void ApiTypeOSSL(IScriptApi api) { - if(!(api is IOSSL_Api)) + if (!(api is IOSSL_Api)) return; m_OSSL_Functions = (IOSSL_Api)api; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs index aa2c9c2..c12b1f8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs @@ -44,9 +44,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { MethodInfo[] myArrayMethodInfo = GetType().GetMethods(BindingFlags.Public|BindingFlags.Instance); - foreach(MethodInfo mi in myArrayMethodInfo) + foreach (MethodInfo mi in myArrayMethodInfo) { - if(mi.Name.Length > 7 && mi.Name.Substring(0, 7) == "ApiType") + if (mi.Name.Length > 7 && mi.Name.Substring(0, 7) == "ApiType") { string type=mi.Name.Substring(7); inits[type]=mi; @@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public void InitApi(string api, IScriptApi data) { - if(!inits.ContainsKey(api)) + if (!inits.ContainsKey(api)) return; MethodInfo mi = inits[api]; diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 6b080a0..8edae6d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -1476,7 +1476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared public override bool Equals(Object o) { - if(!(o is LSLFloat)) + if (!(o is LSLFloat)) return false; return value == ((LSLFloat)o).value; -- cgit v1.1