summaryrefslogtreecommitdiffstats
path: root/do.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2012-12-12 18:38:23 -0800
committerPatrick Davison <snapwilliam@gmail.com>2012-12-12 18:38:23 -0800
commit7a087e906f120f61cbe51f98b0e76079b0f9c13f (patch)
tree1909a24d2f22245140d8214a52ba615545c258e9 /do.php
parent84b050664c8c8968a9c264460016b68595702dc4 (diff)
downloadpathery-7a087e906f120f61cbe51f98b0e76079b0f9c13f.tar.xz
RouteMultiPath() function added for cleaner code.
Added validation support for RouteMultiPath() for a single 2nd-start location path.
Diffstat (limited to 'do.php')
-rw-r--r--do.php18
1 files changed, 2 insertions, 16 deletions
diff --git a/do.php b/do.php
index d574031..c82de22 100644
--- a/do.php
+++ b/do.php
@@ -154,23 +154,9 @@ if ($_GET['r'] == 'getpath') {
$mygrid = MergeMapSolution($map, $solution);
//Check both starting point groups for paths
- $moves = 0;
- $json['blocked'] = false;
- $containsNormalStart = (findTiles($mygrid, "s") !== false);
- $containsReverseStart = (findTiles($mygrid, "S") !== false);
- if($containsNormalStart)
- {
- $json['path'][0] = routePath($mygrid);
- $moves += $json['path'][0]['moves'];
- $json['blocked'] = $json['path'][0]['blocked'];
- }
- if($containsReverseStart)
- {
- $json['path'][1] = routePath($mygrid, false, true);
- $moves += $json['path'][1]['moves'];
- $json['blocked'] = $json['path'][1]['blocked'] || $json['blocked'];
- }
+ $json = routeMultiPath($mygrid);
+ $moves = $json['totalMoves'];
$json['mapid'] = $mapID;
//What could go wrong?