OSDN Git Service

Enable to open chests or disarm traps at player's feet when there are chests and...
authoriks <iks@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 1 Feb 2013 17:47:34 +0000 (17:47 +0000)
committeriks <iks@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 1 Feb 2013 17:47:34 +0000 (17:47 +0000)
src/cmd2.c
src/xtra2.c

index 251a555..03b9b04 100644 (file)
@@ -438,7 +438,7 @@ void do_cmd_search(void)
 /*
  * Determine if a grid contains a chest
  */
-static s16b chest_check(int y, int x)
+static s16b chest_check(int y, int x, bool trapped)
 {
        cave_type *c_ptr = &cave[y][x];
 
@@ -459,8 +459,13 @@ static s16b chest_check(int y, int x)
                /* Skip unknown chests XXX XXX */
                /* if (!(o_ptr->marked & OM_FOUND)) continue; */
 
-               /* Check for chest */
-               if (o_ptr->tval == TV_CHEST) return (this_o_idx);
+               /* Check for non empty chest */
+               if ((o_ptr->tval == TV_CHEST) &&
+                       (((!trapped) && (o_ptr->pval)) || /* non empty */
+                       ((trapped) && (o_ptr->pval > 0)))) /* trapped only */
+               {
+                       return (this_o_idx);
+               }
        }
 
        /* No chest */
@@ -1032,7 +1037,7 @@ static int count_chests(int *y, int *x, bool trapped)
                int xx = px + ddx_ddd[d];
 
                /* No (visible) chest is there */
-               if ((o_idx = chest_check(yy, xx)) == 0) continue;
+               if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
 
                /* Grab the object */
                o_ptr = &o_list[o_idx];
@@ -1261,7 +1266,7 @@ void do_cmd_open(void)
                feat = get_feat_mimic(c_ptr);
 
                /* Check for chest */
-               o_idx = chest_check(y, x);
+               o_idx = chest_check(y, x, FALSE);
 
                /* Nothing useful */
                if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
@@ -2198,7 +2203,7 @@ void do_cmd_disarm(void)
                feat = get_feat_mimic(c_ptr);
 
                /* Check for chests */
-               o_idx = chest_check(y, x);
+               o_idx = chest_check(y, x, TRUE);
 
                /* Disarm a trap */
                if (!is_trap(feat) && !o_idx)
index 4d20c82..76d95eb 100644 (file)
@@ -4510,6 +4510,7 @@ msg_print("
 bool get_rep_dir(int *dp, bool under)
 {
        int dir;
+       cptr prompt;
 
        /* Initialize */
        (*dp) = 0;
@@ -4527,24 +4528,36 @@ bool get_rep_dir(int *dp, bool under)
 
 #endif /* ALLOW_REPEAT -- TNB */
 
+       if (under)
+       {
+               prompt = _("Êý¸þ ('.'­¸µ, ESC¤ÇÃæÃÇ)? ", "Direction ('.' at feet, Escape to cancel)? ");
+       }
+       else
+       {
+               prompt = _("Êý¸þ (ESC¤ÇÃæÃÇ)? ", "Direction (Escape to cancel)? ");
+       }
+       
        /* Get a direction */
        while (!dir)
        {
                char ch;
 
                /* Get a command (or Cancel) */
-#ifdef JP
-if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
-#else
-               if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
-#endif
+               if (!get_com(prompt, &ch, TRUE)) break;
 
+               /* Look down */
+               if ((under) && ((ch == '5') || (ch == '-') || (ch == '.')))
+               {
+                       dir = 5;
+               }
+               else
+               {
+                       /* Look up the direction */
+                       dir = get_keymap_dir(ch);
 
-               /* Look up the direction */
-               dir = get_keymap_dir(ch);
-
-               /* Oops */
-               if (!dir) bell();
+                       /* Oops */
+                       if (!dir) bell();
+               }
        }
 
        /* Prevent weirdness */