diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2012-08-18 17:45:59 -0700 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2012-08-18 17:45:59 -0700 |
commit | 0759852ab7a9af16e5f4c444ef5d1e0db6feabd3 (patch) | |
tree | 3d14988dee9ff20584ab5227cbdb81df3389b6e2 /do.php | |
parent | 6206e6f71133e1266275c7309134bb7f876ea85e (diff) | |
download | pathery-0759852ab7a9af16e5f4c444ef5d1e0db6feabd3.tar.xz |
The start on Multi-day maps and Dual Path mechanic
Halfway started both.
Diffstat (limited to 'do.php')
-rw-r--r-- | do.php | 37 |
1 files changed, 31 insertions, 6 deletions
@@ -128,10 +128,21 @@ if ($_GET['r'] == 'getpath') { $map = GenerateMapByCode($mapcode);
$mygrid = MergeMapSolution($map, $solution);
+ // Old
+ //$json = routePath($mygrid);
+
+ // New
+ // !! Broken!
//Route the path
- $json = routePath($mygrid, $start);
+ $json['path1'] = routePath($mygrid);
+ $json['path2'] = routePath($mygrid, 'X');
+
+ // !! Tmp
+ //$moves = $json['moves'];
+ $moves = $json['path1']['moves'];
- $moves = $json['moves'];
+ // !! Tmp
+ $json['blocked'] = ($json['path1']['blocked']);
$json['mapid'] = $mapID;
@@ -218,7 +229,7 @@ if ($_GET['r'] == 'getpath') { $checkcm = false;
//Is there an existing record?
- if ($myMoves > 0) {
+ if (isset($myMoves)) {
if ($myMoves < $moves) {
$sql = "UPDATE `solutions`
SET `moves` = '$moves' ,
@@ -265,10 +276,24 @@ if ($_GET['r'] == 'getpath') { function isCurrentMap($mapID) {
+ // !! Broke
include_once('./includes/db.inc.php');
- $sql = "SELECT `ID` FROM `mapOfTheDay`
- WHERE `mapDate` = CURDATE() AND
- `mapID` = '$mapID'
+ $sql = "SELECT maps.ID
+ FROM `mapOfTheDay`
+ LEFT JOIN `maps` ON maps.ID = `mapID`
+ WHERE
+ `mapID` = '$mapID' AND
+ (
+ (
+ DATEDIFF(CURDATE(), mapOfTheDay.mapDate) < 1 AND
+ `mapType` IN (1, 2, 3, 4)
+ )
+ OR
+ (
+ DATEDIFF(CURDATE(), mapOfTheDay.mapDate) < 2 AND
+ `mapType` IN (5)
+ )
+ )
";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) == 0)
|