@@ -111,7 +111,7 @@ public function canGoTo($from = [], $direction = 0, $checkFlow = false, $step =
111
111
return true ;
112
112
}
113
113
114
- $ stepT = $ this ->getFlowNodeFrom ($ from , $ direction );
114
+ $ stepT = $ this ->getFlowNodeFrom ($ direction , $ from );
115
115
116
116
if ($ stepT != $ step ) {
117
117
return false ;
@@ -320,7 +320,7 @@ public function getPathFromFlow($from = null, $steps = null) {
320
320
}
321
321
322
322
$ dir = $ this ->getDirection ($ from , $ this ->destination , true , $ steps );
323
- $ next = $ this ->getFlowNodeFrom ($ from , $ dir );
323
+ $ next = $ this ->getFlowNodeFrom ($ dir , $ from );
324
324
325
325
if ($ next == $ steps ) {
326
326
$ nDir = $ this ->getNodeDir ($ from , $ dir );
@@ -520,7 +520,7 @@ public function getAroundNodes($from = []) {
520
520
];
521
521
}
522
522
523
- public function getFlowNodeFrom ($ from = [], $ direction ) {
523
+ public function getFlowNodeFrom ($ direction , $ from = []) {
524
524
switch ($ direction ) {
525
525
case self ::DIR_NORTH :
526
526
return (isset ($ this ->mapFlow [($ from [1 ] - 1 )][($ from [0 ])]) ? $ this ->mapFlow [($ from [1 ] - 1 )][($ from [0 ])] : -1 );
@@ -608,14 +608,14 @@ public function getFlowNodeFrom($from = [], $direction) {
608
608
609
609
public function getAroundFlowNodes ($ from = []) {
610
610
$ ret = [
611
- self ::DIR_NORTH => [0 => ($ from [0 ]), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getFlowNodeFrom ($ from , self ::DIR_NORTH )],
612
- self ::DIR_NORTHEAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getFlowNodeFrom ($ from , self ::DIR_NORTHEAST )],
613
- self ::DIR_EAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ]), 3 => $ this ->getFlowNodeFrom ($ from , self ::DIR_EAST )],
614
- self ::DIR_SOUTHEAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getFlowNodeFrom ($ from , self ::DIR_SOUTHEAST )],
615
- self ::DIR_SOUTH => [0 => ($ from [0 ]), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getFlowNodeFrom ($ from , self ::DIR_SOUTH )],
616
- self ::DIR_SOUTHWEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getFlowNodeFrom ($ from , self ::DIR_SOUTHWEST )],
617
- self ::DIR_WEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ]), 3 => $ this ->getFlowNodeFrom ($ from , self ::DIR_WEST )],
618
- self ::DIR_NORTHWEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getFlowNodeFrom ($ from , self ::DIR_NORTHWEST )],
611
+ self ::DIR_NORTH => [0 => ($ from [0 ]), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getFlowNodeFrom (self ::DIR_NORTH , $ from )],
612
+ self ::DIR_NORTHEAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getFlowNodeFrom (self ::DIR_NORTHEAST , $ from )],
613
+ self ::DIR_EAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ]), 3 => $ this ->getFlowNodeFrom (self ::DIR_EAST , $ from )],
614
+ self ::DIR_SOUTHEAST => [0 => ($ from [0 ] + 1 ), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getFlowNodeFrom (self ::DIR_SOUTHEAST , $ from )],
615
+ self ::DIR_SOUTH => [0 => ($ from [0 ]), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getFlowNodeFrom (self ::DIR_SOUTH , $ from )],
616
+ self ::DIR_SOUTHWEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ] + 1 ), 3 => $ this ->getFlowNodeFrom (self ::DIR_SOUTHWEST , $ from )],
617
+ self ::DIR_WEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ]), 3 => $ this ->getFlowNodeFrom (self ::DIR_WEST , $ from )],
618
+ self ::DIR_NORTHWEST => [0 => ($ from [0 ] - 1 ), 1 => ($ from [1 ] - 1 ), 3 => $ this ->getFlowNodeFrom (self ::DIR_NORTHWEST , $ from )],
619
619
];
620
620
621
621
foreach ($ ret as $ nk => $ node ) {
0 commit comments