From 504342b26a04cf2e33cb49b61d721ee483f5c68b Mon Sep 17 00:00:00 2001 From: zelgadis Date: Sun, 7 Dec 2008 08:49:32 +0000 Subject: 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 --- crawl-ref/source/describe.cc | 7 ++++++- crawl-ref/source/items.cc | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3-54-g00ecf