From 5f55b38cb19aa4bf4c1c56d8e3080d7b7834e27e Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Thu, 18 Apr 2013 01:58:35 -0700 Subject: Blocked shows last Target. --- includes/maps.php | 1 + js/mapspecs.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/maps.php b/includes/maps.php index ec338d7..6b8ba07 100644 --- a/includes/maps.php +++ b/includes/maps.php @@ -1071,6 +1071,7 @@ function routePath($mygrid, $validate = false, $traverseBackwards = false) { //Exit if path is blocked. if ($blocked) { $r['blocked'] = true; + $r['lastTarget'] = $t; return $r; } diff --git a/js/mapspecs.js b/js/mapspecs.js index cb9b27b..31370e3 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -286,7 +286,14 @@ function request_path_done() { console.error('\n JO error ' + JO.error[i]); if (JO.blocked) { - alert("The path is blocked!"); + var lastTarget; + for(i in JO.path) { + if (JO.path[i].blocked != true) continue; + lastTarget = JO.path[i].lastTarget; + } + if (lastTarget == 'f') lastTarget = 'finish'; + alert("The path is blocked, can't reach "+lastTarget); + return; } -- cgit v1.2.3