Formatting cleanup, minor refactoring. Fixed some comparisons of value types and null.
parent
901e97f821
commit
6ec680918b
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
|||
/// <param name="action"></param>
|
||||
public void ForEachScenePresence(Action<ScenePresence> 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
|
||||
{
|
||||
|
|
|
@ -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++)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,12 +1037,16 @@ 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)
|
||||
{
|
||||
m_log.Warn("[PHYSICS]: Unable to space collide");
|
||||
|
@ -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,9 +1351,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
else
|
||||
{
|
||||
IntPtr sGeomIsIn = d.GeomGetSpace(geom);
|
||||
if (!(sGeomIsIn.Equals(null)))
|
||||
{
|
||||
if (sGeomIsIn != (IntPtr) 0)
|
||||
if (sGeomIsIn != IntPtr.Zero)
|
||||
{
|
||||
if (d.GeomIsSpace(currentspace))
|
||||
{
|
||||
|
@ -1363,12 +1365,11 @@ 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,9 +1410,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
else
|
||||
{
|
||||
IntPtr sGeomIsIn = d.GeomGetSpace(geom);
|
||||
if (!(sGeomIsIn.Equals(null)))
|
||||
{
|
||||
if (sGeomIsIn != (IntPtr)0)
|
||||
if (sGeomIsIn != IntPtr.Zero)
|
||||
{
|
||||
if (d.GeomIsSpace(sGeomIsIn))
|
||||
{
|
||||
|
@ -1427,7 +1426,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The routines in the Position and Size sections do the 'inserting' into the space,
|
||||
// so all we have to do is make sure that the space that we're putting the prim into
|
||||
|
@ -1461,20 +1459,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the space the prim should be in by it's position
|
||||
/// Calculates the space the prim should be in by its position
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns>a pointer to the space. This could be a new space or reused space.</returns>
|
||||
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;
|
||||
return staticPrimspace[xyspace[0], xyspace[1]];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -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));
|
||||
|
|
|
@ -45,8 +45,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
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)
|
||||
|
@ -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);
|
||||
|
|
|
@ -45,27 +45,25 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
|||
ChannelServices.RegisterChannel(chan, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a channel for communicating w/ the remote object
|
||||
/// Notice no port is specified on the client
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue