From f6e592dbee5c917856291f18b0e7c3cf79737acf Mon Sep 17 00:00:00 2001 From: wyld-sw Date: Mon, 29 Jan 2024 18:06:50 -0500 Subject: [PATCH 1/2] Fixes crasher and adds mlvel 1 resteictions to CONTENTS_ARRAY. --- include/p_db.h | 7 +++---- src/p_db.c | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/include/p_db.h b/include/p_db.h index e3e043b8..d16d880f 100644 --- a/include/p_db.h +++ b/include/p_db.h @@ -969,10 +969,9 @@ void prim_newprogram(PRIM_PROTOTYPE); /** * Implementation of MUF CONTENTS_ARRAY * - * Consumes a dbref, and returns an array of its contents. Requires - * remote-read permissions when applicable. - * - * Unlike prim_contents, this has no MUCKER level 1 restrictions. + * Consumes a dbref, and returns an array of its contents. Only returns + * controlled non-DARK objects for MUCKER level 1. Requires remote-read + * permissions when applicable. * * @param player the player running the MUF program * @param program the program being run diff --git a/src/p_db.c b/src/p_db.c index 72037d2a..f230d535 100644 --- a/src/p_db.c +++ b/src/p_db.c @@ -451,8 +451,8 @@ prim_contents(PRIM_PROTOTYPE) abort_interp("Invalid argument type."); } + CHECKREMOTE(oper1->data.objref); ref = CONTENTS(oper1->data.objref); - CHECKREMOTE(ref); while (mlev < 2 && ref != NOTHING && (FLAGS(ref) & DARK) && !controls(ProgUID, ref)) { ref = NEXTOBJ(ref); @@ -3345,10 +3345,9 @@ prim_getpidinfo(PRIM_PROTOTYPE) /** * Implementation of MUF CONTENTS_ARRAY * - * Consumes a dbref, and returns an array of its contents. Requires - * remote-read permissions when applicable. - * - * Unlike prim_contents, this has no MUCKER level 1 restrictions. + * Consumes a dbref, and returns an array of its contents. Only returns + * controlled non-DARK objects for MUCKER level 1. Requires remote-read + * permissions when applicable. * * @param player the player running the MUF program * @param program the program being run @@ -3382,12 +3381,20 @@ prim_contents_array(PRIM_PROTOTYPE) CHECKREMOTE(oper1->data.objref); for (ref = CONTENTS(oper1->data.objref); ObjExists(ref); ref = NEXTOBJ(ref)) { + if (mlev < 2 && ref != NOTHING && (FLAGS(ref) & DARK) && !controls(ProgUID, ref)) { + continue; + } + count++; } nw = new_array_packed(count, fr->pinning); for (ref = CONTENTS(oper1->data.objref), count = 0; ObjExists(ref); ref = NEXTOBJ(ref)) { + if (mlev < 2 && ref != NOTHING && (FLAGS(ref) & DARK) && !controls(ProgUID, ref)) { + continue; + } + array_set_intkey_refval(&nw, count++, ref); } From 8d6409bc5d4d4c5258bcdf0a4149e946faee4936 Mon Sep 17 00:00:00 2001 From: wyld-sw Date: Fri, 16 Feb 2024 20:15:27 -0500 Subject: [PATCH 2/2] Fix lib-editor "invalid line" error logic. --- dbs/starterdb/muf/18.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbs/starterdb/muf/18.m b/dbs/starterdb/muf/18.m index a4db610b..819ea063 100644 --- a/dbs/starterdb/muf/18.m +++ b/dbs/starterdb/muf/18.m @@ -97,7 +97,7 @@ then then then (max line) - dup 1 < if pop 1 + dup 1 < if pop pop 1 else swap 1 + over over > if swap then pop