src/obj-tval.c
int tval_find_idx(const char *name)
{
	size_t i = 0;
	unsigned int r;
	char *mod_name;

	if (sscanf(name, "%u", &r) == 1)
		return r;

	mod_name = de_armour(name);

	for (i = 0; i < N_ELEMENTS(tval_names); i++) {
		if (!my_stricmp(mod_name, tval_names[i].name)) {
			string_free(mod_name);
			return tval_names[i].tval;
		}
	}

	string_free(mod_name);
	return -1;
}
/**
 * Returns the numeric equivalent tval of the textual tval `name`.
 */
Returns the numeric equivalent tval of the textual tval `name`.
Returns the numeric equivalent tval of the textual tval ` name ` .
int tval_find_idx(const char *name)
{
	size_t i = 0;
	unsigned int r;
	char *mod_name;
	if (sscanf(name, "%u", &r) == 1)
		return r;
	mod_name = de_armour(name);
	for (i = 0; i < N_ELEMENTS(tval_names); i++) {
		if (!my_stricmp(mod_name, tval_names[i].name)) {
			string_free(mod_name);
			return tval_names[i].tval;
		}
	}
	string_free(mod_name);
	return -1;
}
int tval_find_idx ( const char * name ) { size_t i = 0 ; unsigned int r ; char * mod_name ; if ( sscanf ( name , " " , & r ) == 1 ) return r ; mod_name = de_armour ( name ) ; for ( i = 0 ; i < N_ELEMENTS ( tval_names ) ; i ++ ) { if ( ! my_stricmp ( mod_name , tval_names [ i ] . name ) ) { string_free ( mod_name ) ; return tval_names [ i ] . tval ; } } string_free ( mod_name ) ; return -1 ; }
Returns the numeric equivalent tval of the textual tval `name`.
Returns the numeric equivalent tval of the textual tval ` name ` .