Пример #1
0
/* removes property list --- if it's not there then ignore */
void
remove_property_list(dbref player, int all)
{
    PropPtr l;
    PropPtr p;
    PropPtr n;

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

#ifdef DISKBASE
    fetchprops(player);
#endif

    if ((l = DBFETCH(player)->properties)) {
        p = first_node(l);
        while (p) {
            n = next_node(l, PropName(p));
            remove_proplist_item(player, p, all);
            l = DBFETCH(player)->properties;
            p = n;
        }
    }
#ifdef DISKBASE
    dirtyprops(player);
#endif

    DBDIRTY(player);
}
Пример #2
0
int
is_propdir(dbref player, const char *type)
{

#ifdef DISKBASE
    fetchprops(player);
#endif

    return (is_propdir_nofetch(player, type));
}
Пример #3
0
PropPtr
first_prop(dbref player, const char *dir, PropPtr *list, char *name)
{

#ifdef DISKBASE
    fetchprops(player);
#endif

    return (first_prop_nofetch(player, dir, list, name));
}
Пример #4
0
int
size_properties(dbref player, int load)
{
#ifdef DISKBASE
    if (load) {
        fetchprops(player);
        fetch_propvals(player, "/");
    }
#endif
    return size_proplist(DBFETCH(player)->properties);
}
Пример #5
0
void
set_property(dbref object, const char *pname, PData * dat)
{
#ifdef DISKBASE
    fetchprops(object);
    set_property_nofetch(object, pname, dat, 0);
    dirtyprops(object);
#else
    set_property_nofetch(object, pname, dat, 0);
#endif
    DBDIRTY(object);
}
Пример #6
0
PropPtr
copy_prop(dbref old)
{
    PropPtr p, n = NULL;

#ifdef DISKBASE
    fetchprops(old);
#endif

    p = DBFETCH(old)->properties;
    copy_proplist(old, &n, p);
    return (n);
}
Пример #7
0
/* adds a new property to an object */
void
add_property(dbref player, const char *type, const char *pclass, int value)
{

#ifdef DISKBASE
    fetchprops(player);
    add_prop_nofetch(player, type, pclass, value);
    dirtyprops(player);
#else
    add_prop_nofetch(player, type, pclass, value);
#endif
    DBDIRTY(player);
}
Пример #8
0
void
set_property(dbref player, const char *type, int flags, PTYPE value)
{
    /* if( tp_db_readonly ) return; *//* Why did we remove this? */
#ifdef DISKBASE
    fetchprops(player);
    set_property_nofetch(player, type, flags, (PTYPE) value);
    dirtyprops(player);
#else
    set_property_nofetch(player, type, flags, (PTYPE) value);
#endif
    DBDIRTY(player);
}
Пример #9
0
PropPtr
get_property(dbref player, const char *type)
{
    PropPtr p;
    char buf[BUFFER_LEN];
    char *w;

#ifdef DISKBASE
    fetchprops(player);
#endif

    w = strcpy(buf, type);

    p = propdir_get_elem(DBFETCH(player)->properties, w);
    return (p);
}
Пример #10
0
void
remove_property(dbref player, const char *type)
{

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

#ifdef DISKBASE
    fetchprops(player);
#endif

    remove_property_nofetch(player, type);

#ifdef DISKBASE
    dirtyprops(player);
#endif
}
Пример #11
0
void
find_path( dbref loc, const char *pathname, char buf[BUFFER_LEN] ) {
    PropPtr propadr, pptr;

#ifdef DISKBASE
    fetchprops(loc);
#endif
    buf[0] = '\0';
    propadr = first_prop(loc, "@u/d/", &pptr, buf);

    while (propadr > 0) {
	if( exit_prefix(buf, pathname) )
	    return;
	propadr = next_prop(pptr, propadr, buf);
    }
    buf[0] = '\0';
}
Пример #12
0
const char *
mfn_dirprops(MFUNARGS)
{
    char propname[BUFFER_LEN];
    PropPtr propadr, pptr;
    char buf2[BUFFER_LEN];
    int list_limit = MAX_MFUN_LIST_LEN;
    dbref obj;
    int outlen, nextlen;

    if(argc > 1) {
	obj = mesg_dbref_local(player, what, perms, argv[1]);
	if (obj == AMBIGUOUS || obj == UNKNOWN || obj == NOTHING || obj == HOME)
	    ABORT_MPI("DIRPROPS","Match failed");
	if (obj == PERMDENIED)
	    ABORT_MPI("DIRPROPS",NOPERM_MESG);
    } else obj = what;

    buf[0] = '\0';
    outlen = 0;

#ifdef DISKBASE
	fetchprops(obj);
#endif

    propadr = first_prop(obj, argv[0], &pptr, propname);
    while ((propadr > 0) && *propname) {
	    if ( ( !Prop_Hidden(propname) && !(PropFlags(propadr) & PROP_SYSPERMS))
		    || (Permlevel(perms) >= tp_hidden_prop_mlevel)) {
		sprintf(buf2, "%s", propname);
		nextlen = strlen(buf2);
		if ((outlen + nextlen) >= (BUFFER_LEN - 3))
		    break;
		if (outlen) strcat((buf+(outlen++)), "\r");
		strcat((buf + outlen), buf2);
		outlen += nextlen;
		list_limit--;
	    }
	propadr = next_prop(pptr, propadr, propname);
    }

    return buf;
}
Пример #13
0
char *
next_prop_name(dbref player, char *outbuf, char *name)
{
    char *ptr;
    char buf[BUFFER_LEN];
    PropPtr p, l;

#ifdef DISKBASE
    fetchprops(player);
#endif

    strcpy(buf, name);
    if (!*name || name[strlen(name) - 1] == PROPDIR_DELIMITER) {
        l = DBFETCH(player)->properties;
        p = propdir_first_elem(l, buf);
        if (!p) {
            *outbuf = '\0';
            return NULL;
        }
        strcat(strcpy(outbuf, name), PropName(p));
    } else {
/*        if (!(get_property(player,name))) {
	   *outbuf = '\0';
	   return NULL;
	}
*/
        l = DBFETCH(player)->properties;
        p = propdir_next_elem(l, buf);
        if (!p) {
            *outbuf = '\0';
            return NULL;
        }
        strcpy(outbuf, name);
        ptr = rindex(outbuf, PROPDIR_DELIMITER);
        if (!ptr)
            ptr = outbuf;
        *(ptr++) = PROPDIR_DELIMITER;
        strcpy(ptr, PropName(p));
    }
    return outbuf;
}