Skip to content

Commit

Permalink
Object sensing: scan full pile for noticing; do not notice known igno…
Browse files Browse the repository at this point in the history
…red items

See discussion here, https://forum.angband.live/forum/showthread.php?t=11614 .  In object detection, also scan full pile for noticing.
  • Loading branch information
backwardsEric authored and NickMcConnell committed Dec 12, 2023
1 parent 7338378 commit 0218ca1
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/effect-handler-general.c
Original file line number Diff line number Diff line change
Expand Up @@ -1685,8 +1685,19 @@ bool effect_handler_SENSE_OBJECTS(effect_handler_context_t *context)
continue;
}

/* Notice an object is detected */
objects = true;
/*
* Is there any object which either has not been seen
* or has been seen and is not ignored? If so, notify
* the player.
*/
for (; !objects && obj; obj = obj->next) {
if (!obj->known
|| obj->known->kind == unknown_gold_kind
|| obj->known->kind == unknown_item_kind
|| !ignore_item_ok(player, obj)) {
objects = true;
}
}

/* Mark the pile as aware */
square_sense_pile(cave, grid);
Expand Down Expand Up @@ -1739,9 +1750,14 @@ bool effect_handler_DETECT_OBJECTS(effect_handler_context_t *context)
continue;
}

/* Notice an object is detected */
if (!ignore_item_ok(player, obj)) {
objects = true;
/*
* Is there any object which is not ignored? If so,
* notify the player.
*/
for (; !objects && obj; obj = obj->next) {
if (!ignore_item_ok(player, obj)) {
objects = true;
}
}

/* Mark the pile as seen */
Expand Down

0 comments on commit 0218ca1

Please sign in to comment.