From 57ec78ae83592e5f55457fbcff4de929f5a9b7d7 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 31 May 2008 20:26:20 +0000 Subject: Consolidate all cases where corpses are turned into skeletons, as suggested by dolorous in BR 1977925, and turn coloured draconian corpses into plain draconian skeletons. Same when the game attempts to create coloured draconian skeletons or simulacrums. Added autoinscription to the single inscription command ('{') - this is necessary for items with long descriptions that can't autoinscribed otherwise. Added a small hack to make death cobs (%) appear correctly in the monster list. The rest is cleanup, I believe. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5376 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/describe.cc | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'crawl-ref/source/describe.cc') diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 18007cd6ea..afe37a0704 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -1975,7 +1975,58 @@ void describe_item( item_def &item, bool allow_inscribe ) getch(); } +void inscribe_item(item_def &item) +{ + mpr(item.name(DESC_INVENTORY).c_str(), MSGCH_EQUIPMENT); + + std::string ainscrip; + + if (is_random_artefact(item)) + ainscrip = _randart_auto_inscription(item); + + // Only allow autoinscription if we don't have all the text + // already. + const bool autoinscribe = + is_random_artefact(item) + && !ainscrip.empty() + && item.inscription.find(ainscrip) == std::string::npos; + + mprf( MSGCH_PROMPT, "Inscribe with what%s? ", + autoinscribe ? " ('a' to autoinscribe)" : "" ); + + char buf[79]; + if (!cancelable_get_line(buf, sizeof buf)) + { + // Strip spaces from the end. + for (int i = strlen(buf) - 1; i >= 0; i--) + { + if (isspace( buf[i] )) + buf[i] = 0; + else + break; + } + + if (autoinscribe && buf[1] == 0 && (buf[0] == 'a' || buf[0] == 'A')) + { + // Remove previous randart inscription + _trim_randart_inscrip(item); + + if (!item.inscription.empty()) + item.inscription += ", "; + item.inscription += ainscrip; + } + else + item.inscription = std::string(buf); + + mpr(item.name(DESC_INVENTORY).c_str(), MSGCH_EQUIPMENT); + you.wield_change = true; + } + else + { + canned_msg(MSG_OK); + } +} //--------------------------------------------------------------- // // describe_spell -- cgit v1.2.3-54-g00ecf