add lock and try to debug image
parent
c75eacd7d1
commit
e3c230c2f8
|
@ -323,14 +323,16 @@ namespace OpenSim.Modules.PathFinding
|
||||||
m_scriptModule.DispatchReply(requestData.ScriptID, 19850, "", requestData.RequestID.ToString());
|
m_scriptModule.DispatchReply(requestData.ScriptID, 19850, "", requestData.RequestID.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_scriptModule.DispatchReply(requestData.ScriptID, 19853, "", requestData.RequestID.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_scriptModule.DispatchReply(requestData.ScriptID, 19851, "", requestData.RequestID.ToString());
|
m_scriptModule.DispatchReply(requestData.ScriptID, 19851, "", requestData.RequestID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scriptModule.DispatchReply(requestData.ScriptID, 19853, "", requestData.RequestID.ToString());
|
|
||||||
}
|
}
|
||||||
catch (Exception _error)
|
catch (Exception _error)
|
||||||
{
|
{
|
||||||
|
@ -345,30 +347,40 @@ namespace OpenSim.Modules.PathFinding
|
||||||
|
|
||||||
private void generateDebugImage(ScriptRequestData requestData)
|
private void generateDebugImage(ScriptRequestData requestData)
|
||||||
{
|
{
|
||||||
Environment _env = m_environments.Find(X => X.ID == requestData.EnvironmentID);
|
try
|
||||||
|
|
||||||
if (_env != null)
|
|
||||||
{
|
{
|
||||||
Bitmap _bitmap = new Bitmap(_env.Size, _env.Size);
|
Environment _env = m_environments.Find(X => X.ID == requestData.EnvironmentID);
|
||||||
|
|
||||||
foreach(PathNode thisNode in _env.Nodes)
|
if (_env != null)
|
||||||
{
|
{
|
||||||
if (thisNode.Walkable)
|
lock (_env)
|
||||||
_bitmap.SetPixel(thisNode.PositionX, thisNode.PositionY, Color.Green);
|
{
|
||||||
|
Bitmap _bitmap = new Bitmap(_env.Size, _env.Size);
|
||||||
|
|
||||||
if (!thisNode.Walkable)
|
foreach (PathNode thisNode in _env.Nodes)
|
||||||
_bitmap.SetPixel(thisNode.PositionX, thisNode.PositionY, Color.Black);
|
{
|
||||||
|
if (thisNode.Walkable)
|
||||||
|
_bitmap.SetPixel(thisNode.PositionX, thisNode.PositionY, Color.Green);
|
||||||
|
|
||||||
if (thisNode.Target)
|
if (!thisNode.Walkable)
|
||||||
_bitmap.SetPixel(thisNode.PositionX, thisNode.PositionY, Color.Blue);
|
_bitmap.SetPixel(thisNode.PositionX, thisNode.PositionY, Color.Black);
|
||||||
|
|
||||||
|
if (thisNode.Target)
|
||||||
|
_bitmap.SetPixel(thisNode.PositionX, thisNode.PositionY, Color.Blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
_bitmap.Save(requestData.EnvironmentID + ".png");
|
||||||
|
m_scriptModule.DispatchReply(requestData.ScriptID, 19850, "", requestData.RequestID.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_bitmap.Save(requestData.EnvironmentID + ".png");
|
m_scriptModule.DispatchReply(requestData.ScriptID, 19851, "", requestData.RequestID.ToString());
|
||||||
m_scriptModule.DispatchReply(requestData.ScriptID, 19850, "", requestData.RequestID.ToString());
|
}
|
||||||
return;
|
catch (Exception _error)
|
||||||
|
{
|
||||||
|
m_scriptModule.DispatchReply(requestData.ScriptID, 19860, _error.Message, requestData.RequestID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scriptModule.DispatchReply(requestData.ScriptID, 19851, "", requestData.RequestID.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in New Issue