summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-25 15:11:37 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-25 15:11:37 +0000
commit0eceb6ff8b8501d07c94e2e5d46aca19121b205e (patch)
treefe32d5ef03aff51b088f03670ee8052a8309080c /crawl-ref/source
parent378c95389b4ac05f90399105c705a2667a1c922e (diff)
downloadcrawl-ref-0eceb6ff8b8501d07c94e2e5d46aca19121b205e.tar.gz
crawl-ref-0eceb6ff8b8501d07c94e2e5d46aca19121b205e.zip
Fix 1914059: randart jewellery inconsistently described as {tried} by
adding yet another entry to props. FR 1949504: Move version information into the help scroller, yay! It also looks much nicer now (if I may say so). Go, take a look! :) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5234 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/acr.cc7
-rw-r--r--crawl-ref/source/chardump.cc84
-rw-r--r--crawl-ref/source/command.cc162
-rw-r--r--crawl-ref/source/command.h2
-rw-r--r--crawl-ref/source/enum.h1
-rw-r--r--crawl-ref/source/item_use.cc12
-rw-r--r--crawl-ref/source/itemname.cc15
-rw-r--r--crawl-ref/source/output.cc18
-rw-r--r--crawl-ref/source/randart.cc2
-rw-r--r--crawl-ref/source/tile1.cc51
10 files changed, 225 insertions, 129 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 88d22351ad..06f82d291d 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1223,7 +1223,6 @@ static bool _cmd_is_repeatable(command_type cmd, bool is_again = false)
case CMD_DISPLAY_CHARACTER_STATUS:
case CMD_DISPLAY_SPELLS:
case CMD_EXPERIENCE_CHECK:
- case CMD_GET_VERSION:
case CMD_RESISTS_SCREEN:
case CMD_READ_MESSAGES:
case CMD_SEARCH_STASHES:
@@ -2361,10 +2360,6 @@ void process_command( command_type cmd )
canned_msg(MSG_OK);
break;
- case CMD_GET_VERSION:
- version();
- break;
-
case CMD_REPEAT_CMD:
_setup_cmd_repeat();
break;
@@ -3375,7 +3370,7 @@ static command_type _keycode_to_command( keycode_type key )
case 'R': return CMD_REMOVE_JEWELLERY;
case 'S': return CMD_SAVE_GAME;
case 'T': return CMD_REMOVE_ARMOUR;
- case 'V': return CMD_GET_VERSION;
+ case 'V': return CMD_NO_CMD;
case 'W': return CMD_WEAR_ARMOUR;
case 'X': return CMD_DISPLAY_MAP;
case 'Z': return CMD_ZAP_WAND;
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index c57c1c9a7b..ba88129280 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -691,9 +691,7 @@ static void sdump_inventory(dump_params &par)
char tmp_quant[20];
for (i = 0; i < OBJ_GOLD; i++)
- {
inv_class2[i] = 0;
- }
for (i = 0; i < ENDOFPACK; i++)
{
@@ -761,7 +759,7 @@ static void sdump_inventory(dump_params &par)
}
if (origin_describable(you.inv[j])
- && dump_item_origin(you.inv[j], ival))
+ && dump_item_origin(you.inv[j], ival))
{
text += "\n" " (" + origin_desc(you.inv[j]) + ")";
}
@@ -1037,20 +1035,20 @@ static void sdump_kills_by_place(dump_params &par)
std::string result = "";
std::string header =
-"Table legend:\n"
-" A = Kills in this place as a percentage of kills in entire the game.\n"
-" B = Kills by you in this place as a percentage of kills by you in\n"
-" the entire game.\n"
-" C = Kills by friends in this place as a percentage of kills by\n"
-" friends in the entire game.\n"
-" D = Other kills in this place as a percentage of other kills in the\n"
-" entire game.\n"
-" E = Character level experience gained in this place as a percentage of\n"
-" character level experience gained in the entire game.\n"
-" F = Skills experience gained in this place as a percentage of skills\n"
-" experience gained in the entire game.\n"
-" G = Experience gained in this place divided by the number of levels of\n"
-" this place that you have seen.\n\n";
+ "Table legend:\n"
+ " A = Kills in this place as a percentage of kills in entire the game.\n"
+ " B = Kills by you in this place as a percentage of kills by you in\n"
+ " the entire game.\n"
+ " C = Kills by friends in this place as a percentage of kills by\n"
+ " friends in the entire game.\n"
+ " D = Other kills in this place as a percentage of other kills in the\n"
+ " entire game.\n"
+ " E = Character level experience gained in this place as a percentage of\n"
+ " character level experience gained in the entire game.\n"
+ " F = Skills experience gained in this place as a percentage of skills\n"
+ " experience gained in the entire game.\n"
+ " G = Experience gained in this place divided by the number of levels of\n"
+ " this place that you have seen.\n\n";
header += " ";
header += " A B C D E F G\n";
@@ -1119,16 +1117,17 @@ static void sdump_mutations(dump_params &par)
const char *hunger_level(void)
{
return ((you.hunger <= 1000) ? "starving" :
- (you.hunger <= 2600) ? "hungry" :
- (you.hunger < 7000) ? "not hungry" :
- (you.hunger < 11000) ? "full" : "completely stuffed");
+ (you.hunger <= 2600) ? "hungry" :
+ (you.hunger < 7000) ? "not hungry" :
+ (you.hunger < 11000) ? "full"
+ : "completely stuffed");
}
static std::string morgue_directory()
{
- std::string dir =
- !Options.morgue_dir.empty()? Options.morgue_dir :
- !SysEnv.crawl_dir.empty() ? SysEnv.crawl_dir : "";
+ std::string dir = (!Options.morgue_dir.empty() ? Options.morgue_dir :
+ !SysEnv.crawl_dir.empty() ? SysEnv.crawl_dir
+ : "");
if (!dir.empty() && dir[dir.length() - 1] != FILE_SEPARATOR)
dir += FILE_SEPARATOR;
@@ -1151,20 +1150,17 @@ void dump_map(FILE *fp)
for (int j = Y_BOUND_1; j <= Y_BOUND_2; j++)
if (env.map[i][j].known())
{
- if ( i > max_x )
- max_x = i;
- if ( i < min_x )
- min_x = i;
- if ( j > max_y )
- max_y = j;
- if ( j < min_y )
- min_y = j;
+ if (i > max_x) max_x = i;
+ if (i < min_x) min_x = i;
+ if (j > max_y) max_y = j;
+ if (j < min_y) min_y = j;
}
- for ( int y = min_y; y <= max_y; ++y )
+ for (int y = min_y; y <= max_y; ++y)
{
- for ( int x = min_x; x <= max_x; ++x )
+ for (int x = min_x; x <= max_x; ++x)
fputc( env.map[x][y].glyph(), fp );
+
fputc('\n', fp);
}
@@ -1176,7 +1172,7 @@ void dump_map(FILE *fp)
void dump_map(const char* fname)
{
FILE* fp = fopen(fname, "w");
- if ( !fp )
+ if (!fp)
return;
dump_map(fp);
@@ -1184,9 +1180,7 @@ void dump_map(const char* fname)
fclose(fp);
}
-static bool write_dump(
- const std::string &fname,
- dump_params &par)
+static bool write_dump( const std::string &fname, dump_params &par)
{
bool succeeded = false;
@@ -1225,25 +1219,29 @@ void display_notes()
{
Menu scr;
scr.set_tag("notes");
- scr.set_title( new MenuEntry("Turn | Place | Note"));
- for ( unsigned int i = 0; i < note_list.size(); ++i )
+ scr.set_title(new MenuEntry("Turn | Place | Note"));
+ for (unsigned int i = 0; i < note_list.size(); ++i)
{
std::string prefix = note_list[i].describe(true, true, false);
std::string suffix = note_list[i].describe(false, false, true);
- if ( suffix.empty() )
+ if (suffix.empty())
continue;
+
int spaceleft = get_number_of_cols() - prefix.length() - 1;
- if ( spaceleft <= 0 )
+ if (spaceleft <= 0)
return;
+
linebreak_string(suffix, spaceleft - 4, spaceleft);
std::vector<std::string> parts = split_string("\n", suffix);
- if ( parts.empty() ) // disregard pure-whitespace notes
+ if (parts.empty()) // disregard pure-whitespace notes
continue;
+
scr.add_entry(new MenuEntry(prefix + parts[0]));
for ( unsigned int j = 1; j < parts.size(); ++j )
+ {
scr.add_entry(new MenuEntry(std::string(prefix.length()-2, ' ') +
std::string("| ") + parts[j]));
-
+ }
}
scr.show();
redraw_screen();
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 1a98cff936..52f8ec9226 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -65,10 +65,18 @@ static const char *features[] = {
"Lua user scripts",
#endif
+#ifdef USE_TILE
+ "Tile support",
+#endif
+
#ifdef WIZARD
"Wizard mode",
#endif
+#ifdef DEBUG
+ "Debug mode",
+#endif
+
#if defined(REGEX_POSIX)
"POSIX regexps",
#elif defined(REGEX_PCRE)
@@ -81,22 +89,95 @@ static const char *features[] = {
"Sound support",
#endif
-#ifdef UNICODE_GLYPHS
- "Unicode glyphs",
+#ifdef DGL_MILESTONES
+ "Milestones",
#endif
-#ifdef USE_TILE
- "Tile support",
+#ifdef UNICODE_GLYPHS
+ "Unicode glyphs",
#endif
};
-void version(void)
+static std::string _get_version_information(void)
+{
+ std::string result = "This is <w>";
+ result += CRAWL " " VERSION "</w> (" VERSION_DETAIL ").";
+ result += "\n\n";
+
+ return (result);
+}
+
+static std::string _get_version_features(void)
+{
+ std::string result = "FEATURES" EOL;
+ result += "--------" EOL;
+
+ for (unsigned int i = 0; i < ARRAYSZ(features); i++)
+ {
+ result += " * ";
+ result += features[i];
+ result += EOL;
+ }
+ result += "\n\n";
+
+ return (result);
+}
+
+static void _add_file_to_scroller(FILE* fp, formatted_scroller& m,
+ int first_hotkey = 0,
+ bool auto_hotkeys = false);
+
+void print_version(void)
{
- mpr( "This is " CRAWL " " VERSION " (" VERSION_DETAIL ")." );
- mprf("Features: %s",
- comma_separated_line(features, features + ARRAYSZ(features))
- .c_str());
-} // end version()
+ formatted_scroller cmd_version;
+
+ // Set flags.
+ int flags = MF_NOSELECT | MF_ALWAYS_SHOW_MORE | MF_NOWRAP | MF_EASY_EXIT;
+ cmd_version.set_flags(flags, false);
+ cmd_version.set_tag("version");
+
+ // FIXME: Allow for hiding Page down when at the end of the listing, ditto
+ // for page up at start of listing.
+ cmd_version.set_more( formatted_string::parse_string(
+ "<cyan>[ + : Page down. - : Page up."
+ " Esc exits.]") );
+
+ cmd_version.add_text(_get_version_information());
+ cmd_version.add_text(_get_version_features());
+
+ // Read in information about changed in comparison to the latest version.
+ FILE* fp = fopen(datafile_path("034_changes.txt", true).c_str(), "r");
+ if (fp)
+ {
+ char buf[200];
+ bool first = true;
+ while (fgets(buf, sizeof buf, fp))
+ {
+ // Remove trailing spaces.
+ for (int i = strlen(buf) - 1; i >= 0; i++)
+ {
+ if (isspace( buf[i] ))
+ buf[i] = 0;
+ else
+ break;
+ }
+ if (first)
+ {
+ // Highlight the first line (title).
+ std::string text = "<w>";
+ text += buf;
+ text += "</w>";
+ cmd_version.add_text(text);
+ first = false;
+ }
+ else
+ cmd_version.add_text(buf);
+ }
+ }
+ fclose(fp);
+
+ cmd_version.show();
+}
void adjust(void)
{
@@ -173,12 +254,11 @@ static void _adjust_item(void)
mpr(you.inv[from_slot].name(DESC_INVENTORY_EQUIP).c_str());
- to_slot = prompt_invent_item(
- "Adjust to which letter?",
- MT_INVLIST,
- -1,
- false,
- false );
+ to_slot = prompt_invent_item( "Adjust to which letter?",
+ MT_INVLIST,
+ -1,
+ false,
+ false );
if (to_slot == PROMPT_ABORT)
{
canned_msg( MSG_OK );
@@ -595,40 +675,39 @@ static const char *targeting_help_2 =
// If auto_hotkeys is true, the function will try to identify
// sections and add appropriate hotkeys.
static void _add_file_to_scroller(FILE* fp, formatted_scroller& m,
- int first_hotkey, bool auto_hotkeys )
+ int first_hotkey, bool auto_hotkeys)
{
bool next_is_hotkey = false;
bool is_first = true;
char buf[200];
- // bracket with MEL_TITLES, so that you won't scroll
- // into it or above it
+ // Bracket with MEL_TITLES, so that you won't scroll into it or above it.
m.add_entry(new MenuEntry(std::string(), MEL_TITLE));
- for ( int i = 0; i < get_number_of_lines(); ++i )
+ for (int i = 0; i < get_number_of_lines(); ++i)
m.add_entry(new MenuEntry(std::string()));
m.add_entry(new MenuEntry(std::string(), MEL_TITLE));
while (fgets(buf, sizeof buf, fp))
{
MenuEntry* me = new MenuEntry(buf);
- if ((next_is_hotkey && (isupper(buf[0]) || isdigit(buf[0]))) ||
- (is_first && first_hotkey))
+ if (next_is_hotkey && (isupper(buf[0]) || isdigit(buf[0]))
+ || is_first && first_hotkey)
{
- int hotkey = is_first ? first_hotkey : buf[0];
- if ( !is_first && buf[0] == 'X' &&
- strlen(buf) >= 3 && isdigit(buf[2]) )
+ int hotkey = (is_first ? first_hotkey : buf[0]);
+ if (!is_first && buf[0] == 'X'
+ && strlen(buf) >= 3 && isdigit(buf[2]))
{
// X.# is hotkeyed to the #
hotkey = buf[2];
}
me->add_hotkey(hotkey);
- if ( isupper(hotkey) )
+ if (isupper(hotkey))
me->add_hotkey(tolower(hotkey));
- me->level = MEL_SUBTITLE;
+ me->level = MEL_SUBTITLE;
me->colour = WHITE;
}
m.add_entry(me);
- // XXX FIXME: there must be a better way to identify sections
+ // FIXME: There must be a better way to identify sections!
next_is_hotkey = auto_hotkeys &&
(strstr(buf, "------------------------------------------"
"------------------------------") == buf);
@@ -1258,7 +1337,7 @@ static int _keyhelp_keyfilter(int ch)
do
{
// resets 'again'
- if (_find_description(again, error) && getch() == 0 )
+ if (_find_description(again, error) && getch() == 0)
getch();
if (again)
@@ -1270,6 +1349,12 @@ static int _keyhelp_keyfilter(int ch)
return -1;
}
+ case 'v':
+ case 'V':
+ {
+ print_version();
+ return -1;
+ }
}
return ch;
}
@@ -1334,7 +1419,7 @@ static void _show_keyhelp_menu(const std::vector<formatted_string> &lines,
"<cyan>[ + : Page down. - : Page up."
" Esc exits.]"));
- if ( with_manual )
+ if (with_manual)
{
cmd_help.set_highlighter(new help_highlighter);
cmd_help.f_keyfilter = _keyhelp_keyfilter;
@@ -1391,26 +1476,27 @@ static void _show_keyhelp_menu(const std::vector<formatted_string> &lines,
std::vector<formatted_string> blines = cols.formatted_lines();
unsigned i;
- for (i = 0; i < blines.size(); ++i )
+ for (i = 0; i < blines.size(); ++i)
cmd_help.add_item_formatted_string(blines[i]);
- while ( static_cast<int>(++i) < get_number_of_lines() )
+ while (static_cast<int>(++i) < get_number_of_lines())
cmd_help.add_item_string("");
+
// unscrollable
cmd_help.add_entry(new MenuEntry(std::string(), MEL_TITLE));
}
- for (unsigned i = 0; i < lines.size(); ++i )
+ for (unsigned i = 0; i < lines.size(); ++i)
cmd_help.add_item_formatted_string(lines[i], (i == 0 ? '?' : 0) );
- if ( with_manual )
+ if (with_manual)
{
- for ( int i = 0; help_files[i].name != NULL; ++i )
+ for (int i = 0; help_files[i].name != NULL; ++i)
{
- // attempt to open this file, skip it if unsuccessful
+ // Attempt to open this file, skip it if unsuccessful.
FILE* fp =
fopen(datafile_path(help_files[i].name, false).c_str(), "r");
- if ( !fp )
+ if (!fp)
continue;
// put in a separator
@@ -1427,7 +1513,7 @@ static void _show_keyhelp_menu(const std::vector<formatted_string> &lines,
}
}
- if ( hotkey )
+ if (hotkey)
cmd_help.jump_to_hotkey(hotkey);
cmd_help.show();
diff --git a/crawl-ref/source/command.h b/crawl-ref/source/command.h
index 0de4a5034c..fa963f90f9 100644
--- a/crawl-ref/source/command.h
+++ b/crawl-ref/source/command.h
@@ -20,7 +20,7 @@
/* ***********************************************************************
* called from: acr
* *********************************************************************** */
-void version(void);
+void print_version(void);
// last updated 12may2000 {dlb}
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 9df5219da0..f49633c301 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -480,7 +480,6 @@ enum command_type
CMD_DISPLAY_CHARACTER_STATUS,
CMD_DISPLAY_SPELLS,
CMD_EXPERIENCE_CHECK,
- CMD_GET_VERSION,
CMD_ADJUST_INVENTORY,
CMD_REPLAY_MESSAGES,
CMD_REDRAW_SCREEN,
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 804995e72b..56755f9314 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2616,9 +2616,9 @@ void jewellery_wear_effects(item_def &item)
randart_prop_type fake_rap = RAP_NUM_PROPERTIES;
bool learn_pluses = false;
- // Randart jewellery shouldn't auto-ID just because the
- // base type is known. Somehow the player should still
- // be told, preferably by message. (jpeg)
+ // Randart jewellery shouldn't auto-ID just because the base type
+ // is known. Somehow the player should still be told, preferably
+ // by message. (jpeg)
const bool artefact = is_random_artefact( item );
const bool known_pluses = item_ident( item, ISFLAG_KNOW_PLUSES );
const bool known_cursed = item_known_cursed( item );
@@ -2761,6 +2761,12 @@ void jewellery_wear_effects(item_def &item)
if (fake_rap != RAP_NUM_PROPERTIES)
randart_wpn_learn_prop( item, fake_rap );
+
+ if (!item.props.exists("jewellery_tried")
+ || !item.props["jewellery_tried"].get_bool())
+ {
+ item.props["jewellery_tried"].get_bool() = true;
+ }
}
else
{
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index f299dbc8d1..c44b0f88a6 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1707,17 +1707,18 @@ static bool _randart_has_known_property(const item_def &item)
bool item_type_tried( const item_def& item )
{
- if ( item_type_known(item) )
- return false;
+ if (item_type_known(item))
+ return (false);
- if ( is_artefact(item) )
+ if (is_artefact(item) && item.base_type == OBJ_JEWELLERY)
{
if (item.base_type == OBJ_JEWELLERY
- && _randart_has_known_property(item))
+ && item.props.exists("jewellery_tried")
+ && item.props["jewellery_tried"].get_bool())
{
- return true;
+ return (true);
}
- return false;
+ return (false);
}
const item_type_id_type idt = objtype_to_idtype(item.base_type);
@@ -1727,7 +1728,7 @@ bool item_type_tried( const item_def& item )
|| type_ids[idt][item.sub_type] == ID_MON_TRIED_TYPE);
}
else
- return false;
+ return (false);
}
id_arr& get_typeid_array()
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 37086cb711..f7dc9180f3 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1946,7 +1946,7 @@ static std::string _overview_screen_title()
return text;
}
-static std::vector<formatted_string> _get_overview_cols1()
+static std::vector<formatted_string> _get_overview_stats()
{
char buf[1000];
@@ -2049,8 +2049,9 @@ static std::vector<formatted_string> _get_overview_cols1()
return cols1.formatted_lines();
}
-static std::vector<formatted_string> _get_overview_cols2(
- std::vector<char> &equip_chars, bool calc_unid = false)
+static std::vector<formatted_string> _get_overview_resistances(
+ std::vector<char> &equip_chars,
+ bool calc_unid = false)
{
char buf[1000];
@@ -2173,7 +2174,7 @@ char _get_overview_screen_results()
overview.add_text(_overview_screen_title());
{
- std::vector<formatted_string> blines = _get_overview_cols1();
+ std::vector<formatted_string> blines = _get_overview_stats();
for (unsigned int i = 0; i < blines.size(); ++i )
overview.add_item_formatted_string(blines[i]);
overview.add_text(" ");
@@ -2182,8 +2183,9 @@ char _get_overview_screen_results()
{
std::vector<char> equip_chars;
- std::vector<formatted_string> blines = _get_overview_cols2(equip_chars,
- calc_unid);
+ std::vector<formatted_string> blines =
+ _get_overview_resistances(equip_chars, calc_unid);
+
for (unsigned int i = 0; i < blines.size(); ++i )
{
// Kind of a hack -- we don't really care what items these
@@ -2205,7 +2207,7 @@ std::string dump_overview_screen(bool full_id)
std::string text = formatted_string::parse_string(_overview_screen_title());
text += EOL;
- std::vector<formatted_string> blines = _get_overview_cols1();
+ std::vector<formatted_string> blines = _get_overview_stats();
for (unsigned int i = 0; i < blines.size(); ++i)
{
text += blines[i];
@@ -2214,7 +2216,7 @@ std::string dump_overview_screen(bool full_id)
text += EOL;
std::vector<char> equip_chars;
- blines = _get_overview_cols2(equip_chars, full_id);
+ blines = _get_overview_resistances(equip_chars, full_id);
for (unsigned int i = 0; i < blines.size(); ++i)
{
text += blines[i];
diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc
index 7e89bac6d7..98ea2ee622 100644
--- a/crawl-ref/source/randart.cc
+++ b/crawl-ref/source/randart.cc
@@ -368,7 +368,7 @@ void randart_desc_properties( const item_def &item,
{
randart_wpn_properties( item, proprt, known);
- if ( !force_fake_props && item_ident( item, ISFLAG_KNOW_PROPERTIES ) )
+ if (!force_fake_props && item_ident( item, ISFLAG_KNOW_PROPERTIES ))
return;
// only jewellery need fake randart properties
diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc
index 600b46fe2e..43ff12e9ec 100644
--- a/crawl-ref/source/tile1.cc
+++ b/crawl-ref/source/tile1.cc
@@ -4457,31 +4457,40 @@ static int _item_unid_type(const item_def &item)
switch (item.base_type)
{
- case OBJ_STAVES:
- id0 = id[ IDTYPE_STAVES ][s];
- if (id0 != ID_KNOWN_TYPE)
- return 1;
- else
- return 0;
+ case OBJ_STAVES:
+ id0 = id[ IDTYPE_STAVES ][s];
+ if (id0 != ID_KNOWN_TYPE)
+ return 1;
+ else
+ return 0;
- case OBJ_SCROLLS:
- id0 = id[ IDTYPE_SCROLLS ][s];
- break;
+ case OBJ_SCROLLS:
+ id0 = id[ IDTYPE_SCROLLS ][s];
+ break;
- case OBJ_WANDS:
- id0 = id[ IDTYPE_WANDS ][s];
- break;
+ case OBJ_WANDS:
+ id0 = id[ IDTYPE_WANDS ][s];
+ break;
- case OBJ_POTIONS:
- id0 = id[ IDTYPE_POTIONS ][s];
- break;
+ case OBJ_POTIONS:
+ id0 = id[ IDTYPE_POTIONS ][s];
+ break;
- case OBJ_JEWELLERY:
- id0 = id[ IDTYPE_JEWELLERY ][s];
- break;
+ case OBJ_JEWELLERY:
+ if (is_artefact(item))
+ {
+ if (item.props.exists("jewellery_tried")
+ && item.props["jewellery_tried"].get_bool())
+ {
+ return 2;
+ }
+ return 1;
+ }
+ id0 = id[ IDTYPE_JEWELLERY ][s];
+ break;
- default:
- return 0;
+ default:
+ return 0;
}
if (id0 == ID_TRIED_TYPE)
@@ -4492,7 +4501,7 @@ static int _item_unid_type(const item_def &item)
return 0;
}
-// Helper routine: sort floor item index and pack into idx
+// Helper routine: sort floor item index and pack into idx.
static int _pack_floor_item(int *idx, int *flag, int *isort, int max)
{
int n = 0;