From: Ian Jackson Date: Mon, 19 Jul 2021 01:26:24 +0000 (+0100) Subject: lowering: Cope when there are heavy pieces with clashing z coords X-Git-Tag: otter-0.7.2~34 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=6141a024363e71ed28818d2cf5ceddcb48699684;p=otter.git lowering: Cope when there are heavy pieces with clashing z coords Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index ea277306..afa0414a 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -642,6 +642,7 @@ function lower_pieces(targets_todo: LowerTodoList): // if that is below topmost light target // <- tomove_light: insert targets from * here Q -> // <- tomove_misstacked: insert non-targets from * here Q -> + // <- heavy non-targets with clashing Z Coords X -> // A // A heavy non-targets (nomove_heavy) // <- tomove_heavy: insert all heavy targets here P -> @@ -733,6 +734,22 @@ function lower_pieces(targets_todo: LowerTodoList): return 'Internal error! Lower with no targets!'; } + while (nomove_heavy.length && + nomove_heavy[nomove_heavy.length-1].p.z == q_z_top) { + // Yowzer. We have to reset the Z coordinates on these heavy + // pieces, whose Z coordinate is the same as the stuff we are not + // touching, because otherwise there is no gap. + // + // Treating them as misstacked instead is sufficient, provided + // we put them at the front (bottom end) of the misstacked list. + // + // This is X in the chart. + // + let restack = nomove_heavy.pop()!; + console.log('LOWER CLASHING Z - RESTACKING', restack); + tomove_misstacked.unshift(restack); + } + type PlanEntry = { content: Entry[], // bottom to top z_top: ZCoord,