@@ -105,7 +105,7 @@ private function getBestDirection($from = [], $direction = 0, $checkFlow = false
105
105
106
106
public function canGoTo ($ from = [], $ direction = 0 , $ checkFlow = false , $ step = null ) {
107
107
if (!$ checkFlow ) {
108
- if ($ this ->getNodeFrom ($ from , $ direction ) === FlowPath::TYPE_WALL ) {
108
+ if ($ this ->getNodeFrom ($ direction , $ from ) === FlowPath::TYPE_WALL ) {
109
109
return false ;
110
110
}
111
111
return true ;
@@ -422,7 +422,7 @@ public function getDestination() {
422
422
}
423
423
}
424
424
425
- public function getNodeFrom ($ from = [], $ direction ) {
425
+ public function getNodeFrom ($ direction , $ from = []) {
426
426
switch ($ direction ) {
427
427
case self ::DIR_NORTH :
428
428
if (!isset ($ this ->map [($ from [1 ] - 1 )]) || !isset ($ this ->map [($ from [1 ] - 1 )][($ from [0 ])])) {
@@ -509,14 +509,14 @@ public function getNodeFrom($from = [], $direction) {
509
509
510
510
public function getAroundNodes ($ from = []) {
511
511
return [
512
- self ::DIR_NORTH => [0 => ($ from [0 ]), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getNodeFrom ($ from , self ::DIR_NORTH )],
513
- self ::DIR_NORTHEAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getNodeFrom ($ from , self ::DIR_NORTHEAST )],
514
- self ::DIR_EAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ]), 3 => $ this ->getNodeFrom ($ from , self ::DIR_EAST )],
515
- self ::DIR_SOUTHEAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getNodeFrom ($ from , self ::DIR_SOUTHEAST )],
516
- self ::DIR_SOUTH => [0 => ($ from [0 ]), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getNodeFrom ($ from , self ::DIR_SOUTH )],
517
- self ::DIR_SOUTHWEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getNodeFrom ($ from , self ::DIR_SOUTHWEST )],
518
- self ::DIR_WEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ]), 3 => $ this ->getNodeFrom ($ from , self ::DIR_WEST )],
519
- self ::DIR_NORTHWEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getNodeFrom ($ from , self ::DIR_NORTHWEST )],
512
+ self ::DIR_NORTH => [0 => ($ from [0 ]), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getNodeFrom (self ::DIR_NORTH , $ from )],
513
+ self ::DIR_NORTHEAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getNodeFrom (self ::DIR_NORTHEAST ), $ from ],
514
+ self ::DIR_EAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ]), 3 => $ this ->getNodeFrom (self ::DIR_EAST ), $ from ],
515
+ self ::DIR_SOUTHEAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getNodeFrom ( self ::DIR_SOUTHEAST ), $ from ],
516
+ self ::DIR_SOUTH => [0 => ($ from [0 ]), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getNodeFrom (self ::DIR_SOUTH ), $ from ],
517
+ self ::DIR_SOUTHWEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getNodeFrom (self ::DIR_SOUTHWEST ), $ from ],
518
+ self ::DIR_WEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ]), 3 => $ this ->getNodeFrom (self ::DIR_WEST ), $ from ],
519
+ self ::DIR_NORTHWEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getNodeFrom (self ::DIR_NORTHWEST ), $ from ],
520
520
];
521
521
}
522
522
0 commit comments