From: Ian Jackson Date: Sat, 21 Nov 2020 00:21:33 +0000 (+0000) Subject: fix lowering X-Git-Tag: otter-0.2.0~452 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=6dc360dc7208d91cfa8305c2fff48d2afd391a3a;p=otter.git fix lowering Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index 8c58edba..392c00ec 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -441,14 +441,21 @@ function lower_pieces(targets_todo: LowerTodoList): } if (Object.keys(targets_todo).length == 0 && bottommost_unpinned !== null) { - console.log('NO TARGETS BUT UNPINNED !=0', n_targets_todo_unpinned); + console.log('LOWER NO TARGETS BUT UNPINNED!', n_targets_todo_unpinned); break; } let new_walk = walk.nextElementSibling; - if (new_walk == null) break; + if (new_walk == null) { + console.log('LOWER WALK NO SIBLING!'); + break; + } walk = new_walk as SVGGraphicsElement; - let piece = walk.dataset.piece; if (piece == null) break; + let piece = walk.dataset.piece; + if (piece == null) { + console.log('LOWER WALK REACHED TOP'); + break; + } let todo = targets_todo[piece]; if (todo) { @@ -460,7 +467,7 @@ function lower_pieces(targets_todo: LowerTodoList): } let p = pieces[piece]!; - if (bottommost_unpinned = null) { // state A + if (bottommost_unpinned === null) { // state A if (!p.pinned) { console.log('LOWER WALK', piece, 'STATE A -> Z'); bottommost_unpinned = { p, piece }; @@ -473,8 +480,10 @@ function lower_pieces(targets_todo: LowerTodoList): // state B if (p.pinned) { - console.log('LOWER WALK', piece, 'STATE B'); + console.log('LOWER WALK', piece, 'STATE B MIS-STACKED'); tomove_misstacked.push({ p, piece }); + } else { + console.log('LOWER WALK', piece, 'STATE B'); } }