mirror of
https://github.com/brazilofmux/tinymux
synced 2026-08-13 00:23:11 -04:00
The flip: FUNCTION/XFUNCTION/FUN::fun/delim_check and the module interfaces take `const UTF8 * const fargs[]`. Double-const is load-bearing: C++ qualification conversion needs const at both pointer levels, so builder-side `UTF8 *[]` arrays convert implicitly — the evaluator, the JIT marshaller, and every owner site need zero casts, and slot reassignment inside bodies becomes a compile error for free. The conversions: the flip landed first so the compiler enumerated every violation; this commit is that inventory worked to zero — ~250 sites across funceval, funceval2, functions, funmath, help, mail, session, powers, levels, predicates, conf, walkdb, stringutil, timeutil/ date_scan (regenerated, one-line diff), exp3, and mux_main, each classified per docs/campaign-2136-const-fargs.md's four recipes. New idioms (functions.h): trim_space_sep_n() — non-destructive trim for (pointer, length) consumers, so trim-then-scan sites need no copy at all; FargVec — the argv counterpart of FargCopy for CS_ARGV handlers. countwords() and DecodeListOfIntegers() rewritten non-destructive. The flip deleted more than it added: #2157's fun_munge list1 copy, the engine_com help-topic copy, fun_index's in-place NUL write, and five const_casts (process_sex x4, sha1_helper). const_cast budget: zero added. Trap recorded in the brief: an old-signature definition doesn't fail the build — it becomes a C++ overload, and the new-signature symbol stays undefined until dlopen(RTLD_NOW). delim_check, the conn_bridge bridges, the dbt_spike stub, and exp3::Call were all silently shadowed; muxscript was the only host that noticed, because netmux's own net.cpp resolved the flat-namespace lookup. After any signature flip, grep the old spelling. Verified: make test EXPECT_CONFIG="jit=yes" (35 passed / 0 failed) and make test-scenario, including the new tests/scenario/sidefx_fargs.py that live-probes the class-3 wrappers smoke never touches (pemit/ trigger/link/tel/wipe/destroy). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
118 lines
6 KiB
C
118 lines
6 KiB
C
/*! \file powers.h
|
|
* \brief Object powers.
|
|
*
|
|
*/
|
|
|
|
#include "copyright.h"
|
|
|
|
#ifndef POWERS_H
|
|
#define POWERS_H
|
|
|
|
#define POWER_EXT 0x1 /* Lives in extended powers word */
|
|
|
|
/* First word of powers */
|
|
#define POW_CHG_QUOTAS 0x00000001 /* May change and see quotas */
|
|
#define POW_CHOWN_ANY 0x00000002 /* Can @chown anything or to anyone */
|
|
#define POW_ANNOUNCE 0x00000004 /* May use @wall */
|
|
#define POW_BOOT 0x00000008 /* May use @boot */
|
|
#define POW_HALT 0x00000010 /* May @halt on other's objects */
|
|
#define POW_CONTROL_ALL 0x00000020 /* I control everything */
|
|
#define POW_WIZARD_WHO 0x00000040 /* See extra WHO information */
|
|
#define POW_EXAM_ALL 0x00000080 /* I can examine everything */
|
|
#define POW_FIND_UNFIND 0x00000100 /* Can find unfindable players */
|
|
#define POW_FREE_MONEY 0x00000200 /* I have infinite money */
|
|
#define POW_FREE_QUOTA 0x00000400 /* I have infinite quota */
|
|
#define POW_HIDE 0x00000800 /* Can set themselves DARK */
|
|
#define POW_IDLE 0x00001000 /* No idle limit */
|
|
#define POW_SEARCH 0x00002000 /* Can @search anyone */
|
|
#define POW_LONGFINGERS 0x00004000 /* Can get/whisper/etc from a distance */
|
|
#define POW_PROG 0x00008000 /* Can use the @prog command */
|
|
#define POW_SITEADMIN 0x00010000 // Can @shutdown and @restart.
|
|
|
|
#define POW_LINK_ANYWHR 0x00020000 /* Can @link exits anywhere */
|
|
#define POW_DARK 0x00040000 /* Full in-room hiding like a dark wizard */
|
|
|
|
#define POW_COMM_ALL 0x00080000 /* Channel wiz */
|
|
#define POW_SEE_QUEUE 0x00100000 /* Player can see the entire queue */
|
|
#define POW_SEE_HIDDEN 0x00200000 /* Player can see hidden players on WHO list */
|
|
#define POW_MONITOR 0x00400000 /* Player can set or clear MONITOR */
|
|
#define POW_POLL 0x00800000 /* Player can set the doing poll */
|
|
#define POW_NO_DESTROY 0x01000000 /* Cannot be destroyed */
|
|
#define POW_GUEST 0x02000000 /* Player is a guest */
|
|
#define POW_PASS_LOCKS 0x04000000 /* Player can pass any lock */
|
|
#define POW_STAT_ANY 0x08000000 /* Can @stat anyone */
|
|
#define POW_STEAL 0x10000000 /* Can give negative money */
|
|
#define POW_TEL_ANYWHR 0x20000000 /* Teleport anywhere */
|
|
#define POW_TEL_UNRST 0x40000000 /* Teleport anything */
|
|
#define POW_UNKILLABLE 0x80000000 /* Can't be killed */
|
|
|
|
/* Second word of powers */
|
|
#define POW_BUILDER 0x00000001 /* Can build */
|
|
#define POW_NO_MAIL_EXPIRE 0x00000002 /* Immune to mail expiration and storage limits */
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* POWERENT: Information about object powers.
|
|
*/
|
|
|
|
typedef struct power_entry
|
|
{
|
|
const UTF8 *powername; /* Name of the flag */
|
|
unsigned int powervalue; /* Which bit in the object is the flag */
|
|
int powerpower; /* Ctrl flags for this power (recursive? :-) */
|
|
int listperm; /* Who sees this flag when set */
|
|
bool (*handler)(dbref target, dbref player, POWER power, int fpowers, bool reset); /* Handler for setting/clearing this flag */
|
|
} POWERENT;
|
|
|
|
typedef struct powerset
|
|
{
|
|
POWER word1;
|
|
POWER word2;
|
|
} POWERSET;
|
|
|
|
extern void init_powertab(void);
|
|
extern void display_powertab(dbref);
|
|
extern void power_set(dbref, dbref, UTF8 *, int);
|
|
extern UTF8 *powers_list(dbref executor, dbref thing);
|
|
extern bool has_power(dbref, dbref, const UTF8 *);
|
|
extern void decompile_powers(dbref, dbref, UTF8 *);
|
|
extern bool decode_power(dbref player, UTF8 *powername, POWERSET *pset);
|
|
|
|
#define s_Guest(c) s_Powers((c), Powers(c) | POW_GUEST)
|
|
|
|
#define Quota(c) (((Powers(c) & POW_CHG_QUOTAS) != 0) || Wizard(c))
|
|
#define Chown_Any(c) (((Powers(c) & POW_CHOWN_ANY) != 0) || Wizard(c))
|
|
#define Announce(c) (((Powers(c) & POW_ANNOUNCE) != 0) || Wizard(c))
|
|
#define Can_Boot(c) (((Powers(c) & POW_BOOT) != 0) || Wizard(c))
|
|
#define Can_Halt(c) (((Powers(c) & POW_HALT) != 0) || Wizard(c))
|
|
#define Control_All(c) (((Powers(c) & POW_CONTROL_ALL) != 0) || Wizard(c))
|
|
#define Wizard_Who(c) (((Powers(c) & POW_WIZARD_WHO) != 0) || WizRoy(c))
|
|
#define See_All(c) (((Powers(c) & POW_EXAM_ALL) != 0) || WizRoy(c))
|
|
#define Find_Unfindable(c) ((Powers(c) & POW_FIND_UNFIND) != 0)
|
|
#define Free_Money(c) (((Powers(c) & POW_FREE_MONEY) != 0) || Immortal(c))
|
|
#define Free_Quota(c) (((Powers(c) & POW_FREE_QUOTA) != 0) || Wizard(c))
|
|
#define Can_Hide(c) (((Powers(c) & POW_HIDE) != 0) || Wizard(c))
|
|
#define Can_Dark(c) (((Powers(c) & POW_DARK) != 0) || Wizard(c))
|
|
#define Can_Idle(c) (((Powers(c) & POW_IDLE) != 0) || Wizard(c))
|
|
#define Search(c) (((Powers(c) & POW_SEARCH) != 0) || WizRoy(c))
|
|
#define Link_Anywhere(c) (((Powers(c) & POW_LINK_ANYWHR) != 0) || WizRoy(c))
|
|
#define Long_Fingers(c) (((Powers(c) & POW_LONGFINGERS) != 0) || Wizard(c))
|
|
#define Comm_All(c) (((Powers(c) & POW_COMM_ALL) != 0) || Wizard(c))
|
|
#define See_Queue(c) (((Powers(c) & POW_SEE_QUEUE) != 0) || WizRoy(c))
|
|
#define See_Hidden(c) (((Powers(c) & POW_SEE_HIDDEN) != 0) || WizRoy(c))
|
|
#define Can_Monitor(c) (((Powers(c) & POW_MONITOR) != 0) || Wizard(c))
|
|
#define Can_Poll(c) (((Powers(c) & POW_POLL) != 0) || Wizard(c))
|
|
#define No_Destroy(c) (((Powers(c) & POW_NO_DESTROY) != 0) || Wizard(c))
|
|
#define Guest(c) ((Powers(c) & POW_GUEST) != 0)
|
|
#define Stat_Any(c) ((Powers(c) & POW_STAT_ANY) != 0)
|
|
#define Steal(c) (((Powers(c) & POW_STEAL) != 0) || Wizard(c))
|
|
#define Tel_Anywhere(c) (((Powers(c) & POW_TEL_ANYWHR) != 0) || Tel_Anything(c))
|
|
#define Tel_Anything(c) (((Powers(c) & POW_TEL_UNRST) != 0) || WizRoy(c))
|
|
#define Unkillable(c) (((Powers(c) & POW_UNKILLABLE) != 0) || Immortal(c))
|
|
#define Prog(c) (((Powers(c) & POW_PROG) != 0) || Wizard(c))
|
|
#define Pass_Locks(c) ((Powers(c) & POW_PASS_LOCKS) != 0)
|
|
#define Builder(c) (((Powers2(c) & POW_BUILDER) != 0) || WizRoy(c))
|
|
#define No_Mail_Expire(c) (((Powers2(c) & POW_NO_MAIL_EXPIRE) != 0) || Wizard(c))
|
|
|
|
#define Can_SiteAdmin(c) (((Powers(c) & POW_SITEADMIN) != 0) || Wizard(c))
|
|
|
|
#endif // !POWERS_H
|