diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-04 17:07:43 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-04 17:07:43 +0000 |
commit | 1df63f2d24648d2467da71b81ba53f039e6539c0 (patch) | |
tree | 3d55cda95aa019b4949566362e55bec7e5155982 /crawl-ref/source/itemprop.cc | |
parent | f5b7079207156bdd82d713a60cf79229fe33a109 (diff) | |
download | crawl-ref-1df63f2d24648d2467da71b81ba53f039e6539c0.tar.gz crawl-ref-1df63f2d24648d2467da71b81ba53f039e6539c0.zip |
Partially fix get_random_armour_type being completely broken (e.g. wizard
hats and caps can get generated again.) get_random_armour_type makes assumptions
about the order of armour_type, which were invalidated by r8681; I'm hesitant
to touch the order again for fear of breaking something. dolorous, can you check?
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8891 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r-- | crawl-ref/source/itemprop.cc | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 620927d1b6..4a079e1501 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -2383,7 +2383,7 @@ int property( const item_def &item, int prop_type ) } // Returns true if item is evokable. -bool gives_ability( const item_def &item ) +bool gives_ability(const item_def &item) { if (!item_type_known(item)) return (false); @@ -2394,7 +2394,7 @@ bool gives_ability( const item_def &item ) { // unwielded weapon item_def *weap = you.slot_item(EQ_WEAPON); - if (!weap || (*weap).slot != item.slot) + if (!weap || weap->slot != item.slot) return (false); break; } @@ -2405,8 +2405,8 @@ bool gives_ability( const item_def &item ) // unworn ring item_def *lring = you.slot_item(EQ_LEFT_RING); item_def *rring = you.slot_item(EQ_RIGHT_RING); - if ((!lring || (*lring).slot != item.slot) - && (!rring || (*rring).slot != item.slot)) + if ((!lring || lring->slot != item.slot) + && (!rring || rring->slot != item.slot)) { return (false); } @@ -2422,7 +2422,7 @@ bool gives_ability( const item_def &item ) { // unworn amulet item_def *amul = you.slot_item(EQ_AMULET); - if (!amul || (*amul).slot != item.slot) + if (!amul || amul->slot != item.slot) return (false); if (item.sub_type == AMU_RAGE) @@ -2438,7 +2438,7 @@ bool gives_ability( const item_def &item ) // unworn armour item_def *arm = you.slot_item(eq); - if (!arm || (*arm).slot != item.slot) + if (!arm || arm->slot != item.slot) return (false); break; } @@ -2458,7 +2458,7 @@ bool gives_ability( const item_def &item ) } // Returns true if the item confers an intrinsic that is shown on the % screen. -bool gives_resistance( const item_def &item ) +bool gives_resistance(const item_def &item) { if (!item_type_known(item)) return (false); @@ -2469,19 +2469,19 @@ bool gives_resistance( const item_def &item ) { // unwielded weapon item_def *weap = you.slot_item(EQ_WEAPON); - if (!weap || (*weap).slot != item.slot) + if (!weap || weap->slot != item.slot) return (false); break; } case OBJ_JEWELLERY: { - if (item.sub_type < NUM_RINGS) + if (!jewellery_is_amulet(item)) { // unworn ring - item_def *lring = you.slot_item(EQ_LEFT_RING); - item_def *rring = you.slot_item(EQ_RIGHT_RING); - if ((!lring || (*lring).slot != item.slot) - && (!rring || (*rring).slot != item.slot)) + const item_def *lring = you.slot_item(EQ_LEFT_RING); + const item_def *rring = you.slot_item(EQ_RIGHT_RING); + if ((!lring || lring->slot != item.slot) + && (!rring || rring->slot != item.slot)) { return (false); } @@ -2499,8 +2499,8 @@ bool gives_resistance( const item_def &item ) else { // unworn amulet - item_def *amul = you.slot_item(EQ_AMULET); - if (!amul || (*amul).slot != item.slot) + const item_def *amul = you.slot_item(EQ_AMULET); + if (!amul || amul->slot != item.slot) return (false); if (item.sub_type != AMU_RAGE && item.sub_type != AMU_INACCURACY) @@ -2516,11 +2516,11 @@ bool gives_resistance( const item_def &item ) // unworn armour item_def *arm = you.slot_item(eq); - if (!arm || (*arm).slot != item.slot) + if (!arm || arm->slot != item.slot) return (false); break; - const int ego = get_armour_ego_type( item ); + const int ego = get_armour_ego_type(item); if (ego >= SPARM_FIRE_RESISTANCE && ego <= SPARM_SEE_INVISIBLE || ego == SPARM_RESISTANCE || ego == SPARM_POSITIVE_ENERGY) { @@ -2531,7 +2531,7 @@ bool gives_resistance( const item_def &item ) { // unwielded staff item_def *weap = you.slot_item(EQ_WEAPON); - if (!weap || (*weap).slot != item.slot) + if (!weap || weap->slot != item.slot) return (false); if (item.sub_type >= STAFF_FIRE && item.sub_type <= STAFF_POISON |