OSDN Git Service

更新指示に関する変更.
[hengband/hengband.git] / src / cmd2.c
index cc2fff9..da90f68 100644 (file)
@@ -1124,9 +1124,6 @@ static bool do_cmd_open_aux(int y, int x)
                        /* Open the door */
                        cave_alter_feat(y, x, FF_OPEN);
 
-                       /* Update some things */
-                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
-
                        /* Sound */
                        sound(SOUND_OPENDOOR);
 
@@ -1159,9 +1156,6 @@ static bool do_cmd_open_aux(int y, int x)
                /* Open the door */
                cave_alter_feat(y, x, FF_OPEN);
 
-               /* Update some things */
-               p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
-
                /* Sound */
                sound(SOUND_OPENDOOR);
        }
@@ -1321,8 +1315,11 @@ static bool do_cmd_close_aux(int y, int x)
        /* Open door */
        if (have_flag(f_info[old_feat].flags, FF_CLOSE))
        {
+               s16b closed_feat = feat_state(old_feat, FF_CLOSE);
+
                /* Hack -- object in the way */
-               if ((c_ptr->o_idx || (c_ptr->info & CAVE_OBJECT)) && (feat_state(old_feat, FF_CLOSE) != old_feat))
+               if ((c_ptr->o_idx || (c_ptr->info & CAVE_OBJECT)) &&
+                   (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
                {
                        /* Message */
 #ifdef JP
@@ -1348,9 +1345,6 @@ static bool do_cmd_close_aux(int y, int x)
                        }
                        else
                        {
-                               /* Update some things */
-                               p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
-
                                /* Sound */
                                sound(SOUND_SHUTDOOR);
                        }
@@ -1576,7 +1570,7 @@ static bool do_cmd_tunnel_aux(int y, int x)
                        cave_alter_feat(y, x, FF_TUNNEL);
 
                        /* Update some things */
-                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
+                       p_ptr->update |= (PU_FLOW);
                }
                else
                {
@@ -1600,18 +1594,23 @@ static bool do_cmd_tunnel_aux(int y, int x)
                {
 #ifdef JP
                        if (tree) msg_format("%s¤òÀÚ¤êʧ¤Ã¤¿¡£", name);
-                       else msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
+                       else
+                       {
+                               msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
+                               p_ptr->update |= (PU_FLOW);
+                       }
 #else
                        if (tree) msg_format("You have cleared away the %s.", name);
-                       else msg_print("You have finished the tunnel.");
+                       else
+                       {
+                               msg_print("You have finished the tunnel.");
+                               p_ptr->update |= (PU_FLOW);
+                       }
 #endif
 
                        /* Remove the feature */
                        cave_alter_feat(y, x, FF_TUNNEL);
 
-                       /* Update some things */
-                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
-
                        chg_virtue(V_DILIGENCE, 1);
                        chg_virtue(V_NATURE, -1);
                }
@@ -1823,13 +1822,9 @@ bool easy_open_door(int y, int x)
                        msg_print("You have picked the lock.");
 #endif
 
-
                        /* Open the door */
                        cave_alter_feat(y, x, FF_OPEN);
 
-                       /* Update some things */
-                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
-
                        /* Sound */
                        sound(SOUND_OPENDOOR);
 
@@ -1859,9 +1854,6 @@ bool easy_open_door(int y, int x)
                /* Open the door */
                cave_alter_feat(y, x, FF_OPEN);
 
-               /* Update some things */
-               p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
-
                /* Sound */
                sound(SOUND_OPENDOOR);
        }
@@ -2300,10 +2292,6 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
 
                /* Hack -- Fall through the door */
                move_player(dir, FALSE, FALSE);
-
-               /* Update some things */
-               p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
-               p_ptr->update |= (PU_DISTANCE);
        }
 
        /* Saving throw against stun */
@@ -3359,7 +3347,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
 void do_cmd_fire_aux(int item, object_type *j_ptr)
 {
        int dir;
-       int j, y, x, ny, nx, ty, tx;
+       int j, y, x, ny, nx, ty, tx, prev_y, prev_x;
        int tdam, tdis, thits, tmul;
        int bonus, chance;
        int cur_dis, visible;
@@ -3501,6 +3489,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        /* Hack -- Handle stuff */
        handle_stuff();
 
+       /* Save the old location */
+       prev_y = y;
+       prev_x = x;
 
        /* Travel until stopped */
        for (cur_dis = 0; cur_dis <= tdis; )
@@ -3542,6 +3533,10 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                        Term_xtra(TERM_XTRA_DELAY, msec);
                }
 
+               /* Save the old location */
+               prev_y = y;
+               prev_x = x;
+
                /* Save the new location */
                x = nx;
                y = ny;
@@ -3720,27 +3715,27 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        /* Chance of breakage (during attacks) */
        j = (hit_body ? breakage_chance(q_ptr) : 0);
 
-       if(stick_to)
+       if (stick_to)
        {
                int m_idx = cave[y][x].m_idx;
                monster_type *m_ptr = &m_list[m_idx];
                int o_idx = o_pop();
 
                if (!o_idx)
-                 {
+               {
 #ifdef JP
-                   msg_format("%s¤Ï¤É¤³¤«¤Ø¹Ô¤Ã¤¿¡£", o_name);
+                       msg_format("%s¤Ï¤É¤³¤«¤Ø¹Ô¤Ã¤¿¡£", o_name);
 #else
-                   msg_format("The %s have gone to somewhere.", o_name);
+                       msg_format("The %s have gone to somewhere.", o_name);
 #endif
-                   if (object_is_fixed_artifact(q_ptr))
-                     {
-                       a_info[j_ptr->name1].cur_num = 0;
-                     }
-                   return;
-                 }
-
-               o_ptr = &o_list[ o_idx ];
+                       if (object_is_fixed_artifact(q_ptr))
+                       {
+                               a_info[j_ptr->name1].cur_num = 0;
+                       }
+                       return;
+               }
+
+               o_ptr = &o_list[o_idx];
                object_copy(o_ptr, q_ptr);
 
                /* Forget mark */
@@ -3757,11 +3752,17 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
 
                /* Carry object */
                m_ptr->hold_o_idx = o_idx;
-
        }
-       else
+       else if (cave_have_flag_bold(y, x, FF_PROJECT))
+       {
                /* Drop (or break) near that location */
                (void)drop_near(q_ptr, j, y, x);
+       }
+       else
+       {
+               /* Drop (or break) near that location */
+               (void)drop_near(q_ptr, j, prev_y, prev_x);
+       }
 }
 
 
@@ -3847,7 +3848,7 @@ static bool item_tester_hook_boomerang(object_type *o_ptr)
 bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
 {
        int dir, item;
-       int i, j, y, x, ty, tx;
+       int i, j, y, x, ty, tx, prev_y, prev_x;
        int ny[19], nx[19];
        int chance, tdam, tdis;
        int mul, div;
@@ -4073,6 +4074,10 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
 
        if (shuriken) chance *= 2;
 
+       /* Save the old location */
+       prev_y = y;
+       prev_x = x;
+
        /* Travel until stopped */
        for (cur_dis = 0; cur_dis <= tdis; )
        {
@@ -4088,24 +4093,21 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT))
                {
                        hit_wall = TRUE;
-                       break;
+                       if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !cave[ny[cur_dis]][nx[cur_dis]].m_idx) break;
                }
 
-               /* Advance the distance */
-               cur_dis++;
-
                /* The player can see the (on screen) missile */
-               if (panel_contains(ny[cur_dis-1], nx[cur_dis-1]) && player_can_see_bold(ny[cur_dis-1], nx[cur_dis-1]))
+               if (panel_contains(ny[cur_dis], nx[cur_dis]) && player_can_see_bold(ny[cur_dis], nx[cur_dis]))
                {
                        char c = object_char(q_ptr);
                        byte a = object_attr(q_ptr);
 
                        /* Draw, Hilite, Fresh, Pause, Erase */
-                       print_rel(c, a, ny[cur_dis-1], nx[cur_dis-1]);
-                       move_cursor_relative(ny[cur_dis-1], nx[cur_dis-1]);
+                       print_rel(c, a, ny[cur_dis], nx[cur_dis]);
+                       move_cursor_relative(ny[cur_dis], nx[cur_dis]);
                        Term_fresh();
                        Term_xtra(TERM_XTRA_DELAY, msec);
-                       lite_spot(ny[cur_dis-1], nx[cur_dis-1]);
+                       lite_spot(ny[cur_dis], nx[cur_dis]);
                        Term_fresh();
                }
 
@@ -4116,10 +4118,16 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                        Term_xtra(TERM_XTRA_DELAY, msec);
                }
 
+               /* Save the old location */
+               prev_y = y;
+               prev_x = x;
+
                /* Save the new location */
-               x = nx[cur_dis-1];
-               y = ny[cur_dis-1];
+               x = nx[cur_dis];
+               y = ny[cur_dis];
 
+               /* Advance the distance */
+               cur_dis++;
 
                /* Monster here, Try to hit it */
                if (cave[y][x].m_idx)
@@ -4346,7 +4354,7 @@ msg_print("
 
                if((back_chance > 30) && (!one_in_(100) || super_boomerang))
                {
-                       for (i = cur_dis-1;i>0;i--)
+                       for (i = cur_dis - 1; i > 0; i--)
                        {
                                if (panel_contains(ny[i], nx[i]) && player_can_see_bold(ny[i], nx[i]))
                                {
@@ -4449,7 +4457,19 @@ msg_print("
        }
 
        /* Drop (or break) near that location */
-       if (do_drop) (void)drop_near(q_ptr, j, y, x);
+       if (do_drop)
+       {
+               if (cave_have_flag_bold(y, x, FF_PROJECT))
+               {
+                       /* Drop (or break) near that location */
+                       (void)drop_near(q_ptr, j, y, x);
+               }
+               else
+               {
+                       /* Drop (or break) near that location */
+                       (void)drop_near(q_ptr, j, prev_y, prev_x);
+               }
+       }
 
        return TRUE;
 }