(void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
break;
case 4: /* Detect Traps + Secret Doors */
- (void)detect_traps(DETECT_RAD_DEFAULT);
+ (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
(void)detect_doors(DETECT_RAD_DEFAULT);
(void)detect_stairs(DETECT_RAD_DEFAULT);
break;
teleport_player(10);
break;
case 2: /* Detect Doors and Traps */
- (void)detect_traps(DETECT_RAD_DEFAULT);
+ (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
(void)detect_doors(DETECT_RAD_DEFAULT);
(void)detect_stairs(DETECT_RAD_DEFAULT);
break;
damroll(3 + ((plev - 1) / 5), 4));
break;
case 2: /* Detect Doors & Traps */
- (void)detect_traps(DETECT_RAD_DEFAULT);
+ (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
(void)detect_doors(DETECT_RAD_DEFAULT);
(void)detect_stairs(DETECT_RAD_DEFAULT);
break;
break;
case 10: /* Nature Awareness -- downgraded */
map_area(DETECT_RAD_MAP);
- (void)detect_traps(DETECT_RAD_DEFAULT);
+ (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
(void)detect_doors(DETECT_RAD_DEFAULT);
(void)detect_stairs(DETECT_RAD_DEFAULT);
(void)detect_monsters_normal(DETECT_RAD_DEFAULT);
(void)set_cut(p_ptr->cut - 10);
break;
case 8: /* Detect Doors & Traps */
- (void)detect_traps(DETECT_RAD_DEFAULT);
+ (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
(void)detect_doors(DETECT_RAD_DEFAULT);
(void)detect_stairs(DETECT_RAD_DEFAULT);
break;
wiz_lite(TRUE, FALSE);
(void)do_inc_stat(A_INT);
(void)do_inc_stat(A_WIS);
- (void)detect_traps(DETECT_RAD_DEFAULT);
+ (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
(void)detect_doors(DETECT_RAD_DEFAULT);
(void)detect_stairs(DETECT_RAD_DEFAULT);
(void)detect_treasure(DETECT_RAD_DEFAULT);
* include scrolls with no effects but recharge or identify, which are
* cancelled before use. XXX Reading them still takes a turn, though.
*/
-static void do_cmd_read_scroll_aux(int item)
+static void do_cmd_read_scroll_aux(int item, bool known)
{
int k, used_up, ident, lev;
object_type *o_ptr;
case SV_SCROLL_DETECT_TRAP:
{
- if (detect_traps(DETECT_RAD_DEFAULT)) ident = TRUE;
+ if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
break;
}
void do_cmd_read_scroll(void)
{
+ object_type *o_ptr;
int item;
cptr q, s;
if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
+ /* Get the item (in the pack) */
+ if (item >= 0)
+ {
+ o_ptr = &inventory[item];
+ }
+
+ /* Get the item (on the floor) */
+ else
+ {
+ o_ptr = &o_list[0 - item];
+ }
+
/* Read the scroll */
- do_cmd_read_scroll_aux(item);
+ do_cmd_read_scroll_aux(item, object_aware_p(o_ptr));
}
-static int staff_effect(int sval, bool *use_charge, bool magic)
+static int staff_effect(int sval, bool *use_charge, bool magic, bool known)
{
int k;
int ident = FALSE;
case SV_STAFF_DETECT_TRAP:
{
- if (detect_traps(DETECT_RAD_DEFAULT)) ident = TRUE;
+ if (detect_traps(DETECT_RAD_DEFAULT, known)) ident = TRUE;
break;
}
/* Sound */
sound(SOUND_ZAP);
- ident = staff_effect(o_ptr->sval, &use_charge, FALSE);
+ ident = staff_effect(o_ptr->sval, &use_charge, FALSE, object_aware_p(o_ptr));
if (!(object_aware_p(o_ptr)))
{
{
case SV_ROD_DETECT_TRAP:
{
- if (detect_traps(DETECT_RAD_DEFAULT)) ident = TRUE;
+ if (detect_traps(DETECT_RAD_DEFAULT, dir ? TRUE : FALSE)) ident = TRUE;
break;
}
*/
static void do_cmd_zap_rod_aux(int item)
{
- int ident, chance, dir, lev, fail;
+ int ident, chance, lev, fail;
+ int dir = 0;
object_type *o_ptr;
bool success;
take_hit(DAMAGE_LOSELIFE, damroll(3, 8), "the Jewel of Judgement", -1);
#endif
- (void)detect_traps(DETECT_RAD_DEFAULT);
+ (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
(void)detect_doors(DETECT_RAD_DEFAULT);
(void)detect_stairs(DETECT_RAD_DEFAULT);
return;
}
- do_cmd_read_scroll_aux(item);
+ do_cmd_read_scroll_aux(item, TRUE);
break;
}
}
else
{
- staff_effect(sval, &use_charge, TRUE);
+ staff_effect(sval, &use_charge, TRUE, TRUE);
if (!use_charge) return;
/* Delayed optimization */
case MUSIC_DETECT:
case MUSIC_DETECT+1:
case MUSIC_DETECT+2:
- detect_traps(DETECT_RAD_DEFAULT);
+ detect_traps(DETECT_RAD_DEFAULT, TRUE);
detect_doors(DETECT_RAD_DEFAULT);
detect_stairs(DETECT_RAD_DEFAULT);
if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
/* spells2.c */
extern void message_pain(int m_idx, int dam);
extern void self_knowledge(void);
-extern bool detect_traps(int range);
+extern bool detect_traps(int range, bool known);
extern bool detect_doors(int range);
extern bool detect_stairs(int range);
extern bool detect_treasure(int range);
b = detect_monsters_normal(DETECT_RAD_DEFAULT);
if (plev > 14) b |= detect_monsters_invis(DETECT_RAD_DEFAULT);
if (plev > 4) {
- b |= detect_traps(DETECT_RAD_DEFAULT);
+ b |= detect_traps(DETECT_RAD_DEFAULT, TRUE);
b |= detect_doors(DETECT_RAD_DEFAULT);
}
}
detect_monsters_normal(DETECT_RAD_DEFAULT);
if (plev > 4)
{
- detect_traps(DETECT_RAD_DEFAULT);
+ detect_traps(DETECT_RAD_DEFAULT, TRUE);
detect_doors(DETECT_RAD_DEFAULT);
detect_stairs(DETECT_RAD_DEFAULT);
}
msg_print("You examine your surroundings.");
#endif
- (void)detect_traps(DETECT_RAD_DEFAULT);
+ (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
(void)detect_doors(DETECT_RAD_DEFAULT);
(void)detect_stairs(DETECT_RAD_DEFAULT);
}
msg_print("You examine your surroundings.");
#endif
- (void)detect_traps(DETECT_RAD_DEFAULT);
+ (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
(void)detect_doors(DETECT_RAD_DEFAULT);
(void)detect_stairs(DETECT_RAD_DEFAULT);
}
/*
* Detect all traps on current panel
*/
-bool detect_traps(int range)
+bool detect_traps(int range, bool known)
{
int x, y;
bool detect = FALSE;
c_ptr = &cave[y][x];
/* Mark as detected */
- if (dist <= range)
+ if (dist <= range && known)
{
if (dist <= range - 1)
c_ptr->info |= (CAVE_IN_DETECT);
bool detect = FALSE;
/* Detect everything */
- if (detect_traps(range)) detect = TRUE;
+ if (detect_traps(range, TRUE)) detect = TRUE;
if (detect_doors(range)) detect = TRUE;
if (detect_stairs(range)) detect = TRUE;
if (detect_treasure(range)) detect = TRUE;