예제 #1
0
/**
 * Dump autoinscriptions
 */
void dump_autoinscriptions(ang_file *f) {
	int i;
	for (i = 1; i < z_info->k_max; i++) {
		struct object_kind *k = &k_info[i];
		char name[120];
		const char *note;

		if (!k->name || !k->tval) continue;
		note = get_autoinscription(k);
		if (note) {
			object_short_name(name, sizeof name, k->name);
			file_putf(f, "inscribe:%s:%s:%s\n", tval_find_name(k->tval), name, note);
		}
	}
}
예제 #2
0
/**
 * Dump objects
 */
void dump_objects(ang_file *fff)
{
	int i;

	file_putf(fff, "# Objects\n");

	for (i = 1; i < z_info->k_max; i++) {
		struct object_kind *kind = &k_info[i];
		char name[120] = "";

		if (!kind->name || !kind->tval) continue;

		object_short_name(name, sizeof name, kind->name);
		file_putf(fff, "object:%s:%s:%d:%d\n", tval_find_name(kind->tval),
				name, kind_x_attr[i], kind_x_char[i]);
	}
}
예제 #3
0
파일: prefs.c 프로젝트: creidieki/angband
/* Dump objects */
void dump_objects(ang_file *fff)
{
	int i;

	file_putf(fff, "# Objects\n");

	for (i = 1; i < z_info->k_max; i++)
	{
		object_kind *k_ptr = &k_info[i];
		char name[120] = "";

		if (!k_ptr->name || !k_ptr->tval) continue;

		get_pref_name(name, sizeof name, k_ptr->name);
		file_putf(fff, "K:%s:%s:%d:%d\n", tval_find_name(k_ptr->tval),
				name, k_ptr->x_attr, k_ptr->x_char);
	}
}
예제 #4
0
/* Dump objects */
void dump_objects(ang_file * fff)
{
	int i;

	file_putf(fff, "# Objects\n");

	for (i = 1; i < z_info->k_max; i++) {
		object_kind *k_ptr = &k_info[i];
		const char *name = k_ptr->name;

		if (!name)
			continue;
		if (name[0] == '&' && name[1] == ' ')
			name += 2;

		file_putf(fff, "K:%s:%s:%d:%d\n", tval_find_name(k_ptr->tval),
				name, k_ptr->x_attr, k_ptr->x_char);
	}
}
예제 #5
0
파일: cmd3.c 프로젝트: CJNyfalt/angband
/*
 * Search the monster, item, and feature types to find the
 * meaning for the given symbol.
 *
 * Note: We currently search items first, then features, then
 * monsters, and we return the first hit for a symbol.
 * This is to prevent mimics and lurkers from matching
 * a symbol instead of the item or feature it is mimicking.
 *
 * Todo: concatenate all matches into buf. This will be much
 * easier once we can loop through item tvals instead of items
 * (see note below.)
 *
 * Todo: Should this take the user's pref files into account?
 */
static void lookup_symbol(struct keypress sym, char *buf, size_t max)
{
	int i;
	monster_base *race;

	/* Look through items */
	/* Note: We currently look through all items, and grab the tval when we find a match.
	It would make more sense to loop through tvals, but then we need to associate
	a display character with each tval. */
	for (i = 1; i < z_info->k_max; i++) {
		if (k_info[i].d_char == (char)sym.code) {
			strnfmt(buf, max, "%c - %s.", (char)sym.code, tval_find_name(k_info[i].tval));
			return;
		}
	}

	/* Look through features */
	/* Note: We need a better way of doing this. Currently '#' matches secret door,
	and '^' matches trap door (instead of the more generic "trap"). */
	for (i = 1; i < z_info->f_max; i++) {
		if (f_info[i].d_char == (char)sym.code) {
			strnfmt(buf, max, "%c - %s.", (char)sym.code, f_info[i].name);
			return;
		}
	}
	
	/* Look through monster templates */
	for (race = rb_info; race; race = race->next){
		if ((char)sym.code == race->d_char) {
			strnfmt(buf, max, "%c - %s.", (char)sym.code, race->text);
			return;
		}
	}

	/* No matches */
	strnfmt(buf, max, "%c - %s.", (char)sym.code, "Unknown Symbol");
	
	return;
}