diff options
author | Jeff Ames | 2008-05-18 23:06:50 +0000 |
---|---|---|
committer | Jeff Ames | 2008-05-18 23:06:50 +0000 |
commit | 6ec680918bc6876f1c1382fb534b653fc34da052 (patch) | |
tree | 7eedbb3fa05b9540de9bba4a583795f1ba919de4 /OpenSim/Region | |
parent | Update svn properties. (diff) | |
download | opensim-SC-6ec680918bc6876f1c1382fb534b653fc34da052.zip opensim-SC-6ec680918bc6876f1c1382fb534b653fc34da052.tar.gz opensim-SC-6ec680918bc6876f1c1382fb534b653fc34da052.tar.bz2 opensim-SC-6ec680918bc6876f1c1382fb534b653fc34da052.tar.xz |
Formatting cleanup, minor refactoring. Fixed some comparisons of value types and null.
Diffstat (limited to 'OpenSim/Region')
14 files changed, 93 insertions, 122 deletions
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 | |||
38 | /* This module doesn't check for changes, since it's *assumed* there are none. | 38 | /* This module doesn't check for changes, since it's *assumed* there are none. |
39 | * Nevertheless, it's possible to have changes, since all the fields are public. | 39 | * Nevertheless, it's possible to have changes, since all the fields are public. |
40 | * There's no event to subscribe to. :/ | 40 | * There's no event to subscribe to. :/ |
41 | * | 41 | * |
42 | * I don't think anything changes the fields beyond RegionModule PostInit, however. | 42 | * I don't think anything changes the fields beyond RegionModule PostInit, however. |
43 | */ | 43 | */ |
44 | private Scene m_scene = null; | 44 | 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 @@ | |||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | ||
27 | */ | 26 | */ |
28 | 27 | ||
29 | using System; | 28 | 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 @@ | |||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | ||
27 | */ | 26 | */ |
28 | 27 | ||
29 | using System; | 28 | using System; |
@@ -53,9 +52,9 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
53 | 52 | ||
54 | /* | 53 | /* |
55 | * David, I don't think we need this at all. When we do the snapshot, we can | 54 | * David, I don't think we need this at all. When we do the snapshot, we can |
56 | * simply look into the parcels that are marked for ShowDirectory -- see | 55 | * simply look into the parcels that are marked for ShowDirectory -- see |
57 | * conditional in RequestSnapshotData | 56 | * conditional in RequestSnapshotData |
58 | * | 57 | * |
59 | //Revise this, look for more direct way of checking for change in land | 58 | //Revise this, look for more direct way of checking for change in land |
60 | #region Client hooks | 59 | #region Client hooks |
61 | 60 | ||
@@ -119,7 +118,7 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
119 | } | 118 | } |
120 | 119 | ||
121 | public XmlNode RequestSnapshotData(XmlDocument nodeFactory) | 120 | public XmlNode RequestSnapshotData(XmlDocument nodeFactory) |
122 | { | 121 | { |
123 | ILandChannel landChannel = (LandChannel)m_scene.LandChannel; | 122 | ILandChannel landChannel = (LandChannel)m_scene.LandChannel; |
124 | Dictionary<int, ILandObject> landList = null; | 123 | Dictionary<int, ILandObject> landList = null; |
125 | try | 124 | 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 | |||
79 | client.OnObjectPermissions += delegate(IClientAPI controller, LLUUID agentID, LLUUID sessionID, | 79 | client.OnObjectPermissions += delegate(IClientAPI controller, LLUUID agentID, LLUUID sessionID, |
80 | byte field, uint localId, uint mask, byte set) { this.Stale = true; }; | 80 | byte field, uint localId, uint mask, byte set) { this.Stale = true; }; |
81 | client.OnRezObject += delegate(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, | 81 | client.OnRezObject += delegate(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, |
82 | LLVector3 RayStart, LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 82 | LLVector3 RayStart, LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
83 | uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, bool RezSelected, | 83 | uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, bool RezSelected, |
84 | bool RemoveItem, LLUUID fromTaskID) { this.Stale = true; }; | 84 | bool RemoveItem, LLUUID fromTaskID) { this.Stale = true; }; |
85 | } | 85 | } |
@@ -99,7 +99,7 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
99 | foreach (EntityBase entity in m_scene.Entities.Values) | 99 | foreach (EntityBase entity in m_scene.Entities.Values) |
100 | { | 100 | { |
101 | // only objects, not avatars | 101 | // only objects, not avatars |
102 | if (entity is SceneObjectGroup) | 102 | if (entity is SceneObjectGroup) |
103 | { | 103 | { |
104 | SceneObjectGroup obj = (SceneObjectGroup)entity; | 104 | SceneObjectGroup obj = (SceneObjectGroup)entity; |
105 | 105 | ||
@@ -135,7 +135,7 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
135 | node = nodeFactory.CreateNode(XmlNodeType.Element, "description", ""); | 135 | node = nodeFactory.CreateNode(XmlNodeType.Element, "description", ""); |
136 | node.InnerText = m_rootPart.Description; | 136 | node.InnerText = m_rootPart.Description; |
137 | xmlobject.AppendChild(node); | 137 | xmlobject.AppendChild(node); |
138 | 138 | ||
139 | node = nodeFactory.CreateNode(XmlNodeType.Element, "flags", ""); | 139 | node = nodeFactory.CreateNode(XmlNodeType.Element, "flags", ""); |
140 | node.InnerText = String.Format("{0:x}", m_rootPart.ObjectFlags); | 140 | node.InnerText = String.Format("{0:x}", m_rootPart.ObjectFlags); |
141 | xmlobject.AppendChild(node); | 141 | 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 @@ | |||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | ||
27 | */ | 26 | */ |
28 | 27 | ||
29 | using System; | 28 | 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 | |||
33 | { | 33 | { |
34 | public delegate void ObjectPaid(LLUUID objectID, LLUUID agentID, int amount); | 34 | public delegate void ObjectPaid(LLUUID objectID, LLUUID agentID, int amount); |
35 | public interface IMoneyModule : IRegionModule | 35 | public interface IMoneyModule : IRegionModule |
36 | { | 36 | { |
37 | bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, | 37 | bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, |
38 | int amount); | 38 | int amount); |
39 | 39 | ||
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 | |||
2658 | ClientManager.ForEachClient(delegate(IClientAPI controller) | 2658 | ClientManager.ForEachClient(delegate(IClientAPI controller) |
2659 | { | 2659 | { |
2660 | ScenePresence p = GetScenePresence(controller.AgentId); | 2660 | ScenePresence p = GetScenePresence(controller.AgentId); |
2661 | bool childagent = !p.Equals(null) && p.IsChildAgent; | 2661 | bool childagent = p != null && p.IsChildAgent; |
2662 | if (controller.AgentId != godID && !childagent) | 2662 | if (controller.AgentId != godID && !childagent) |
2663 | // Do we really want to kick the initiator of this madness? | 2663 | // Do we really want to kick the initiator of this madness? |
2664 | { | 2664 | { |
@@ -2669,14 +2669,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2669 | } | 2669 | } |
2670 | else | 2670 | else |
2671 | { | 2671 | { |
2672 | if (m_scenePresences[agentID].IsChildAgent) | 2672 | m_innerScene.removeUserCount(!m_scenePresences[agentID].IsChildAgent); |
2673 | { | ||
2674 | m_innerScene.removeUserCount(false); | ||
2675 | } | ||
2676 | else | ||
2677 | { | ||
2678 | m_innerScene.removeUserCount(true); | ||
2679 | } | ||
2680 | 2673 | ||
2681 | m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); | 2674 | m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); |
2682 | m_scenePresences[agentID].ControllingClient.Close(true); | 2675 | m_scenePresences[agentID].ControllingClient.Close(true); |
@@ -2696,7 +2689,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2696 | // Check for spoofing.. since this is permissions we're talking about here! | 2689 | // Check for spoofing.. since this is permissions we're talking about here! |
2697 | if ((controller.SessionId == sessionID) && (controller.AgentId == agentID)) | 2690 | if ((controller.SessionId == sessionID) && (controller.AgentId == agentID)) |
2698 | { | 2691 | { |
2699 | |||
2700 | // Tell the object to do permission update | 2692 | // Tell the object to do permission update |
2701 | if (localId != 0) | 2693 | if (localId != 0) |
2702 | { | 2694 | { |
@@ -2706,7 +2698,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2706 | chObjectGroup.UpdatePermissions(agentID, field, localId, mask, set); | 2698 | chObjectGroup.UpdatePermissions(agentID, field, localId, mask, set); |
2707 | } | 2699 | } |
2708 | } | 2700 | } |
2709 | |||
2710 | } | 2701 | } |
2711 | } | 2702 | } |
2712 | 2703 | ||
@@ -3126,8 +3117,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
3126 | /// <param name="action"></param> | 3117 | /// <param name="action"></param> |
3127 | public void ForEachScenePresence(Action<ScenePresence> action) | 3118 | public void ForEachScenePresence(Action<ScenePresence> action) |
3128 | { | 3119 | { |
3129 | // We don't want to try to send messages if there are no avatar. | 3120 | // We don't want to try to send messages if there are no avatars. |
3130 | if (!(m_scenePresences.Equals(null))) | 3121 | if (m_scenePresences != null) |
3131 | { | 3122 | { |
3132 | try | 3123 | try |
3133 | { | 3124 | { |
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 | |||
140 | Result = m_localScenes[i].RegionInfo; | 140 | Result = m_localScenes[i].RegionInfo; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | if (!(Result.Equals(null))) | 143 | if (Result != null) |
144 | { | 144 | { |
145 | for (int i = 0; i < m_localScenes.Count; i++) | 145 | for (int i = 0; i < m_localScenes.Count; i++) |
146 | { | 146 | { |
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 | |||
497 | { | 497 | { |
498 | foreach (TaskInventoryItem item in m_taskInventory.Values) | 498 | foreach (TaskInventoryItem item in m_taskInventory.Values) |
499 | { | 499 | { |
500 | LLUUID ownerID=item.OwnerID; | 500 | LLUUID ownerID = item.OwnerID; |
501 | uint everyoneMask=0; | 501 | uint everyoneMask = 0; |
502 | uint baseMask=item.BaseMask; | 502 | uint baseMask = item.BaseMask; |
503 | uint ownerMask=item.OwnerMask; | 503 | uint ownerMask = item.OwnerMask; |
504 | 504 | ||
505 | if(item.InvType == 10) // Script | 505 | if (item.InvType == 10) // Script |
506 | { | 506 | { |
507 | if((item.OwnerID != client.AgentId) && m_parentGroup.Scene.ExternalChecks.ExternalChecksCanViewScript(item.ItemID, UUID, client.AgentId)) | 507 | if ((item.OwnerID != client.AgentId) && m_parentGroup.Scene.ExternalChecks.ExternalChecksCanViewScript(item.ItemID, UUID, client.AgentId)) |
508 | { | 508 | { |
509 | ownerID=client.AgentId; | 509 | ownerID = client.AgentId; |
510 | baseMask=0x7fffffff; | 510 | baseMask = 0x7fffffff; |
511 | ownerMask=0x7fffffff; | 511 | ownerMask = 0x7fffffff; |
512 | everyoneMask=(uint)(PermissionMask.Move | PermissionMask.Transfer); | 512 | everyoneMask = (uint)(PermissionMask.Move | PermissionMask.Transfer); |
513 | } | 513 | } |
514 | if((item.OwnerID != client.AgentId) && m_parentGroup.Scene.ExternalChecks.ExternalChecksCanEditScript(item.ItemID, UUID, client.AgentId)) | 514 | if ((item.OwnerID != client.AgentId) && m_parentGroup.Scene.ExternalChecks.ExternalChecksCanEditScript(item.ItemID, UUID, client.AgentId)) |
515 | { | 515 | { |
516 | ownerID=client.AgentId; | 516 | ownerID = client.AgentId; |
517 | baseMask=0x7fffffff; | 517 | baseMask = 0x7fffffff; |
518 | ownerMask=0x7fffffff; | 518 | ownerMask = 0x7fffffff; |
519 | everyoneMask=(uint)(PermissionMask.Move | PermissionMask.Transfer | PermissionMask.Modify); | 519 | everyoneMask = (uint)(PermissionMask.Move | PermissionMask.Transfer | PermissionMask.Modify); |
520 | } | 520 | } |
521 | } | 521 | } |
522 | 522 | ||
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 | |||
1469 | 1469 | ||
1470 | public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable) | 1470 | public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable) |
1471 | { | 1471 | { |
1472 | m_log.Info("[APPEARANCE] Setting wearable with client, wearableid, wearable"); | 1472 | m_log.Info("[APPEARANCE] Setting wearable with client, wearableid, wearable"); |
1473 | m_appearance.SetWearable(wearableId, wearable); | 1473 | m_appearance.SetWearable(wearableId, wearable); |
1474 | m_scene.CommsManager.UserService.UpdateUserAppearance(client.AgentId, m_appearance); | 1474 | m_scene.CommsManager.UserService.UpdateUserAppearance(client.AgentId, m_appearance); |
1475 | client.SendWearables(m_appearance.Wearables, m_appearance.Serial++); | 1475 | client.SendWearables(m_appearance.Wearables, m_appearance.Serial++); |
@@ -1524,7 +1524,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1524 | 1524 | ||
1525 | public void SetWearable(int wearableId, AvatarWearable wearable) | 1525 | public void SetWearable(int wearableId, AvatarWearable wearable) |
1526 | { | 1526 | { |
1527 | m_log.Warn("[APPEARANCE] Setting Wearable"); | 1527 | m_log.Warn("[APPEARANCE] Setting Wearable"); |
1528 | m_appearance.SetWearable(wearableId, wearable); | 1528 | m_appearance.SetWearable(wearableId, wearable); |
1529 | m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); | 1529 | m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); |
1530 | } | 1530 | } |
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 | |||
297 | else | 297 | else |
298 | { | 298 | { |
299 | LLUUID assetId; | 299 | LLUUID assetId; |
300 | 300 | ||
301 | InventoryItemBase baseItem = profile.RootFolder.FindItem(wear.ItemID); | 301 | InventoryItemBase baseItem = profile.RootFolder.FindItem(wear.ItemID); |
302 | 302 | ||
303 | if (baseItem != null) | 303 | if (baseItem != null) |
@@ -306,7 +306,7 @@ namespace OpenSim.Region.Modules.AvatarFactory | |||
306 | avatAppearance.Wearables[wear.Type].AssetID = assetId; | 306 | avatAppearance.Wearables[wear.Type].AssetID = assetId; |
307 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; | 307 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; |
308 | } | 308 | } |
309 | else | 309 | else |
310 | { | 310 | { |
311 | m_log.ErrorFormat("[APPEARANCE] Can't find inventory item {0}, not wearing", wear.ItemID); | 311 | m_log.ErrorFormat("[APPEARANCE] Can't find inventory item {0}, not wearing", wear.ItemID); |
312 | } | 312 | } |
@@ -314,8 +314,8 @@ namespace OpenSim.Region.Modules.AvatarFactory | |||
314 | } | 314 | } |
315 | } | 315 | } |
316 | m_scene.CommsManager.UserService.UpdateUserAppearance(clientView.AgentId, avatAppearance); | 316 | m_scene.CommsManager.UserService.UpdateUserAppearance(clientView.AgentId, avatAppearance); |
317 | } | 317 | } |
318 | else | 318 | else |
319 | { | 319 | { |
320 | m_log.Error("Root Profile is null, we can't set the appearance"); | 320 | m_log.Error("Root Profile is null, we can't set the appearance"); |
321 | } | 321 | } |
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 | |||
144 | //private int m_returncollisions = 10; | 144 | //private int m_returncollisions = 10; |
145 | 145 | ||
146 | private IntPtr contactgroup; | 146 | private IntPtr contactgroup; |
147 | private IntPtr LandGeom = (IntPtr) 0; | 147 | private IntPtr LandGeom; |
148 | 148 | ||
149 | private IntPtr WaterGeom = (IntPtr)0; | 149 | private IntPtr WaterGeom; |
150 | 150 | ||
151 | private float nmTerrainContactFriction = 255.0f; | 151 | private float nmTerrainContactFriction = 255.0f; |
152 | private float nmTerrainContactBounce = 0.1f; | 152 | private float nmTerrainContactBounce = 0.1f; |
@@ -430,7 +430,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
430 | 430 | ||
431 | internal void waitForSpaceUnlock(IntPtr space) | 431 | internal void waitForSpaceUnlock(IntPtr space) |
432 | { | 432 | { |
433 | //if (space != (IntPtr)0) | 433 | //if (space != IntPtr.Zero) |
434 | //while (d.SpaceLockQuery(space)) { } // Wait and do nothing | 434 | //while (d.SpaceLockQuery(space)) { } // Wait and do nothing |
435 | } | 435 | } |
436 | 436 | ||
@@ -461,7 +461,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
461 | 461 | ||
462 | if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) | 462 | if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) |
463 | { | 463 | { |
464 | if (g1 == (IntPtr)0 || g2 == (IntPtr)0) | 464 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) |
465 | return; | 465 | return; |
466 | // Separating static prim geometry spaces. | 466 | // Separating static prim geometry spaces. |
467 | // We'll be calling near recursivly if one | 467 | // We'll be calling near recursivly if one |
@@ -484,7 +484,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
484 | return; | 484 | return; |
485 | } | 485 | } |
486 | 486 | ||
487 | if (g1 == (IntPtr)0 || g2 == (IntPtr)0) | 487 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) |
488 | return; | 488 | return; |
489 | 489 | ||
490 | IntPtr b1 = d.GeomGetBody(g1); | 490 | IntPtr b1 = d.GeomGetBody(g1); |
@@ -1037,10 +1037,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1037 | { | 1037 | { |
1038 | lock (chr) | 1038 | lock (chr) |
1039 | { | 1039 | { |
1040 | if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0 && chr.m_taintremove == false) | 1040 | if (space != IntPtr.Zero && chr.prim_geom != IntPtr.Zero && chr.m_taintremove == false) |
1041 | { | ||
1041 | d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); | 1042 | d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); |
1043 | } | ||
1042 | else | 1044 | else |
1045 | { | ||
1043 | 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"); | 1046 | 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"); |
1047 | } | ||
1044 | } | 1048 | } |
1045 | } | 1049 | } |
1046 | catch (AccessViolationException) | 1050 | catch (AccessViolationException) |
@@ -1204,7 +1208,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1204 | remCollisionEventReporting(prim); | 1208 | remCollisionEventReporting(prim); |
1205 | lock (ode) | 1209 | lock (ode) |
1206 | { | 1210 | { |
1207 | if (prim.prim_geom != (IntPtr)0) | 1211 | if (prim.prim_geom != IntPtr.Zero) |
1208 | { | 1212 | { |
1209 | prim.ResetTaints(); | 1213 | prim.ResetTaints(); |
1210 | 1214 | ||
@@ -1217,7 +1221,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1217 | // If the geometry is in the targetspace, remove it from the target space | 1221 | // If the geometry is in the targetspace, remove it from the target space |
1218 | //m_log.Warn(prim.m_targetSpace); | 1222 | //m_log.Warn(prim.m_targetSpace); |
1219 | 1223 | ||
1220 | //if (prim.m_targetSpace != (IntPtr)0) | 1224 | //if (prim.m_targetSpace != IntPtr.Zero) |
1221 | //{ | 1225 | //{ |
1222 | //if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) | 1226 | //if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) |
1223 | //{ | 1227 | //{ |
@@ -1226,7 +1230,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1226 | //{ | 1230 | //{ |
1227 | //waitForSpaceUnlock(prim.m_targetSpace); | 1231 | //waitForSpaceUnlock(prim.m_targetSpace); |
1228 | //d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); | 1232 | //d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); |
1229 | prim.m_targetSpace = (IntPtr)0; | 1233 | prim.m_targetSpace = IntPtr.Zero; |
1230 | //} | 1234 | //} |
1231 | //else | 1235 | //else |
1232 | //{ | 1236 | //{ |
@@ -1239,10 +1243,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1239 | //m_log.Warn(prim.prim_geom); | 1243 | //m_log.Warn(prim.prim_geom); |
1240 | try | 1244 | try |
1241 | { | 1245 | { |
1242 | if (prim.prim_geom != (IntPtr)0) | 1246 | if (prim.prim_geom != IntPtr.Zero) |
1243 | { | 1247 | { |
1244 | d.GeomDestroy(prim.prim_geom); | 1248 | d.GeomDestroy(prim.prim_geom); |
1245 | prim.prim_geom = (IntPtr)0; | 1249 | prim.prim_geom = IntPtr.Zero; |
1246 | } | 1250 | } |
1247 | else | 1251 | else |
1248 | { | 1252 | { |
@@ -1258,7 +1262,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1258 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore | 1262 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore |
1259 | //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) | 1263 | //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) |
1260 | //{ | 1264 | //{ |
1261 | //if (!(prim.m_targetSpace.Equals(null))) | 1265 | //if (prim.m_targetSpace != null) |
1262 | //{ | 1266 | //{ |
1263 | //if (d.GeomIsSpace(prim.m_targetSpace)) | 1267 | //if (d.GeomIsSpace(prim.m_targetSpace)) |
1264 | //{ | 1268 | //{ |
@@ -1327,11 +1331,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1327 | if (currentspace != space) | 1331 | if (currentspace != space) |
1328 | { | 1332 | { |
1329 | //m_log.Info("[SPACE]: C:" + currentspace.ToString() + " g:" + geom.ToString()); | 1333 | //m_log.Info("[SPACE]: C:" + currentspace.ToString() + " g:" + geom.ToString()); |
1330 | //if (currentspace == (IntPtr) 0) | 1334 | //if (currentspace == IntPtr.Zero) |
1331 | //{ | 1335 | //{ |
1332 | //int adfadf = 0; | 1336 | //int adfadf = 0; |
1333 | //} | 1337 | //} |
1334 | if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr) 0) | 1338 | if (d.SpaceQuery(currentspace, geom) && currentspace != IntPtr.Zero) |
1335 | { | 1339 | { |
1336 | if (d.GeomIsSpace(currentspace)) | 1340 | if (d.GeomIsSpace(currentspace)) |
1337 | { | 1341 | { |
@@ -1347,20 +1351,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1347 | else | 1351 | else |
1348 | { | 1352 | { |
1349 | IntPtr sGeomIsIn = d.GeomGetSpace(geom); | 1353 | IntPtr sGeomIsIn = d.GeomGetSpace(geom); |
1350 | if (!(sGeomIsIn.Equals(null))) | 1354 | if (sGeomIsIn != IntPtr.Zero) |
1351 | { | 1355 | { |
1352 | if (sGeomIsIn != (IntPtr) 0) | 1356 | if (d.GeomIsSpace(currentspace)) |
1353 | { | 1357 | { |
1354 | if (d.GeomIsSpace(currentspace)) | 1358 | waitForSpaceUnlock(sGeomIsIn); |
1355 | { | 1359 | d.SpaceRemove(sGeomIsIn, geom); |
1356 | waitForSpaceUnlock(sGeomIsIn); | 1360 | } |
1357 | d.SpaceRemove(sGeomIsIn, geom); | 1361 | else |
1358 | } | 1362 | { |
1359 | else | 1363 | m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + |
1360 | { | 1364 | sGeomIsIn.ToString() + " Geom:" + geom.ToString()); |
1361 | m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + | ||
1362 | sGeomIsIn.ToString() + " Geom:" + geom.ToString()); | ||
1363 | } | ||
1364 | } | 1365 | } |
1365 | } | 1366 | } |
1366 | } | 1367 | } |
@@ -1368,7 +1369,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1368 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore | 1369 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore |
1369 | if (d.SpaceGetNumGeoms(currentspace) == 0) | 1370 | if (d.SpaceGetNumGeoms(currentspace) == 0) |
1370 | { | 1371 | { |
1371 | if (currentspace != (IntPtr) 0) | 1372 | if (currentspace != IntPtr.Zero) |
1372 | { | 1373 | { |
1373 | if (d.GeomIsSpace(currentspace)) | 1374 | if (d.GeomIsSpace(currentspace)) |
1374 | { | 1375 | { |
@@ -1391,7 +1392,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1391 | else | 1392 | else |
1392 | { | 1393 | { |
1393 | // this is a physical object that got disabled. ;.; | 1394 | // this is a physical object that got disabled. ;.; |
1394 | if (currentspace != (IntPtr)0 && geom != (IntPtr)0) | 1395 | if (currentspace != IntPtr.Zero && geom != IntPtr.Zero) |
1395 | { | 1396 | { |
1396 | if (d.SpaceQuery(currentspace, geom)) | 1397 | if (d.SpaceQuery(currentspace, geom)) |
1397 | { | 1398 | { |
@@ -1409,20 +1410,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1409 | else | 1410 | else |
1410 | { | 1411 | { |
1411 | IntPtr sGeomIsIn = d.GeomGetSpace(geom); | 1412 | IntPtr sGeomIsIn = d.GeomGetSpace(geom); |
1412 | if (!(sGeomIsIn.Equals(null))) | 1413 | if (sGeomIsIn != IntPtr.Zero) |
1413 | { | 1414 | { |
1414 | if (sGeomIsIn != (IntPtr)0) | 1415 | if (d.GeomIsSpace(sGeomIsIn)) |
1415 | { | 1416 | { |
1416 | if (d.GeomIsSpace(sGeomIsIn)) | 1417 | waitForSpaceUnlock(sGeomIsIn); |
1417 | { | 1418 | d.SpaceRemove(sGeomIsIn, geom); |
1418 | waitForSpaceUnlock(sGeomIsIn); | 1419 | } |
1419 | d.SpaceRemove(sGeomIsIn, geom); | 1420 | else |
1420 | } | 1421 | { |
1421 | else | 1422 | m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + |
1422 | { | 1423 | sGeomIsIn.ToString() + " Geom:" + geom.ToString()); |
1423 | m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + | ||
1424 | sGeomIsIn.ToString() + " Geom:" + geom.ToString()); | ||
1425 | } | ||
1426 | } | 1424 | } |
1427 | } | 1425 | } |
1428 | } | 1426 | } |
@@ -1461,20 +1459,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1461 | } | 1459 | } |
1462 | 1460 | ||
1463 | /// <summary> | 1461 | /// <summary> |
1464 | /// Calculates the space the prim should be in by it's position | 1462 | /// Calculates the space the prim should be in by its position |
1465 | /// </summary> | 1463 | /// </summary> |
1466 | /// <param name="pos"></param> | 1464 | /// <param name="pos"></param> |
1467 | /// <returns>a pointer to the space. This could be a new space or reused space.</returns> | 1465 | /// <returns>a pointer to the space. This could be a new space or reused space.</returns> |
1468 | public IntPtr calculateSpaceForGeom(PhysicsVector pos) | 1466 | public IntPtr calculateSpaceForGeom(PhysicsVector pos) |
1469 | { | 1467 | { |
1470 | IntPtr locationbasedspace =IntPtr.Zero; | 1468 | int[] xyspace = calculateSpaceArrayItemFromPos(pos); |
1471 | 1469 | //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); | |
1472 | int[] xyspace = calculateSpaceArrayItemFromPos(pos); | 1470 | return staticPrimspace[xyspace[0], xyspace[1]]; |
1473 | //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); | ||
1474 | locationbasedspace = staticPrimspace[xyspace[0], xyspace[1]]; | ||
1475 | |||
1476 | //locationbasedspace = space; | ||
1477 | return locationbasedspace; | ||
1478 | } | 1471 | } |
1479 | 1472 | ||
1480 | /// <summary> | 1473 | /// <summary> |
@@ -2050,7 +2043,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2050 | 2043 | ||
2051 | lock (OdeLock) | 2044 | lock (OdeLock) |
2052 | { | 2045 | { |
2053 | if (!(LandGeom == (IntPtr) 0)) | 2046 | if (LandGeom != IntPtr.Zero) |
2054 | { | 2047 | { |
2055 | d.SpaceRemove(space, LandGeom); | 2048 | d.SpaceRemove(space, LandGeom); |
2056 | } | 2049 | } |
@@ -2060,7 +2053,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2060 | offset, thickness, wrap); | 2053 | offset, thickness, wrap); |
2061 | d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); | 2054 | d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); |
2062 | LandGeom = d.CreateHeightfield(space, HeightmapData, 1); | 2055 | LandGeom = d.CreateHeightfield(space, HeightmapData, 1); |
2063 | if (LandGeom != (IntPtr)0) | 2056 | if (LandGeom != IntPtr.Zero) |
2064 | { | 2057 | { |
2065 | d.GeomSetCategoryBits(LandGeom, (int)(CollisionCategories.Land)); | 2058 | d.GeomSetCategoryBits(LandGeom, (int)(CollisionCategories.Land)); |
2066 | d.GeomSetCollideBits(LandGeom, (int)(CollisionCategories.Space)); | 2059 | d.GeomSetCollideBits(LandGeom, (int)(CollisionCategories.Space)); |
@@ -2115,7 +2108,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2115 | 2108 | ||
2116 | lock (OdeLock) | 2109 | lock (OdeLock) |
2117 | { | 2110 | { |
2118 | if (!(WaterGeom == (IntPtr)0)) | 2111 | if (WaterGeom != IntPtr.Zero) |
2119 | { | 2112 | { |
2120 | d.SpaceRemove(space, WaterGeom); | 2113 | d.SpaceRemove(space, WaterGeom); |
2121 | } | 2114 | } |
@@ -2125,7 +2118,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2125 | offset, thickness, wrap); | 2118 | offset, thickness, wrap); |
2126 | d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); | 2119 | d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); |
2127 | WaterGeom = d.CreateHeightfield(space, HeightmapData, 1); | 2120 | WaterGeom = d.CreateHeightfield(space, HeightmapData, 1); |
2128 | if (WaterGeom != (IntPtr)0) | 2121 | if (WaterGeom != IntPtr.Zero) |
2129 | { | 2122 | { |
2130 | d.GeomSetCategoryBits(WaterGeom, (int)(CollisionCategories.Water)); | 2123 | d.GeomSetCategoryBits(WaterGeom, (int)(CollisionCategories.Water)); |
2131 | d.GeomSetCollideBits(WaterGeom, (int)(CollisionCategories.Space)); | 2124 | 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 | |||
39 | //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled); | 39 | //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled); |
40 | private Dictionary<string, string> dataTypes = new Dictionary<string, string>(); | 40 | private Dictionary<string, string> dataTypes = new Dictionary<string, string>(); |
41 | private Dictionary<string, string> quotes = new Dictionary<string, string>(); | 41 | private Dictionary<string, string> quotes = new Dictionary<string, string>(); |
42 | // c Style | 42 | // c Style |
43 | private Regex cstylecomments = new Regex(@"/\*(.|[\r\n])*?\*/", RegexOptions.Compiled | RegexOptions.Multiline); | 43 | private Regex cstylecomments = new Regex(@"/\*(.|[\r\n])*?\*/", RegexOptions.Compiled | RegexOptions.Multiline); |
44 | // c# one liners | 44 | // c# one liners |
45 | private Regex conelinecomments = new Regex(@".?([\/]{2}[^\n]*)|([\n]{1,}[\/]{2}[^\n]*)", RegexOptions.Compiled | RegexOptions.Multiline); | 45 | private Regex conelinecomments = new Regex(@".?([\/]{2}[^\n]*)|([\n]{1,}[\/]{2}[^\n]*)", RegexOptions.Compiled | RegexOptions.Multiline); |
46 | // ([^\"])((?:[a-zA-Z])\.[a-zA-Z].?)([^\"]) | 46 | // ([^\"])((?:[a-zA-Z])\.[a-zA-Z].?)([^\"]) |
47 | |||
48 | |||
49 | 47 | ||
50 | // value we're looking for: (?:[a-zA-Z])\.[a-zA-Z] | 48 | // value we're looking for: (?:[a-zA-Z])\.[a-zA-Z] |
51 | public LSL2CSConverter() | 49 | public LSL2CSConverter() |
@@ -89,16 +87,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
89 | bool last_was_escape = false; | 87 | bool last_was_escape = false; |
90 | int quote_replaced_count = 0; | 88 | int quote_replaced_count = 0; |
91 | 89 | ||
92 | |||
93 | |||
94 | string removecomments = conelinecomments.Replace(Script, ""); | 90 | string removecomments = conelinecomments.Replace(Script, ""); |
95 | removecomments = cstylecomments.Replace(removecomments, ""); | 91 | removecomments = cstylecomments.Replace(removecomments, ""); |
96 | string[] localscript = removecomments.Split('"'); | 92 | string[] localscript = removecomments.Split('"'); |
97 | string checkscript = String.Empty; | 93 | string checkscript = String.Empty; |
98 | bool flip = true; | 94 | bool flip = true; |
99 | 95 | ||
100 | |||
101 | |||
102 | for (int p = 0; p < localscript.Length; p++) | 96 | for (int p = 0; p < localscript.Length; p++) |
103 | { | 97 | { |
104 | if (localscript[p].Length >= 1) | 98 | if (localscript[p].Length >= 1) |
@@ -115,7 +109,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
115 | if (!flip) | 109 | if (!flip) |
116 | checkscript += "\"" + localscript[p]; | 110 | checkscript += "\"" + localscript[p]; |
117 | } | 111 | } |
118 | 112 | ||
119 | //System.Console.WriteLine("SCRIPT:" + checkscript); | 113 | //System.Console.WriteLine("SCRIPT:" + checkscript); |
120 | 114 | ||
121 | // checks for alpha.alpha way of referring to objects in C# | 115 | // checks for alpha.alpha way of referring to objects in C# |
@@ -132,9 +126,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
132 | if (SecurityM.Success) | 126 | if (SecurityM.Success) |
133 | throw new Exception("CS0103: 'The object.GetType method isn't allowed in LSL'"); | 127 | throw new Exception("CS0103: 'The object.GetType method isn't allowed in LSL'"); |
134 | 128 | ||
135 | |||
136 | |||
137 | |||
138 | for (int p = 0; p < Script.Length; p++) | 129 | for (int p = 0; p < Script.Length; p++) |
139 | { | 130 | { |
140 | C = Script.Substring(p, 1); | 131 | 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 | |||
45 | ChannelServices.RegisterChannel(chan, true); | 45 | ChannelServices.RegisterChannel(chan, true); |
46 | } | 46 | } |
47 | 47 | ||
48 | /// <summary> | ||
49 | /// Create a channel for communicating w/ the remote object | ||
50 | /// Notice no port is specified on the client | ||
51 | /// </summary> | ||
48 | public ScriptServerInterfaces.ServerRemotingObject Connect(string hostname, int port) | 52 | public ScriptServerInterfaces.ServerRemotingObject Connect(string hostname, int port) |
49 | { | 53 | { |
50 | // Create a channel for communicating w/ the remote object | 54 | ScriptServerInterfaces.ServerRemotingObject obj = null; |
51 | // Notice no port is specified on the client | 55 | |
52 | |||
53 | try | 56 | try |
54 | { | 57 | { |
55 | // Create an instance of the remote object | 58 | // Create an instance of the remote object |
56 | ScriptServerInterfaces.ServerRemotingObject obj = (ScriptServerInterfaces.ServerRemotingObject)Activator.GetObject( | 59 | obj = (ScriptServerInterfaces.ServerRemotingObject)Activator.GetObject( |
57 | typeof(ScriptServerInterfaces.ServerRemotingObject), | 60 | typeof(ScriptServerInterfaces.ServerRemotingObject), |
58 | "tcp://" + hostname + ":" + port + "/DotNetEngine"); | 61 | "tcp://" + hostname + ":" + port + "/DotNetEngine"); |
59 | 62 | ||
60 | // Use the object | 63 | if (obj == null) |
61 | if (obj.Equals(null)) | ||
62 | { | 64 | { |
63 | Console.WriteLine("Error: unable to locate server"); | 65 | Console.WriteLine("Error: unable to locate server"); |
64 | } | 66 | } |
65 | else | ||
66 | { | ||
67 | return obj; | ||
68 | } | ||
69 | } | 67 | } |
70 | catch (SocketException) | 68 | catch (SocketException) |
71 | { | 69 | { |
@@ -75,7 +73,8 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
75 | { | 73 | { |
76 | Console.WriteLine("Error: unable to connect to server"); | 74 | Console.WriteLine("Error: unable to connect to server"); |
77 | } | 75 | } |
78 | return null; | 76 | |
77 | return obj; | ||
79 | } | 78 | } |
80 | } | 79 | } |
81 | } | 80 | } |