mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 14:38:39 +00:00
Fix bugs/typos
This commit is contained in:
parent
bebfbafae8
commit
c9e439c0f4
|
|
@ -41,7 +41,7 @@ class JumpPointSearch implements PathFinderInterface
|
||||||
$startNode->setF(0.0);
|
$startNode->setF(0.0);
|
||||||
$startNode->setOpened(true);
|
$startNode->setOpened(true);
|
||||||
|
|
||||||
$openList = new Heap(function($node1, $node2) { return $node1->getF() - $nodeB->getF(); });
|
$openList = new Heap(function($node1, $node2) { return $node1->getF() - $node2->getF(); });
|
||||||
$openList->push($startNode);
|
$openList->push($startNode);
|
||||||
$node = null;
|
$node = null;
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ class JumpPointSearch implements PathFinderInterface
|
||||||
|
|
||||||
if (!$neighbor->isOpened()) {
|
if (!$neighbor->isOpened()) {
|
||||||
$openList->push($neighbor);
|
$openList->push($neighbor);
|
||||||
$jumpPoint->setOpened(true);
|
$neighbor->setOpened(true);
|
||||||
} else {
|
} else {
|
||||||
$openList->update($neighbor);
|
$openList->update($neighbor);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class Path
|
||||||
public array $nodes = [];
|
public array $nodes = [];
|
||||||
private float $weight = 0.0;
|
private float $weight = 0.0;
|
||||||
private float $distance = 0.0;
|
private float $distance = 0.0;
|
||||||
private ?Grid $grid = null;
|
private Grid $grid;
|
||||||
|
|
||||||
public function __construct(Grid $grid)
|
public function __construct(Grid $grid)
|
||||||
{
|
{
|
||||||
|
|
@ -42,7 +42,7 @@ class Path
|
||||||
public function expandPath() : array
|
public function expandPath() : array
|
||||||
{
|
{
|
||||||
$reverse = \array_reverse($this->nodes);
|
$reverse = \array_reverse($this->nodes);
|
||||||
$length = count($reverse);
|
$length = \count($reverse);
|
||||||
|
|
||||||
if ($length < 2) {
|
if ($length < 2) {
|
||||||
return $reverse;
|
return $reverse;
|
||||||
|
|
@ -54,7 +54,7 @@ class Path
|
||||||
$coord1 = $reverse[$i + 1];
|
$coord1 = $reverse[$i + 1];
|
||||||
|
|
||||||
$interpolated = $this->interpolate($coord0, $coord1);
|
$interpolated = $this->interpolate($coord0, $coord1);
|
||||||
$iLength = count($interpolated);
|
$iLength = \count($interpolated);
|
||||||
|
|
||||||
$expanded = \array_merge($expanded, \array_slice($interpolated, 0, $iLength - 1));
|
$expanded = \array_merge($expanded, \array_slice($interpolated, 0, $iLength - 1));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user