• R/O
  • SSH
  • HTTPS

xangband: Commit


Commit MetaInfo

Révision1882 (tree)
l'heure2013-03-15 15:04:18
Auteuriks

Message de Log

Be able to disarm and open chests under the player

Change Summary

Modification

--- TinyAngband/trunk/src/cmd2.c (revision 1881)
+++ TinyAngband/trunk/src/cmd2.c (revision 1882)
@@ -362,7 +362,7 @@
362362 /*
363363 * Determine if a grid contains a chest
364364 */
365-static s16b chest_check(int y, int x)
365+static s16b chest_check(int y, int x, bool trapped)
366366 {
367367 cave_type *c_ptr = &cave[y][x];
368368
@@ -382,8 +382,13 @@
382382 /* Skip unknown chests XXX XXX */
383383 /* if (!(o_ptr->marked & OM_FOUND)) continue; */
384384
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+ }
387392 }
388393
389394 /* No chest */
@@ -750,7 +755,7 @@
750755 int xx = px + ddx_ddd[d];
751756
752757 /* 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;
754759
755760 /* Grab the object */
756761 o_ptr = &o_list[o_idx];
@@ -971,7 +976,7 @@
971976 c_ptr = &cave[y][x];
972977
973978 /* Check for chest */
974- o_idx = chest_check(y, x);
979+ o_idx = chest_check(y, x, FALSE);
975980
976981 /* Nothing useful */
977982 if (!((c_ptr->feat >= FEAT_DOOR_HEAD) &&
@@ -2047,7 +2052,7 @@
20472052 c_ptr = &cave[y][x];
20482053
20492054 /* Check for chests */
2050- o_idx = chest_check(y, x);
2055+ o_idx = chest_check(y, x, TRUE);
20512056
20522057 /* Disarm a trap */
20532058 if (!is_trap(c_ptr->feat) && !o_idx)
--- TinyAngband/trunk/src/xtra2.c (revision 1881)
+++ TinyAngband/trunk/src/xtra2.c (revision 1882)
@@ -3591,6 +3591,7 @@
35913591 bool get_rep_dir_aux(int *dp, bool under)
35923592 {
35933593 int dir;
3594+ cptr prompt;
35943595
35953596 /* Repeat previous command */
35963597 if (repeat_pull(dp))
@@ -3604,6 +3605,15 @@
36043605 /* Global direction */
36053606 dir = command_dir;
36063607
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+
36073617 /* Get a direction */
36083618 while (!dir)
36093619 {
@@ -3610,18 +3620,21 @@
36103620 char ch;
36113621
36123622 /* 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;
36183624
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);
36193634
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+ }
36253638 }
36263639
36273640 /* Prevent weirdness */
@@ -3648,12 +3661,7 @@
36483661 if (command_dir != dir)
36493662 {
36503663 /* 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."));
36573665 }
36583666
36593667 /* Save direction */
Afficher sur ancien navigateur de dépôt.