chiark / gitweb /
script: raise: log a message when nothing oculd be raised
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Jul 2021 00:57:05 +0000 (01:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Jul 2021 00:57:50 +0000 (01:57 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index d6a7acfb0cc672c4fa4559ffe5ec2b6cdf9d3eb5..d8cd1b0cf322c78207e123b1afc4ba4c283411c6 100644 (file)
@@ -813,11 +813,16 @@ function pin_unpin(uo: UoRecord, newpin: boolean) {
 keyops_local['raise'] = function (uo: UoRecord) { raise_targets(uo); }
 
 function raise_targets(uo: UoRecord) {
+  let any = false;
   for (let piece of uo.targets!) {
     let p = pieces[piece]!;
     if (p.pinned || !piece_moveable(p)) continue;
+    any = true;
     piece_raise(piece, p, "NotYet");
   }
+  if (!any) { 
+    add_log_message('No pieces could be raised.');
+  }
 }
 
 function piece_raise(piece: PieceId, p: PieceInfo,