add try
parent
4ac5da4ee2
commit
d3d8eb1d45
|
@ -319,14 +319,16 @@ namespace OpenSim.Modules.PathFinding
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generatePath(ScriptRequestData requestData)
|
private void generatePath(ScriptRequestData requestData)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
lock (m_environments)
|
lock (m_environments)
|
||||||
{
|
{
|
||||||
Environment _env = m_environments.Find(X => X.ID == requestData.EnvironmentID);
|
Environment _env = m_environments.Find(X => X.ID == requestData.EnvironmentID);
|
||||||
|
|
||||||
if(_env.Start != null && _env.Target != null)
|
if (_env.Start != null && _env.Target != null)
|
||||||
{
|
{
|
||||||
if(_env.Start.PositionX == _env.Target.PositionX && _env.Start.PositionY == _env.Target.PositionY)
|
if (_env.Start.PositionX == _env.Target.PositionX && _env.Start.PositionY == _env.Target.PositionY)
|
||||||
m_scriptModule.DispatchReply(requestData.ScriptID, 19850, "", requestData.RequestID.ToString());
|
m_scriptModule.DispatchReply(requestData.ScriptID, 19850, "", requestData.RequestID.ToString());
|
||||||
|
|
||||||
GridSize _pathFindingGridSize = new GridSize(_env.Size, _env.Size);
|
GridSize _pathFindingGridSize = new GridSize(_env.Size, _env.Size);
|
||||||
|
@ -335,11 +337,11 @@ namespace OpenSim.Modules.PathFinding
|
||||||
|
|
||||||
Grid _pathFindingGrid = Grid.CreateGridWithLateralAndDiagonalConnections(_pathFindingGridSize, _pathFindingCellSize, _pathFindingVelocity);
|
Grid _pathFindingGrid = Grid.CreateGridWithLateralAndDiagonalConnections(_pathFindingGridSize, _pathFindingCellSize, _pathFindingVelocity);
|
||||||
|
|
||||||
foreach(INode _thisNode in _pathFindingGrid.GetAllNodes())
|
foreach (INode _thisNode in _pathFindingGrid.GetAllNodes())
|
||||||
{
|
{
|
||||||
PathNode _node = _env.Nodes.Find(X => X.PositionX == (int)_thisNode.Position.X && X.PositionY == (int)_thisNode.Position.Y);
|
PathNode _node = _env.Nodes.Find(X => X.PositionX == (int)_thisNode.Position.X && X.PositionY == (int)_thisNode.Position.Y);
|
||||||
|
|
||||||
if(_node == null)
|
if (_node == null)
|
||||||
{
|
{
|
||||||
_pathFindingGrid.DisconnectNode(new GridPosition((int)_thisNode.Position.X, (int)_thisNode.Position.Y));
|
_pathFindingGrid.DisconnectNode(new GridPosition((int)_thisNode.Position.X, (int)_thisNode.Position.Y));
|
||||||
_pathFindingGrid.RemoveDiagonalConnectionsIntersectingWithNode(new GridPosition((int)_thisNode.Position.X, (int)_thisNode.Position.Y));
|
_pathFindingGrid.RemoveDiagonalConnectionsIntersectingWithNode(new GridPosition((int)_thisNode.Position.X, (int)_thisNode.Position.Y));
|
||||||
|
@ -355,7 +357,7 @@ namespace OpenSim.Modules.PathFinding
|
||||||
|
|
||||||
foreach (var _thisEdge in _pathFindingPath.Edges)
|
foreach (var _thisEdge in _pathFindingPath.Edges)
|
||||||
{
|
{
|
||||||
if(lastX != (int)_thisEdge.End.Position.X && lastY != (int)_thisEdge.End.Position.Y)
|
if (lastX != (int)_thisEdge.End.Position.X && lastY != (int)_thisEdge.End.Position.Y)
|
||||||
{
|
{
|
||||||
_pathString += "<" + _thisEdge.End.Position.X + ", " + _thisEdge.End.Position.Y + ", 0>;";
|
_pathString += "<" + _thisEdge.End.Position.X + ", " + _thisEdge.End.Position.Y + ", 0>;";
|
||||||
|
|
||||||
|
@ -364,7 +366,7 @@ namespace OpenSim.Modules.PathFinding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_pathString += "<" + _pathFindingPath.Edges[_pathFindingPath.Edges.Count-1].End.Position.X + ", " + _pathFindingPath.Edges[_pathFindingPath.Edges.Count - 1].End.Position.Y + ", 0>;";
|
_pathString += "<" + _pathFindingPath.Edges[_pathFindingPath.Edges.Count - 1].End.Position.X + ", " + _pathFindingPath.Edges[_pathFindingPath.Edges.Count - 1].End.Position.Y + ", 0>;";
|
||||||
|
|
||||||
|
|
||||||
if (_pathFindingPath.Type == PathType.Complete)
|
if (_pathFindingPath.Type == PathType.Complete)
|
||||||
|
@ -381,6 +383,10 @@ namespace OpenSim.Modules.PathFinding
|
||||||
m_scriptModule.DispatchReply(requestData.ScriptID, 19854, "", requestData.RequestID.ToString());
|
m_scriptModule.DispatchReply(requestData.ScriptID, 19854, "", requestData.RequestID.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}catch(Exception _error)
|
||||||
|
{
|
||||||
|
m_scriptModule.DispatchReply(requestData.ScriptID, 19860, _error.Message, requestData.RequestID.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateDebugImage(ScriptRequestData requestData)
|
private void generateDebugImage(ScriptRequestData requestData)
|
||||||
|
|
Loading…
Reference in New Issue