/* * Format object o_ptr's name into 'buf'. */ static int obj_desc_name(ref string buf, int max, int end, Object o_ptr, bool prefix, Detail mode, bool spoil) { bool known = o_ptr.is_known() || ((o_ptr.ident & Object.IDENT_STORE) != 0) || spoil; bool aware = o_ptr.flavor_is_aware() || ((o_ptr.ident & Object.IDENT_STORE) != 0) || spoil; string basename = obj_desc_get_basename(o_ptr, aware); string modstr = obj_desc_get_modstr(o_ptr.kind); if (aware && !o_ptr.kind.everseen && !spoil) { o_ptr.kind.everseen = true; } if (prefix) { end = obj_desc_name_prefix(ref buf, max, end, o_ptr, known, basename, modstr); } /* Pluralize if (not forced singular) and * (not a known/visible artifact) and * (not one in stack or forced plural) */ obj_desc_name_format(ref buf, basename, modstr, ((mode & Detail.SINGULAR) == 0) && !(o_ptr.artifact == null && (o_ptr.name_is_visible() || known)) && (o_ptr.number != 1 || ((mode & Detail.PLURAL) != 0))); /** Append extra names of various kinds **/ if ((o_ptr.name_is_visible() || known) && o_ptr.artifact != null) { buf = buf + " " + o_ptr.artifact.Name; } else if ((spoil && o_ptr.ego != null) || o_ptr.ego_is_visible()) { buf = buf + " " + o_ptr.ego.name; } else if (aware && o_ptr.artifact == null && (o_ptr.kind.flavor != null || o_ptr.kind.tval == TVal.TV_SCROLL)) { buf = buf + " of " + o_ptr.kind.Name; } return(end); }
/* * Format object o_ptr's name into 'buf'. */ static int obj_desc_name(ref string buf, int max, int end, Object o_ptr, bool prefix, Detail mode, bool spoil) { bool known = o_ptr.is_known() || ((o_ptr.ident & Object.IDENT_STORE) != 0) || spoil; bool aware = o_ptr.flavor_is_aware() || ((o_ptr.ident & Object.IDENT_STORE) != 0) || spoil; string basename = obj_desc_get_basename(o_ptr, aware); string modstr = obj_desc_get_modstr(o_ptr.kind); if (aware && !o_ptr.kind.everseen && !spoil) o_ptr.kind.everseen = true; if (prefix) end = obj_desc_name_prefix(ref buf, max, end, o_ptr, known, basename, modstr); /* Pluralize if (not forced singular) and * (not a known/visible artifact) and * (not one in stack or forced plural) */ obj_desc_name_format(ref buf, basename, modstr, ((mode & Detail.SINGULAR) == 0) && !(o_ptr.artifact == null && (o_ptr.name_is_visible() || known)) && (o_ptr.number != 1 || ((mode & Detail.PLURAL) != 0))); /** Append extra names of various kinds **/ if((o_ptr.name_is_visible() || known) && o_ptr.artifact != null) buf = buf + " " + o_ptr.artifact.Name; else if((spoil && o_ptr.ego != null) || o_ptr.ego_is_visible()) buf = buf + " " + o_ptr.ego.name; else if(aware && o_ptr.artifact == null && (o_ptr.kind.flavor != null || o_ptr.kind.tval == TVal.TV_SCROLL)) buf = buf + " of " + o_ptr.kind.Name; return end; }