diff --git a/M02_MasterTemplete/CostFlow/M02_CF_FuncPanel.ts b/M02_MasterTemplete/CostFlow/M02_CF_FuncPanel.ts index f43861d16..84dad666f 100644 --- a/M02_MasterTemplete/CostFlow/M02_CF_FuncPanel.ts +++ b/M02_MasterTemplete/CostFlow/M02_CF_FuncPanel.ts @@ -24,7 +24,7 @@ const TEXT = { GotHint: ["누르거나 칸에 끌어 놓음", "Click, or drag onto a cell"], NoGot: ["선으로 들어온 알약이 없음", "No pill has come in yet"], Placed: ["놓임", "placed"], - Free: ["놓을 칸 없음", "not placed"], + Free: ["아직 안 놓은 알약", "not placed yet"], Busy: ["이미 쓰는 칸", "That cell is already in use"], Locked: [ "받은 알약이 놓인 칸은 선의 값으로 채워짐 — 직접 못 고침", @@ -260,6 +260,8 @@ function incoming(st: State): { port: string; unit: string }[] { "-"); out.set(l.to.name, unit || "-"); } + // 선 없이 칸 없는 받는 알약만 있어도 보임(새 함수 상자가 먼저 만든 자리) + for (const i of funcOf(st)?.inputs ?? []) if (!out.has(i.port)) out.set(i.port, "-"); return [...out].map(([port, unit]) => ({ port, unit })); } @@ -273,7 +275,7 @@ function problems(st: State): string[] { } } for (const p of incoming(st)) { - if (!f.inputs.some((i) => i.port === p.port)) out.push(`${p.port}${tf("Unplaced")}`); + if (!f.inputs.some((i) => i.port === p.port && i.cell)) out.push(`${p.port}${tf("Unplaced")}`); } if (!f.output.cell) out.push(tf("OutNone")); return out; @@ -285,12 +287,13 @@ function applyMarks(st: State): void { const f = funcOf(st); if (!f) return; const marks = new Map(); - for (const i of f.inputs) marks.set(i.cell, { kind: "in", label: `${tf("Got")} ${i.port}` }); + for (const i of f.inputs.filter((x) => x.cell)) + marks.set(i.cell, { kind: "in", label: `${tf("Got")} ${i.port}` }); for (const v of f.variables) if (v.cell) marks.set(v.cell, { kind: "var", label: `${tf("Vars")} ${v.name}` }); if (f.output.cell) marks.set(f.output.cell, { kind: "out", label: `${tf("OutNow")} ${f.output.name}` }); - const locked = new Set(f.inputs.map((i) => i.cell)); + const locked = new Set(f.inputs.filter((i) => i.cell).map((i) => i.cell)); const list = problems(st); const bad = new Set(list.map((p) => p.split(" ")[0])); for (const c of st.parts.sheet.querySelectorAll(".aislo-cell")) { @@ -581,7 +584,7 @@ function onBook(st: State, book: Workbook): void { if (!f) return; const sheet = plain(structuredClone(book.시트[0])); const hit = f.inputs.find( - (i) => JSON.stringify(f.sheet.칸[i.cell]) !== JSON.stringify(sheet.칸[i.cell]), + (i) => i.cell && JSON.stringify(f.sheet.칸[i.cell]) !== JSON.stringify(sheet.칸[i.cell]), ); if (hit) { showToast(tf("Locked"), "error");