extern void WIN32_CDECL flag_broadcast(const char *flag1,
const char *flag2, const char *fmt, ...)
__attribute__ ((__format__(__printf__, 3, 4)));
+extern void WIN32_CDECL level_broadcast(int minlevel, const char *fmt, ...)
+ __attribute__ ((__format__(__printf__, 2, 3)));
extern void raw_notify(dbref player, const char *msg);
extern void notify_list(dbref speaker, dbref thing, const char *atr,
if (WIFSIGNALED(dump_status)) {
do_rawlog(LT_ERR, T("ERROR! forking dump exited with signal %d"),
WTERMSIG(dump_status));
- flag_broadcast("ROYALTY WIZARD", 0,
- T("GAME: ERROR! Forking database save failed!"));
+ level_broadcast(LEVEL_ADMIN, T("GAME: ERROR! Forking database save failed!"));
} else if (WIFEXITED(dump_status)) {
if (WEXITSTATUS(dump_status) == 0) {
time(&globals.last_dump_time);
do_rawlog(LT_ERR,
T("ERROR! forking dump exited with exit code %d"),
WEXITSTATUS(dump_status));
- flag_broadcast("ROYALTY WIZARD", 0,
+ level_broadcast(LEVEL_ADMIN,
T("GAME: ERROR! Forking database save failed!"));
}
}
if (!*s)
/* We got a '!' that wasn't followed by a letter.
* Fail the check. */
- return (type == 1) ? 0 : ret;
+ return -1;
/* Find the flag. */
fp = letter_to_flagptr(n, *s, Typeof(it));
if (!fp) {
* we couldn't find that flag. For AND, since we've failed
* a check, we can return false. Otherwise we just go on.
*/
- if (type == 1)
- return 0;
- else
- continue;
+ return -1;
}
} else {
if (type == 1)
* it, or we don't have a flag and we want it. Since it's
* AND, we return false.
*/
- return 0;
+ ret = 0;
} else if ((type == 0) && ((!negate && temp) || (negate && !temp))) {
/* We've found something we want, in an OR. We OR a
* true with the current value.
if (!*s) {
/* We got a '!' that wasn't followed by a string.
* Fail the check. */
- if (type == 1)
- ret = 0;
+ ret = -1;
break;
}
/* Find the flag. */
* we couldn't find that flag. For AND, since we've failed
* a check, we can return false. Otherwise we just go on.
*/
- if (type == 1) {
- ret = 0;
- break;
- } else
- continue;
+ ret = -1;
+ break;
} else {
/* does the object have this flag? There's a special case
* here, as we want (for consistency with flaglist_check)
* AND, we return false.
*/
ret = 0;
- break;
} else if ((type == 0) && ((!negate && temp) || (negate && !temp))) {
/* We've found something we want, in an OR. We OR a
* true with the current value.
{"AND", fun_and, 2, INT_MAX, FN_REG},
{"ANDFLAGS", fun_andflags, 2, 2, FN_REG},
{"ANDLFLAGS", fun_andlflags, 2, 2, FN_REG},
- {"ANDLPOWERS", fun_andlflags, 2, 2, FN_REG},
+ {"ANDLPOWERS", fun_unimp, 2, 2, FN_REG},
{"ANSI", fun_ansi, 2, -2, FN_REG},
#ifdef ANSI_DEBUG
{"ANSIINSPECT", fun_ansiinspect, 1, 2, FN_REG},
{"ORD", fun_ord, 1, 1, FN_REG},
{"ORFLAGS", fun_orflags, 2, 2, FN_REG},
{"ORLFLAGS", fun_orlflags, 2, 2, FN_REG},
- {"ORLPOWERS", fun_orlflags, 2, 2, FN_REG},
+ {"ORLPOWERS", fun_unimp, 2, 2, FN_REG},
{"OOREF", fun_ooref, 0, 0, FN_REG},
{"OWNER", fun_owner, 1, 1, FN_REG},
{"PARENT", fun_parent, 1, 2, FN_REG},
}
/* ARGSUSED */
-FUNCTION(fun_orflags)
+FUNCTION(fun_orlflags)
{
dbref it = match_thing(executor, args[0]);
- if (!strcmp(called_as, "ORPOWERS"))
- safe_boolean(flaglist_check("POWER", executor, it, args[1], 0), buff, bp);
+ int hasflag;
+ if (!strcmp(called_as, "ORLPOWERS"))
+ hasflag = flaglist_check_long("POWER", executor, it, args[1], 0);
else
- safe_boolean(flaglist_check("FLAG", executor, it, args[1], 0), buff, bp);
+ hasflag = flaglist_check_long("FLAG", executor, it, args[1], 0);
+ if (hasflag == -1)
+ if (!strcmp(called_as, "ORLPOWERS"))
+ safe_str(T("#-1 INVALID POWER"), buff, bp);
+ else
+ safe_str(T("#-1 INVALID FLAG"), buff, bp);
+ else
+ safe_boolean(hasflag, buff, bp);
}
+
/* ARGSUSED */
-FUNCTION(fun_andflags)
+FUNCTION(fun_orflags)
{
dbref it = match_thing(executor, args[0]);
- if (!strcmp(called_as, "ANDPOWERS"))
- safe_boolean(flaglist_check("POWER", executor, it, args[1], 1), buff, bp);
+ int hasflag;
+ hasflag = flaglist_check("FLAG", executor, it, args[1], 0);
+ if (hasflag == -1)
+ safe_str(T("#-1 INVALID FLAG"), buff, bp);
else
- safe_boolean(flaglist_check("FLAG", executor, it, args[1], 1), buff, bp);
+ safe_boolean(hasflag, buff, bp);
}
/* ARGSUSED */
-FUNCTION(fun_orlflags)
+FUNCTION(fun_andflags)
{
dbref it = match_thing(executor, args[0]);
- if (!strcmp(called_as, "ORLPOWERS"))
- safe_boolean(flaglist_check_long("POWER", executor, it, args[1], 0), buff,
- bp);
+ int hasflag;
+ hasflag = flaglist_check("FLAG", executor, it, args[1], 1);
+ if (hasflag == -1)
+ safe_str(T("#-1 INVALID FLAG"), buff, bp);
else
- safe_boolean(flaglist_check_long("FLAG", executor, it, args[1], 0), buff,
- bp);
+ safe_boolean(hasflag, buff, bp);
}
/* ARGSUSED */
FUNCTION(fun_andlflags)
{
dbref it = match_thing(executor, args[0]);
- if (!strcmp(called_as, "ANDLPOWERS"))
- safe_boolean(flaglist_check_long("POWER", executor, it, args[1], 1), buff,
- bp);
+ int hasflag;
+
+ hasflag = flaglist_check_long("FLAG", executor, it, args[1], 1);
+ if (hasflag == -1)
+ safe_str(T("#-1 INVALID FLAG"), buff, bp);
else
- safe_boolean(flaglist_check_long("FLAG", executor, it, args[1], 1), buff,
- bp);
+ safe_boolean(hasflag, buff, bp);
}
+
static lock_type
get_locktype(str)
char *str;
cf_downmotd_msg[BUFFER_LEN], cf_fullmotd_msg[BUFFER_LEN];
extern HASHTAB htab_function;
+FUNCTION(fun_unimp) {
+ /* Dummy function for unimplemented stuff */
+ safe_str("#-1 UNIMPLEMENTED", buff, bp);
+}
+
/* ARGSUSED */
FUNCTION(fun_valid)
{
notify_anything(GOD, na_one, &player, NULL, NA_NOLISTEN, msg);
}
+
/** Notify all connected players with the given flag(s).
* If no flags are given, everyone is notified. If one flag list is given,
* all connected players with some flag in that list are notified.
}
}
+void WIN32_CDECL
+level_broadcast(dbref minlevel, const char *fmt, ...) {
+ va_list args;
+ char tbuf1[BUFFER_LEN];
+ DESC *d;
+ int ok;
+
+ va_start(args, fmt);
+#ifdef HAS_VSNPRINTF
+ (void) vsnprintf(tbuf1, sizeof tbuf1, fmt, args);
+#else
+ (void) vsprintf(tbuf1, fmt, args);
+#endif
+ va_end(args);
+ tbuf1[BUFFER_LEN - 1] = '\0';
+
+ DESC_ITER_CONN(d) {
+ if (GoodObject(d->player) && (minlevel == 0 || LEVEL(d->player) >= minlevel)) {
+ queue_string_eol(d, tbuf1);
+ process_output(d);
+ }
+ }
+}
+
slab *text_block_slab = NULL; /**< Slab for 'struct text_block' allocations */
static struct text_block *