Changeset 721

Show
Ignore:
Timestamp:
02/26/08 05:10:14 (6 months ago)
Author:
takkaria
Message:

Fix #408:

  • Add a pre-check before activing the effect that makes the item aware if it's "obvious". This is a bit of a hack, really.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/cmd6.c

    r633 r721  
    118118        int effect; 
    119119        bool ident = FALSE, used; 
     120        bool was_aware = object_aware_p(o_ptr); 
    120121        int dir = 5; 
    121122 
     
    136137        } 
    137138 
    138         /* Use energy regardless of failure */  
     139        /* Use energy regardless of failure */ 
    139140        p_ptr->energy_use = 100; 
    140141 
     
    158159        } 
    159160 
     161        /* A bit of a hack to make ID work better. 
     162           -- Check for "obvious" effects beforehand. */ 
     163        if (effect_obvious(effect)) object_aware(o_ptr); 
     164 
    160165        /* Do effect */ 
    161         used = do_effect(effect, &ident, dir, beam_chance(o_ptr->tval)); 
     166        used = effect_do(effect, &ident, dir, beam_chance(o_ptr->tval)); 
    162167 
    163168        /* Food feeds the player */ 
     
    177182         * it as "tried". 
    178183         */ 
    179         if (ident && !object_aware_p(o_ptr)
     184        if (ident && !was_aware
    180185        { 
    181186                /* Object level */ 
     
    192197        } 
    193198 
    194          
     199 
    195200        /* Some uses are "free" */ 
    196201        if (!used) return; 
  • trunk/src/effects.c

    r720 r721  
    4444 * Utility functions 
    4545 */ 
    46 bool effect_aim(int effect) 
     46bool effect_aim(effect_type effect) 
    4747{ 
    4848        if (effect < 1 || effect > EF_MAX) 
     
    5252} 
    5353 
    54 const char *effect_desc(int effect) 
     54const char *effect_desc(effect_type effect) 
    5555{ 
    5656        if (effect < 1 || effect > EF_MAX) 
     
    6060} 
    6161 
     62bool effect_obvious(effect_type effect) 
     63{ 
     64        if (effect == EF_IDENTIFY) 
     65                return TRUE; 
     66 
     67        return FALSE; 
     68} 
     69 
    6270 
    6371/* 
    6472 * The "wonder" effect. 
    65  *  
     73 * 
    6674 * Returns TRUE if the effect is evident. 
    6775 */ 
     
    136144 * Do an effect, given an object. 
    137145 */ 
    138 bool do_effect(int effect, bool *ident, int dir, int beam) 
     146bool effect_do(effect_type effect, bool *ident, int dir, int beam) 
    139147{ 
    140148        int py = p_ptr->py; 
  • trunk/src/effects.h

    r720 r721  
    1919#define INCLUDED_EFFECTS_H 
    2020 
    21 bool do_effect(int effect, bool *ident, int dir, int beam); 
    22 bool effect_aim(int effect); 
    23 const char *effect_desc(int effect); 
    24  
    2521/* Types of effect */ 
    2622typedef enum 
     
    3329} effect_type; 
    3430 
     31/*** Functions ***/ 
     32 
     33bool effect_do(effect_type effect, bool *ident, int dir, int beam); 
     34bool effect_aim(effect_type effect); 
     35const char *effect_desc(effect_type effect); 
     36bool effect_obvious(effect_type effect); 
     37 
    3538#endif /* INCLUDED_EFFECTS_H */