Log error if we attempt to add/remove an OdeCharacter from the _characters list inappropriately

iar_mods
Justin Clark-Casey (justincc) 2011-11-22 22:46:25 +00:00
parent ace4324e75
commit b56410285b
1 changed files with 33 additions and 23 deletions

View File

@ -377,8 +377,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <param value="name">Name of the scene. Useful in debug messages.</param>
public OdeScene(string name)
{
m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name);
m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name);
Name = name;
@ -769,7 +768,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
catch (AccessViolationException)
{
m_log.Warn("[PHYSICS]: Unable to collide test a space");
m_log.Warn("[ODE SCENE]: Unable to collide test a space");
return;
}
//Colliding a space or a geom with a space or a geom. so drill down
@ -821,17 +820,17 @@ namespace OpenSim.Region.Physics.OdePlugin
count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf);
if (count > contacts.Length)
m_log.Error("[PHYSICS]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length);
m_log.Error("[ODE SCENE]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length);
}
catch (SEHException)
{
m_log.Error(
"[PHYSICS]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim.");
"[ODE SCENE]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim.");
base.TriggerPhysicsBasedRestart();
}
catch (Exception e)
{
m_log.WarnFormat("[PHYSICS]: Unable to collide test an object: {0}", e.Message);
m_log.WarnFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message);
return;
}
@ -1556,7 +1555,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
catch (AccessViolationException)
{
m_log.WarnFormat("[PHYSICS]: Unable to space collide {0}", Name);
m_log.WarnFormat("[ODE SCENE]: Unable to space collide {0}", Name);
}
//float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y);
@ -1587,13 +1586,13 @@ namespace OpenSim.Region.Physics.OdePlugin
removeprims = new List<OdePrim>();
}
removeprims.Add(chr);
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. Removed it from the active prim list. This needs to be fixed!");
m_log.Debug("[ODE SCENE]: 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. Removed it from the active prim list. This needs to be fixed!");
}
}
}
catch (AccessViolationException)
{
m_log.Warn("[PHYSICS]: Unable to space collide");
m_log.Warn("[ODE SCENE]: Unable to space collide");
}
}
}
@ -1729,13 +1728,24 @@ namespace OpenSim.Region.Physics.OdePlugin
_characters.Add(chr);
if (chr.bad)
m_log.ErrorFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid);
m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to characters list", chr.m_uuid);
}
else
{
m_log.ErrorFormat(
"[ODE SCENE]: Tried to add character {0} {1} but they are already in the set!",
chr.Name, chr.LocalID);
}
}
internal void RemoveCharacter(OdeCharacter chr)
{
_characters.Remove(chr);
if (_characters.Contains(chr))
_characters.Remove(chr);
else
m_log.ErrorFormat(
"[ODE SCENE]: Tried to remove character {0} {1} but they are not in the list!",
chr.Name, chr.LocalID);
}
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
@ -2222,7 +2232,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//m_log.Warn(prim.prim_geom);
if (!prim.RemoveGeom())
m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene");
m_log.Warn("[ODE SCENE]: Unable to remove prim from physics scene");
lock (_prims)
_prims.Remove(prim);
@ -2314,7 +2324,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + currentspace +
m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" + currentspace +
" Geom:" + geom);
}
}
@ -2330,7 +2340,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" +
sGeomIsIn + " Geom:" + geom);
}
}
@ -2353,7 +2363,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" +
currentspace + " Geom:" + geom);
}
}
@ -2373,7 +2383,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" +
currentspace + " Geom:" + geom);
}
}
@ -2389,7 +2399,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" +
sGeomIsIn + " Geom:" + geom);
}
}
@ -2633,7 +2643,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
{
_taintedActors.Add(taintedchar);
if (taintedchar.bad)
m_log.DebugFormat("[PHYSICS]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid);
m_log.DebugFormat("[ODE SCENE]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid);
}
}
}
@ -2836,7 +2846,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
}
catch (Exception e)
{
m_log.ErrorFormat("[PHYSICS]: {0}, {1}, {2}", e.Message, e.TargetSite, e);
m_log.ErrorFormat("[ODE SCENE]: {0}, {1}, {2}", e.Message, e.TargetSite, e);
}
timeLeft -= ODE_STEPSIZE;
@ -2845,7 +2855,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
foreach (OdeCharacter actor in _characters)
{
if (actor.bad)
m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid);
m_log.WarnFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid);
actor.UpdatePositionAndVelocity(defects);
}
@ -3405,7 +3415,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
{
if (Single.IsNaN(resultarr2[y, x]) || Single.IsInfinity(resultarr2[y, x]))
{
m_log.Warn("[PHYSICS]: Non finite heightfield element detected. Setting it to 0");
m_log.Warn("[ODE SCENE]: Non finite heightfield element detected. Setting it to 0");
resultarr2[y, x] = 0;
}
returnarr[i] = resultarr2[y, x];
@ -3436,7 +3446,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
private void SetTerrain(float[] heightMap, Vector3 pOffset)
{
int startTime = Util.EnvironmentTickCount();
m_log.DebugFormat("[PHYSICS]: Setting terrain for {0}", Name);
m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0}", Name);
// this._heightmap[i] = (double)heightMap[i];
// dbm (danx0r) -- creating a buffer zone of one extra sample all around
@ -3561,7 +3571,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
}
m_log.DebugFormat(
"[PHYSICS]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime));
"[ODE SCENE]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime));
}
public override void DeleteTerrain()