Exemplo n.º 1
0
/* removes property --- if it's not there then ignore */
void
remove_property_nofetch(dbref player, const char *type)
{
    PropPtr l;
    char buf[BUFFER_LEN];
    char *w;

    /* if( tp_db_readonly ) return; *//* Why did we remove this? */

    w = strcpy(buf, type);

    l = DBFETCH(player)->properties;
    l = propdir_delete_elem(l, w);
    DBFETCH(player)->properties = l;
    if ((FLAGS(player) & LISTENER) && !(get_property(player, "_listen") ||
                                        get_property(player, "_olisten") ||
                                        get_property(player, "~listen") ||
                                        get_property(player, "~olisten") ||
                                        get_property(player, "@olisten") ||
                                        get_property(player, "@listen") ||
                                        get_property(player, "_alisten") ||
                                        get_property(player, "_aolisten") ||
                                        get_property(player, "~alisten") ||
                                        get_property(player, "~aolisten") ||
                                        get_property(player, "@aolisten") ||
                                        get_property(player, "@alisten")
        )) {
        FLAGS(player) &= ~LISTENER;
    }
    if ((FLAG2(player) & F2COMMAND) && !(get_property(player, "_command") ||
                                         get_property(player, "_ocommand") ||
                                         get_property(player, "~command") ||
                                         get_property(player, "~ocommand") ||
                                         get_property(player, "@ocommand") ||
                                         get_property(player, "@command")
        )) {
        FLAG2(player) &= ~F2COMMAND;
    }
    DBDIRTY(player);
}
Exemplo n.º 2
0
/* path is the name of the property to delete */
PropPtr
propdir_delete_elem(PropPtr root, char *path)
{
	PropPtr p;
	char *n;

	if (!root)
		return (NULL);
	while (*path && *path == PROPDIR_DELIMITER)
		path++;
	if (!*path)
		return (root);
	n = index(path, PROPDIR_DELIMITER);
	while (n && *n == PROPDIR_DELIMITER)
		*(n++) = '\0';
	if (n && *n) {
		/* just another propdir in the path */
		p = locate_prop(root, path);
		if (p && PropDir(p)) {
			/* yup, found the propdir */
			SetPDir(p, propdir_delete_elem(PropDir(p), n));
			if (!PropDir(p) && PropType(p) == PROP_DIRTYP) {
				root = delete_prop(&root, PropName(p));
			}
		}
		/* return the updated root pntr */
		return (root);
	} else {
		/* aha, we are finally to the property itself. */
		p = locate_prop(root, path);
		if (p && PropDir(p)) {
			delete_proplist(PropDir(p));
		}
		(void) delete_prop(&root, path);
		return (root);
	}
}