diff options
author | BlueRaja <BlueRaja.admin@gmail.com> | 2012-08-18 19:50:47 -0500 |
---|---|---|
committer | BlueRaja <BlueRaja.admin@gmail.com> | 2012-08-18 19:50:47 -0500 |
commit | d2b27af54e560591e44393de0d22fd8621c3320c (patch) | |
tree | 2d8809d4594e0a3b548451e34ab15fdd6ebbf059 /do.php | |
parent | 55656d931a05f533e11b8a3860c5dce4c66c88ca (diff) | |
parent | 4f00fc760a2d01542d70a5f3cbafea360b3766d6 (diff) | |
download | pathery-d2b27af54e560591e44393de0d22fd8621c3320c.tar.xz |
Merge branch 'master' of git.raylu.net:pathery
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)
|