From: Ian Jackson Date: Mon, 5 Jul 2021 22:17:17 +0000 (+0100) Subject: script: When lowering, avoid raising X-Git-Tag: otter-0.7.2~262 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ba3367615ff6854114cca02823430974d8aa1bef;p=otter.git script: When lowering, avoid raising It can happen that the z of the piece which sets the z_top for the end of the plan (with z_bot == null) will cause the first lowered piece to actually be raised. This is particularly troublesome if the piece is an occulting one, which the server will not allowe to be raised. Handle this case specially: if necessary, set the z_top to top piece of that plan entry. Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index e069f04d..933781b5 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -741,6 +741,11 @@ function lower_pieces(targets_todo: LowerTodoList): for (const pe of plan) { if (pe.z_top != null) z_top = pe.z_top; let z_bot = pe.z_bot; + if (pe.content.length != 0 && z_bot == null) { + let first_z = pe.content[0].p.z; + if (z_top >= first_z) + z_top = first_z; + } let zrange = wasm_bindgen.range(z_bot, z_top, pe.content.length); console.log('LOQER PLAN PE', pe, z_bot, z_top, pe.content.length, zrange.debug());