Fixes brace style (#248)

This commit is contained in:
Kamron Batman 2020-09-13 21:49:46 -07:00 • committed by GitHub
parent a236617ad9
commit 8149620b0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1503 changed files with 28575 additions and 1717 deletions

View file

@ -53,22 +53,32 @@ namespace Server.PathAlgorithms.FastAStar
private void RemoveFromChain(int node)
{
if (node < 0 || node >= NodeCount)
{
return;
}
if (!m_Touched[node] || !m_OnOpen[node])
{
return;
}
var prev = m_Nodes[node].prev;
var next = m_Nodes[node].next;
if (m_OpenList == node)
{
m_OpenList = next;
}
if (prev != -1)
{
m_Nodes[prev].next = next;
}
if (next != -1)
{
m_Nodes[next].prev = prev;
}
m_Nodes[node].prev = -1;
m_Nodes[node].next = -1;
@ -77,12 +87,16 @@ namespace Server.PathAlgorithms.FastAStar
private void AddToChain(int node)
{
if (node < 0 || node >= NodeCount)
{
return;
}
RemoveFromChain(node);
if (m_OpenList != -1)
{
m_Nodes[m_OpenList].prev = node;
}
m_Nodes[node].next = m_OpenList;
m_Nodes[node].prev = -1;
@ -96,7 +110,9 @@ namespace Server.PathAlgorithms.FastAStar
public override Direction[] Find(Mobile m, Map map, Point3D start, Point3D goal)
{
if (!Utility.InRange(start, goal, AreaSize))
{
return null;
}
m_Touched.SetAll(false);
@ -131,7 +147,9 @@ namespace Server.PathAlgorithms.FastAStar
var bestNode = FindBest(m_OpenList);
if (++depth > MaxDepth)
{
break;
}
if (bc != null)
{
@ -149,7 +167,9 @@ namespace Server.PathAlgorithms.FastAStar
MoveImpl.Goal = Point3D.Zero;
if (count == 0)
{
break;
}
for (var i = 0; i < count; ++i)
{
@ -158,7 +178,9 @@ namespace Server.PathAlgorithms.FastAStar
var wasTouched = m_Touched[newNode];
if (wasTouched)
{
continue;
}
var newCost = m_Nodes[bestNode].cost + 1;
var newTotal = newCost + Heuristic(
@ -168,19 +190,25 @@ namespace Server.PathAlgorithms.FastAStar
);
if (m_Nodes[newNode].total <= newTotal)
{
continue;
}
m_Nodes[newNode].parent = bestNode;
m_Nodes[newNode].cost = newCost;
m_Nodes[newNode].total = newTotal;
if (m_OnOpen[newNode])
{
continue;
}
AddToChain(newNode);
if (newNode != destNode)
{
continue;
}
var pathCount = 0;
var parent = m_Nodes[newNode].parent;
@ -197,13 +225,17 @@ namespace Server.PathAlgorithms.FastAStar
parent = m_Nodes[newNode].parent;
if (newNode == fromNode)
{
break;
}
}
var dirs = new Direction[pathCount];
while (pathCount > 0)
{
dirs[backtrack++] = path[--pathCount];
}
return dirs;
}
@ -302,7 +334,9 @@ namespace Server.PathAlgorithms.FastAStar
y += py;
if (x < 0 || x >= AreaSize || y < 0 || y >= AreaSize)
{
continue;
}
if (CalcMoves.CheckMovement(m, map, p3D, (Direction)i, out var z))
{