diff options
author | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-09-24 09:05:40 -0500 |
---|---|---|
committer | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-09-24 09:05:40 -0500 |
commit | 3ed0f149cfa5f8e40ccb554c550415ac63c6895b (patch) | |
tree | 99b2079fa3ded72fa37ca208dffde4a4246e0180 /crawl-ref | |
parent | 54ea5f1b75472ced662a1e066907d4ee5fbcccf4 (diff) | |
download | crawl-ref-3ed0f149cfa5f8e40ccb554c550415ac63c6895b.tar.gz crawl-ref-3ed0f149cfa5f8e40ccb554c550415ac63c6895b.zip |
Apply jpeg's patch in [2865661] to fix the "unlinked item" bug with
potions.
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/dungeon.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 39 |
2 files changed, 18 insertions, 24 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index f693fc6125..1abe8a5a99 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -4620,7 +4620,8 @@ static void _dgn_give_mon_spec_items(mons_spec &mspec, if (item_made != NON_ITEM && item_made != -1) { item_def &item(mitm[item_made]); - mon.pickup_item(item, 0, true); + if (!mon.pickup_item(item, 0, true)) + destroy_item(item_made, true); } } } diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 9d2ce0610d..bcd2e3f76a 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -3990,7 +3990,7 @@ item_def *monsters::weapon(int which_attack) return NULL; // Even/odd attacks use main/offhand weapon - if ( which_attack > 1 ) + if (which_attack > 1) which_attack &= 1; // This randomly picks one of the wielded weapons for monsters that can use @@ -5239,17 +5239,6 @@ bool monsters::pickup_potion(item_def &item, int near) if (!this->can_drink_potion(ptype)) return (false); - switch (ptype) - { - case POT_SPEED: - case POT_INVISIBILITY: - // If there are any item using monsters that are permanently - // invisible, this might have to be restricted. - break; - default: - return (false); - } - return (pickup(item, MSLOT_POTION, near)); } @@ -8259,16 +8248,18 @@ bool monsters::can_drink_potion(potion_type ptype) const if (mons_class_is_stationary(this->type)) return (false); - if (mons_itemuse(this) >= MONUSE_STARTING_EQUIPMENT) + if (mons_itemuse(this) < MONUSE_STARTING_EQUIPMENT) + return (false); + + // These monsters cannot drink. + if (mons_is_skeletal(type) || mons_is_insubstantial(type) + || mons_species() == MONS_LICH || mons_genus(type) == MONS_MUMMY) { - if (mons_is_skeletal(type) || mons_is_insubstantial(type) - || mons_species() == MONS_LICH || mons_genus(type) == MONS_MUMMY) - { - return (false); - } + return (false); + } - switch (ptype) - { + switch (ptype) + { case POT_HEALING: case POT_HEAL_WOUNDS: return (holiness() != MH_NONLIVING @@ -8276,11 +8267,13 @@ bool monsters::can_drink_potion(potion_type ptype) const case POT_BLOOD: case POT_BLOOD_COAGULATED: return (mons_species() == MONS_VAMPIRE); + case POT_SPEED: + case POT_INVISIBILITY: + // If there are any item using monsters that are permanently + // invisible, this might have to be restricted. + return (true); default: break; - } - - return (true); } return (false); |