case TV_DEATH_BOOK:
case TV_TRUMP_BOOK:
case TV_ARCANE_BOOK:
- case TV_ENCHANT_BOOK:
+ case TV_CRAFT_BOOK:
case TV_DAEMON_BOOK:
case TV_CRUSADE_BOOK:
case TV_MUSIC_BOOK:
case TV_DIGGING:
case TV_BOW:
{
- if (o_ptr->art_name) break;
- if (o_ptr->name2) break;
+ if (object_is_artifact(o_ptr)) break;
+ if (object_is_ego(o_ptr)) break;
if (cost <= 10L) size += damroll(3, 5);
if (cost <= 100L) size += damroll(3, 5);
break;
if (o_ptr->to_d != j_ptr->to_d) return (0);
if (o_ptr->to_a != j_ptr->to_a) return (0);
- /* Require identical "artifact" names */
- if (o_ptr->name1 != j_ptr->name1) return (0);
-
/* Require identical "ego-item" names */
if (o_ptr->name2 != j_ptr->name2) return (0);
- /* Random artifacts don't stack !*/
- if (o_ptr->art_name || j_ptr->art_name) return (0);
+ /* Artifacts don't stack! */
+ if (object_is_artifact(o_ptr) || object_is_artifact(j_ptr)) return (0);
/* Hack -- Identical art_flags! */
for (i = 0; i < TR_FLAG_SIZE; i++)
/* The "home" acts like the player */
if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
{
+ bool old_stack_force_notes = stack_force_notes;
+ bool old_stack_force_costs = stack_force_costs;
+
+ if (cur_store_num != STORE_HOME)
+ {
+ stack_force_notes = FALSE;
+ stack_force_costs = FALSE;
+ }
+
/* Check all the items */
for (i = 0; i < st_ptr->stock_num; i++)
{
j_ptr = &st_ptr->stock[i];
/* Can the new object be combined with the old one? */
- if (object_similar(j_ptr, o_ptr)) return -1;
+ if (object_similar(j_ptr, o_ptr))
+ {
+ if (cur_store_num != STORE_HOME)
+ {
+ stack_force_notes = old_stack_force_notes;
+ stack_force_costs = old_stack_force_costs;
+ }
+
+ return -1;
+ }
+ }
+
+ if (cur_store_num != STORE_HOME)
+ {
+ stack_force_notes = old_stack_force_notes;
+ stack_force_costs = old_stack_force_costs;
}
}
case TV_DEATH_BOOK:
case TV_TRUMP_BOOK:
case TV_ARCANE_BOOK:
- case TV_ENCHANT_BOOK:
+ case TV_CRAFT_BOOK:
case TV_DAEMON_BOOK:
case TV_MUSIC_BOOK:
case TV_AMULET:
case TV_LIFE_BOOK:
case TV_TRUMP_BOOK:
case TV_ARCANE_BOOK:
- case TV_ENCHANT_BOOK:
+ case TV_CRAFT_BOOK:
case TV_DAEMON_BOOK:
case TV_CRUSADE_BOOK:
case TV_MUSIC_BOOK:
}
+/*
+ * Combine and reorder items in the home
+ */
+bool combine_and_reorder_home(int store_num)
+{
+ int i, j, k;
+ s32b o_value;
+ object_type forge, *o_ptr, *j_ptr;
+ bool flag = FALSE, combined;
+ store_type *old_st_ptr = st_ptr;
+ bool old_stack_force_notes = stack_force_notes;
+ bool old_stack_force_costs = stack_force_costs;
+
+ st_ptr = &town[1].store[store_num];
+ if (store_num != STORE_HOME)
+ {
+ stack_force_notes = FALSE;
+ stack_force_costs = FALSE;
+ }
+
+ do
+ {
+ combined = FALSE;
+
+ /* Combine the items in the home (backwards) */
+ for (i = st_ptr->stock_num - 1; i > 0; i--)
+ {
+ /* Get the item */
+ o_ptr = &st_ptr->stock[i];
+
+ /* Skip empty items */
+ if (!o_ptr->k_idx) continue;
+
+ /* Scan the items above that item */
+ for (j = 0; j < i; j++)
+ {
+ int max_num;
+
+ /* Get the item */
+ j_ptr = &st_ptr->stock[j];
+
+ /* Skip empty items */
+ if (!j_ptr->k_idx) continue;
+
+ /*
+ * Get maximum number of the stack if these
+ * are similar, get zero otherwise.
+ */
+ max_num = object_similar_part(j_ptr, o_ptr);
+
+ /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
+ if (max_num && j_ptr->number < max_num)
+ {
+ if (o_ptr->number + j_ptr->number <= max_num)
+ {
+ /* Add together the item counts */
+ object_absorb(j_ptr, o_ptr);
+
+ /* One object is gone */
+ st_ptr->stock_num--;
+
+ /* Slide everything down */
+ for (k = i; k < st_ptr->stock_num; k++)
+ {
+ /* Structure copy */
+ st_ptr->stock[k] = st_ptr->stock[k + 1];
+ }
+
+ /* Erase the "final" slot */
+ object_wipe(&st_ptr->stock[k]);
+ }
+ else
+ {
+ int old_num = o_ptr->number;
+ int remain = j_ptr->number + o_ptr->number - max_num;
+
+ /* Add together the item counts */
+ object_absorb(j_ptr, o_ptr);
+
+ o_ptr->number = remain;
+
+ /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
+ if (o_ptr->tval == TV_ROD)
+ {
+ o_ptr->pval = o_ptr->pval * remain / old_num;
+ o_ptr->timeout = o_ptr->timeout * remain / old_num;
+ }
+
+ /* Hack -- if wands are stacking, combine the charges. -LM- */
+ else if (o_ptr->tval == TV_WAND)
+ {
+ o_ptr->pval = o_ptr->pval * remain / old_num;
+ }
+ }
+
+ /* Take note */
+ combined = TRUE;
+
+ /* Done */
+ break;
+ }
+ }
+ }
+
+ flag |= combined;
+ }
+ while (combined);
+
+ /* Re-order the items in the home (forwards) */
+ for (i = 0; i < st_ptr->stock_num; i++)
+ {
+ /* Get the item */
+ o_ptr = &st_ptr->stock[i];
+
+ /* Skip empty slots */
+ if (!o_ptr->k_idx) continue;
+
+ /* Get the "value" of the item */
+ o_value = object_value(o_ptr);
+
+ /* Scan every occupied slot */
+ for (j = 0; j < st_ptr->stock_num; j++)
+ {
+ if (object_sort_comp(o_ptr, o_value, &st_ptr->stock[j])) break;
+ }
+
+ /* Never move down */
+ if (j >= i) continue;
+
+ /* Take note */
+ flag = TRUE;
+
+ /* Get local object */
+ j_ptr = &forge;
+
+ /* Save a copy of the moving item */
+ object_copy(j_ptr, &st_ptr->stock[i]);
+
+ /* Slide the objects */
+ for (k = i; k > j; k--)
+ {
+ /* Slide the item */
+ object_copy(&st_ptr->stock[k], &st_ptr->stock[k - 1]);
+ }
+
+ /* Insert the moving item */
+ object_copy(&st_ptr->stock[j], j_ptr);
+ }
+
+ st_ptr = old_st_ptr;
+ if (store_num != STORE_HOME)
+ {
+ stack_force_notes = old_stack_force_notes;
+ stack_force_costs = old_stack_force_costs;
+ }
+
+ return flag;
+}
+
/*
* Add the item "o_ptr" to the inventory of the "Home"
static int home_carry(object_type *o_ptr)
{
int slot;
- s32b value, j_value;
+ s32b value;
int i;
object_type *j_ptr;
+ bool old_stack_force_notes = stack_force_notes;
+ bool old_stack_force_costs = stack_force_costs;
+ if (cur_store_num != STORE_HOME)
+ {
+ stack_force_notes = FALSE;
+ stack_force_costs = FALSE;
+ }
/* Check each existing item (try to combine) */
for (slot = 0; slot < st_ptr->stock_num; slot++)
/* Save the new number of items */
object_absorb(j_ptr, o_ptr);
+ if (cur_store_num != STORE_HOME)
+ {
+ stack_force_notes = old_stack_force_notes;
+ stack_force_costs = old_stack_force_costs;
+ }
+
/* All done */
return (slot);
}
}
+ if (cur_store_num != STORE_HOME)
+ {
+ stack_force_notes = old_stack_force_notes;
+ stack_force_costs = old_stack_force_costs;
+ }
+
/* No space? */
/*
* ±£¤·µ¡Ç½: ¥ª¥×¥·¥ç¥ó powerup_home ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¤È
* ²æ¤¬²È¤¬ 20 ¥Ú¡¼¥¸¤Þ¤Ç»È¤¨¤ë
*/
/* No space? */
- if ( powerup_home == TRUE) {
+ if ((cur_store_num != STORE_HOME) || (powerup_home == TRUE)) {
if (st_ptr->stock_num >= st_ptr->stock_size) {
return (-1);
}
/* Check existing slots to see if we must "slide" */
for (slot = 0; slot < st_ptr->stock_num; slot++)
{
- /* Get that item */
- j_ptr = &st_ptr->stock[slot];
-
- /* Hack -- readable books always come first */
- if ((o_ptr->tval == mp_ptr->spell_book) &&
- (j_ptr->tval != mp_ptr->spell_book)) break;
- if ((j_ptr->tval == mp_ptr->spell_book) &&
- (o_ptr->tval != mp_ptr->spell_book)) continue;
-
- /* Objects sort by decreasing type */
- if (o_ptr->tval > j_ptr->tval) break;
- if (o_ptr->tval < j_ptr->tval) continue;
-
- /* Can happen in the home */
- if (!object_aware_p(o_ptr)) continue;
- if (!object_aware_p(j_ptr)) break;
-
- /* Objects sort by increasing sval */
- if (o_ptr->sval < j_ptr->sval) break;
- if (o_ptr->sval > j_ptr->sval) continue;
-
- /* Objects in the home can be unknown */
- if (!object_known_p(o_ptr)) continue;
- if (!object_known_p(j_ptr)) break;
-
- /*
- * Hack: otherwise identical rods sort by
- * increasing recharge time --dsb
- */
- if (o_ptr->tval == TV_ROD)
- {
- if (o_ptr->pval < j_ptr->pval) break;
- if (o_ptr->pval > j_ptr->pval) continue;
- }
- if ((o_ptr->tval == TV_CORPSE) || (o_ptr->tval == TV_FIGURINE) || (o_ptr->tval == TV_STATUE))
- {
- if (r_info[o_ptr->pval].level < r_info[j_ptr->pval].level) break;
- if ((r_info[o_ptr->pval].level == r_info[j_ptr->pval].level) && (o_ptr->pval < j_ptr->pval)) break;
- }
-
- /* Objects sort by decreasing value */
- j_value = object_value(j_ptr);
- if (value > j_value) break;
- if (value < j_value) continue;
+ if (object_sort_comp(o_ptr, value, &st_ptr->stock[slot])) break;
}
/* Slide the others up */
chg_virtue(V_SACRIFICE, -1);
+ (void)combine_and_reorder_home(cur_store_num);
+
/* Return the location */
return (slot);
}
int i, j;
/* Ego items are never crap */
- if (o_ptr->name2) return (FALSE);
+ if (object_is_ego(o_ptr)) return (FALSE);
/* Good items are never crap */
if (o_ptr->to_a > 0) return (FALSE);
#endif
Term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
+ if (use_bigtile) cur_col++;
+
cur_col += 2;
}
/* Home is much easier */
else
{
+ bool combined_or_reordered;
+
/* Distribute charges of wands/rods */
distribute_charges(o_ptr, j_ptr, amt);
store_item_increase(item, -amt);
store_item_optimize(item);
+ combined_or_reordered = combine_and_reorder_home(STORE_HOME);
+
/* Hack -- Item is still here */
if (i == st_ptr->stock_num)
{
+ /* Redraw everything */
+ if (combined_or_reordered) display_inventory();
+
/* Redraw the item */
- display_entry(item);
+ else display_entry(item);
}
/* The item is gone */
/* Hack -- Cannot remove cursed items */
- if ((item >= INVEN_RARM) && cursed_p(o_ptr))
+ if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
{
/* Oops */
#ifdef JP
display_inventory();
}
}
- if (item >= INVEN_RARM) calc_android_exp();
- if ((choice == 0) && ((item == INVEN_RARM) || (item == INVEN_LARM))) kamaenaoshi(item);
+
+ if ((choice == 0) && (item >= INVEN_RARM))
+ {
+ calc_android_exp();
+ kamaenaoshi(item);
+ }
}
/* Describe it fully */
- if (!screen_object(o_ptr, TRUE))
+ if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL))
#ifdef JP
msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
#else
/*
+ * Remove an item from museum (Originally from TOband)
+ */
+static void museum_remove_object(void)
+{
+ int i;
+ int item;
+ object_type *o_ptr;
+ char o_name[MAX_NLEN];
+ char out_val[160];
+
+ /* Empty? */
+ if (st_ptr->stock_num <= 0)
+ {
+#ifdef JP
+ msg_print("Çîʪ´Û¤Ë¤Ï²¿¤âÃÖ¤¤¤Æ¤¢¤ê¤Þ¤»¤ó¡£");
+#else
+ msg_print("Museum is empty.");
+#endif
+
+ return;
+ }
+
+ /* Find the number of objects on this and following pages */
+ i = st_ptr->stock_num - store_top;
+
+ /* And then restrict it to the current page */
+ if (i > 12) i = 12;
+
+ /* Prompt */
+#ifdef JP
+ sprintf(out_val, "¤É¤Î¥¢¥¤¥Æ¥à¤ÎŸ¼¨¤ò¤ä¤á¤µ¤»¤Þ¤¹¤«¡©");
+#else
+ sprintf(out_val, "Which item do you want to order to remove? ");
+#endif
+
+ /* Get the item number to be removed */
+ if (!get_stock(&item, out_val, 0, i - 1)) return;
+
+ /* Get the actual index */
+ item = item + store_top;
+
+ /* Get the actual item */
+ o_ptr = &st_ptr->stock[item];
+
+ /* Description */
+ object_desc(o_name, o_ptr, 0);
+
+#ifdef JP
+ msg_print("Ÿ¼¨¤ò¤ä¤á¤µ¤»¤¿¥¢¥¤¥Æ¥à¤ÏÆóÅ٤ȸ«¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡ª");
+ if (!get_check(format("ËÜÅö¤Ë%s¤ÎŸ¼¨¤ò¤ä¤á¤µ¤»¤Þ¤¹¤«¡©", o_name))) return;
+#else
+ msg_print("You cannot see items which is removed from the Museum!");
+ if (!get_check(format("Really order to remove %s from the Museum? ", o_name))) return;
+#endif
+
+ /* Message */
+#ifdef JP
+ msg_format("%s¤ÎŸ¼¨¤ò¤ä¤á¤µ¤»¤¿¡£", o_name);
+#else
+ msg_format("You ordered to remove %s.", o_name);
+#endif
+
+ /* Remove the items from the home */
+ store_item_increase(item, -o_ptr->number);
+ store_item_optimize(item);
+
+ (void)combine_and_reorder_home(STORE_MUSEUM);
+
+ /* The item is gone */
+
+ /* Nothing left */
+ if (st_ptr->stock_num == 0) store_top = 0;
+
+ /* Nothing left on that screen */
+ else if (store_top >= st_ptr->stock_num) store_top -= 12;
+
+ /* Redraw everything */
+ display_inventory();
+
+ return;
+}
+
+
+/*
* Hack -- set this to leave the store
*/
static bool leave_store = FALSE;
/* Browse a book */
case 'b':
{
- do_cmd_browse();
+ if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
+ (p_ptr->pclass == CLASS_BERSERKER) ||
+ (p_ptr->pclass == CLASS_NINJA) ||
+ (p_ptr->pclass == CLASS_MIRROR_MASTER)
+ ) do_cmd_mind_browse();
+ else if (p_ptr->pclass == CLASS_SMITH)
+ do_cmd_kaji(TRUE);
+ else if (p_ptr->pclass == CLASS_MAGIC_EATER)
+ do_cmd_magic_eater(TRUE);
+ else do_cmd_browse();
break;
}
case '=':
{
do_cmd_options();
+ (void)combine_and_reorder_home(STORE_HOME);
+ do_cmd_redraw();
+ display_store();
break;
}
/* Hack -- Unknown command */
default:
{
+ if ((cur_store_num == STORE_MUSEUM) && (command_cmd == 'r'))
+ {
+ museum_remove_object();
+ }
+ else
+ {
#ifdef JP
- msg_print("¤½¤Î¥³¥Þ¥ó¥É¤ÏŹ¤ÎÃæ¤Ç¤Ï»È¤¨¤Þ¤»¤ó¡£");
+ msg_print("¤½¤Î¥³¥Þ¥ó¥É¤ÏŹ¤ÎÃæ¤Ç¤Ï»È¤¨¤Þ¤»¤ó¡£");
#else
- msg_print("That command does not work in stores.");
+ msg_print("That command does not work in stores.");
#endif
+ }
break;
}
c_ptr = &cave[py][px];
/* Verify a store */
- if (!have_flag(f_flags_grid(c_ptr), FF_STORE))
+ if (!cave_have_flag_grid(c_ptr, FF_STORE))
{
#ifdef JP
msg_print("¤³¤³¤Ë¤ÏŹ¤¬¤¢¤ê¤Þ¤»¤ó¡£");
}
/* Extract the store code */
- which = f_info[c_ptr->feat].power;
+ which = f_info[c_ptr->feat].subtype;
old_town_num = p_ptr->town_num;
if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
if (cur_store_num == STORE_HOME)
{
#ifdef JP
- prt("g) ¥¢¥¤¥Æ¥à¤ò¼è¤ë", 21, 27);
- prt("d) ¥¢¥¤¥Æ¥à¤òÃÖ¤¯", 22, 27);
- prt("x) ²È¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤ë", 23,27);
+ prt("g) ¥¢¥¤¥Æ¥à¤ò¼è¤ë", 21, 27);
+ prt("d) ¥¢¥¤¥Æ¥à¤òÃÖ¤¯", 22, 27);
+ prt("x) ²È¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤ë", 23,27);
#else
- prt("g) Get an item.", 21, 27);
- prt("d) Drop an item.", 22, 27);
- prt("x) eXamine an item in the home.", 23,27);
+ prt("g) Get an item.", 21, 27);
+ prt("d) Drop an item.", 22, 27);
+ prt("x) eXamine an item in the home.", 23,27);
#endif
-
}
/* Museum commands */
else if (cur_store_num == STORE_MUSEUM)
{
#ifdef JP
- prt("d) ¥¢¥¤¥Æ¥à¤òÃÖ¤¯", 21, 27);
- prt("x) Çîʪ´Û¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤ë", 23,27);
+ prt("d) ¥¢¥¤¥Æ¥à¤òÃÖ¤¯", 21, 27);
+ prt("r) ¥¢¥¤¥Æ¥à¤ÎŸ¼¨¤ò¤ä¤á¤ë", 22, 27);
+ prt("x) Çîʪ´Û¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤ë", 23, 27);
#else
- prt("d) Drop an item.", 21, 27);
- prt("x) eXamine an item in the museum.", 23,27);
+ prt("d) Drop an item.", 21, 27);
+ prt("r) order to Remove an item.", 22, 27);
+ prt("x) eXamine an item in the museum.", 23, 27);
#endif
-
}
/* Shop commands XXX XXX XXX */
prt("s) ¥¢¥¤¥Æ¥à¤òÇä¤ë", 22, 30);
prt("x) ¾¦ÉʤòÄ´¤Ù¤ë", 23,30);
#else
- prt("p) Purchase an item.", 21, 30);
- prt("s) Sell an item.", 22, 30);
- prt("x) eXamine an item in the shop", 23,30);
+ prt("p) Purchase an item.", 21, 30);
+ prt("s) Sell an item.", 22, 30);
+ prt("x) eXamine an item in the shop", 23,30);
#endif
-
}
#ifdef JP
prt("i/e) »ý¤Áʪ/ÁõÈ÷¤Î°ìÍ÷", 21, 56);
- if( rogue_like_commands == TRUE )
+ if (rogue_like_commands)
{
prt("w/T) ÁõÈ÷¤¹¤ë/¤Ï¤º¤¹", 22, 56);
}
#else
prt("i/e) Inventry/Equipment list", 21, 56);
- if( rogue_like_commands == TRUE )
+ if (rogue_like_commands)
{
prt("w/T) Wear/Take off equipment", 22, 56);
}
/* Get the item */
o_ptr = &st_ptr->stock[i];
- if (!(artifact_p(o_ptr) || o_ptr->art_name))
+ if (!object_is_artifact(o_ptr))
{
/* Hack -- Sell all non-artifact old items for "half price" */
o_ptr->discount = 50;
{
int j;
- int old_rating = rating;
-
cur_store_num = store_num;
/* Ignore home */
/* Acquire some new items */
while (st_ptr->stock_num < j) store_create();
-
-
- /* Hack -- Restore the rating */
- rating = old_rating;
}