summaryrefslogtreecommitdiffstats
path: root/includes/maps.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2011-04-22 12:32:53 -0700
committerPatrick Davison <snapwilliam@gmail.com>2011-04-22 12:32:53 -0700
commit6554ac5bcacd25b6062d298a0e0b7ed6982282ba (patch)
tree461502c4c16ed058c4254d218c467f667e1eb864 /includes/maps.php
parent257e02d25a629a1b6d6fbb133b38b06dcfbc7777 (diff)
downloadpathery-6554ac5bcacd25b6062d298a0e0b7ed6982282ba.tar.xz
Added map "Seeing Double" to Saturday.
Fixed an issue with pathing related to multiple checkpoints and a teleport.
Diffstat (limited to 'includes/maps.php')
-rw-r--r--includes/maps.php30
1 files changed, 8 insertions, 22 deletions
diff --git a/includes/maps.php b/includes/maps.php
index 0329e18..8cee2b3 100644
--- a/includes/maps.php
+++ b/includes/maps.php
@@ -770,64 +770,48 @@ function GetTile($mapMatrix, $id)
// [path] path-string. [blocked] boolean, [moves] int.
function routePath($mygrid, $start = '') {
- //== This should grab the start positions by scaning the map.
- //if ($start == '') {
- // for ($i = 1; $i <= $mygrid[0][1]; $i++) {
- // $start .= "0,$i.";
- // }
- //}
+ //Locate the start locations.
$start = findTiles($mygrid, "s");
-
- //echo $start;
//Checkpoint names
$cpnames = Array("a", "b", "c", "d", "e");
- //== Relies on the map headers being accurate.
//Get the amount of checkpoints on this map.
- //$cpcount = $mygrid[0][2];
$cpcount = 0;
- //Get the amount of checkpoints on this map.
foreach ($cpnames as $cpt)
if (findTiles($mygrid, $cpt))
$cpcount++;
- //Add the existing checkpoints to targets.
+ //Add the existing checkpoints to target array.
for($p = 0; $p < $cpcount; $p++) {
$target[] = $cpnames[$p];
}
- //Always need the finish line.
+ //Our last target is the finish line.
$target[] = 'f';
//Assume that we're not blocked, and raise a red flag later.
$blocked = false;
-
//All possible teleports in play.
$tpnames = Array('t', 'm', 'g', 'i', 'k');
-
+ //Find all the existing teleports.
$tpcount = 0;
foreach ($tpnames as $tpt)
if (findTiles($mygrid, $tpt))
$tpcount++;
- //$tpcount = intval($mygrid[0][5] * .5);
-
-
- //Add the existing checkpoints to targets.
+ //Save the existing teleports, to check for them later.
for($p = 0; $p < $tpcount; $p++) {
$teleport[] = $tpnames[$p];
}
+ //Where there's an in, there's an out.
$teleout['t'] = 'u';
$teleout['m'] = 'n';
$teleout['g'] = 'h';
$teleout['i'] = 'j';
$teleout['k'] = 'l';
- //$r['tparray'] = $teleport;
- //$r['cparray'] = $target;
-
//Loop through all the targets.
foreach($target as $t) {
//Path from where we are, to the target.
@@ -896,6 +880,8 @@ function routePath($mygrid, $start = '') {
//123 U CORDS U
//123 U CORDS U 2322
$p['path'] .= $z['path'];
+ //Our end point may have been modified.
+ $p['end'] = $z['end'];
$movesoffset -= countmoves($out);
//}