add lock and try to debug image

master
Christopher Latza 2020-06-19 20:27:33 +02:00
parent c75eacd7d1
commit e3c230c2f8
1 changed files with 30 additions and 18 deletions

View File

@ -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)
{ {
@ -344,14 +346,18 @@ namespace OpenSim.Modules.PathFinding
} }
private void generateDebugImage(ScriptRequestData requestData) private void generateDebugImage(ScriptRequestData requestData)
{
try
{ {
Environment _env = m_environments.Find(X => X.ID == requestData.EnvironmentID); Environment _env = m_environments.Find(X => X.ID == requestData.EnvironmentID);
if (_env != null) if (_env != null)
{
lock (_env)
{ {
Bitmap _bitmap = new Bitmap(_env.Size, _env.Size); Bitmap _bitmap = new Bitmap(_env.Size, _env.Size);
foreach(PathNode thisNode in _env.Nodes) foreach (PathNode thisNode in _env.Nodes)
{ {
if (thisNode.Walkable) if (thisNode.Walkable)
_bitmap.SetPixel(thisNode.PositionX, thisNode.PositionY, Color.Green); _bitmap.SetPixel(thisNode.PositionX, thisNode.PositionY, Color.Green);
@ -367,9 +373,15 @@ namespace OpenSim.Modules.PathFinding
m_scriptModule.DispatchReply(requestData.ScriptID, 19850, "", requestData.RequestID.ToString()); m_scriptModule.DispatchReply(requestData.ScriptID, 19850, "", requestData.RequestID.ToString());
return; return;
} }
}
m_scriptModule.DispatchReply(requestData.ScriptID, 19851, "", requestData.RequestID.ToString()); m_scriptModule.DispatchReply(requestData.ScriptID, 19851, "", requestData.RequestID.ToString());
} }
catch (Exception _error)
{
m_scriptModule.DispatchReply(requestData.ScriptID, 19860, _error.Message, requestData.RequestID.ToString());
}
}
#endregion #endregion