From f6457b46ac3df9ca32ca464918de1a915df07d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Thu, 10 Apr 2025 11:02:28 -0400 Subject: [PATCH] Fix felicity IGM and readfile Readfile does not log an error when the file does not exist. In felicity.ref, `s04 and `s05 were left unchanged from whatever they happened to be previously, displaying junk when someone looked at the message. Now, `s04 and `s05 are explicitly set to zero-length strings first so they just display nothing. Fixes #906 --- xtrn/lord2/cnw/felicity.ref | 2 ++ xtrn/lord2/lord2.js | 10 +++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/xtrn/lord2/cnw/felicity.ref b/xtrn/lord2/cnw/felicity.ref index 7f1e683a85..7aa7b82a7c 100644 --- a/xtrn/lord2/cnw/felicity.ref +++ b/xtrn/lord2/cnw/felicity.ref @@ -763,6 +763,8 @@ Leave A New Message Do Nothing @if responce is 1 then do begin @begin + @do `s04 is nil + @do `s05 is nil @readfile felnote.txt `s04 `s05 diff --git a/xtrn/lord2/lord2.js b/xtrn/lord2/lord2.js index cb0eda0c4f..64aae26c80 100644 --- a/xtrn/lord2/lord2.js +++ b/xtrn/lord2/lord2.js @@ -1574,13 +1574,9 @@ function insane_run_ref(sec, fname, refret) } f.close(); } - else - throw new Error('@readfile unable to open '+f.name); - // Documentation says it won't change variables if file too short... - // By felicity.ref ends up displaying junk... - //while (vs.length) { - // setvar(vs.shift(), ''); - //} + // Per felicity.ref, it's not an error to read past end, and + // variables keep previous value... which did print junk, but + // has been fixed. }, 'restorecursor':function(args) { dk.console.gotoxy(saved_cursor.x, saved_cursor.y); -- GitLab