summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-07 08:49:32 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-07 08:49:32 +0000
commit504342b26a04cf2e33cb49b61d721ee483f5c68b (patch)
tree2f1a37c872ed506edca6147e67afb2264bedb46f
parente99482b467e5cfe80a476f49eae8d398eab79440 (diff)
downloadcrawl-ref-504342b26a04cf2e33cb49b61d721ee483f5c68b.tar.gz
crawl-ref-504342b26a04cf2e33cb49b61d721ee483f5c68b.zip
Merge r7762: fix some god gift autoinscription problems.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@7763 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/describe.cc7
-rw-r--r--crawl-ref/source/items.cc19
2 files changed, 25 insertions, 1 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 72d603a09f..631fa0769b 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -2140,7 +2140,12 @@ void inscribe_item(item_def &item, bool proper_prompt)
_trim_randart_inscrip(item);
if (!item.inscription.empty())
- item.inscription += ", ";
+ {
+ if (ends_with(item.inscription, ","))
+ item.inscription += " ";
+ else
+ item.inscription += ", ";
+ }
item.inscription += ainscrip;
break;
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 2c1a077769..2f7f552d3e 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1509,6 +1509,13 @@ int move_item_to_player( int obj, int quant_got, bool quiet )
_check_note_item(mitm[obj]);
+ const bool floor_god_gift
+ = mitm[obj].inscription.find("god gift")
+ != std::string::npos;
+ const bool inv_god_gift
+ = you.inv[m].inscription.find("god gift")
+ != std::string::npos;
+
// If the object on the ground is inscribed, but not
// the one in inventory, then the inventory object
// picks up the other's inscription.
@@ -1518,6 +1525,18 @@ int move_item_to_player( int obj, int quant_got, bool quiet )
you.inv[m].inscription = mitm[obj].inscription;
}
+ // Remove god gift inscription unless both items have it.
+ if (floor_god_gift && !inv_god_gift
+ || inv_god_gift && !floor_god_gift)
+ {
+ you.inv[m].inscription
+ = replace_all(you.inv[m].inscription,
+ "god gift, ", "");
+ you.inv[m].inscription
+ = replace_all(you.inv[m].inscription,
+ "god gift", "");
+ }
+
if (is_blood_potion(mitm[obj]))
pick_up_blood_potions_stack(mitm[obj], quant_got);