Be able to disarm and open chests under the player
@@ -362,7 +362,7 @@ | ||
362 | 362 | /* |
363 | 363 | * Determine if a grid contains a chest |
364 | 364 | */ |
365 | -static s16b chest_check(int y, int x) | |
365 | +static s16b chest_check(int y, int x, bool trapped) | |
366 | 366 | { |
367 | 367 | cave_type *c_ptr = &cave[y][x]; |
368 | 368 |
@@ -382,8 +382,13 @@ | ||
382 | 382 | /* Skip unknown chests XXX XXX */ |
383 | 383 | /* if (!(o_ptr->marked & OM_FOUND)) continue; */ |
384 | 384 | |
385 | - /* Check for chest */ | |
386 | - if (o_ptr->tval == TV_CHEST) return (this_o_idx); | |
385 | + /* Check for non empty chest */ | |
386 | + if ((o_ptr->tval == TV_CHEST) && | |
387 | + (((!trapped) && (o_ptr->pval)) || /* non empty */ | |
388 | + ((trapped) && (o_ptr->pval > 0)))) /* trapped only */ | |
389 | + { | |
390 | + return (this_o_idx); | |
391 | + } | |
387 | 392 | } |
388 | 393 | |
389 | 394 | /* No chest */ |
@@ -750,7 +755,7 @@ | ||
750 | 755 | int xx = px + ddx_ddd[d]; |
751 | 756 | |
752 | 757 | /* No (visible) chest is there */ |
753 | - if ((o_idx = chest_check(yy, xx)) == 0) continue; | |
758 | + if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue; | |
754 | 759 | |
755 | 760 | /* Grab the object */ |
756 | 761 | o_ptr = &o_list[o_idx]; |
@@ -971,7 +976,7 @@ | ||
971 | 976 | c_ptr = &cave[y][x]; |
972 | 977 | |
973 | 978 | /* Check for chest */ |
974 | - o_idx = chest_check(y, x); | |
979 | + o_idx = chest_check(y, x, FALSE); | |
975 | 980 | |
976 | 981 | /* Nothing useful */ |
977 | 982 | if (!((c_ptr->feat >= FEAT_DOOR_HEAD) && |
@@ -2047,7 +2052,7 @@ | ||
2047 | 2052 | c_ptr = &cave[y][x]; |
2048 | 2053 | |
2049 | 2054 | /* Check for chests */ |
2050 | - o_idx = chest_check(y, x); | |
2055 | + o_idx = chest_check(y, x, TRUE); | |
2051 | 2056 | |
2052 | 2057 | /* Disarm a trap */ |
2053 | 2058 | if (!is_trap(c_ptr->feat) && !o_idx) |
@@ -3591,6 +3591,7 @@ | ||
3591 | 3591 | bool get_rep_dir_aux(int *dp, bool under) |
3592 | 3592 | { |
3593 | 3593 | int dir; |
3594 | + cptr prompt; | |
3594 | 3595 | |
3595 | 3596 | /* Repeat previous command */ |
3596 | 3597 | if (repeat_pull(dp)) |
@@ -3604,6 +3605,15 @@ | ||
3604 | 3605 | /* Global direction */ |
3605 | 3606 | dir = command_dir; |
3606 | 3607 | |
3608 | + if (under) | |
3609 | + { | |
3610 | + prompt = _("方向 ('.'足元, ESCで中断)? ", "Direction ('.' at feet, Escape to cancel)? "); | |
3611 | + } | |
3612 | + else | |
3613 | + { | |
3614 | + prompt = _("方向 (ESCで中断)? ", "Direction (Escape to cancel)? "); | |
3615 | + } | |
3616 | + | |
3607 | 3617 | /* Get a direction */ |
3608 | 3618 | while (!dir) |
3609 | 3619 | { |
@@ -3610,18 +3620,21 @@ | ||
3610 | 3620 | char ch; |
3611 | 3621 | |
3612 | 3622 | /* Get a command (or Cancel) */ |
3613 | -#ifdef JP | |
3614 | -if (!get_com("方向 (ESCで中断)? ", &ch)) break; | |
3615 | -#else | |
3616 | - if (!get_com("Direction (Escape to cancel)? ", &ch)) break; | |
3617 | -#endif | |
3623 | + if (!get_com(prompt, &ch)) break; | |
3618 | 3624 | |
3625 | + /* Look down */ | |
3626 | + if ((under) && ((ch == '5') || (ch == '-') || (ch == '.'))) | |
3627 | + { | |
3628 | + dir = 5; | |
3629 | + } | |
3630 | + else | |
3631 | + { | |
3632 | + /* Look up the direction */ | |
3633 | + dir = get_keymap_dir(ch); | |
3619 | 3634 | |
3620 | - /* Look up the direction */ | |
3621 | - dir = get_keymap_dir(ch); | |
3622 | - | |
3623 | - /* Oops */ | |
3624 | - if (!dir) bell(); | |
3635 | + /* Oops */ | |
3636 | + if (!dir) bell(); | |
3637 | + } | |
3625 | 3638 | } |
3626 | 3639 | |
3627 | 3640 | /* Prevent weirdness */ |
@@ -3648,12 +3661,7 @@ | ||
3648 | 3661 | if (command_dir != dir) |
3649 | 3662 | { |
3650 | 3663 | /* Warn the user */ |
3651 | -#ifdef JP | |
3652 | -msg_print("あなたは混乱している。"); | |
3653 | -#else | |
3654 | - msg_print("You are confused."); | |
3655 | -#endif | |
3656 | - | |
3664 | + msg_print(_("あなたは混乱している。", "You are confused.")); | |
3657 | 3665 | } |
3658 | 3666 | |
3659 | 3667 | /* Save direction */ |