/*
* Search for hidden things
*/
-void search(void)
+static void discover_hidden_things(int y, int x)
{
- int y, x, chance;
-
s16b this_o_idx, next_o_idx = 0;
cave_type *c_ptr;
+ /* Access the grid */
+ c_ptr = &cave[y][x];
- /* Start with base search ability */
- chance = p_ptr->skill_srh;
+ /* Invisible trap */
+ if (c_ptr->mimic && is_trap(c_ptr->feat))
+ {
+ /* Pick a trap */
+ disclose_grid(y, x);
- /* Penalize various conditions */
- if (p_ptr->blind || no_lite()) chance = chance / 10;
- if (p_ptr->confused || p_ptr->image) chance = chance / 10;
+ /* Message */
+ msg_print(_("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£", "You have found a trap."));
- /* Search the nearby grids, which are always in bounds */
- for (y = (py - 1); y <= (py + 1); y++)
+ /* Disturb */
+ disturb(0, 1);
+ }
+
+ /* Secret door */
+ if (is_hidden_door(c_ptr))
{
- for (x = (px - 1); x <= (px + 1); x++)
- {
- /* Sometimes, notice things */
- if (randint0(100) < chance)
- {
- /* Access the grid */
- c_ptr = &cave[y][x];
+ /* Message */
+ msg_print(_("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£", "You have found a secret door."));
- /* Invisible trap */
- if (c_ptr->mimic && is_trap(c_ptr->feat))
- {
- /* Pick a trap */
- disclose_grid(y, x);
+ /* Disclose */
+ disclose_grid(y, x);
- /* Message */
-#ifdef JP
- msg_print("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£");
-#else
- msg_print("You have found a trap.");
-#endif
+ /* Disturb */
+ disturb(0, 0);
+ }
- /* Disturb */
- disturb(0, 1);
- }
+ /* Scan all objects in the grid */
+ for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
+ {
+ object_type *o_ptr;
- /* Secret door */
- if (is_hidden_door(c_ptr))
- {
- /* Message */
-#ifdef JP
- msg_print("±£¤·¥É¥¢¤òȯ¸«¤·¤¿¡£");
-#else
- msg_print("You have found a secret door.");
-#endif
+ /* Acquire object */
+ o_ptr = &o_list[this_o_idx];
- /* Disclose */
- disclose_grid(y, x);
+ /* Acquire next object */
+ next_o_idx = o_ptr->next_o_idx;
- /* Disturb */
- disturb(0, 0);
- }
+ /* Skip non-chests */
+ if (o_ptr->tval != TV_CHEST) continue;
- /* Scan all objects in the grid */
- for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
- {
- object_type *o_ptr;
+ /* Skip non-trapped chests */
+ if (!chest_traps[o_ptr->pval]) continue;
- /* Acquire object */
- o_ptr = &o_list[this_o_idx];
+ /* Identify once */
+ if (!object_is_known(o_ptr))
+ {
+ /* Message */
+ msg_print(_("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª", "You have discovered a trap on the chest!"));
- /* Acquire next object */
- next_o_idx = o_ptr->next_o_idx;
+ /* Know the trap */
+ object_known(o_ptr);
- /* Skip non-chests */
- if (o_ptr->tval != TV_CHEST) continue;
+ /* Notice it */
+ disturb(0, 0);
+ }
+ }
+}
- /* Skip non-trapped chests */
- if (!chest_traps[o_ptr->pval]) continue;
+void search(void)
+{
+ int i, chance;
- /* Identify once */
- if (!object_is_known(o_ptr))
- {
- /* Message */
-#ifdef JP
- msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤¿¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡ª");
-#else
- msg_print("You have discovered a trap on the chest!");
-#endif
+ /* Start with base search ability */
+ chance = p_ptr->skill_srh;
- /* Know the trap */
- object_known(o_ptr);
+ /* Penalize various conditions */
+ if (p_ptr->blind || no_lite()) chance = chance / 10;
+ if (p_ptr->confused || p_ptr->image) chance = chance / 10;
- /* Notice it */
- disturb(0, 0);
- }
- }
- }
+ /* Search the nearby grids, which are always in bounds */
+ for (i = 0; i < 9; ++ i)
+ {
+ /* Sometimes, notice things */
+ if (randint0(100) < chance)
+ {
+ discover_hidden_things(py + ddy_ddd[i], px + ddx_ddd[i]);
}
}
}