From ccb9171b5884a80787b98b1845f5a8e8e6275165 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 7 Jul 2008 14:23:40 +0000 Subject: Fix potions of decay created by mummy curse sometimes being inscribed. Change inscription prompt to work as intended by David, after all. :) Make manuals use a reading counter (plus2) that is initialized with 3 + random2(15). Once it reaches 0, the manual crumbles to dust. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6443 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/describe.cc | 96 +++++++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 36 deletions(-) (limited to 'crawl-ref/source/describe.cc') diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 5adabd8e35..658191e1c8 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -2059,8 +2059,9 @@ void inscribe_item(item_def &item, bool proper_prompt) } } - std::string prompt = (is_inscribed ? "Add what to inscription? " - : "Inscribe with what? "); + std::string prompt = (is_inscribed ? "Add to inscription? " + : "Inscribe item? "); + if (need_autoinscribe || is_inscribed) { prompt += "(You may also "; @@ -2068,7 +2069,7 @@ void inscribe_item(item_def &item, bool proper_prompt) { prompt += "(a)utoinscribe"; if (is_inscribed) - prompt += " or "; + prompt += ", or "; } if (is_inscribed) prompt += "(c)lear it"; @@ -2082,54 +2083,77 @@ void inscribe_item(item_def &item, bool proper_prompt) prompt = "" + prompt + ""; formatted_string::parse_string(prompt).display(); - if (Options.tutorial_left && wherey() <= get_number_of_lines() - 5) + if (Options.tutorial_left && wherey() <= get_number_of_lines() - 5) tutorial_inscription_info(need_autoinscribe, prompt); } - char buf[79]; - if (!cancelable_get_line(buf, sizeof buf)) + int keyin = tolower(c_getch()); + switch (keyin) { - // Strip spaces from the end. - for (int i = strlen(buf) - 1; i >= 0; i--) - { - if (isspace( buf[i] )) - buf[i] = 0; - else - break; - } + case 'a': + // Remove previous randart inscription + _trim_randart_inscrip(item); - if (need_autoinscribe && buf[1] == 0 - && (buf[0] == 'a' || buf[0] == 'A')) - { - // Remove previous randart inscription - _trim_randart_inscrip(item); + if (!item.inscription.empty()) + item.inscription += ", "; - if (!item.inscription.empty()) - item.inscription += ", "; + item.inscription += ainscrip; + break; + case 'c': + item.inscription.clear(); + break; + case 'y': + { + prompt = (is_inscribed ? "Add what to inscription? " + : "Inscribe with what? "); - item.inscription += ainscrip; - } - else if (is_inscribed && buf[1] == 0 - && (buf[0] == 'c' || buf[0] == 'C')) + if (proper_prompt) + mpr(prompt.c_str(), MSGCH_PROMPT); + else { - item.inscription.clear(); + prompt = EOL "" + prompt + ""; + formatted_string::parse_string(prompt).display(); } - else if (strlen(buf) > 0) + + char buf[79]; + if (!cancelable_get_line(buf, sizeof buf)) { - if (is_inscribed) - item.inscription += ", "; + // Strip spaces from the end. + for (int i = strlen(buf) - 1; i >= 0; i--) + { + if (isspace( buf[i] )) + buf[i] = 0; + else + break; + } - item.inscription += std::string(buf); - } + if (strlen(buf) > 0) + { + if (is_inscribed) + item.inscription += ", "; - if (proper_prompt) + item.inscription += std::string(buf); + } + } + else if (proper_prompt) { - mpr(item.name(DESC_INVENTORY).c_str(), MSGCH_EQUIPMENT); - you.wield_change = true; + canned_msg(MSG_OK); + return; } + break; } - else if (proper_prompt) - canned_msg(MSG_OK); + default: + if (proper_prompt) + canned_msg(MSG_OK); + return; + } + + if (proper_prompt) + { + mpr(item.name(DESC_INVENTORY).c_str(), MSGCH_EQUIPMENT); + you.wield_change = true; + } + } //--------------------------------------------------------------- // -- cgit v1.2.3-54-g00ecf