OSDN Git Service

[Refactor] #37353 幻覚によるコマンド制約を cmd_limit_image() に分離。 / Separate cmd_limit_image().
authordeskull <deskull@users.sourceforge.jp>
Thu, 7 Mar 2019 12:12:12 +0000 (21:12 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Thu, 7 Mar 2019 12:12:12 +0000 (21:12 +0900)
src/cmd2.c
src/externs.h
src/snipe.c

index 0988b76..fd5cd5a 100644 (file)
@@ -95,6 +95,16 @@ bool cmd_limit_confused(player_type *creature_ptr)
        return FALSE;
 }
 
+bool cmd_limit_image(player_type *creature_ptr)
+{
+       if (creature_ptr->image)
+       {
+               msg_print(_("幻覚が見えて集中できない!", "You are too hallucinated!"));
+               return TRUE;
+       }
+       return FALSE;
+}
+
 bool cmd_limit_arena(player_type *creature_ptr)
 {
        if (creature_ptr->inside_arena)
index 8c9d3c9..b07bfcd 100644 (file)
@@ -492,6 +492,7 @@ extern bool cmd_limit_arena(player_type *creature_ptr);
 extern bool cmd_limit_time_walk(player_type *creature_ptr);
 extern bool cmd_limit_blind(player_type *creature_ptr);
 extern bool cmd_limit_confused(player_type *creature_ptr);
+extern bool cmd_limit_image(player_type *creature_ptr);
 extern void forget_travel_flow(void);
 extern void do_cmd_go_up(void);
 extern void do_cmd_go_down(void);
index 37f95b5..e82f7ca 100644 (file)
@@ -536,14 +536,8 @@ void do_cmd_snipe(void)
        COMMAND_CODE n = 0;
        bool            cast;
 
-       if (cmd_limit_confused(p_ptr)) return;
-
-       /* not if hullucinated */
-       if (p_ptr->image)
-       {
-               msg_print(_("幻覚が見えて集中できない!", "You are too hallucinated!"));
-               return;
-       }
+       if(cmd_limit_confused(p_ptr)) return;
+       if(cmd_limit_image(p_ptr)) return;
 
        /* not if stuned */
        if (p_ptr->stun)