Changeset 755

Show
Ignore:
Timestamp:
03/09/08 17:16:25 (7 months ago)
Author:
GabeCunningham
Message:

Fix #407: Detection now gives a message when nothing is detected, as long as you are aware of the scroll, etc.

Files:

Legend:

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

    r721 r755  
    3838                case TV_WAND:  msg = "use the wand";  what = "wand";  break; 
    3939                case TV_STAFF: msg = "use the staff"; what = "staff"; break; 
    40                 default:       msg = "activatee it";  break; 
     40                default:       msg = "activate it";  break; 
    4141        } 
    4242 
     
    164164 
    165165        /* Do effect */ 
    166         used = effect_do(effect, &ident, dir, beam_chance(o_ptr->tval)); 
     166        used = effect_do(effect, &ident, was_aware, dir, beam_chance(o_ptr->tval)); 
    167167 
    168168        /* Food feeds the player */ 
  • trunk/src/effects.c

    r752 r755  
    144144 * Do an effect, given an object. 
    145145 */ 
    146 bool effect_do(effect_type effect, bool *ident, int dir, int beam) 
     146bool effect_do(effect_type effect, bool *ident, bool aware, int dir, int beam) 
    147147{ 
    148148        int py = p_ptr->py; 
     
    595595                        (void)do_inc_stat(A_INT); 
    596596                        (void)do_inc_stat(A_WIS); 
    597                         (void)detect_traps(); 
    598                         (void)detect_doorstairs(); 
    599                         (void)detect_treasure(); 
     597                        (void)detect_traps(TRUE); 
     598                        (void)detect_doorstairs(TRUE); 
     599                        (void)detect_treasure(TRUE); 
    600600                        identify_pack(); 
    601601                        self_knowledge(TRUE); 
     
    678678                case EF_DETECT_TREASURE: 
    679679                { 
    680                         if (detect_treasure()) *ident = TRUE; 
     680                        if (detect_treasure(aware)) *ident = TRUE; 
    681681                        return TRUE; 
    682682                } 
     
    684684                case EF_DETECT_TRAP: 
    685685                { 
    686                         if (detect_traps()) *ident = TRUE; 
     686                        if (detect_traps(aware)) *ident = TRUE; 
    687687                        return TRUE; 
    688688                } 
     
    690690                case EF_DETECT_DOORSTAIR: 
    691691                { 
    692                         if (detect_doorstairs()) *ident = TRUE; 
     692                        if (detect_doorstairs(aware)) *ident = TRUE; 
    693693                        return TRUE; 
    694694                } 
     
    696696                case EF_DETECT_INVIS: 
    697697                { 
    698                         if (detect_monsters_invis()) *ident = TRUE; 
     698                        if (detect_monsters_invis(aware)) *ident = TRUE; 
    699699                        return TRUE; 
    700700                } 
     
    702702                case EF_DETECT_EVIL: 
    703703                { 
    704                         if (detect_monsters_evil()) *ident = TRUE; 
     704                        if (detect_monsters_evil(aware)) *ident = TRUE; 
    705705                        return TRUE; 
    706706                } 
     
    708708                case EF_DETECT_ALL: 
    709709                { 
    710                         if (detect_all()) *ident = TRUE; 
     710                        if (detect_all(aware)) *ident = TRUE; 
    711711                        return TRUE; 
    712712                } 
     
    10101010                        *ident = TRUE; 
    10111011                        wiz_lite(); 
    1012                         (void)detect_traps(); 
    1013                         (void)detect_doorstairs(); 
     1012                        (void)detect_traps(TRUE); 
     1013                        (void)detect_doorstairs(TRUE); 
    10141014                        return TRUE; 
    10151015                } 
  • trunk/src/effects.h

    r721 r755  
    3131/*** Functions ***/ 
    3232 
    33 bool effect_do(effect_type effect, bool *ident, int dir, int beam); 
     33bool effect_do(effect_type effect, bool *ident, bool aware, int dir, int beam); 
    3434bool effect_aim(effect_type effect); 
    3535const char *effect_desc(effect_type effect); 
  • trunk/src/externs.h

    r728 r755  
    475475extern bool lose_all_info(void); 
    476476extern void set_recall(void); 
    477 extern bool detect_traps(void); 
    478 extern bool detect_doorstairs(void); 
    479 extern bool detect_treasure(void); 
    480 extern bool detect_objects_magic(void); 
    481 extern bool detect_monsters_normal(void); 
    482 extern bool detect_monsters_invis(void); 
    483 extern bool detect_monsters_evil(void); 
    484 extern bool detect_all(void); 
     477extern bool detect_traps(bool aware); 
     478extern bool detect_doorstairs(bool aware); 
     479extern bool detect_treasure(bool aware); 
     480extern bool detect_objects_magic(bool aware); 
     481extern bool detect_monsters_normal(bool aware); 
     482extern bool detect_monsters_invis(bool aware); 
     483extern bool detect_monsters_evil(bool aware); 
     484extern bool detect_all(bool aware); 
    485485extern void stair_creation(void); 
    486486extern bool enchant(object_type *o_ptr, int n, int eflag); 
  • trunk/src/spells2.c

    r725 r755  
    10171017 * Detect traps around the player. 
    10181018 */ 
    1019 bool detect_traps(void
     1019bool detect_traps(bool aware
    10201020{ 
    10211021        int y, x; 
     
    10701070        if (detect) 
    10711071                msg_print("You sense the presence of traps!"); 
     1072        else 
     1073                /* Trap detection always makes you aware, even if no traps are present */ 
     1074                msg_print("You sense no traps."); 
    10721075 
    10731076        /* Mark the redraw flag */ 
     
    10831086 * Detect doors and stairs around the player. 
    10841087 */ 
    1085 bool detect_doorstairs(void
     1088bool detect_doorstairs(bool aware
    10861089{ 
    10871090        int y, x; 
     
    11491152        else if (!doors && stairs) msg_print("You sense the presence of stairs!"); 
    11501153        else if (doors && stairs)  msg_print("You sense the presence of doors and stairs!"); 
     1154        else if (aware && !doors && !stairs) msg_print("You sense no doors or stairs."); 
    11511155 
    11521156        /* Result */ 
     
    11581162 * Detect all treasure around the player. 
    11591163 */ 
    1160 bool detect_treasure(void
     1164bool detect_treasure(bool aware
    11611165{ 
    11621166        int i; 
     
    12481252                msg_print("You sense the presence of objects!"); 
    12491253 
     1254        if (aware && !gold_object && !gold_buried && !objects) 
     1255                msg_print("You sense no treasure or objects."); 
     1256 
    12501257        return (gold_object || gold_buried || objects); 
    12511258} 
     
    12611268 * It can probably be argued that this function is now too powerful. 
    12621269 */ 
    1263 bool detect_objects_magic(void
     1270bool detect_objects_magic(bool aware
    12641271{ 
    12651272        int i, y, x, tv; 
     
    13231330        if (detect) 
    13241331                msg_print("You sense the presence of magic objects!"); 
     1332        else if (aware && !detect) 
     1333                msg_print("You sense no magic objects."); 
    13251334 
    13261335        return detect; 
     
    13311340 * Detect "normal" monsters around the player. 
    13321341 */ 
    1333 bool detect_monsters_normal(void
     1342bool detect_monsters_normal(bool aware
    13341343{ 
    13351344        int i, y, x; 
     
    13851394        if (flag) 
    13861395                msg_print("You sense the presence of monsters!"); 
    1387  
     1396        else if (aware && !flag) 
     1397                msg_print("You sense no monsters."); 
     1398                 
    13881399        /* Result */ 
    13891400        return flag; 
     
    13941405 * Detect "invisible" monsters around the player. 
    13951406 */ 
    1396 bool detect_monsters_invis(void
     1407bool detect_monsters_invis(bool aware
    13971408{ 
    13981409        int i, y, x; 
     
    14571468        if (flag) 
    14581469                msg_print("You sense the presence of invisible creatures!"); 
     1470        else if (aware && !flag) 
     1471                msg_print("You sense no invisible creatures."); 
    14591472 
    14601473        return (flag); 
     
    14661479 * Detect "evil" monsters around the player. 
    14671480 */ 
    1468 bool detect_monsters_evil(void
     1481bool detect_monsters_evil(bool aware
    14691482{ 
    14701483        int i, y, x; 
     
    15291542        if (flag) 
    15301543                msg_print("You sense the presence of evil creatures!"); 
     1544        else if (aware && !flag) 
     1545                msg_print("You sense no evil creatures."); 
    15311546 
    15321547        return flag; 
     
    15381553 * Detect everything 
    15391554 */ 
    1540 bool detect_all(void
     1555bool detect_all(bool aware
    15411556{ 
    15421557        bool detect = FALSE; 
    15431558 
    15441559        /* Detect everything */ 
    1545         if (detect_traps()) detect = TRUE; 
    1546         if (detect_doorstairs()) detect = TRUE; 
    1547         if (detect_treasure()) detect = TRUE; 
    1548         if (detect_monsters_invis()) detect = TRUE; 
    1549         if (detect_monsters_normal()) detect = TRUE; 
     1560        if (detect_traps(aware)) detect = TRUE; 
     1561        if (detect_doorstairs(aware)) detect = TRUE; 
     1562        if (detect_treasure(aware)) detect = TRUE; 
     1563        if (detect_monsters_invis(aware)) detect = TRUE; 
     1564        if (detect_monsters_normal(aware)) detect = TRUE; 
    15501565 
    15511566        /* Result */ 
  • trunk/src/wizard.c

    r673 r755  
    15391539                case 'd': 
    15401540                { 
    1541                         detect_all(); 
     1541                        detect_all(TRUE); 
    15421542                        break; 
    15431543                } 
  • trunk/src/x-spell.c

    r580 r755  
    491491                case SPELL_DETECT_MONSTERS: 
    492492                { 
    493                         (void)detect_monsters_normal(); 
     493                        (void)detect_monsters_normal(TRUE); 
    494494                        break; 
    495495                } 
     
    509509                case SPELL_TREASURE_DETECTION: 
    510510                { 
    511                         (void)detect_treasure(); 
     511                        (void)detect_treasure(TRUE); 
    512512                        break; 
    513513                } 
     
    523523                case SPELL_FIND_TRAPS_DOORS: 
    524524                { 
    525                         (void)detect_traps(); 
    526                         (void)detect_doorstairs(); 
     525                        (void)detect_traps(TRUE); 
     526                        (void)detect_doorstairs(TRUE); 
    527527                        break; 
    528528                } 
     
    767767                case SPELL_DETECT_INVISIBLE: 
    768768                { 
    769                         (void)detect_monsters_invis(); 
     769                        (void)detect_monsters_invis(TRUE); 
    770770                        break; 
    771771                } 
     
    773773                case SPELL_DETECT_ENCHANTMENT: 
    774774                { 
    775                         (void)detect_objects_magic(); 
     775                        (void)detect_objects_magic(TRUE); 
    776776                        break; 
    777777                } 
     
    923923                case PRAYER_DETECT_EVIL: 
    924924                { 
    925                         (void)detect_monsters_evil(); 
     925                        (void)detect_monsters_evil(TRUE); 
    926926                        break; 
    927927                } 
     
    954954                case PRAYER_FIND_TRAPS: 
    955955                { 
    956                         (void)detect_traps(); 
     956                        (void)detect_traps(TRUE); 
    957957                        break; 
    958958                } 
     
    960960                case PRAYER_DETECT_DOORS_STAIRS: 
    961961                { 
    962                         (void)detect_doorstairs(); 
     962                        (void)detect_doorstairs(TRUE); 
    963963                        break; 
    964964                } 
     
    11281128                case PRAYER_DETECT_MONSTERS: 
    11291129                { 
    1130                         (void)detect_monsters_normal(); 
     1130                        (void)detect_monsters_normal(TRUE); 
    11311131                        break; 
    11321132                } 
     
    11341134                case PRAYER_DETECTION: 
    11351135                { 
    1136                         (void)detect_all(); 
     1136                        (void)detect_all(TRUE); 
    11371137                        break; 
    11381138                }