OSDN Git Service

[Refactor] #38852 いくつかの do_cmd_*() をリファクタリング。 / Refactor some do_cmd_*().
authorDeskull <deskull@users.sourceforge.jp>
Thu, 10 Jan 2019 04:13:32 +0000 (13:13 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Thu, 10 Jan 2019 04:13:32 +0000 (13:13 +0900)
src/cmd-item.c
src/cmd-zaprod.c
src/cmd-zapwand.c
src/cmd2.c
src/dungeon.c

index 2742620..0a09158 100644 (file)
@@ -1844,7 +1844,19 @@ void do_cmd_use(void)
 {
        OBJECT_IDX item;
        object_type *o_ptr;
-       cptr        q, s;
+       cptr q, s;
+
+       if (p_ptr->wild_mode)
+       {
+               return;
+       }
+
+       if (p_ptr->inside_arena)
+       {
+               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
+               msg_print(NULL);
+               return;
+       }
 
        if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
        {
index 8f3aa5d..655ae0a 100644 (file)
@@ -397,6 +397,18 @@ void do_cmd_zap_rod(void)
        OBJECT_IDX item;
        cptr q, s;
 
+       if (p_ptr->wild_mode)
+       {
+               return;
+       }
+
+       if (p_ptr->inside_arena)
+       {
+               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
+               msg_print(NULL);
+               return;
+       }
+
        if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
        {
                set_action(ACTION_NONE);
index 94380a9..298531e 100644 (file)
@@ -454,6 +454,15 @@ void do_cmd_aim_wand(void)
        OBJECT_IDX item;
        cptr q, s;
 
+       if (p_ptr->wild_mode) return;
+
+       if (p_ptr->inside_arena)
+       {
+               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
+               msg_print(NULL);
+               return;
+       }
+
        /* Restrict choices to wands */
        item_tester_tval = TV_WAND;
 
index 0467584..81ed834 100644 (file)
@@ -3139,6 +3139,8 @@ void do_cmd_fire(void)
        object_type *j_ptr, *ammo_ptr;
        cptr q, s;
 
+       if(p_ptr->wild_mode) return;
+
        is_fired = FALSE;       /* not fired yet */
 
        /* Get the "bow" (if any) */
@@ -3251,6 +3253,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
        bool come_back = FALSE;
        bool do_drop = TRUE;
 
+       if (p_ptr->wild_mode) return FALSE;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
index e4d5811..245a245 100644 (file)
@@ -4300,44 +4300,28 @@ static void process_command(void)
                /* Fire an item */
                case 'f':
                {
-                       if (!p_ptr->wild_mode) do_cmd_fire();
+                       do_cmd_fire();
                        break;
                }
 
                /* Throw an item */
                case 'v':
                {
-                       if (!p_ptr->wild_mode) do_cmd_throw(1, FALSE, -1);
+                       do_cmd_throw(1, FALSE, -1);
                        break;
                }
 
                /* Aim a wand */
                case 'a':
                {
-                       if (!p_ptr->wild_mode)
-                       {
-                               if (!p_ptr->inside_arena)
-                                       do_cmd_aim_wand();
-                               else
-                               {
-                                       msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
-                                       msg_print(NULL);
-                               }
-                       }
+                       do_cmd_aim_wand();
                        break;
                }
 
                /* Zap a rod */
                case 'z':
                {
-                       if (!p_ptr->wild_mode)
-                       {
-                       if (p_ptr->inside_arena)
-                       {
-                               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
-                               msg_print(NULL);
-                       }
-                       else if (use_command && rogue_like_commands)
+                       if (use_command && rogue_like_commands)
                        {
                                do_cmd_use();
                        }
@@ -4345,7 +4329,6 @@ static void process_command(void)
                        {
                                do_cmd_zap_rod();
                        }
-                       }
                        break;
                }