From 6ec680918bc6876f1c1382fb534b653fc34da052 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 18 May 2008 23:06:50 +0000 Subject: Formatting cleanup, minor refactoring. Fixed some comparisons of value types and null. --- OpenSim/Region/DataSnapshot/EstateSnapshot.cs | 2 +- OpenSim/Region/DataSnapshot/LLSDDiscovery.cs | 1 - OpenSim/Region/DataSnapshot/LandSnapshot.cs | 7 +- OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | 6 +- OpenSim/Region/DataSnapshot/SnapshotStore.cs | 1 - .../Region/Environment/Interfaces/IMoneyModule.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 17 +--- OpenSim/Region/Environment/Scenes/SceneManager.cs | 2 +- .../Scenes/SceneObjectPart.Inventory.cs | 30 +++---- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 4 +- .../Modules/AvatarFactory/AvatarFactoryModule.cs | 8 +- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 99 ++++++++++------------ .../DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 15 +--- .../ScriptEngine/RemoteServer/RemoteServer.cs | 21 +++-- 14 files changed, 93 insertions(+), 122 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs b/OpenSim/Region/DataSnapshot/EstateSnapshot.cs index 40b96d5..9a25c1d 100644 --- a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/EstateSnapshot.cs @@ -38,7 +38,7 @@ namespace OpenSim.Region.DataSnapshot.Providers /* This module doesn't check for changes, since it's *assumed* there are none. * Nevertheless, it's possible to have changes, since all the fields are public. * There's no event to subscribe to. :/ - * + * * I don't think anything changes the fields beyond RegionModule PostInit, however. */ private Scene m_scene = null; diff --git a/OpenSim/Region/DataSnapshot/LLSDDiscovery.cs b/OpenSim/Region/DataSnapshot/LLSDDiscovery.cs index 209f804..e1d7ac3 100644 --- a/OpenSim/Region/DataSnapshot/LLSDDiscovery.cs +++ b/OpenSim/Region/DataSnapshot/LLSDDiscovery.cs @@ -23,7 +23,6 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* */ using System; diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs index 4bfa87a..02e80ba 100644 --- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs @@ -23,7 +23,6 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* */ using System; @@ -53,9 +52,9 @@ namespace OpenSim.Region.DataSnapshot.Providers /* * David, I don't think we need this at all. When we do the snapshot, we can - * simply look into the parcels that are marked for ShowDirectory -- see + * simply look into the parcels that are marked for ShowDirectory -- see * conditional in RequestSnapshotData - * + * //Revise this, look for more direct way of checking for change in land #region Client hooks @@ -119,7 +118,7 @@ namespace OpenSim.Region.DataSnapshot.Providers } public XmlNode RequestSnapshotData(XmlDocument nodeFactory) - { + { ILandChannel landChannel = (LandChannel)m_scene.LandChannel; Dictionary landList = null; try diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs index af73ba0..e5b2ad4 100644 --- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs @@ -79,7 +79,7 @@ namespace OpenSim.Region.DataSnapshot.Providers client.OnObjectPermissions += delegate(IClientAPI controller, LLUUID agentID, LLUUID sessionID, byte field, uint localId, uint mask, byte set) { this.Stale = true; }; client.OnRezObject += delegate(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, - LLVector3 RayStart, LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, + LLVector3 RayStart, LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, bool RezSelected, bool RemoveItem, LLUUID fromTaskID) { this.Stale = true; }; } @@ -99,7 +99,7 @@ namespace OpenSim.Region.DataSnapshot.Providers foreach (EntityBase entity in m_scene.Entities.Values) { // only objects, not avatars - if (entity is SceneObjectGroup) + if (entity is SceneObjectGroup) { SceneObjectGroup obj = (SceneObjectGroup)entity; @@ -135,7 +135,7 @@ namespace OpenSim.Region.DataSnapshot.Providers node = nodeFactory.CreateNode(XmlNodeType.Element, "description", ""); node.InnerText = m_rootPart.Description; xmlobject.AppendChild(node); - + node = nodeFactory.CreateNode(XmlNodeType.Element, "flags", ""); node.InnerText = String.Format("{0:x}", m_rootPart.ObjectFlags); xmlobject.AppendChild(node); diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs index 7e2c060..4f4beea 100644 --- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs +++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs @@ -23,7 +23,6 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* */ using System; diff --git a/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs b/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs index 0531d5c..de39d0f 100644 --- a/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs @@ -33,7 +33,7 @@ namespace OpenSim.Region.Environment.Interfaces { public delegate void ObjectPaid(LLUUID objectID, LLUUID agentID, int amount); public interface IMoneyModule : IRegionModule - { + { bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d4b85c2..e1764b5 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2658,7 +2658,7 @@ namespace OpenSim.Region.Environment.Scenes ClientManager.ForEachClient(delegate(IClientAPI controller) { ScenePresence p = GetScenePresence(controller.AgentId); - bool childagent = !p.Equals(null) && p.IsChildAgent; + bool childagent = p != null && p.IsChildAgent; if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness? { @@ -2669,14 +2669,7 @@ namespace OpenSim.Region.Environment.Scenes } else { - if (m_scenePresences[agentID].IsChildAgent) - { - m_innerScene.removeUserCount(false); - } - else - { - m_innerScene.removeUserCount(true); - } + m_innerScene.removeUserCount(!m_scenePresences[agentID].IsChildAgent); m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); m_scenePresences[agentID].ControllingClient.Close(true); @@ -2696,7 +2689,6 @@ namespace OpenSim.Region.Environment.Scenes // Check for spoofing.. since this is permissions we're talking about here! if ((controller.SessionId == sessionID) && (controller.AgentId == agentID)) { - // Tell the object to do permission update if (localId != 0) { @@ -2706,7 +2698,6 @@ namespace OpenSim.Region.Environment.Scenes chObjectGroup.UpdatePermissions(agentID, field, localId, mask, set); } } - } } @@ -3126,8 +3117,8 @@ namespace OpenSim.Region.Environment.Scenes /// public void ForEachScenePresence(Action action) { - // We don't want to try to send messages if there are no avatar. - if (!(m_scenePresences.Equals(null))) + // We don't want to try to send messages if there are no avatars. + if (m_scenePresences != null) { try { diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 8f3de51..1568632 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -140,7 +140,7 @@ namespace OpenSim.Region.Environment.Scenes Result = m_localScenes[i].RegionInfo; } } - if (!(Result.Equals(null))) + if (Result != null) { for (int i = 0; i < m_localScenes.Count; i++) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index 8c5737c..d63260d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -497,26 +497,26 @@ namespace OpenSim.Region.Environment.Scenes { foreach (TaskInventoryItem item in m_taskInventory.Values) { - LLUUID ownerID=item.OwnerID; - uint everyoneMask=0; - uint baseMask=item.BaseMask; - uint ownerMask=item.OwnerMask; + LLUUID ownerID = item.OwnerID; + uint everyoneMask = 0; + uint baseMask = item.BaseMask; + uint ownerMask = item.OwnerMask; - if(item.InvType == 10) // Script + if (item.InvType == 10) // Script { - if((item.OwnerID != client.AgentId) && m_parentGroup.Scene.ExternalChecks.ExternalChecksCanViewScript(item.ItemID, UUID, client.AgentId)) + if ((item.OwnerID != client.AgentId) && m_parentGroup.Scene.ExternalChecks.ExternalChecksCanViewScript(item.ItemID, UUID, client.AgentId)) { - ownerID=client.AgentId; - baseMask=0x7fffffff; - ownerMask=0x7fffffff; - everyoneMask=(uint)(PermissionMask.Move | PermissionMask.Transfer); + ownerID = client.AgentId; + baseMask = 0x7fffffff; + ownerMask = 0x7fffffff; + everyoneMask = (uint)(PermissionMask.Move | PermissionMask.Transfer); } - if((item.OwnerID != client.AgentId) && m_parentGroup.Scene.ExternalChecks.ExternalChecksCanEditScript(item.ItemID, UUID, client.AgentId)) + if ((item.OwnerID != client.AgentId) && m_parentGroup.Scene.ExternalChecks.ExternalChecksCanEditScript(item.ItemID, UUID, client.AgentId)) { - ownerID=client.AgentId; - baseMask=0x7fffffff; - ownerMask=0x7fffffff; - everyoneMask=(uint)(PermissionMask.Move | PermissionMask.Transfer | PermissionMask.Modify); + ownerID = client.AgentId; + baseMask = 0x7fffffff; + ownerMask = 0x7fffffff; + everyoneMask = (uint)(PermissionMask.Move | PermissionMask.Transfer | PermissionMask.Modify); } } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 5221914..93ec138 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -1469,7 +1469,7 @@ namespace OpenSim.Region.Environment.Scenes public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable) { - m_log.Info("[APPEARANCE] Setting wearable with client, wearableid, wearable"); + m_log.Info("[APPEARANCE] Setting wearable with client, wearableid, wearable"); m_appearance.SetWearable(wearableId, wearable); m_scene.CommsManager.UserService.UpdateUserAppearance(client.AgentId, m_appearance); client.SendWearables(m_appearance.Wearables, m_appearance.Serial++); @@ -1524,7 +1524,7 @@ namespace OpenSim.Region.Environment.Scenes public void SetWearable(int wearableId, AvatarWearable wearable) { - m_log.Warn("[APPEARANCE] Setting Wearable"); + m_log.Warn("[APPEARANCE] Setting Wearable"); m_appearance.SetWearable(wearableId, wearable); m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); } diff --git a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs index f5e0ca2..3ac8e9a 100644 --- a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs @@ -297,7 +297,7 @@ namespace OpenSim.Region.Modules.AvatarFactory else { LLUUID assetId; - + InventoryItemBase baseItem = profile.RootFolder.FindItem(wear.ItemID); if (baseItem != null) @@ -306,7 +306,7 @@ namespace OpenSim.Region.Modules.AvatarFactory avatAppearance.Wearables[wear.Type].AssetID = assetId; avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; } - else + else { m_log.ErrorFormat("[APPEARANCE] Can't find inventory item {0}, not wearing", wear.ItemID); } @@ -314,8 +314,8 @@ namespace OpenSim.Region.Modules.AvatarFactory } } m_scene.CommsManager.UserService.UpdateUserAppearance(clientView.AgentId, avatAppearance); - } - else + } + else { m_log.Error("Root Profile is null, we can't set the appearance"); } diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 70f0785..fef0c4e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -144,9 +144,9 @@ namespace OpenSim.Region.Physics.OdePlugin //private int m_returncollisions = 10; private IntPtr contactgroup; - private IntPtr LandGeom = (IntPtr) 0; + private IntPtr LandGeom; - private IntPtr WaterGeom = (IntPtr)0; + private IntPtr WaterGeom; private float nmTerrainContactFriction = 255.0f; private float nmTerrainContactBounce = 0.1f; @@ -430,7 +430,7 @@ namespace OpenSim.Region.Physics.OdePlugin internal void waitForSpaceUnlock(IntPtr space) { - //if (space != (IntPtr)0) + //if (space != IntPtr.Zero) //while (d.SpaceLockQuery(space)) { } // Wait and do nothing } @@ -461,7 +461,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) { - if (g1 == (IntPtr)0 || g2 == (IntPtr)0) + if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) return; // Separating static prim geometry spaces. // We'll be calling near recursivly if one @@ -484,7 +484,7 @@ namespace OpenSim.Region.Physics.OdePlugin return; } - if (g1 == (IntPtr)0 || g2 == (IntPtr)0) + if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) return; IntPtr b1 = d.GeomGetBody(g1); @@ -1037,10 +1037,14 @@ namespace OpenSim.Region.Physics.OdePlugin { lock (chr) { - if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0 && chr.m_taintremove == false) + if (space != IntPtr.Zero && chr.prim_geom != IntPtr.Zero && chr.m_taintremove == false) + { d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); + } else + { m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed"); + } } } catch (AccessViolationException) @@ -1204,7 +1208,7 @@ namespace OpenSim.Region.Physics.OdePlugin remCollisionEventReporting(prim); lock (ode) { - if (prim.prim_geom != (IntPtr)0) + if (prim.prim_geom != IntPtr.Zero) { prim.ResetTaints(); @@ -1217,7 +1221,7 @@ namespace OpenSim.Region.Physics.OdePlugin // If the geometry is in the targetspace, remove it from the target space //m_log.Warn(prim.m_targetSpace); - //if (prim.m_targetSpace != (IntPtr)0) + //if (prim.m_targetSpace != IntPtr.Zero) //{ //if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) //{ @@ -1226,7 +1230,7 @@ namespace OpenSim.Region.Physics.OdePlugin //{ //waitForSpaceUnlock(prim.m_targetSpace); //d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); - prim.m_targetSpace = (IntPtr)0; + prim.m_targetSpace = IntPtr.Zero; //} //else //{ @@ -1239,10 +1243,10 @@ namespace OpenSim.Region.Physics.OdePlugin //m_log.Warn(prim.prim_geom); try { - if (prim.prim_geom != (IntPtr)0) + if (prim.prim_geom != IntPtr.Zero) { d.GeomDestroy(prim.prim_geom); - prim.prim_geom = (IntPtr)0; + prim.prim_geom = IntPtr.Zero; } else { @@ -1258,7 +1262,7 @@ namespace OpenSim.Region.Physics.OdePlugin //If there are no more geometries in the sub-space, we don't need it in the main space anymore //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) //{ - //if (!(prim.m_targetSpace.Equals(null))) + //if (prim.m_targetSpace != null) //{ //if (d.GeomIsSpace(prim.m_targetSpace)) //{ @@ -1327,11 +1331,11 @@ namespace OpenSim.Region.Physics.OdePlugin if (currentspace != space) { //m_log.Info("[SPACE]: C:" + currentspace.ToString() + " g:" + geom.ToString()); - //if (currentspace == (IntPtr) 0) + //if (currentspace == IntPtr.Zero) //{ //int adfadf = 0; //} - if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr) 0) + if (d.SpaceQuery(currentspace, geom) && currentspace != IntPtr.Zero) { if (d.GeomIsSpace(currentspace)) { @@ -1347,20 +1351,17 @@ namespace OpenSim.Region.Physics.OdePlugin else { IntPtr sGeomIsIn = d.GeomGetSpace(geom); - if (!(sGeomIsIn.Equals(null))) + if (sGeomIsIn != IntPtr.Zero) { - if (sGeomIsIn != (IntPtr) 0) + if (d.GeomIsSpace(currentspace)) { - if (d.GeomIsSpace(currentspace)) - { - waitForSpaceUnlock(sGeomIsIn); - d.SpaceRemove(sGeomIsIn, geom); - } - else - { - m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + - sGeomIsIn.ToString() + " Geom:" + geom.ToString()); - } + waitForSpaceUnlock(sGeomIsIn); + d.SpaceRemove(sGeomIsIn, geom); + } + else + { + m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + + sGeomIsIn.ToString() + " Geom:" + geom.ToString()); } } } @@ -1368,7 +1369,7 @@ namespace OpenSim.Region.Physics.OdePlugin //If there are no more geometries in the sub-space, we don't need it in the main space anymore if (d.SpaceGetNumGeoms(currentspace) == 0) { - if (currentspace != (IntPtr) 0) + if (currentspace != IntPtr.Zero) { if (d.GeomIsSpace(currentspace)) { @@ -1391,7 +1392,7 @@ namespace OpenSim.Region.Physics.OdePlugin else { // this is a physical object that got disabled. ;.; - if (currentspace != (IntPtr)0 && geom != (IntPtr)0) + if (currentspace != IntPtr.Zero && geom != IntPtr.Zero) { if (d.SpaceQuery(currentspace, geom)) { @@ -1409,20 +1410,17 @@ namespace OpenSim.Region.Physics.OdePlugin else { IntPtr sGeomIsIn = d.GeomGetSpace(geom); - if (!(sGeomIsIn.Equals(null))) + if (sGeomIsIn != IntPtr.Zero) { - if (sGeomIsIn != (IntPtr)0) + if (d.GeomIsSpace(sGeomIsIn)) { - if (d.GeomIsSpace(sGeomIsIn)) - { - waitForSpaceUnlock(sGeomIsIn); - d.SpaceRemove(sGeomIsIn, geom); - } - else - { - m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + - sGeomIsIn.ToString() + " Geom:" + geom.ToString()); - } + waitForSpaceUnlock(sGeomIsIn); + d.SpaceRemove(sGeomIsIn, geom); + } + else + { + m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + + sGeomIsIn.ToString() + " Geom:" + geom.ToString()); } } } @@ -1461,20 +1459,15 @@ namespace OpenSim.Region.Physics.OdePlugin } /// - /// Calculates the space the prim should be in by it's position + /// Calculates the space the prim should be in by its position /// /// /// a pointer to the space. This could be a new space or reused space. public IntPtr calculateSpaceForGeom(PhysicsVector pos) { - IntPtr locationbasedspace =IntPtr.Zero; - - int[] xyspace = calculateSpaceArrayItemFromPos(pos); - //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); - locationbasedspace = staticPrimspace[xyspace[0], xyspace[1]]; - - //locationbasedspace = space; - return locationbasedspace; + int[] xyspace = calculateSpaceArrayItemFromPos(pos); + //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); + return staticPrimspace[xyspace[0], xyspace[1]]; } /// @@ -2050,7 +2043,7 @@ namespace OpenSim.Region.Physics.OdePlugin lock (OdeLock) { - if (!(LandGeom == (IntPtr) 0)) + if (LandGeom != IntPtr.Zero) { d.SpaceRemove(space, LandGeom); } @@ -2060,7 +2053,7 @@ namespace OpenSim.Region.Physics.OdePlugin offset, thickness, wrap); d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); LandGeom = d.CreateHeightfield(space, HeightmapData, 1); - if (LandGeom != (IntPtr)0) + if (LandGeom != IntPtr.Zero) { d.GeomSetCategoryBits(LandGeom, (int)(CollisionCategories.Land)); d.GeomSetCollideBits(LandGeom, (int)(CollisionCategories.Space)); @@ -2115,7 +2108,7 @@ namespace OpenSim.Region.Physics.OdePlugin lock (OdeLock) { - if (!(WaterGeom == (IntPtr)0)) + if (WaterGeom != IntPtr.Zero) { d.SpaceRemove(space, WaterGeom); } @@ -2125,7 +2118,7 @@ namespace OpenSim.Region.Physics.OdePlugin offset, thickness, wrap); d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); WaterGeom = d.CreateHeightfield(space, HeightmapData, 1); - if (WaterGeom != (IntPtr)0) + if (WaterGeom != IntPtr.Zero) { d.GeomSetCategoryBits(WaterGeom, (int)(CollisionCategories.Water)); d.GeomSetCollideBits(WaterGeom, (int)(CollisionCategories.Space)); diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 2469107..765eb5d 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs @@ -39,13 +39,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled); private Dictionary dataTypes = new Dictionary(); private Dictionary quotes = new Dictionary(); - // c Style + // c Style private Regex cstylecomments = new Regex(@"/\*(.|[\r\n])*?\*/", RegexOptions.Compiled | RegexOptions.Multiline); - // c# one liners + // c# one liners private Regex conelinecomments = new Regex(@".?([\/]{2}[^\n]*)|([\n]{1,}[\/]{2}[^\n]*)", RegexOptions.Compiled | RegexOptions.Multiline); // ([^\"])((?:[a-zA-Z])\.[a-zA-Z].?)([^\"]) - - // value we're looking for: (?:[a-zA-Z])\.[a-zA-Z] public LSL2CSConverter() @@ -89,16 +87,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL bool last_was_escape = false; int quote_replaced_count = 0; - - string removecomments = conelinecomments.Replace(Script, ""); removecomments = cstylecomments.Replace(removecomments, ""); string[] localscript = removecomments.Split('"'); string checkscript = String.Empty; bool flip = true; - - for (int p = 0; p < localscript.Length; p++) { if (localscript[p].Length >= 1) @@ -115,7 +109,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL if (!flip) checkscript += "\"" + localscript[p]; } - + //System.Console.WriteLine("SCRIPT:" + checkscript); // checks for alpha.alpha way of referring to objects in C# @@ -132,9 +126,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL if (SecurityM.Success) throw new Exception("CS0103: 'The object.GetType method isn't allowed in LSL'"); - - - for (int p = 0; p < Script.Length; p++) { C = Script.Substring(p, 1); diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs b/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs index 603808e..2a51b91 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs @@ -45,27 +45,25 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer ChannelServices.RegisterChannel(chan, true); } + /// + /// Create a channel for communicating w/ the remote object + /// Notice no port is specified on the client + /// public ScriptServerInterfaces.ServerRemotingObject Connect(string hostname, int port) { - // Create a channel for communicating w/ the remote object - // Notice no port is specified on the client - + ScriptServerInterfaces.ServerRemotingObject obj = null; + try { // Create an instance of the remote object - ScriptServerInterfaces.ServerRemotingObject obj = (ScriptServerInterfaces.ServerRemotingObject)Activator.GetObject( + obj = (ScriptServerInterfaces.ServerRemotingObject)Activator.GetObject( typeof(ScriptServerInterfaces.ServerRemotingObject), "tcp://" + hostname + ":" + port + "/DotNetEngine"); - // Use the object - if (obj.Equals(null)) + if (obj == null) { Console.WriteLine("Error: unable to locate server"); } - else - { - return obj; - } } catch (SocketException) { @@ -75,7 +73,8 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer { Console.WriteLine("Error: unable to connect to server"); } - return null; + + return obj; } } } -- cgit v1.1