* 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))
{
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;
}
}
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;
}
{
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