fix haku-wasm/haku.js errors not resetting properly sometimes

This commit is contained in:
りき萌 2024-08-24 18:40:16 +02:00
parent 59a6bda0ba
commit ba89b6eb04
5 changed files with 10 additions and 4 deletions

View file

@ -4,6 +4,8 @@ export class Painter {
}
renderBrushToWall(haku, centerX, centerY, wall) {
haku.resetVm();
let evalResult = haku.evalBrush();
if (evalResult.status != "ok")
return { status: "error", phase: "eval", result: evalResult };
@ -23,12 +25,10 @@ export class Painter {
let renderResult = haku.renderValue(chunk.pixmap, x, y);
if (renderResult.status != "ok") {
haku.resetVm();
return { status: "error", phase: "render", result: renderResult };
}
}
}
haku.resetVm();
for (let y = topChunk; y < bottomChunk; ++y) {
for (let x = leftChunk; x < rightChunk; ++x) {