Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lib-editor's "invalid line" error logic. #726

Merged
merged 2 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dbs/starterdb/muf/18.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions include/p_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions src/p_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down
Loading