示例#1
0
int
fetchprops_priority(dbref obj, int mode, const char *pdir)
{
	const char *s;
	int hitflag = 0;

	/* update fetched timestamp */
	DBFETCH(obj)->propstime = time(NULL);

	/* if in memory, don't try to reload. */
	if (DBFETCH(obj)->propsmode != PROPS_UNLOADED) {

		/* but do update the queue position */
		addobject_ringqueue(obj, DBFETCH(obj)->propsmode);
		if (!pdir)
			pdir = "/";
		while ((s = propdir_unloaded(DBFETCH(obj)->properties, pdir))) {
			propcache_misses++;
			hitflag++;
			if (!mode)
				update_fetchstats();
			if (FLAGS(obj) & SAVED_DELTA) {
				getproperties(delta_infile, obj, s);
			} else {
				getproperties(input_file, obj, s);
			}
		}
		if (hitflag) {
			return 1;
		} else {
			propcache_hits++;
			return 0;
		}
	}

	propcache_misses++;

	housecleanprops();

	/* actually load in root properties from the appropriate file */
	if (FLAGS(obj) & SAVED_DELTA) {
		getproperties(delta_infile, obj, "/");
	} else {
		getproperties(input_file, obj, "/");
	}

	/* update fetch statistics */
	if (!mode)
		update_fetchstats();

	/* add object to appropriate queue */
	addobject_ringqueue(obj, ((mode) ? PROPS_PRIORITY : PROPS_LOADED));

	return 1;
}
示例#2
0
int
fetch_propvals(dbref obj, const char *dir)
{
    PropPtr p, pptr;
    int cnt = 0;
    char buf[BUFFER_LEN];
    char name[BUFFER_LEN];

    p = first_prop_nofetch(obj, dir, &pptr, name, sizeof(name));
    while (p) {
        cnt = (cnt || propfetch(obj, p));
        if (PropDir(p) || (PropFlags(p) & PROP_DIRUNLOADED)) {
            strcpyn(buf, sizeof(buf), dir);
            strcatn(buf, sizeof(buf), name);
            strcatn(buf, sizeof(buf), "/");
            if (PropFlags(p) & PROP_DIRUNLOADED) {
                SetPFlags(p, (PropFlags(p) & ~PROP_DIRUNLOADED));
                getproperties(input_file, obj, buf);
            }
            fetch_propvals(obj, buf);
        }
        p = next_prop(pptr, p, name, sizeof(name));
    }
    return cnt;
}