fuzzball-muck / fuzzball

Ongoing development of the Fuzzball MUCK server software and associated functionality.
Other
46 stars 26 forks source link

Unifies setting and clearing lock properties. #713

Closed wyld-sw closed 8 months ago

wyld-sw commented 8 months ago

This attempts to combine the locking implementations used in the codebase.

Reunification

Most of the lock commands (e.g., @lock, @ownlock) use set_standard_lock for their implementation. @unlock and SETPROPSTR did not; this is now corrected.

CLEARLOCK, GETLOCK, and SETLOCK

These macros were used for the main object lock only; they are now extended to act on any type of lock.

CLEARLOCK now removes the property (instead of setting it to TRUE_BOOLEXP) as other mechanisms do. It also continues to update an object's modification time.

GETLOCK can now be used in all cases that get_property_lock was called directly. Is it redundant? Probably - but then so are lot of other GET* macros.

SETLOCK is now used in the refactored _set_lock (discussed below). It also continues to update an object's modification time.

_set_lock

This helper function is now called by set_standard_lock and prim_setlockstr, with a "silent" argument to determine if messages are displayed to the user. Lock parsing errors continue to be displayed no matter what. I was hoping to use a smaller method signature, but them's the breaks.

Thoughts

I wonder if we should introduce SETCHLOCK, SETCONLOCK, SETFLOCK, SETLINKLOCK, SETOWNLOCK, and SETREADLOCK - since the standard messages have their own "set" aliases.

Suggestions welcome.

tanabi commented 8 months ago

I really like the consolidation here, looks quite good. As for the idea for other macros ... I think that's a pretty good idea really. Though not necessarily pressing to do right now, we could backlog a ticket for it. I'm going to approve this ohe and merge for now.