From 5823c511f7decbf8cc8aa9008dd9a6c7cce91c09 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Mon, 7 Aug 2023 21:15:35 +0200 Subject: [PATCH] yajilin: Repair hook when adding clue --- src/variety/yajilin.js | 22 +++++++++++++--------- test/script/yajilin.js | 9 +++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/variety/yajilin.js b/src/variety/yajilin.js index a0c72db8b..8a1d6d890 100644 --- a/src/variety/yajilin.js +++ b/src/variety/yajilin.js @@ -151,15 +151,6 @@ } } this.board.redrawAffected(cells); - }, - qnum: function() { - this.setQsub(0); - this.setQans(0); - var adb = this.adjborder; - var bs = [adb.top, adb.bottom, adb.left, adb.right]; - for (var i = 0; i < bs.length; i++) { - bs[i].line = 0; - } } } }, @@ -231,6 +222,19 @@ clist.add(cell); } return clist; + }, + + prehook: { + qnum: function() { + this.setQsub(0); + this.setQans(0); + var adb = this.adjborder; + var bs = [adb.top, adb.bottom, adb.left, adb.right]; + for (var i = 0; i < bs.length; i++) { + bs[i].removeLine(); + bs[i].draw(); + } + } } }, "Cell@koburin#2": { diff --git a/test/script/yajilin.js b/test/script/yajilin.js index 3b1ea1295..fa92eb769 100644 --- a/test/script/yajilin.js +++ b/test/script/yajilin.js @@ -117,6 +117,15 @@ ui.debug.addDebugData("yajilin", { { input: ["editmode", "cursor,5,1", "mouse,left, 5,1"], result: "pzprv3/yajilin/1/4/0,- . 0,- . /. . . . /0 0 0 /" + }, + /* test prehook */ + { + input: ["newboard,2,2", "playmode", "mouse,left,1,1,3,1,3,3,1,3"], + result: "pzprv3/yajilin/2/2/. . /. . /. . /. . /1 /1 /0 1 /" + }, + { + input: ["editmode", "cursor,1,3", "key,1"], + result: "pzprv3/yajilin/2/2/. . /0,1 . /. . /. . /1 /0 /0 1 /" } ] });