OSDN Git Service

Implementing MCI command for BGM playing.
[hengband/hengband.git] / src / store.c
index 17dbea6..ed1b998 100644 (file)
@@ -1,15 +1,15 @@
-/* File: store.c */
-
-/*
- * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
- *
- * This software may be copied and distributed for educational, research,
- * and not for profit purposes provided that this copyright and statement
- * are included in all such copies.  Other copyrights may also apply.
+/*!
+ * @file store.c
+ * @brief Å¹¤Î½èÍý / Store commands
+ * @date 2014/02/02
+ * @author
+ * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
+ * This software may be copied and distributed for educational, research, and\n
+ * not for profit purposes provided that this copyright and statement are\n
+ * included in all such copies.\n
+ * 2014 Deskull rearranged comment for Doxygen.
  */
 
-/* Purpose: Store commands */
-
 #include "angband.h"
 
 #define MIN_STOCK 12
@@ -19,7 +19,7 @@ static int store_top = 0;
 static int store_bottom = 0;
 static int xtra_stock = 0;
 static store_type *st_ptr = NULL;
-static owner_type *ot_ptr = NULL;
+static const owner_type *ot_ptr = NULL;
 static s16b old_town_num = 0;
 static s16b inner_town_num = 0;
 #define RUMOR_CHANCE 8
@@ -47,7 +47,7 @@ static cptr comment_1[MAX_COMMENT_1] =
 };
 
 #ifdef JP
-/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÄɲåá¥Ã¥»¡¼¥¸¡Ê¾µÂú¡Ë */
+/*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÄɲåá¥Ã¥»¡¼¥¸¡Ê¾µÂú¡Ë */
 static cptr comment_1_B[MAX_COMMENT_1] = {
        "¤Þ¤¢¡¢¤½¤ì¤Ç¤¤¤¤¤ä¡£",
        "º£Æü¤Ï¤½¤ì¤Ç´ªÊÛ¤·¤Æ¤ä¤ë¡£",
@@ -106,7 +106,7 @@ static cptr comment_2b[MAX_COMMENT_2B] =
 };
 
 #ifdef JP
-/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÇä¤ë¤È¤­¡Ë */
+/*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÇä¤ë¤È¤­¡Ë */
 static cptr comment_2b_B[MAX_COMMENT_2B] = {
        "¤¤¤¯¤é²¶Íͤ¬¤ª¿Í¹¥¤·¤È¤Ï¤¤¤¨ $%s ¤¬¸Â³¦¤À¤Í¡£·ù¤Ê¤éµ¢¤ê¤Ê¡£",
        "¶â¤¬¤Ê¤¤¤Î¤«¤¤¡¢¤¢¤ó¤¿¡©¤Þ¤º¤Ï²È¤Ëµ¢¤Ã¤Æ $%s Â·¤¨¤Æ¤­¤Ê¡£",
@@ -172,7 +172,7 @@ static cptr comment_3b[MAX_COMMENT_3B] =
 };
 
 #ifdef JP
-/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÇ㤤¼è¤ê¡Ë */
+/*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÇ㤤¼è¤ê¡Ë */
 static cptr comment_3b_B[MAX_COMMENT_3B] = {
        " $%s ¤Ã¤Æ¤È¤³¤í¤À¤Í¡£¤½¤Î¤É¤¦¤·¤è¤¦¤â¤Ê¤¤¥¬¥é¥¯¥¿¤Ï¡£",
        "¤³¤Î²¶¤¬ $%s ¤Ã¤Æ¸À¤Ã¤Æ¤¤¤ë¤ó¤À¤«¤é¡¢¤½¤ÎÄ̤ê¤Ë¤·¤¿Êý¤¬¿È¤Î¤¿¤á¤À¤¾¡£",
@@ -207,7 +207,7 @@ static cptr comment_4a[MAX_COMMENT_4A] =
 };
 
 #ifdef JP
-/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÅܤê¤ÎĺÅÀ¡Ë */
+/*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÅܤê¤ÎĺÅÀ¡Ë */
 static cptr comment_4a_B[MAX_COMMENT_4A] = {
        "¤Ê¤á¤ä¤¬¤Ã¤Æ¡ª²¹¸ü¤Ê²¶ÍͤǤâ¸Â³¦¤¬¤¢¤ë¤Ã¤Æ¤³¤È¤òÃΤ졪",
        "²¶¤ò¤³¤³¤Þ¤ÇÅܤ餻¤Æ...Ì¿¤¬¤¢¤ë¤À¤±¤Ç¤â¤¢¤ê¤¬¤¿¤¤¤È»×¤¨¡ª",
@@ -234,7 +234,7 @@ static cptr comment_4b[MAX_COMMENT_4B] =
 };
 
 #ifdef JP
-/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÄɤ¤½Ð¤·¡Ë */
+/*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÄɤ¤½Ð¤·¡Ë */
 static cptr comment_4b_B[MAX_COMMENT_4B] = {
        "ÆóÅ٤Ȥ¦¤Á¤ËÍè¤ë¤ó¤¸¤ã¤Í¤¨¡ª¡ª",
        "¤È¤Ã¤È¤È¡¢¤É¤Ã¤«¤Ø¼º¤»¤í¡ª¡ª",
@@ -269,7 +269,7 @@ static cptr comment_5[MAX_COMMENT_5] =
 };
 
 #ifdef JP
-/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÅܤê¡Ë */
+/*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÅܤê¡Ë */
 static cptr comment_5_B[MAX_COMMENT_5] = {
        "»þ´Ö¤Î̵Â̤À¤Ê¡¢¤³¤ì¤Ï¡£",
        "Ìñ²ð¤Ê¤ªµÒÍͤÀ¤Ê¡ª",
@@ -301,13 +301,13 @@ static cptr comment_6[MAX_COMMENT_6] =
 
 
 
-/*
+/*!
+ * @brief ¼è°úÀ®¸ù»þ¤ÎŹ¼ç¤Î¥á¥Ã¥»¡¼¥¸½èÍý /
  * Successful haggle.
+ * @return ¤Ê¤·
  */
 static void say_comment_1(void)
 {
-       char rumour[1024];
-
 #ifdef JP
        /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î¤È¤­¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
        if ( cur_store_num == STORE_BLACK ) {
@@ -324,25 +324,21 @@ static void say_comment_1(void)
        if (one_in_(RUMOR_CHANCE))
        {
 #ifdef JP
-msg_print("Ź¼ç¤Ï¼ª¤¦¤Á¤·¤¿:");
+               msg_print("Ź¼ç¤Ï¼ª¤¦¤Á¤·¤¿:");
 #else
                msg_print("The shopkeeper whispers something into your ear:");
 #endif
-
-
-#ifdef JP
-if (!get_rnd_line_jonly("rumors_j.txt", 0, rumour, 10))
-#else
-               if (!get_rnd_line("rumors.txt", 0, rumour))
-#endif
-
-                       msg_print(rumour);
+               display_rumor(TRUE);
        }
 }
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥¢¥¤¥Æ¥à¤òÇ㤦»þ¤Î²Á³ÊÂå°Æ¥á¥Ã¥»¡¼¥¸½èÍý /
  * Continue haggling (player is buying)
+ * @param value Å¹¼ç¤ÎÄ󼨲Á³Ê
+ * @param annoyed Å¹¼ç¤Î¤¤¤é¤Ä¤­ÅÙ
+ * @return ¤Ê¤·
  */
 static void say_comment_2(s32b value, int annoyed)
 {
@@ -378,8 +374,12 @@ static void say_comment_2(s32b value, int annoyed)
 }
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥¢¥¤¥Æ¥à¤òÇä¤ë»þ¤Î²Á³ÊÂå°Æ¥á¥Ã¥»¡¼¥¸½èÍý /
  * Continue haggling (player is selling)
+ * @param value Å¹¼ç¤ÎÄ󼨲Á³Ê
+ * @param annoyed Å¹¼ç¤Î¤¤¤é¤Ä¤­ÅÙ
+ * @return ¤Ê¤·
  */
 static void say_comment_3(s32b value, int annoyed)
 {
@@ -415,8 +415,10 @@ static void say_comment_3(s32b value, int annoyed)
 }
 
 
-/*
+/*!
+ * @brief Å¹¼ç¤¬¥×¥ì¥¤¥ä¡¼¤òÄɤ¤½Ð¤¹»þ¤Î¥á¥Ã¥»¡¼¥¸½èÍý /
  * Kick 'da bum out.                                   -RAK-
+ * @return ¤Ê¤·
  */
 static void say_comment_4(void)
 {
@@ -438,8 +440,10 @@ static void say_comment_4(void)
 }
 
 
-/*
+/*!
+ * @brief Å¹¼ç¤¬¥×¥ì¥¤¥ä¡¼¤Ë¼è¤ê¹ç¤ï¤Ê¤¤»þ¤Î¥á¥Ã¥»¡¼¥¸½èÍý /
  * You are insulting me
+ * @return ¤Ê¤·
  */
 static void say_comment_5(void)
 {
@@ -458,8 +462,10 @@ static void say_comment_5(void)
 }
 
 
-/*
+/*!
+ * @brief Å¹¼ç¤¬¥×¥ì¥¤¥ä¡¼¤ÎÄ󼨤òÍý²ò¤Ç¤­¤Ê¤«¤Ã¤¿»þ¤Î¥á¥Ã¥»¡¼¥¸½èÍý /
  * That makes no sense.
+ * @return ¤Ê¤·
  */
 static void say_comment_6(void)
 {
@@ -467,11 +473,6 @@ static void say_comment_6(void)
 }
 
 
-
-/*
- * Messages for reacting to purchase prices.
- */
-
 #define MAX_COMMENT_7A 4
 
 static cptr comment_7a[MAX_COMMENT_7A] =
@@ -545,9 +546,14 @@ static cptr comment_7d[MAX_COMMENT_7D] =
 };
 
 
-/*
+/*!
+ * @brief Å¹¼ç¤¬¸ò¾Ä¤ò½ª¤¨¤¿ºÝ¤ÎÈ¿±þ¤òÊÖ¤¹½èÍý /
  * Let a shop-keeper React to a purchase
- *
+ * @param price ¥¢¥¤¥Æ¥à¤Î¼è°ú³Û
+ * @param value ¥¢¥¤¥Æ¥à¤Î¼ÂºÝ²ÁÃÍ
+ * @param guess Å¹¼ç¤¬Åö½éͽÁÛ¤·¤Æ¤¤¤¿²ÁÃÍ
+ * @return ¤Ê¤·
+ * @details 
  * We paid "price", it was worth "value", and we thought it was worth "guess"
  */
 static void purchase_analyze(s32b price, s32b value, s32b guess)
@@ -630,7 +636,7 @@ static byte rgold_adj[MAX_RACES][MAX_RACES] =
        /*Hum, HfE, Elf,  Hal, Gno, Dwa, HfO, HfT, Dun, HiE, Barbarian,
         HfOg, HGn, HTn, Cyc, Yek, Klc, Kbd, Nbl, DkE, Drc, Mind Flayer,
         Imp,  Glm, Skl, Zombie, Vampire, Spectre, Fairy, Beastman, Ent,
-        Angel, Demon, Kuta*/
+        Angel, Demon, Kuta*/
 
        /* Human */
        { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
@@ -842,7 +848,7 @@ static byte rgold_adj[MAX_RACES][MAX_RACES] =
          110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
          110, 101, 115, 110 },
 
-       /* Kuta */
+       /* Kutar */
        { 110, 110, 105, 105, 110, 115, 115, 115, 110, 105, 110,
          115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
          115, 115, 125, 125, 125, 125, 105, 115, 105,  95, 140,
@@ -857,25 +863,27 @@ static byte rgold_adj[MAX_RACES][MAX_RACES] =
 
 
 
-
-/*
+/*!
+ * @brief Å¹ÊÞ²Á³Ê¤ò·èÄꤹ¤ë /
  * Determine the price of an item (qty one) in a store.
- *
+ * @param o_ptr Å¹ÊÞ¤Ëʤ٤륪¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
+ * @param greed Å¹¼ç¤Î¶¯ÍßÅÙ
+ * @param flip TRUE¤Ê¤é¤ÐŹ¼ç¤Ë¤È¤Ã¤Æ¤ÎÇã¼è²Á³Ê¡¢FALSE¤Ê¤éÇä½Ð²Á³Ê¤ò·×»»
+ * @return ¤Ê¤·
+ * @details 
+ * <pre>
  * This function takes into account the player's charisma, and the
  * shop-keepers friendliness, and the shop-keeper's base greed, but
  * never lets a shop-keeper lose money in a transaction.
- *
  * The "greed" value should exceed 100 when the player is "buying" the
  * item, and should be less than 100 when the player is "selling" it.
- *
  * Hack -- the black market always charges twice as much as it should.
- *
  * Charisma adjustment runs from 80 to 130
  * Racial adjustment runs from 95 to 130
- *
  * Since greed/charisma/racial adjustments are centered at 100, we need
  * to adjust (by 200) to extract a usable multiplier.  Note that the
  * "greed" value is always something (?).
+ * </pre>
  */
 static s32b price_item(object_type *o_ptr, int greed, bool flip)
 {
@@ -942,9 +950,15 @@ static s32b price_item(object_type *o_ptr, int greed, bool flip)
 }
 
 
-/*
+/*!
+ * @brief °Â²Á¤Ê¾ÃÌ×ÉʤÎÈÎÇä¿ô¤òÁý¤ä¤·¡¢Äã³ÎΨ¤Ç³ä°ú¤Ë¤¹¤ë /
  * Certain "cheap" objects should be created in "piles"
+ * @param o_ptr Å¹ÊÞ¤Ëʤ٤륪¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
+ * @details 
+ * <pre>
  * Some objects can be sold at a "discount" (in small piles)
+ * </pre>
  */
 static void mass_produce(object_type *o_ptr)
 {
@@ -990,6 +1004,7 @@ static void mass_produce(object_type *o_ptr)
                case TV_CRUSADE_BOOK:
                case TV_MUSIC_BOOK:
                case TV_HISSATSU_BOOK:
+               case TV_HEX_BOOK:
                {
                        if (cost <= 50L) size += damroll(2, 3);
                        if (cost <= 500L) size += damroll(1, 3);
@@ -1057,12 +1072,6 @@ static void mass_produce(object_type *o_ptr)
                                if (cost < 1601L) size += damroll(1, 5);
                                else if (cost < 3201L) size += damroll(1, 3);
                        }
-
-                       /* Ensure that mass-produced rods and wands get the correct pvals. */
-                       if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
-                       {
-                               o_ptr->pval *= size;
-                       }
                        break;
                }
        }
@@ -1110,14 +1119,26 @@ msg_print("
 
        /* Save the total pile size */
        o_ptr->number = size - (size * discount / 100);
+
+       /* Ensure that mass-produced rods and wands get the correct pvals. */
+       if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
+       {
+               o_ptr->pval *= o_ptr->number;
+       }
 }
 
 
 
-/*
+/*!
+ * @brief Å¹ÊÞ¤Ëʤ٤¿ÉʤòƱ°ìÉʤǤ¢¤ë¤«¤É¤¦¤«È½Äꤹ¤ë /
  * Determine if a store item can "absorb" another item
- *
+ * @param o_ptr È½Äꤹ¤ë¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿1
+ * @param j_ptr È½Äꤹ¤ë¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿2
+ * @return Æ±°ì°·¤¤¤Ç¤­¤ë¤Ê¤éTRUE¤òÊÖ¤¹
+ * @details 
+ * <pre>
  * See "object_similar()" for the same function for the "player"
+ * </pre>
  */
 static bool store_object_similar(object_type *o_ptr, object_type *j_ptr)
 {
@@ -1171,8 +1192,16 @@ static bool store_object_similar(object_type *o_ptr, object_type *j_ptr)
 }
 
 
-/*
+/*!
+ * @brief Å¹ÊÞ¤Ëʤ٤¿Éʤò½Å¤Í¹ç¤ï¤»¤Ç¤­¤ë¤«¤É¤¦¤«È½Äꤹ¤ë /
  * Allow a store item to absorb another item
+ * @param o_ptr È½Äꤹ¤ë¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿1
+ * @param j_ptr È½Äꤹ¤ë¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿2
+ * @return ½Å¤Í¹ç¤ï¤»¤Ç¤­¤ë¤Ê¤éTRUE¤òÊÖ¤¹
+ * @details 
+ * <pre>
+ * See "object_similar()" for the same function for the "player"
+ * </pre>
  */
 static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
 {
@@ -1198,15 +1227,20 @@ static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
 }
 
 
-/*
+/*!
+ * @brief Å¹ÊÞ¤ËÉʤòÃÖ¤¯¥¹¥Ú¡¼¥¹¤¬¤¢¤ë¤«¤É¤¦¤«¤ÎȽÄê¤òÊÖ¤¹ /
  * Check to see if the shop will be carrying too many objects  -RAK-
+ * @param o_ptr Å¹ÊÞ¤ËÃÖ¤­¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ÃÖ¤­¾ì¤¬¤Ê¤¤¤Ê¤é0¡¢½Å¤Í¹ç¤ï¤»¤Ç¤­¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ë¤Ê¤é-1¡¢¥¹¥Ú¡¼¥¹¤¬¤¢¤ë¤Ê¤é1¤òÊÖ¤¹¡£
+ * @details 
+ * <pre>
  * 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.
+ * </pre>
  */
 static int store_check_num(object_type *o_ptr)
 {
@@ -1285,7 +1319,11 @@ static int store_check_num(object_type *o_ptr)
        return 0;
 }
 
-
+/*!
+ * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¤«¤ÎȽÄê¤òÊÖ¤¹ /
+ * @param o_ptr È½Äꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¥¢¥¤¥Æ¥à¤¬½ËÊ¡¤µ¤ì¤¿¥¢¥¤¥Æ¥à¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
+ */
 static bool is_blessed(object_type *o_ptr)
 {
        u32b flgs[TR_FLAG_SIZE];
@@ -1296,9 +1334,12 @@ static bool is_blessed(object_type *o_ptr)
 
 
 
-/*
+/*!
+ * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬½êÄê¤ÎŹÊޤǰú¤­¼è¤ì¤ë¤«¤É¤¦¤«¤òÊÖ¤¹ /
  * Determine if the current store will purchase the given item
- *
+ * @param o_ptr È½Äꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¥¢¥¤¥Æ¥à¤¬Ç㤤¼è¤ì¤ë¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
+ * @note
  * Note that a shop-keeper must refuse to buy "worthless" items
  */
 static bool store_will_buy(object_type *o_ptr)
@@ -1461,6 +1502,7 @@ static bool store_will_buy(object_type *o_ptr)
                                case TV_CRAFT_BOOK:
                                case TV_DAEMON_BOOK:
                                case TV_MUSIC_BOOK:
+                               case TV_HEX_BOOK:
                                case TV_AMULET:
                                case TV_RING:
                                case TV_STAFF:
@@ -1497,6 +1539,7 @@ static bool store_will_buy(object_type *o_ptr)
                                case TV_DAEMON_BOOK:
                                case TV_CRUSADE_BOOK:
                                case TV_MUSIC_BOOK:
+                               case TV_HEX_BOOK:
                                        break;
                                default:
                                        return (FALSE);
@@ -1513,8 +1556,11 @@ static bool store_will_buy(object_type *o_ptr)
 }
 
 
-/*
- * Combine and reorder items in the home
+/*!
+ * @brief ¸½ºß¤ÎÄ®¤Î»ØÄꤵ¤ì¤¿Å¹ÊޤΥ¢¥¤¥Æ¥à¤òÀ°Íý¤¹¤ë /
+ * Combine and reorder items in store.
+ * @param store_num Å¹ÊÞID
+ * @return ¼ÂºÝ¤ËÀ°Íý¤¬¹Ô¤ï¤ì¤¿¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
  */
 bool combine_and_reorder_home(int store_num)
 {
@@ -1673,15 +1719,18 @@ bool combine_and_reorder_home(int store_num)
 }
 
 
-/*
+/*!
+ * @brief ²æ¤¬²È¤Ë¥ª¥Ö¥¸¥§¥¯¥È¤ò²Ã¤¨¤ë /
  * Add the item "o_ptr" to the inventory of the "Home"
- *
+ * @param o_ptr ²Ã¤¨¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¼ý¤á¤¿Àè¤ÎID
+ * @details
+ * <pre>
  * In all cases, return the slot (or -1) where the object was placed
- *
  * Note that this is a hacked up version of "inven_carry()".
- *
  * Also note that it may not correctly "adapt" to "knowledge" bacoming
  * known, the player may have to pick stuff up and drop it again.
+ * </pre>
  */
 static int home_carry(object_type *o_ptr)
 {
@@ -1775,17 +1824,18 @@ static int home_carry(object_type *o_ptr)
 }
 
 
-/*
+/*!
+ * @brief Å¹Êޤ˥ª¥Ö¥¸¥§¥¯¥È¤ò²Ã¤¨¤ë /
  * Add the item "o_ptr" to a real stores inventory.
- *
- * If the item is "worthless", it is thrown away (except in the home).
- *
- * If the item cannot be combined with an object already in the inventory,
- * make a new slot for it, and calculate its "per item" price. Note that
- * this price will be negative, since the price will not be "fixed" yet.
- * Adding an item to a "fixed" price stack will not change the fixed price.
- *
+ * @param o_ptr ²Ã¤¨¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¼ý¤á¤¿Àè¤ÎID
+ * @details
+ * <pre>
  * In all cases, return the slot (or -1) where the object was placed
+ * Note that this is a hacked up version of "inven_carry()".
+ * Also note that it may not correctly "adapt" to "knowledge" bacoming
+ * known, the player may have to pick stuff up and drop it again.
+ * </pre>
  */
 static int store_carry(object_type *o_ptr)
 {
@@ -1879,9 +1929,17 @@ static int store_carry(object_type *o_ptr)
 }
 
 
-/*
+/*!
+ * @brief Å¹ÊޤΥª¥Ö¥¸¥§¥¯¥È¿ô¤òÁý¤ä¤¹ /
+ * Add the item "o_ptr" to a real stores inventory.
+ * @param item Áý¤ä¤·¤¿¤¤¥¢¥¤¥Æ¥à¤ÎID
+ * @param num Áý¤ä¤·¤¿¤¤¿ô
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * Increase, by a given amount, the number of a certain item
  * in a certain store. This can result in zero items.
+ * </pre>
  */
 static void store_item_increase(int item, int num)
 {
@@ -1902,8 +1960,11 @@ static void store_item_increase(int item, int num)
 }
 
 
-/*
+/*!
+ * @brief Å¹ÊޤΥª¥Ö¥¸¥§¥¯¥È¿ô¤òºï½ü¤¹¤ë /
  * Remove a slot if it is empty
+ * @param item ºï½ü¤·¤¿¤¤¥¢¥¤¥Æ¥à¤ÎID
+ * @return ¤Ê¤·
  */
 static void store_item_optimize(int item)
 {
@@ -1932,11 +1993,16 @@ static void store_item_optimize(int item)
        object_wipe(&st_ptr->stock[j]);
 }
 
-
-/*
+/*!
+ * @brief ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍѤÎ̵²ÁÃÍÉʤÎÇÓ½üȽÄê /
  * This function will keep 'crap' out of the black market.
+ * @param o_ptr È½Äꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Ë¤È¤Ã¤Æ̵²ÁÃͤÊÉʤʤé¤ÐTRUE¤òÊÖ¤¹
+ * @details
+ * <pre>
  * Crap is defined as any item that is "available" elsewhere
  * Based on a suggestion by "Lee Vogt" <lvogt@cig.mcel.mot.com>
+ * </pre>
  */
 static bool black_market_crap(object_type *o_ptr)
 {
@@ -1971,9 +2037,14 @@ static bool black_market_crap(object_type *o_ptr)
 }
 
 
-/*
+/*!
+ * @brief Å¹ÊÞ¤ÎÉÊ·¤¨ÊѲ½¤Î¤¿¤á¤Ë¥¢¥¤¥Æ¥à¤òºï½ü¤¹¤ë /
  * Attempt to delete (some of) a random item from the store
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * Hack -- we attempt to "maintain" piles of items when possible.
+ * </pre>
  */
 static void store_delete(void)
 {
@@ -2003,16 +2074,19 @@ static void store_delete(void)
 }
 
 
-/*
+/*!
+ * @brief Å¹ÊÞ¤ÎÉÊ·¤¨ÊѲ½¤Î¤¿¤á¤Ë¥¢¥¤¥Æ¥à¤òÄɲ乤ë /
  * Creates a random item and gives it to a store
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * This algorithm needs to be rethought.  A lot.
  * Currently, "normal" stores use a pre-built array.
- *
  * Note -- the "level" given to "obj_get_num()" is a "favored"
  * level, that is, there is a much higher chance of getting
  * items with a level approaching that of the given level...
- *
  * Should we check for "permission" to have the given item?
+ * </pre>
  */
 static void store_create(void)
 {
@@ -2115,9 +2189,11 @@ static void store_create(void)
 }
 
 
-
-/*
+/*!
+ * @brief Å¹Êޤγä°úÂоݳ°¤Ë¤¹¤ë¤«¤É¤¦¤«¤òȽÄê /
  * Eliminate need to bargain if player has haggled well in the past
+ * @param minprice ¥¢¥¤¥Æ¥à¤ÎºÇÄãÈÎÇä²Á³Ê
+ * @return ³ä°ú¤ò¶Ø»ß¤¹¤ë¤Ê¤éTRUE¤òÊÖ¤¹¡£
  */
 static bool noneedtobargain(s32b minprice)
 {
@@ -2138,8 +2214,13 @@ static bool noneedtobargain(s32b minprice)
 }
 
 
-/*
+/*!
+ * @brief Å¹¼ç¤Î»ý¤Ä¥×¥ì¥¤¥ä¡¼¤ËÂФ¹¤ëÇäÇã¤ÎÎɤ·°­¤··Ð¸³¤òµ­²±¤¹¤ë /
  * Update the bargain info
+ * @param price ¼ÂºÝ¤Î¼è°ú²Á³Ê
+ * @param minprice Å¹¼ç¤ÎÄ󼨤·¤¿²Á³Ê
+ * @param num ÇäÇã¿ô 
+ * @return ¤Ê¤·
  */
 static void updatebargain(s32b price, s32b minprice, int num)
 {
@@ -2171,9 +2252,11 @@ static void updatebargain(s32b price, s32b minprice, int num)
 }
 
 
-
-/*
+/*!
+ * @brief Å¹¤Î¾¦Éʥꥹ¥È¤òºÆɽ¼¨¤¹¤ë /
  * Re-displays a single store entry
+ * @param pos É½¼¨¹Ô
+ * @return ¤Ê¤·
  */
 static void display_entry(int pos)
 {
@@ -2316,8 +2399,11 @@ static void display_entry(int pos)
 }
 
 
-/*
+/*!
+ * @brief Å¹¤Î¾¦Éʥꥹ¥È¤òɽ¼¨¤¹¤ë /
  * Displays a store's inventory                -RAK-
+ * @return ¤Ê¤·
+ * @details
  * All prices are listed as "per individual object".  -BEN-
  */
 static void display_inventory(void)
@@ -2365,11 +2451,26 @@ static void display_inventory(void)
 #endif
 
        }
+
+       if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM)
+       {
+               k = st_ptr->stock_size;
+
+               if (cur_store_num == STORE_HOME && !powerup_home) k /= 10;
+#ifdef JP
+               put_str(format("¥¢¥¤¥Æ¥à¿ô:  %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 27);
+#else
+               put_str(format("Objects:  %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 30);
+#endif
+       }
 }
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Î½ê»ý¶â¤òɽ¼¨¤¹¤ë /
  * Displays players gold                                       -RAK-
+ * @return ¤Ê¤·
+ * @details
  */
 static void store_prt_gold(void)
 {
@@ -2386,9 +2487,11 @@ static void store_prt_gold(void)
        prt(out_val, 19 + xtra_stock, 68);
 }
 
-
-/*
+/*!
+ * @brief Å¹ÊÞ¾ðÊóÁ´ÂΤòɽ¼¨¤¹¤ë¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Displays store (after clearing screen)              -RAK-
+ * @return ¤Ê¤·
+ * @details
  */
 static void display_store(void)
 {
@@ -2512,8 +2615,14 @@ static void display_store(void)
 
 
 
-/*
+/*!
+ * @brief Å¹ÊÞ¤«¤é¥¢¥¤¥Æ¥à¤òÁªÂò¤¹¤ë /
  * Get the ID of a store item and return its value     -RAK-
+ * @param com_val ÁªÂòID¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @param pmt ¥á¥Ã¥»¡¼¥¸¥­¥ã¥×¥·¥ç¥ó
+ * @param i ÁªÂòÈϰϤκǾ®ÃÍ
+ * @param j ÁªÂòÈϰϤκÇÂçÃÍ
+ * @return ¼ÂºÝ¤ËÁªÂò¤·¤¿¤éTRUE¡¢¥­¥ã¥ó¥»¥ë¤·¤¿¤éFALSE
  */
 static int get_stock(int *com_val, cptr pmt, int i, int j)
 {
@@ -2600,8 +2709,10 @@ static int get_stock(int *com_val, cptr pmt, int i, int j)
 }
 
 
-/*
+/*!
+ * @brief Å¹¼ç¤ÎÉÔËþÅÙ¤òÁý¤ä¤·¡¢¥×¥ì¥¤¥ä¡¼¤òÄù¤á½Ð¤¹È½Äê¤È½èÍý¤ò¹Ô¤¦ /
  * Increase the insult counter and get angry if too many -RAK-
+ * @return ¥×¥ì¥¤¥ä¡¼¤òÄù¤á½Ð¤¹¾ì¹çTRUE¤òÊÖ¤¹
  */
 static int increase_insults(void)
 {
@@ -2631,8 +2742,10 @@ static int increase_insults(void)
 }
 
 
-/*
+/*!
+ * @brief Å¹¼ç¤ÎÉÔËþÅÙ¤ò¸º¤é¤¹ /
  * Decrease insults                            -RAK-
+ * @return ¥×¥ì¥¤¥ä¡¼¤òÄù¤á½Ð¤¹¾ì¹çTRUE¤òÊÖ¤¹
  */
 static void decrease_insults(void)
 {
@@ -2641,8 +2754,10 @@ static void decrease_insults(void)
 }
 
 
-/*
+/*!
+ * @brief Å¹¼ç¤ÎÉÔËþÅÙ¤¬Áý¤¨¤¿¾ì¹ç¤Î¤ß¤Î¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤¹¤ë /
  * Have insulted while haggling                        -RAK-
+ * @return ¥×¥ì¥¤¥ä¡¼¤òÄù¤á½Ð¤¹¾ì¹çTRUE¤òÊÖ¤¹
  */
 static int haggle_insults(void)
 {
@@ -2668,8 +2783,14 @@ static bool allow_inc = FALSE;
 static s32b last_inc = 0L;
 
 
-/*
+/*!
+ * @brief ¸ò¾Ä²Á³Ê¤ò³Îǧ¤Èǧ¾Ú¤ÎÀ§Èó¤ò¹Ô¤¦ /
  * Get a haggle
+ * @param pmt ¥á¥Ã¥»¡¼¥¸
+ * @param poffer ÊÌÅÓ²Á³ÊÄ󼨤ò¤·¤¿¾ì¹ç¤ÎÃͤòÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @param price ¸½ºß¤Î¸ò¾Ä²Á³Ê
+ * @param final ºÇ½ª³ÎÄê²Á³Ê¤Ê¤é¤ÐTRUE
+ * @return ¥×¥ì¥¤¥ä¡¼¤òÄù¤á½Ð¤¹¾ì¹çTRUE¤òÊÖ¤¹
  */
 static int get_haggle(cptr pmt, s32b *poffer, s32b price, int final)
 {
@@ -2818,9 +2939,16 @@ static int get_haggle(cptr pmt, s32b *poffer, s32b price, int final)
 }
 
 
-/*
+/*!
+ * @brief Å¹¼ç¤¬¥×¥ì¥¤¥ä¡¼¤«¤é¤Î¸ò¾Ä²Á³Ê¤òȽÃǤ¹¤ë /
  * Receive an offer (from the player)
- *
+ * @param pmt ¥á¥Ã¥»¡¼¥¸
+ * @param poffer Å¹¼ç¤«¤é¤Î¸ò¾Ä²Á³Ê¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @param last_offer ¸½ºß¤Î¸ò¾Ä²Á³Ê
+ * @param factor Å¹¼ç¤Î²Á³Ê´ð½àÇÜΨ
+ * @param price ¥¢¥¤¥Æ¥à¤Î¼Â²ÁÃÍ
+ * @param final ºÇ½ª²Á³Ê³ÎÄê¤Ê¤é¤ÐTRUE
+ * @return ¥×¥ì¥¤¥ä¡¼¤Î²Á³Ê¤ËÂФ·¤ÆÉÔÉþ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹ /
  * Return TRUE if offer is NOT okay
  */
 static bool receive_offer(cptr pmt, s32b *poffer,
@@ -2848,9 +2976,12 @@ static bool receive_offer(cptr pmt, s32b *poffer,
 }
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤¬¹ØÆþ¤¹¤ë»þ¤ÎÃÍÀÚ¤ê½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Haggling routine                            -RAK-
- *
+ * @param o_ptr ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param price ºÇ½ª²Á³Ê¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @return ¥×¥ì¥¤¥ä¡¼¤Î²Á³Ê¤ËÂФ·¤ÆŹ¼ç¤¬ÉÔÉþ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹ /
  * Return TRUE if purchase is NOT successful
  */
 static bool purchase_haggle(object_type *o_ptr, s32b *price)
@@ -3063,9 +3194,12 @@ static bool purchase_haggle(object_type *o_ptr, s32b *price)
 }
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤¬ÇäµÑ¤¹¤ë»þ¤ÎÃÍÀÚ¤ê½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Haggling routine                            -RAK-
- *
+ * @param o_ptr ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param price ºÇ½ª²Á³Ê¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
+ * @return ¥×¥ì¥¤¥ä¡¼¤Î²Á³Ê¤ËÂФ·¤ÆŹ¼ç¤¬ÉÔÉþ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹ /
  * Return TRUE if purchase is NOT successful
  */
 static bool sell_haggle(object_type *o_ptr, s32b *price)
@@ -3303,8 +3437,10 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
 }
 
 
-/*
+/*!
+ * @brief Å¹¤«¤é¤Î¹ØÆþ½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Buy an item from a store                    -RAK-
+ * @return ¤Ê¤·
  */
 static void store_purchase(void)
 {
@@ -3753,8 +3889,10 @@ msg_format("%s
 }
 
 
-/*
+/*!
+ * @brief Å¹¤«¤é¤ÎÇäµÑ½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Sell an item to the store (or home)
+ * @return ¤Ê¤·
  */
 static void store_sell(void)
 {
@@ -4155,8 +4293,10 @@ msg_format("%s
 }
 
 
-/*
+/*!
+ * @brief Å¹¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Examine an item in a store                     -JDL-
+ * @return ¤Ê¤·
  */
 static void store_examine(void)
 {
@@ -4255,8 +4395,10 @@ msg_print("
 }
 
 
-/*
+/*!
+ * @brief Çîʪ´Û¤Î¥¢¥¤¥Æ¥à¤ò½üµî¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Remove an item from museum (Originally from TOband)
+ * @return ¤Ê¤·
  */
 static void museum_remove_object(void)
 {
@@ -4345,13 +4487,17 @@ static void museum_remove_object(void)
 static bool leave_store = FALSE;
 
 
-/*
+/*!
+ * @brief Å¹ÊÞ½èÍý¥³¥Þ¥ó¥ÉÁªÂò¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Process a command in a store
- *
+ * @return ¤Ê¤·
+ * @note
+ * <pre>
  * Note that we must allow the use of a few "special" commands
  * in the stores which are not allowed in the dungeon, and we
  * must disable some commands which are allowed in the dungeon
  * but not in the stores, to prevent chaos.
+ * </pre>
  */
 static void store_process_command(void)
 {
@@ -4541,9 +4687,9 @@ static void store_process_command(void)
                        else if (p_ptr->pclass == CLASS_SMITH)
                                do_cmd_kaji(TRUE);
                        else if (p_ptr->pclass == CLASS_MAGIC_EATER)
-                               do_cmd_magic_eater(TRUE);
+                               do_cmd_magic_eater(TRUE, FALSE);
                        else if (p_ptr->pclass == CLASS_SNIPER)
-                               do_cmd_snipe();
+                               do_cmd_snipe_browse();
                        else do_cmd_browse();
                        break;
                }
@@ -4732,15 +4878,19 @@ static void store_process_command(void)
 }
 
 
-/*
- * Enter a store, and interact with it.
- *
+/*!
+ * @brief Å¹ÊÞ½èÍýÁ´ÂΤΥᥤ¥ó¥ë¡¼¥Á¥ó /
+ * Enter a store, and interact with it. *
+ * @return ¤Ê¤·
+ * @note
+ * <pre>
  * Note that we use the standard "request_command()" function
  * to get a command, allowing us to use "command_arg" and all
  * command macros and other nifty stuff, but we use the special
  * "shopping" argument, to force certain commands to be converted
  * into other commands, normally, we convert "p" (pray) and "m"
  * (cast magic) into "g" (get), and "s" (search) into "d" (drop).
+ * </pre>
  */
 void do_cmd_store(void)
 {
@@ -4831,6 +4981,8 @@ void do_cmd_store(void)
        /* No automatic command */
        command_new = 0;
 
+       /* Do not expand macros */
+       get_com_no_macros = TRUE;
 
        /* Save the store number */
        cur_store_num = which;
@@ -5102,6 +5254,8 @@ void do_cmd_store(void)
        /* Hack -- Cancel "see" mode */
        command_see = FALSE;
 
+       /* Allow expanding macros */
+       get_com_no_macros = FALSE;
 
        /* Flush messages XXX XXX XXX */
        msg_print(NULL);
@@ -5127,8 +5281,11 @@ void do_cmd_store(void)
 
 
 
-/*
+/*!
+ * @brief ¸½ºß¤ÎÄ®¤ÎŹ¼ç¤ò¸òÂ夵¤»¤ë /
  * Shuffle one of the stores.
+ * @param which Å¹ÊÞ¼ïÎà¤ÎID
+ * @return ¤Ê¤·
  */
 void store_shuffle(int which)
 {
@@ -5198,8 +5355,12 @@ void store_shuffle(int which)
 }
 
 
-/*
+/*!
+ * @brief Å¹¤ÎÉÊ·¤¨¤òÊѲ½¤µ¤»¤ë /
  * Maintain the inventory at the stores.
+ * @param town_num Ä®¤ÎID
+ * @param store_num Å¹ÊÞ¼ïÎà¤ÎID
+ * @return ¤Ê¤·
  */
 void store_maint(int town_num, int store_num)
 {
@@ -5278,8 +5439,12 @@ void store_maint(int town_num, int store_num)
 }
 
 
-/*
+/*!
+ * @brief Å¹ÊÞ¾ðÊó¤ò½é´ü²½¤¹¤ë /
  * Initialize the stores
+ * @param town_num Ä®¤ÎID
+ * @param store_num Å¹ÊÞ¼ïÎà¤ÎID
+ * @return ¤Ê¤·
  */
 void store_init(int town_num, int store_num)
 {
@@ -5332,6 +5497,11 @@ void store_init(int town_num, int store_num)
 }
 
 
+/*!
+ * @brief ¥¢¥¤¥Æ¥à¤òÄ®¤Î¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Ë°ÜÆ°¤µ¤»¤ë /
+ * @param o_ptr °ÜÆ°¤µ¤»¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
+ */
 void move_to_black_market(object_type *o_ptr)
 {
        /* Not in town */
@@ -5345,3 +5515,4 @@ void move_to_black_market(object_type *o_ptr)
 
        object_wipe(o_ptr); /* Don't leave a bogus object behind... */
 }
+