summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/describe.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-31 20:26:20 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-31 20:26:20 +0000
commit57ec78ae83592e5f55457fbcff4de929f5a9b7d7 (patch)
tree7f85295bb2791f405554336cc2e1ebb744571a4c /crawl-ref/source/describe.cc
parent7df3a8aa8296fea631280b085f4c70a93fd23a54 (diff)
downloadcrawl-ref-57ec78ae83592e5f55457fbcff4de929f5a9b7d7.tar.gz
crawl-ref-57ec78ae83592e5f55457fbcff4de929f5a9b7d7.zip
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
Diffstat (limited to 'crawl-ref/source/describe.cc')
-rw-r--r--crawl-ref/source/describe.cc51
1 files changed, 51 insertions, 0 deletions
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