extern object_flag_type flags_from_old_flags(long old_flags, long old_toggles,
int type);
extern FLAG *add_flag(const char *name, const char letter, int type,
- int perms, int negate_perms);
+ int perms, int negate_perms);
extern void do_list_flags(dbref player, const char *arg, int lc);
extern char *list_all_flags(const char *ns, const char *name, dbref privs, int which);
extern void do_flag_info(const char *ns, dbref player, const char *name);
do_flag_info("FLAG", player, f->name);
} else {
/* Insert the flag in the ptab by the given alias */
- ptab_start_inserts(n->tab);
- ptab_insert(n->tab, alias, f);
- ptab_end_inserts(n->tab);
- if ((f = match_flag_ns(n, alias)))
+ if (alias_flag(name, alias))
do_flag_info("FLAG", player, alias);
else
notify(player, T("Unknown failure adding alias."));
}
}
+ /** Add a new alias for a flag.
+ * \param ns name of the flagspace to use.
+ * \param name name of the flag
+ * \param alias new alias for the flag
+ * \retval 1 alias added successfully
+ * \retval 0 failed to add alias
+ */
+int
+alias_flag_generic(const char *ns, const char *name, const char *alias)
+{
+ FLAG *f;
+ FLAGSPACE *n;
+
+ Flagspace_Lookup(n, ns);
+
+ f = match_flag_ns(n, name);
+ if (!f) {
+ return 0; /* no such flag 'name' */
+ }
+
+ if (ptab_find_exact(n->tab, strupper(alias))) {
+ return 0; /* a flag called 'alias' already exists */
+ }
+
+ ptab_start_inserts(n->tab);
+ ptab_insert(n->tab, strupper(alias), f);
+ ptab_end_inserts(n->tab);
+ return ((f = match_flag_ns(n, alias)) ? 1 : 0);
+}
+
+
/** Change a flag's alias.
* \param player the enactor.
* \param name name of the flag.