summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/makeitem.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-03 06:08:48 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-03 06:08:48 +0000
commit8bf4f93aa163d478558f5ea3897c6158bd9781ea (patch)
tree9cefd9fff350b86c4d83a7be00b16199e8fe46b9 /crawl-ref/source/makeitem.cc
parent921d8f93a339385678d72c8347725a5bc3de1145 (diff)
downloadcrawl-ref-8bf4f93aa163d478558f5ea3897c6158bd9781ea.tar.gz
crawl-ref-8bf4f93aa163d478558f5ea3897c6158bd9781ea.zip
Add another optional parameter to items() of makeitem.{cc,h}, the agent
parameter. If not -1 then it will be used to set the acquirement agent of the item. This is done in items() so that make_item_randart() can use it if it's called from items(). Before this _god_fits_artefact() in randart.cc was only being called for choosing an appropriate god for random artifact names, and not to check the appropriateness of the randart proeprties chosen for randart god gifts. Changed _god_fits_artefact() so that if a bug leads a god to gifting an item with an inapropriate base_type or sub_type that it will give an assertion or error message instead of causing make_item_randart() to go into an infinite loop. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7726 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/makeitem.cc')
-rw-r--r--crawl-ref/source/makeitem.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index bd7131e0bd..80f2b20771 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2648,7 +2648,8 @@ int items( int allow_uniques, // not just true-false,
int item_race, // weapon / armour racial categories
// item_race also gives type of rune!
unsigned mapmask,
- int force_ego) // desired ego/brand
+ int force_ego, // desired ego/brand
+ int agent) // acquirement agent, if not -1
{
// TODO: Allow a combination of force_ego > 0 and
// force_type == OBJ_RANDOM, so that (for example) you could have
@@ -2667,6 +2668,11 @@ int items( int allow_uniques, // not just true-false,
item_def& item(mitm[p]);
+ // make_item_randart() might do things differently based upon the
+ // acquirement agent, especially for god gifts.
+ if (agent != -1)
+ origin_acquired(item, agent);
+
const bool force_good = (item_level == MAKE_GOOD_ITEM);
if (force_ego > 0)