OSDN Git Service

博物館に寄贈するとき、全く同じ物が既に寄贈してあるときはメッセージを
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 3 Apr 2002 04:24:20 +0000 (04:24 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 3 Apr 2002 04:24:20 +0000 (04:24 +0000)
少し変えるようにしてみた。写真をコレクションするときに
気付かずに複数まとまっているのがなんか気に食わなかったので。

src/store.c

index 7cc76e9..b0490f1 100644 (file)
@@ -1217,28 +1217,17 @@ static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
  * Check to see if the shop will be carrying too many objects  -RAK-
  * Note that the shop, just like a player, will not accept things
  * it cannot hold.     Before, one could "nuke" potions this way.
+ *
+ * Return value is now int:
+ *  0 : No space
+ * -1 : Can be combined to existing slot.
+ *  1 : Cannot be combined but there are empty spaces.
  */
-static bool store_check_num(object_type *o_ptr)
+static int store_check_num(object_type *o_ptr)
 {
        int        i;
        object_type *j_ptr;
 
-       /* Free space is always usable */
-       /*
-        * ¥ª¥×¥·¥ç¥ó powerup_home ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¤È
-        * ²æ¤¬²È¤¬ 20 ¥Ú¡¼¥¸¤Þ¤Ç»È¤¨¤ë
-        */
-       if ((cur_store_num == STORE_HOME) && ( powerup_home == FALSE )) {
-               if (st_ptr->stock_num < ((st_ptr->stock_size) / 10)) {
-                       return TRUE;
-               }
-       }
-       else{
-               if (st_ptr->stock_num < st_ptr->stock_size) {
-                       return TRUE;
-               }
-       }
-
        /* The "home" acts like the player */
        if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
        {
@@ -1249,7 +1238,7 @@ static bool store_check_num(object_type *o_ptr)
                        j_ptr = &st_ptr->stock[i];
 
                        /* Can the new object be combined with the old one? */
-                       if (object_similar(j_ptr, o_ptr)) return (TRUE);
+                       if (object_similar(j_ptr, o_ptr)) return -1;
                }
        }
 
@@ -1263,12 +1252,28 @@ static bool store_check_num(object_type *o_ptr)
                        j_ptr = &st_ptr->stock[i];
 
                        /* Can the new object be combined with the old one? */
-                       if (store_object_similar(j_ptr, o_ptr)) return (TRUE);
+                       if (store_object_similar(j_ptr, o_ptr)) return -1;
+               }
+       }
+
+       /* Free space is always usable */
+       /*
+        * ¥ª¥×¥·¥ç¥ó powerup_home ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¤È
+        * ²æ¤¬²È¤¬ 20 ¥Ú¡¼¥¸¤Þ¤Ç»È¤¨¤ë
+        */
+       if ((cur_store_num == STORE_HOME) && ( powerup_home == FALSE )) {
+               if (st_ptr->stock_num < ((st_ptr->stock_size) / 10)) {
+                       return 1;
+               }
+       }
+       else{
+               if (st_ptr->stock_num < st_ptr->stock_size) {
+                       return 1;
                }
        }
 
        /* But there was no room at the inn... */
-       return (FALSE);
+       return 0;
 }
 
 
@@ -3863,11 +3868,26 @@ msg_format("%s
        {
                char o2_name[MAX_NLEN];
                object_desc(o2_name, q_ptr, TRUE, 0);
+
+               if (-1 == store_check_num(q_ptr))
+               {
+#ifdef JP
+                       msg_print("¤½¤ì¤ÈƱ¤¸ÉÊʪ¤Ï´û¤ËÇîʪ´Û¤Ë¤¢¤ë¤è¤¦¤Ç¤¹¡£");
+#else
+                       msg_print("The same object as it is already in the Museum.");
+#endif
+               }
+               else
+               {
+#ifdef JP
+                       msg_print("Çîʪ´Û¤Ë´ó£¤·¤¿¤â¤Î¤Ï¼è¤ê½Ð¤¹¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó¡ª¡ª");
+#else
+                       msg_print("You cannot take items which is given to the Museum back!!");
+#endif
+               }
 #ifdef JP
-               msg_print("Çîʪ´Û¤Ë´ó£¤·¤¿¤â¤Î¤Ï¼è¤ê½Ð¤¹¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó¡ª¡ª");
                if (!get_check(format("ËÜÅö¤Ë%s¤ò´ó£¤·¤Þ¤¹¤«¡©", o2_name))) return;
 #else
-               msg_print("You cannot take items which is given to the Museum back!!");
                if (!get_check(format("Really give %s to the Museum? ", o2_name))) return;
 #endif