OSDN Git Service

ペットコマンドを開くとすぐ実行されるペット数の数え上げループの結果は
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Thu, 12 Jun 2003 23:17:45 +0000 (23:17 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Thu, 12 Jun 2003 23:17:45 +0000 (23:17 +0000)
ペットの解放の可否にしか使われないので, ループをPET_DISMISSのブロック
に移した上でペットがいれば途中で打ち切る仕様に変更.

src/cmd5.c

index 4e1615f..ee6540e 100644 (file)
@@ -5864,7 +5864,7 @@ void do_cmd_pet(void)
        int                     ask;
        char                    choice;
        char                    out_val[160];
-       int                     pets = 0, pet_ctr;
+       int                     pet_ctr;
        monster_type    *m_ptr;
 
        int mode = 0;
@@ -5876,16 +5876,6 @@ void do_cmd_pet(void)
 
        num = 0;
 
-       /* Calculate pets */
-       /* Process the monsters (backwards) */
-       for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
-       {
-               /* Access the monster */
-               m_ptr = &m_list[pet_ctr];
-
-               if (is_pet(m_ptr)) pets++;
-       }
-
 #ifdef JP
        power_desc[num] = "¥Ú¥Ã¥È¤òÊü¤¹";
 #else
@@ -6281,7 +6271,14 @@ strnfmt(out_val, 78, "(
        {
                case PET_DISMISS: /* Dismiss pets */
                {
-                       if (!pets)
+                       /* Check pets (backwards) */
+                       for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
+                       {
+                               /* Player has pet */
+                               if (is_pet(&m_list[pet_ctr])) break;
+                       }
+
+                       if (!pet_ctr)
                        {
 #ifdef JP
                                msg_print("¥Ú¥Ã¥È¤¬¤¤¤Ê¤¤¡ª");