diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2012-12-12 18:38:23 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2012-12-12 18:38:23 -0800 |
commit | 7a087e906f120f61cbe51f98b0e76079b0f9c13f (patch) | |
tree | 1909a24d2f22245140d8214a52ba615545c258e9 /do.php | |
parent | 84b050664c8c8968a9c264460016b68595702dc4 (diff) | |
download | pathery-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.php | 18 |
1 files changed, 2 insertions, 16 deletions
@@ -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?
|