OSDN Git Service

[Refactor] #38997 purchase_analyze() にplayer_type * 引数を追加 / Added player_type * argum...
[hengband/hengband.git] / src / store.c
index b03d79c..e0b33b1 100644 (file)
  */
 
 #include "angband.h"
+#include "core.h"
+#include "util.h"
+#include "term.h"
+
+#include "floor.h"
+#include "cmd-basic.h"
+#include "cmd-dump.h"
 #include "cmd-item.h"
+#include "cmd-smith.h"
 #include "cmd-zapwand.h"
 #include "cmd-magiceat.h"
+#include "spells.h"
 #include "store.h"
 #include "avatar.h"
 #include "cmd-spell.h"
 #include "rumor.h"
 #include "player-status.h"
+#include "player-class.h"
+#include "player-inventory.h"
+#include "object-flavor.h"
 #include "object-hook.h"
+#include "floor-events.h"
+#include "snipe.h"
+#include "files.h"
+#include "player-effects.h"
+#include "player-race.h"
+#include "mind.h"
+#include "world.h"
+#include "objectkind.h"
+#include "autopick.h"
+#include "floor-town.h"
+#include "japanese.h"
+#include "view-mainwindow.h"
+#include "wild.h"
 
 #define MIN_STOCK 12
 
@@ -1610,9 +1635,10 @@ byte store_table[MAX_STORES][STORE_CHOICES][2] =
 /*!
  * @brief 取引成功時の店主のメッセージ処理 /
  * Successful haggle.
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-static void say_comment_1(void)
+static void say_comment_1(player_type *player_ptr)
 {
 #ifdef JP
        /* ブラックマーケットのときは別のメッセージを出す */
@@ -1634,7 +1660,7 @@ static void say_comment_1(void)
 #else
                msg_print("The shopkeeper whispers something into your ear:");
 #endif
-               display_rumor(TRUE);
+               display_rumor(player_ptr, TRUE);
        }
 }
 
@@ -1862,14 +1888,14 @@ static concptr comment_7d[MAX_COMMENT_7D] =
  * @details 
  * We paid "price", it was worth "value", and we thought it was worth "guess"
  */
-static void purchase_analyze(PRICE price, PRICE value, PRICE guess)
+static void purchase_analyze(player_type *player_ptr, PRICE price, PRICE value, PRICE guess)
 {
        /* Item was worthless, but we bought it */
        if ((value <= 0) && (price > value))
        {
                msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
-               chg_virtue(V_HONOUR, -1);
-               chg_virtue(V_JUSTICE, -1);
+               chg_virtue(player_ptr, V_HONOUR, -1);
+               chg_virtue(player_ptr, V_JUSTICE, -1);
                sound(SOUND_STORE1);
        }
 
@@ -1877,8 +1903,8 @@ static void purchase_analyze(PRICE price, PRICE value, PRICE guess)
        else if ((value < guess) && (price > value))
        {
                msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
-               chg_virtue(V_JUSTICE, -1);
-               if (one_in_(4)) chg_virtue(V_HONOUR, -1);
+               chg_virtue(player_ptr, V_JUSTICE, -1);
+               if (one_in_(4)) chg_virtue(player_ptr, V_HONOUR, -1);
                sound(SOUND_STORE2);
        }
 
@@ -1886,8 +1912,8 @@ static void purchase_analyze(PRICE price, PRICE value, PRICE guess)
        else if ((value > guess) && (value < (4 * guess)) && (price < value))
        {
                msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
-               if (one_in_(4)) chg_virtue(V_HONOUR, -1);
-               else if (one_in_(4)) chg_virtue(V_HONOUR, 1);
+               if (one_in_(4)) chg_virtue(player_ptr, V_HONOUR, -1);
+               else if (one_in_(4)) chg_virtue(player_ptr, V_HONOUR, 1);
                sound(SOUND_STORE3);
        }
 
@@ -1895,9 +1921,9 @@ static void purchase_analyze(PRICE price, PRICE value, PRICE guess)
        else if ((value > guess) && (price < value))
        {
                msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
-               if (one_in_(2)) chg_virtue(V_HONOUR, -1);
-               if (one_in_(4)) chg_virtue(V_HONOUR, 1);
-               if (10 * price < value) chg_virtue(V_SACRIFICE, 1);
+               if (one_in_(2)) chg_virtue(player_ptr, V_HONOUR, -1);
+               if (one_in_(4)) chg_virtue(player_ptr, V_HONOUR, 1);
+               if (10 * price < value) chg_virtue(player_ptr, V_SACRIFICE, 1);
                sound(SOUND_STORE4);
        }
 }
@@ -1919,229 +1945,235 @@ 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, Kutar */
+        Angel, Demon, Kutar, Android, Merfolk */
 
        /* Human */
        { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
          124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
          115, 105, 125, 125, 125, 125, 105, 120, 105,  95, 140,
-         100, 120, 110, 105 },
+         100, 120, 110, 105, 110 },
 
        /* Half-Elf */
        { 110, 100, 100, 105, 110, 120, 125, 130, 110, 100, 110,
          120, 115, 108, 115, 110, 110, 120, 120, 115, 115, 110,
          120, 110, 110, 110, 120, 110, 100, 125, 100,  95, 140,
-         110, 115, 110, 110 },
+         110, 115, 110, 110, 110 },
 
        /* Elf */
        { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
          120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
          120, 115, 110, 110, 120, 110, 100, 125, 100,  95, 140,
-         110, 110, 105, 110 },
+         110, 110, 105, 110, 110 },
 
        /* Halfling */
        { 115, 110, 105,  95, 105, 110, 115, 130, 115, 105, 115,
          125, 120, 120, 125, 115, 110, 120, 120, 120, 115, 115,
          120, 110, 120, 120, 130, 110, 110, 130, 110,  95, 140,
-         115, 120, 105, 115 },
+         115, 120, 105, 115, 105 },
 
        /* Gnome */
        { 115, 115, 110, 105,  95, 110, 115, 130, 115, 110, 115,
          120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
          120, 101, 110, 110, 120, 120, 115, 130, 115,  95, 140,
-         115, 110, 110, 115 },
+         115, 110, 110, 115, 110 },
 
        /* Dwarf */
        { 115, 120, 120, 110, 110,  95, 125, 135, 115, 120, 115,
          125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
          120, 105, 115, 115, 115, 115, 120, 130, 120,  95, 140,
-         115, 110, 115, 115 },
+         115, 110, 115, 115, 120 },
 
        /* Half-Orc */
        { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
          110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
          115, 125, 120, 120, 115, 120, 125, 115, 125,  95, 140,
-         115, 110, 115, 115 },
+         115, 110, 115, 115, 125 },
 
        /* Half-Troll */
        { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
          110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
          110, 115, 112, 112, 115, 112, 120, 110, 120,  95, 140,
-         110, 110, 115, 110 },
+         110, 110, 115, 110, 130 },
 
        /* Amberite */
        { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
          120, 120, 105, 120, 115, 105, 115, 120, 110, 105, 105,
          120, 105, 120, 120, 125, 120, 105, 135, 105,  95, 140,
-         100, 110, 110, 100 },
+         100, 110, 110, 100, 110 },
 
        /* High_Elf */
        { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
          125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
          125, 115, 120, 120, 125, 120, 100, 125, 100,  95, 140,
-         110, 110, 105, 110 },
+         110, 110, 105, 110, 110 },
 
        /* Human / Barbarian (copied from human) */
        { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
          124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
          115, 105, 125, 125, 130, 125, 115, 120, 115,  95, 140,
-         100, 120, 110, 100 },
+         100, 120, 110, 100, 110 },
 
        /* Half-Ogre: theoretical, copied from half-troll */
        { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
          110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
          110, 115, 112, 112, 115, 112, 120, 110, 120,  95, 140,
-         110, 110, 115, 110 },
+         110, 110, 115, 110, 120 },
 
        /* Half-Giant: theoretical, copied from half-troll */
        { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
          110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
          110, 115, 112, 112, 115, 112, 130, 120, 130,  95, 140,
-         110, 110, 115, 110 },
+         110, 110, 115, 110, 115 },
 
        /* Half-Titan: theoretical, copied from High_Elf */
        { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
          125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
          125, 115, 120, 120, 120, 120, 130, 130, 130,  95, 140,
-         110, 110, 115, 110 },
+         110, 110, 115, 110, 108 },
 
        /* Cyclops: theoretical, copied from half-troll */
        { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
          110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
          110, 115, 112, 112, 115, 112, 130, 130, 130,  95, 140,
-         110, 110, 115, 110 },
+         110, 110, 115, 110, 115 },
 
        /* Yeek: theoretical, copied from Half-Orc */
        { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
          110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
          115, 125, 120, 120, 120, 120, 130, 130, 130,  95, 140,
-         115, 110, 115, 115 },
+         115, 110, 115, 115, 110 },
 
        /* Klackon: theoretical, copied from Gnome */
        { 115, 115, 110, 105,  95, 110, 115, 130, 115, 110, 115,
          120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
          120, 101, 110, 110, 120, 120, 130, 130, 130,  95, 140,
-         115, 110, 115, 115 },
+         115, 110, 115, 115, 110 },
 
        /* Kobold: theoretical, copied from Half-Orc */
        { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
          110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
          115, 125, 120, 120, 120, 120, 130, 130, 130,  95, 140,
-         115, 110, 115, 115 },
+         115, 110, 115, 115, 120 },
 
        /* Nibelung: theoretical, copied from Dwarf */
        { 115, 120, 120, 110, 110,  95, 125, 135, 115, 120, 115,
          125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
          120, 105, 115, 115, 120, 120, 130, 130, 130,  95, 140,
-         115, 135, 115, 115 },
+         115, 135, 115, 115, 120 },
 
        /* Dark Elf */
        { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
          115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
          110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
-         110, 101, 115, 110 },
+         110, 101, 115, 110, 115 },
 
        /* Draconian: theoretical, copied from High_Elf */
        { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
          125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
          125, 115, 120, 120, 120, 120, 130, 130, 130,  95, 140,
-         110, 110, 115, 110 },
+         110, 110, 115, 110, 115 },
 
        /* Mind Flayer: theoretical, copied from High_Elf */
        { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
          125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
          125, 115, 120, 120, 120, 120, 130, 130, 130,  95, 140,
-         110, 110, 115, 110 },
+         110, 110, 115, 110, 110 },
 
        /* Imp: theoretical, copied from High_Elf */
        { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
          125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
          125, 115, 120, 120, 120, 120, 130, 130, 130, 120, 120,
-         110, 110, 115, 110 },
+         110, 110, 115, 110, 120 },
 
        /* Golem: theoretical, copied from High_Elf */
        { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
          125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
          125, 115, 120, 120, 120, 120, 130, 130, 130,  95, 140,
-         110, 110, 115, 110 },
+         110, 110, 115, 110, 110 },
 
        /* Skeleton: theoretical, copied from half-orc */
        { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
          110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
          115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
-         115, 110, 125, 115 },
+         115, 110, 125, 115, 110 },
 
        /* Zombie: Theoretical, copied from half-orc */
        { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
          110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
          115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
-         115, 110, 125, 115 },
+         115, 110, 125, 115, 110 },
 
        /* Vampire: Theoretical, copied from half-orc */
        { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
          110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
          115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
-         115, 110, 125, 115 },
+         115, 110, 125, 115, 120 },
 
        /* Spectre: Theoretical, copied from half-orc */
        { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
          110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
          115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
-         115, 110, 125, 115 },
+         115, 110, 125, 115, 110 },
 
        /* Sprite: Theoretical, copied from half-orc */
        { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
          110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
          115, 125, 120, 120, 120, 120, 130, 130, 130,  95, 140,
-         115, 110, 105, 115 },
+         115, 110, 105, 115, 110 },
 
        /* Beastman: Theoretical, copied from half-orc */
        { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
          110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
          115, 125, 120, 120, 120, 120, 130, 130, 130,  95, 140,
-         115, 110, 115, 115 },
+         115, 110, 115, 115, 125 },
 
        /* Ent */
        { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
          120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
          120, 115, 110, 110, 120, 110, 100, 125, 100,  95, 140,
-         110, 110, 105, 110 },
+         110, 110, 105, 110, 110 },
 
        /* Angel */
        {  95,  95,  95,  95,  95,  95,  95,  95,  95,  95,  95,
           95,  95,  95,  95,  95,  95,  95,  95,  95,  95,  95,
           95,  95,  95,  95,  95,  95,  95,  95,  95,  95, 160,
-          95,  95,  95,  95 },
+          95,  95,  95,  95,  95 },
 
        /* Demon */
        { 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
          140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
          140, 140, 140, 140, 140, 140, 140, 140, 140, 160, 120,
-         140, 140, 140, 140 },
+         140, 140, 140, 140, 140 },
 
        /* Dunadan */
        { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
          124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
          115, 105, 125, 125, 125, 125, 105, 120, 105,  95, 140,
-         100, 120, 110, 100 },
+         100, 120, 110, 100, 110 },
 
        /* Shadow Fairy */
        { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
          115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
          110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
-         110, 101, 115, 110 },
+         110, 101, 115, 110, 115 },
 
        /* 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,
-         110, 115, 100, 110 },
+         110, 115, 100, 110, 110 },
 
        /* Android */
        { 105, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
          124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
          115, 105, 125, 125, 125, 125, 105, 120, 105,  95, 140,
-         100, 120, 110, 100 },
+         100, 120, 110, 100, 110 },
+
+       /* Merfolk */
+       { 110, 110, 110, 105, 110, 120, 125, 130, 110, 110, 110,
+         120, 115, 108, 115, 110, 110, 120, 120, 115, 115, 110,
+         120, 110, 110, 110, 120, 110, 110, 125, 110,  95, 140,
+         110, 115, 110, 110, 100 },
 };
 
 
@@ -2152,7 +2184,7 @@ static byte rgold_adj[MAX_RACES][MAX_RACES] =
  * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
  * @param greed 店主の強欲度
  * @param flip TRUEならば店主にとっての買取価格、FALSEなら売出価格を計算
- * @return ã\81ªã\81\97
+ * @return ã\82¢ã\82¤ã\83\86ã\83 ã\81®åº\97è\88\97価格
  * @details 
  * <pre>
  * This function takes into account the player's charisma, and the
@@ -2168,12 +2200,11 @@ static byte rgold_adj[MAX_RACES][MAX_RACES] =
  * "greed" value is always something (?).
  * </pre>
  */
-static s32b price_item(object_type *o_ptr, int greed, bool flip)
+static PRICE price_item(object_type *o_ptr, int greed, bool flip)
 {
-       int     factor;
-       int     adjust;
-       s32b    price;
-
+       int factor;
+       int adjust;
+       PRICE price;
 
        /* Get the value of one of the items */
        price = object_value(o_ptr);
@@ -2181,7 +2212,6 @@ static s32b price_item(object_type *o_ptr, int greed, bool flip)
        /* Worthless items */
        if (price <= 0) return (0L);
 
-
        /* Compute the racial factor */
        factor = rgold_adj[ot_ptr->owner_race][p_ptr->prace];
 
@@ -2418,50 +2448,50 @@ static bool store_object_similar(object_type *o_ptr, object_type *j_ptr)
        int i;
 
        /* Hack -- Identical items cannot be stacked */
-       if (o_ptr == j_ptr) return (0);
+       if (o_ptr == j_ptr) return 0;
 
        /* Different objects cannot be stacked */
-       if (o_ptr->k_idx != j_ptr->k_idx) return (0);
+       if (o_ptr->k_idx != j_ptr->k_idx) return 0;
 
        /* Different charges (etc) cannot be stacked, unless wands or rods. */
-       if ((o_ptr->pval != j_ptr->pval) && (o_ptr->tval != TV_WAND) && (o_ptr->tval != TV_ROD)) return (0);
+       if ((o_ptr->pval != j_ptr->pval) && (o_ptr->tval != TV_WAND) && (o_ptr->tval != TV_ROD)) return 0;
 
        /* Require many identical values */
-       if (o_ptr->to_h != j_ptr->to_h) return (0);
-       if (o_ptr->to_d != j_ptr->to_d) return (0);
-       if (o_ptr->to_a != j_ptr->to_a) return (0);
+       if (o_ptr->to_h != j_ptr->to_h) return 0;
+       if (o_ptr->to_d != j_ptr->to_d) return 0;
+       if (o_ptr->to_a != j_ptr->to_a) return 0;
 
        /* Require identical "ego-item" names */
-       if (o_ptr->name2 != j_ptr->name2) return (0);
+       if (o_ptr->name2 != j_ptr->name2) return 0;
 
        /* Artifacts don't stack! */
-       if (object_is_artifact(o_ptr) || object_is_artifact(j_ptr)) return (0);
+       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++)
-               if (o_ptr->art_flags[i] != j_ptr->art_flags[i]) return (0);
+               if (o_ptr->art_flags[i] != j_ptr->art_flags[i]) return 0;
 
        /* Hack -- Never stack "powerful" items */
-       if (o_ptr->xtra1 || j_ptr->xtra1) return (0);
+       if (o_ptr->xtra1 || j_ptr->xtra1) return 0;
 
        /* Hack -- Never stack recharging items */
-       if (o_ptr->timeout || j_ptr->timeout) return (0);
+       if (o_ptr->timeout || j_ptr->timeout) return 0;
 
        /* Require many identical values */
-       if (o_ptr->ac != j_ptr->ac)   return (0);
-       if (o_ptr->dd != j_ptr->dd)   return (0);
-       if (o_ptr->ds != j_ptr->ds)   return (0);
+       if (o_ptr->ac != j_ptr->ac)   return 0;
+       if (o_ptr->dd != j_ptr->dd)   return 0;
+       if (o_ptr->ds != j_ptr->ds)   return 0;
 
        /* Hack -- Never stack chests */
-       if (o_ptr->tval == TV_CHEST) return (0);
-       if (o_ptr->tval == TV_STATUE) return (0);
-       if (o_ptr->tval == TV_CAPTURE) return (0);
+       if (o_ptr->tval == TV_CHEST) return 0;
+       if (o_ptr->tval == TV_STATUE) return 0;
+       if (o_ptr->tval == TV_CAPTURE) return 0;
 
        /* Require matching discounts */
-       if (o_ptr->discount != j_ptr->discount) return (0);
+       if (o_ptr->discount != j_ptr->discount) return 0;
 
        /* They match, so they must be similar */
-       return (TRUE);
+       return TRUE;
 }
 
 
@@ -2597,12 +2627,12 @@ static int store_check_num(object_type *o_ptr)
  * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
  * @return アイテムが祝福されたアイテムならばTRUEを返す
  */
-static bool is_blessed(object_type *o_ptr)
+static bool is_blessed_item(object_type *o_ptr)
 {
        BIT_FLAGS flgs[TR_FLAG_SIZE];
        object_flags(o_ptr, flgs);
-       if (have_flag(flgs, TR_BLESSED)) return (TRUE);
-       else return (FALSE);
+       if (have_flag(flgs, TR_BLESSED)) return TRUE;
+       else return FALSE;
 }
 
 
@@ -2618,7 +2648,7 @@ static bool is_blessed(object_type *o_ptr)
 static bool store_will_buy(object_type *o_ptr)
 {
        /* Hack -- The Home is simple */
-       if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) return (TRUE);
+       if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) return TRUE;
 
        /* Switch on the store */
        switch (cur_store_num)
@@ -2649,7 +2679,7 @@ static bool store_will_buy(object_type *o_ptr)
                                case TV_CARD:
                                break;
                                default:
-                               return (FALSE);
+                               return FALSE;
                        }
                        break;
                }
@@ -2671,7 +2701,7 @@ static bool store_will_buy(object_type *o_ptr)
                                case TV_DRAG_ARMOR:
                                break;
                                default:
-                               return (FALSE);
+                               return FALSE;
                        }
                        break;
                }
@@ -2693,11 +2723,11 @@ static bool store_will_buy(object_type *o_ptr)
                                break;
                                case TV_HAFTED:
                                {
-                                       if(o_ptr->sval == SV_WIZSTAFF) return (FALSE);
+                                       if(o_ptr->sval == SV_WIZSTAFF) return FALSE;
                                }
                                break;
                                default:
-                               return (FALSE);
+                               return FALSE;
                        }
                        break;
                }
@@ -2737,10 +2767,10 @@ static bool store_will_buy(object_type *o_ptr)
                                case TV_POLEARM:
                                case TV_SWORD:
                                {
-                                       if (is_blessed(o_ptr)) break;
+                                       if (is_blessed_item(o_ptr)) break;
                                }
                                default:
-                               return (FALSE);
+                               return FALSE;
                        }
                        break;
                }
@@ -2755,7 +2785,7 @@ static bool store_will_buy(object_type *o_ptr)
                                case TV_POTION:
                                break;
                                default:
-                               return (FALSE);
+                               return FALSE;
                        }
                        break;
                }
@@ -2788,10 +2818,10 @@ static bool store_will_buy(object_type *o_ptr)
                                case TV_HAFTED:
                                {
                                        if(o_ptr->sval == SV_WIZSTAFF) break;
-                                       else return (FALSE);
+                                       else return FALSE;
                                }
                                default:
-                               return (FALSE);
+                               return FALSE;
                        }
                        break;
                }
@@ -2815,17 +2845,17 @@ static bool store_will_buy(object_type *o_ptr)
                                case TV_HEX_BOOK:
                                        break;
                                default:
-                                       return (FALSE);
+                                       return FALSE;
                        }
                        break;
                }
        }
 
        /* Ignore "worthless" items */
-       if (object_value(o_ptr) <= 0) return (FALSE);
+       if (object_value(o_ptr) <= 0) return FALSE;
 
        /* Assume okay */
-       return (TRUE);
+       return TRUE;
 }
 
 
@@ -3050,12 +3080,12 @@ static int home_carry(object_type *o_ptr)
        /* No space? */
        if ((cur_store_num != STORE_HOME) || (powerup_home == TRUE)) {
                if (st_ptr->stock_num >= st_ptr->stock_size) {
-                       return (-1);
+                       return -1;
                }
        }
        else{
                if (st_ptr->stock_num >= ((st_ptr->stock_size) / 10)) {
-                       return (-1);
+                       return -1;
                }
        }
 
@@ -3081,7 +3111,7 @@ static int home_carry(object_type *o_ptr)
        /* Insert the new item */
        st_ptr->stock[slot] = *o_ptr;
 
-       chg_virtue(V_SACRIFICE, -1);
+       chg_virtue(p_ptr, V_SACRIFICE, -1);
 
        (void)combine_and_reorder_home(cur_store_num);
 
@@ -3114,7 +3144,7 @@ static int store_carry(object_type *o_ptr)
        value = object_value(o_ptr);
 
        /* Cursed/Worthless items "disappear" when sold */
-       if (value <= 0) return (-1);
+       if (value <= 0) return -1;
 
        /* All store items are fully *identified* */
        o_ptr->ident |= IDENT_MENTAL;
@@ -3143,7 +3173,7 @@ static int store_carry(object_type *o_ptr)
        }
 
        /* No space? */
-       if (st_ptr->stock_num >= st_ptr->stock_size) return (-1);
+       if (st_ptr->stock_num >= st_ptr->stock_size) return -1;
 
 
        /* Check existing slots to see if we must "slide" */
@@ -3274,12 +3304,12 @@ static bool black_market_crap(object_type *o_ptr)
        int i, j;
 
        /* Ego items are never crap */
-       if (object_is_ego(o_ptr)) return (FALSE);
+       if (object_is_ego(o_ptr)) return FALSE;
 
        /* Good items are never crap */
-       if (o_ptr->to_a > 0) return (FALSE);
-       if (o_ptr->to_h > 0) return (FALSE);
-       if (o_ptr->to_d > 0) return (FALSE);
+       if (o_ptr->to_a > 0) return FALSE;
+       if (o_ptr->to_h > 0) return FALSE;
+       if (o_ptr->to_d > 0) return FALSE;
 
        /* Check all stores */
        for (i = 0; i < MAX_STORES; i++)
@@ -3293,12 +3323,12 @@ static bool black_market_crap(object_type *o_ptr)
                        object_type *j_ptr = &town_info[p_ptr->town_num].store[i].stock[j];
 
                        /* Duplicate item "type", assume crappy */
-                       if (o_ptr->k_idx == j_ptr->k_idx) return (TRUE);
+                       if (o_ptr->k_idx == j_ptr->k_idx) return TRUE;
                }
        }
 
        /* Assume okay */
-       return (FALSE);
+       return FALSE;
 }
 
 
@@ -3343,6 +3373,7 @@ static void store_delete(void)
 /*!
  * @brief 店舗の品揃え変化のためにアイテムを追加する /
  * Creates a random item and gives it to a store
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @details
  * <pre>
@@ -3354,7 +3385,7 @@ static void store_delete(void)
  * Should we check for "permission" to have the given item?
  * </pre>
  */
-static void store_create(void)
+static void store_create(player_type *player_ptr)
 {
        OBJECT_IDX i;
        int tries;
@@ -3363,11 +3394,9 @@ static void store_create(void)
        object_type forge;
        object_type *q_ptr;
 
-
        /* Paranoia -- no room left */
        if (st_ptr->stock_num >= st_ptr->stock_size) return;
 
-
        /* Hack -- consider up to four items */
        for (tries = 0; tries < 4; tries++)
        {
@@ -3378,7 +3407,7 @@ static void store_create(void)
                        level = 25 + randint0(25);
 
                        /* Random item (usually of given level) */
-                       i = get_obj_num(level);
+                       i = get_obj_num(player_ptr, level, 0x00000000);
 
                        /* Handle failure */
                        if (!i) continue;
@@ -3400,7 +3429,7 @@ static void store_create(void)
                object_prep(q_ptr, i);
 
                /* Apply some "low-level" magic (no artifacts) */
-               apply_magic(q_ptr, level, AM_NO_FIXED_ART);
+               apply_magic(player_ptr, q_ptr, level, AM_NO_FIXED_ART);
 
                /* Require valid object */
                if (!store_will_buy(q_ptr)) continue;
@@ -3467,16 +3496,16 @@ static bool noneedtobargain(PRICE minprice)
        PRICE bad = st_ptr->bad_buy;
 
        /* Cheap items are "boring" */
-       if (minprice < 10L) return (TRUE);
+       if (minprice < 10L) return TRUE;
 
        /* Perfect haggling */
-       if (good == MAX_SHORT) return (TRUE);
+       if (good == MAX_SHORT) return TRUE;
 
        /* Reward good haggles, punish bad haggles, notice price */
-       if (good > ((3 * bad) + (5 + (minprice/50)))) return (TRUE);
+       if (good > ((3 * bad) + (5 + (minprice/50)))) return TRUE;
 
        /* Return the flag */
-       return (FALSE);
+       return FALSE;
 }
 
 
@@ -3658,7 +3687,7 @@ static void display_entry(int pos)
 
 /*!
  * @brief 店の商品リストを表示する /
- * Displays a store's inventory                -RAK-
+ * Displays a store's inventory -RAK-
  * @return なし
  * @details
  * All prices are listed as "per individual object".  -BEN-
@@ -3803,8 +3832,6 @@ static void display_store(void)
 
        /* Display the current gold */
        store_prt_gold();
-
-       /* Draw in the inventory */
        display_inventory();
 }
 
@@ -3832,11 +3859,9 @@ static int get_stock(COMMAND_CODE *com_val, concptr pmt, int i, int j)
                if ((*com_val >= i) && (*com_val <= j))
                {
                        /* Success */
-                       return (TRUE);
+                       return TRUE;
                }
        }
-
-       /* Paranoia */
        msg_print(NULL);
 
        /* Assume failure */
@@ -3884,12 +3909,12 @@ static int get_stock(COMMAND_CODE *com_val, concptr pmt, int i, int j)
        /* Clear the prompt */
        prt("", 0, 0);
 
-       if (command == ESCAPE) return (FALSE);
+       if (command == ESCAPE) return FALSE;
 
        repeat_push(*com_val);
 
        /* Success */
-       return (TRUE);
+       return TRUE;
 }
 
 
@@ -3915,14 +3940,14 @@ static int increase_insults(void)
                st_ptr->bad_buy = 0;
 
                /* Open tomorrow */
-               st_ptr->store_open = turn + TURNS_PER_TICK*TOWN_DAWN/8 + randint1(TURNS_PER_TICK*TOWN_DAWN/8);
+               st_ptr->store_open = current_world_ptr->game_turn + TURNS_PER_TICK*TOWN_DAWN/8 + randint1(TURNS_PER_TICK*TOWN_DAWN/8);
 
                /* Closed */
-               return (TRUE);
+               return TRUE;
        }
 
        /* Not closed */
-       return (FALSE);
+       return FALSE;
 }
 
 
@@ -3946,13 +3971,13 @@ static void decrease_insults(void)
 static int haggle_insults(void)
 {
        /* Increase insults */
-       if (increase_insults()) return (TRUE);
+       if (increase_insults()) return TRUE;
 
        /* Display and flush insult */
        say_comment_5();
 
        /* Still okay */
-       return (FALSE);
+       return FALSE;
 }
 
 
@@ -4009,8 +4034,6 @@ static int get_haggle(concptr pmt, s32b *poffer, PRICE price, int final)
        {
                sprintf(buf, "%s ", pmt);
        }
-
-       /* Paranoia */
        msg_print(NULL);
 
        /* Ask until done */
@@ -4093,7 +4116,7 @@ static int get_haggle(concptr pmt, s32b *poffer, PRICE price, int final)
        }
 
        /* Success */
-       return (TRUE);
+       return TRUE;
 }
 
 
@@ -4117,20 +4140,20 @@ static bool receive_offer(concptr pmt, s32b *poffer,
        while (TRUE)
        {
                /* Get a haggle (or cancel) */
-               if (!get_haggle(pmt, poffer, price, final)) return (TRUE);
+               if (!get_haggle(pmt, poffer, price, final)) return TRUE;
 
                /* Acceptable offer */
                if (((*poffer) * factor) >= (last_offer * factor)) break;
 
                /* Insult, and check for kicked out */
-               if (haggle_insults()) return (TRUE);
+               if (haggle_insults()) return TRUE;
 
                /* Reject offer (correctly) */
                (*poffer) = last_offer;
        }
 
        /* Success */
-       return (FALSE);
+       return FALSE;
 }
 
 
@@ -4298,12 +4321,12 @@ static bool purchase_haggle(object_type *o_ptr, s32b *price)
                }
        }
 
-       if (cancel) return (TRUE);
+       if (cancel) return TRUE;
 
        updatebargain(*price, final_ask, o_ptr->number);
 
        /* Do not cancel */
-       return (FALSE);
+       return FALSE;
 }
 
 
@@ -4324,18 +4347,12 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
        int     flag, loop_flag, noneed;
        int     annoyed = 0, final = FALSE;
        bool    cancel = FALSE;
-#ifdef JP
-       concptr pmt = "提示金額";
-#else
-       concptr    pmt = "Offer";
-#endif
+       concptr pmt = _("提示金額", "Offer");
 
        char    out_val[160];
 
-
        *price = 0;
 
-
        /* Obtain the starting offer and the final offer */
        cur_ask = price_item(o_ptr, ot_ptr->max_inflate, TRUE);
        final_ask = price_item(o_ptr, ot_ptr->min_inflate, TRUE);
@@ -4358,12 +4375,7 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
                /* No reason to haggle */
                if (final_ask >= purse)
                {
-#ifdef JP
-                       msg_print("即座にこの金額にまとまった。");
-#else
-                       msg_print("You instantly agree upon the price.");
-#endif
-
+                       msg_print(_("即座にこの金額にまとまった。", "You instantly agree upon the price."));
                        msg_print(NULL);
 
                        /* Offer full purse */
@@ -4373,12 +4385,7 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
                /* No need to haggle */
                else if (noneed)
                {
-#ifdef JP
-                       msg_print("結局この金額にまとまった。");
-#else
-                       msg_print("You eventually agree upon the price.");
-#endif
-
+                       msg_print(_("結局この金額にまとまった。", "You eventually agree upon the price."));
                        msg_print(NULL);
                }
 
@@ -4386,12 +4393,7 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
                else
                {
                        /* Message summary */
-#ifdef JP
-                       msg_print("すんなりとこの金額にまとまった。");
-#else
-                       msg_print("You quickly agree upon the price.");
-#endif
-
+                       msg_print(_("すんなりとこの金額にまとまった。", "You quickly agree upon the price."));
                        msg_print(NULL);
                }
 
@@ -4400,12 +4402,7 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
 
                /* Final offer */
                final = TRUE;
-#ifdef JP
-               pmt = "最終提示金額";
-#else
-               pmt = "Final Offer";
-#endif
-
+               pmt = _("最終提示金額", "Final Offer");
        }
 
        /* Haggle for the whole pile */
@@ -4432,18 +4429,13 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
        /* Haggle */
        for (flag = FALSE; !flag; )
        {
-               while (1)
+               while (TRUE)
                {
                        loop_flag = TRUE;
 
                        (void)sprintf(out_val, "%s :  %ld", pmt, (long)cur_ask);
                        put_str(out_val, 1, 0);
-#ifdef JP
-                       cancel = receive_offer("提示する価格? ",
-#else
-                       cancel = receive_offer("What price do you ask? ",
-#endif
-
+                       cancel = receive_offer(_("提示する価格? ", "What price do you ask? "),
                                                                   &offer, last_offer, -1, cur_ask, final);
 
                        if (cancel)
@@ -4496,11 +4488,7 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
                        {
                                cur_ask = final_ask;
                                final = TRUE;
-#ifdef JP
-                               pmt = "最終提示金額";
-#else
-                               pmt = "Final Offer";
-#endif
+                               pmt = _("最終提示金額", "Final Offer");
 
                                annoyed++;
                                if (annoyed > 3)
@@ -4525,33 +4513,29 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
                                allow_inc = TRUE;
                                prt("", 1, 0);
                                (void)sprintf(out_val,
-#ifdef JP
-                                             "前回の提示価格 $%ld", (long)last_offer);
-#else
-                                                         "Your last bid %ld", (long)last_offer);
-#endif
-
+                                       _("前回の提示価格 $%ld", "Your last bid %ld"), (long)last_offer);
                                put_str(out_val, 1, 39);
                                say_comment_3(cur_ask, annoyed);
                        }
                }
        }
 
-       if (cancel) return (TRUE);
+       if (cancel) return TRUE;
 
        updatebargain(*price, final_ask, o_ptr->number);
 
        /* Do not cancel */
-       return (FALSE);
+       return FALSE;
 }
 
 
 /*!
  * @brief 店からの購入処理のメインルーチン /
  * Buy an item from a store                    -RAK-
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-static void store_purchase(void)
+static void store_purchase(player_type *player_ptr)
 {
        int i, choice;
        COMMAND_CODE item, item_new;
@@ -4571,11 +4555,7 @@ static void store_purchase(void)
 
        if (cur_store_num == STORE_MUSEUM)
        {
-#ifdef JP
-               msg_print("博物館から取り出すことはできません。");
-#else
-               msg_print("Museum.");
-#endif
+               msg_print(_("博物館から取り出すことはできません。", "Museum."));
                return;
        }
 
@@ -4583,23 +4563,12 @@ static void store_purchase(void)
        if (st_ptr->stock_num <= 0)
        {
                if (cur_store_num == STORE_HOME)
-#ifdef JP
-                       msg_print("我が家には何も置いてありません。");
-#else
-                       msg_print("Your home is empty.");
-#endif
-
+                       msg_print(_("我が家には何も置いてありません。", "Your home is empty."));
                else
-#ifdef JP
-                       msg_print("現在商品の在庫を切らしています。");
-#else
-                       msg_print("I am currently out of stock.");
-#endif
-
+                       msg_print(_("現在商品の在庫を切らしています。", "I am currently out of stock."));
                return;
        }
 
-
        /* Find the number of objects on this and following pages */
        i = (st_ptr->stock_num - store_top);
 
@@ -4676,11 +4645,7 @@ static void store_purchase(void)
                {
                        msg_format(_("一つにつき $%ldです。", "That costs %ld gold per item."), (long)(best));
                }
-
-               /* Get a quantity */
                amt = get_quantity(NULL, o_ptr->number);
-
-               /* Allow user abort */
                if (amt <= 0) return;
        }
        j_ptr = &forge;
@@ -4729,7 +4694,7 @@ static void store_purchase(void)
                        choice = purchase_haggle(j_ptr, &price);
 
                        /* Hack -- Got kicked out */
-                       if (st_ptr->store_open >= turn) return;
+                       if (st_ptr->store_open >= current_world_ptr->game_turn) return;
                }
 
                /* Player wants it */
@@ -4739,15 +4704,15 @@ static void store_purchase(void)
                        if (price == (best * j_ptr->number)) o_ptr->ident |= (IDENT_FIXED);
 
                        /* Player can afford it */
-                       if (p_ptr->au >= price)
+                       if (player_ptr->au >= price)
                        {
                                /* Say "okay" */
-                               say_comment_1();
+                               say_comment_1(player_ptr);
 
                                if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
-                                       chg_virtue(V_JUSTICE, -1);
+                                       chg_virtue(player_ptr, V_JUSTICE, -1);
                                if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
-                                       chg_virtue(V_NATURE, -1);
+                                       chg_virtue(player_ptr, V_NATURE, -1);
 
                                /* Make a sound */
                                sound(SOUND_BUY);
@@ -4756,13 +4721,13 @@ static void store_purchase(void)
                                decrease_insults();
 
                                /* Spend the money */
-                               p_ptr->au -= price;
+                               player_ptr->au -= price;
 
                                /* Update the display */
                                store_prt_gold();
 
                                /* Hack -- buying an item makes you aware of it */
-                               object_aware(j_ptr);
+                               object_aware(player_ptr, j_ptr);
 
                                /* Hack -- clear the "fixed" flag from the item */
                                j_ptr->ident &= ~(IDENT_FIXED);
@@ -4773,12 +4738,12 @@ static void store_purchase(void)
                                msg_format(_("%sを $%ldで購入しました。", "You bought %s for %ld gold."), o_name, (long)price);
 
                                strcpy(record_o_name, o_name);
-                               record_turn = turn;
+                               record_turn = current_world_ptr->game_turn;
 
-                               if (record_buy) do_cmd_write_nikki(NIKKI_BUY, 0, o_name);
+                               if (record_buy) exe_write_diary(player_ptr, NIKKI_BUY, 0, o_name);
                                object_desc(o_name, o_ptr, OD_NAME_ONLY);
                                if(record_rand_art && o_ptr->art_name)
-                                       do_cmd_write_nikki(NIKKI_ART, 0, o_name);
+                                       exe_write_diary(player_ptr, NIKKI_ART, 0, o_name);
 
                                /* Erase the inscription */
                                j_ptr->inscription = 0;
@@ -4787,21 +4752,22 @@ static void store_purchase(void)
                                j_ptr->feeling = FEEL_NONE;
                                j_ptr->ident &= ~(IDENT_STORE);
                                /* Give it to the player */
-                               item_new = inven_carry(j_ptr);
+                               item_new = inven_carry(player_ptr, j_ptr);
 
                                /* Describe the final result */
-                               object_desc(o_name, &inventory[item_new], 0);
+                               object_desc(o_name, &player_ptr->inventory_list[item_new], 0);
                                msg_format(_("%s(%c)を手に入れた。", "You have %s (%c)."), o_name, index_to_label(item_new));
 
                                /* Auto-inscription */
-                               autopick_alter_item(item_new, FALSE);
+                               autopick_alter_item(player_ptr, item_new, FALSE);
 
                                /* Now, reduce the original stack's pval. */
                                if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
                                {
                                        o_ptr->pval -= j_ptr->pval;
                                }
-                               handle_stuff();
+
+                               handle_stuff(player_ptr);
 
                                /* Note how many slots the store used to have */
                                i = st_ptr->stock_num;
@@ -4837,11 +4803,10 @@ static void store_purchase(void)
                                                msg_print(_("店主は新たな在庫を取り出した。", "The shopkeeper brings out some new stock."));
                                        }
 
-                                       /* New inventory */
                                        for (i = 0; i < 10; i++)
                                        {
                                                /* Maintain the store */
-                                               store_maint(p_ptr->town_num, cur_store_num);
+                                               store_maint(player_ptr, player_ptr->town_num, cur_store_num);
                                        }
 
                                        /* Start over */
@@ -4883,13 +4848,13 @@ static void store_purchase(void)
                distribute_charges(o_ptr, j_ptr, amt);
 
                /* Give it to the player */
-               item_new = inven_carry(j_ptr);
+               item_new = inven_carry(player_ptr, j_ptr);
 
                /* Describe just the result */
-               object_desc(o_name, &inventory[item_new], 0);
+               object_desc(o_name, &player_ptr->inventory_list[item_new], 0);
 
                msg_format(_("%s(%c)を取った。", "You have %s (%c)."), o_name, index_to_label(item_new));
-               handle_stuff();
+               handle_stuff(player_ptr);
 
                /* Take note if we take the last one */
                i = st_ptr->stock_num;
@@ -4919,21 +4884,19 @@ static void store_purchase(void)
                        else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
                        display_inventory();
 
-                       chg_virtue(V_SACRIFICE, 1);
+                       chg_virtue(player_ptr, V_SACRIFICE, 1);
                }
        }
-
-       /* Not kicked out */
-       return;
 }
 
 
 /*!
  * @brief 店からの売却処理のメインルーチン /
  * Sell an item to the store (or home)
+ * @param owner_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-static void store_sell(void)
+static void store_sell(player_type *owner_ptr)
 {
        int choice;
        OBJECT_IDX item;
@@ -4944,7 +4907,6 @@ static void store_sell(void)
 
        object_type forge;
        object_type *q_ptr;
-
        object_type *o_ptr;
 
        concptr q, s;
@@ -4979,7 +4941,7 @@ static void store_sell(void)
                s = _("欲しい物がないですねえ。", "You have nothing that I want.");
        }
 
-       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       o_ptr = choose_object(owner_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
        if (!o_ptr) return;
 
        /* Hack -- Cannot remove cursed items */
@@ -4992,13 +4954,9 @@ static void store_sell(void)
        /* Assume one item */
        amt = 1;
 
-       /* Find out how many the player wants (letter means "all") */
        if (o_ptr->number > 1)
        {
-               /* Get a quantity */
                amt = get_quantity(NULL, o_ptr->number);
-
-               /* Allow user abort */
                if (amt <= 0) return;
        }
        q_ptr = &forge;
@@ -5043,7 +5001,6 @@ static void store_sell(void)
                return;
        }
 
-
        /* Real store */
        if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
        {
@@ -5056,27 +5013,27 @@ static void store_sell(void)
                choice = sell_haggle(q_ptr, &price);
 
                /* Kicked out */
-               if (st_ptr->store_open >= turn) return;
+               if (st_ptr->store_open >= current_world_ptr->game_turn) return;
 
                /* Sold... */
                if (choice == 0)
                {
                        /* Say "okay" */
-                       say_comment_1();
+                       say_comment_1(owner_ptr);
 
                        /* Make a sound */
                        sound(SOUND_SELL);
 
                        /* Be happy */
                        if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
-                               chg_virtue(V_JUSTICE, -1);
+                               chg_virtue(owner_ptr, V_JUSTICE, -1);
 
                        if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
-                               chg_virtue(V_NATURE, 1);
+                               chg_virtue(owner_ptr, V_NATURE, 1);
                        decrease_insults();
 
                        /* Get some money */
-                       p_ptr->au += price;
+                       owner_ptr->au += price;
 
                        /* Update the display */
                        store_prt_gold();
@@ -5084,7 +5041,7 @@ static void store_sell(void)
                        /* Get the "apparent" value */
                        dummy = object_value(q_ptr) * q_ptr->number;
 
-                       identify_item(o_ptr);
+                       identify_item(owner_ptr, o_ptr);
                        q_ptr = &forge;
 
                        /* Get a copy of the object */
@@ -5114,12 +5071,12 @@ static void store_sell(void)
                        /* Describe the result (in message buffer) */
                        msg_format(_("%sを $%ldで売却しました。", "You sold %s for %ld gold."), o_name, (long)price);
 
-                       if (record_sell) do_cmd_write_nikki(NIKKI_SELL, 0, o_name);
+                       if (record_sell) exe_write_diary(owner_ptr, NIKKI_SELL, 0, o_name);
 
                        if (!((o_ptr->tval == TV_FIGURINE) && (value > 0)))
                        {
                         /* Analyze the prices (and comment verbally) unless a figurine*/
-                       purchase_analyze(price, value, dummy);
+                       purchase_analyze(owner_ptr, price, value, dummy);
                        }
 
                        /*
@@ -5132,15 +5089,15 @@ static void store_sell(void)
                        q_ptr->timeout = 0;
 
                        /* Take the item from the player, describe the result */
-                       inven_item_increase(item, -amt);
-                       inven_item_describe(item);
+                       inven_item_increase(owner_ptr, item, -amt);
+                       inven_item_describe(owner_ptr, item);
 
                        /* If items remain, auto-inscribe before optimizing */
                        if (o_ptr->number > 0)
-                               autopick_alter_item(item, FALSE);
+                               autopick_alter_item(owner_ptr, item, FALSE);
 
-                       inven_item_optimize(item);
-                       handle_stuff();
+                       inven_item_optimize(owner_ptr, item);
+                       handle_stuff(owner_ptr);
 
                        /* The store gets that (known) item */
                        item_pos = store_carry(q_ptr);
@@ -5171,7 +5128,7 @@ static void store_sell(void)
 
                if (!get_check(format(_("本当に%sを寄贈しますか?", "Really give %s to the Museum? "), o2_name))) return;
 
-               identify_item(q_ptr);
+               identify_item(owner_ptr, q_ptr);
                q_ptr->ident |= IDENT_MENTAL;
 
                /* Distribute charges of wands/rods */
@@ -5179,11 +5136,8 @@ static void store_sell(void)
                msg_format(_("%sを置いた。(%c)", "You drop %s (%c)."), o_name, index_to_label(item));
                choice = 0;
 
-               /* Take it from the players inventory */
-               inven_item_increase(item, -amt);
-               inven_item_describe(item);
-               inven_item_optimize(item);
-               handle_stuff();
+               vary_item(owner_ptr, item, -amt);
+               handle_stuff(owner_ptr);
 
                /* Let the home carry it */
                item_pos = home_carry(q_ptr);
@@ -5204,11 +5158,8 @@ static void store_sell(void)
 
                choice = 0;
 
-               /* Take it from the players inventory */
-               inven_item_increase(item, -amt);
-               inven_item_describe(item);
-               inven_item_optimize(item);
-               handle_stuff();
+               vary_item(owner_ptr, item, -amt);
+               handle_stuff(owner_ptr);
 
                /* Let the home carry it */
                item_pos = home_carry(q_ptr);
@@ -5223,8 +5174,8 @@ static void store_sell(void)
 
        if ((choice == 0) && (item >= INVEN_RARM))
        {
-               calc_android_exp();
-               kamaenaoshi(item);
+               calc_android_exp(owner_ptr);
+               verify_equip_slot(owner_ptr, item);
        }
 }
 
@@ -5363,6 +5314,7 @@ static bool leave_store = FALSE;
 /*!
  * @brief 店舗処理コマンド選択のメインルーチン /
  * Process a command in a store
+ * @param client_ptr 顧客となるクリーチャーの参照ポインタ
  * @return なし
  * @note
  * <pre>
@@ -5372,7 +5324,7 @@ static bool leave_store = FALSE;
  * but not in the stores, to prevent chaos.
  * </pre>
  */
-static void store_process_command(void)
+static void store_process_command(player_type *client_ptr)
 {
        /* Handle repeating the last command */
        repeat_check();
@@ -5397,7 +5349,7 @@ static void store_process_command(void)
                case '-':
                {
                        if (st_ptr->stock_num <= store_bottom) {
-                               msg_print(_("これで全部です。", "Entire inventory is shown."));
+                               msg_print(_("これで全部です。", "Entire client_ptr->inventory_list is shown."));
                        }
                        else{
                                store_top -= store_bottom;
@@ -5415,7 +5367,7 @@ static void store_process_command(void)
                {
                        if (st_ptr->stock_num <= store_bottom)
                        {
-                               msg_print(_("これで全部です。", "Entire inventory is shown."));
+                               msg_print(_("これで全部です。", "Entire client_ptr->inventory_list is shown."));
                        }
                        else
                        {
@@ -5445,7 +5397,7 @@ static void store_process_command(void)
 
                case KTRL('R'):
                {
-                       do_cmd_redraw();
+                       do_cmd_redraw(client_ptr);
                        display_store();
                        break;
                }
@@ -5453,14 +5405,14 @@ static void store_process_command(void)
                /* Get (purchase) */
                case 'g':
                {
-                       store_purchase();
+                       store_purchase(client_ptr);
                        break;
                }
 
                /* Drop (Sell) */
                case 'd':
                {
-                       store_sell();
+                       store_sell(client_ptr);
                        break;
                }
 
@@ -5482,35 +5434,35 @@ static void store_process_command(void)
                /* Wear/wield equipment */
                case 'w':
                {
-                       do_cmd_wield();
+                       do_cmd_wield(client_ptr);
                        break;
                }
 
                /* Take off equipment */
                case 't':
                {
-                       do_cmd_takeoff();
+                       do_cmd_takeoff(client_ptr);
                        break;
                }
 
                /* Destroy an item */
                case 'k':
                {
-                       do_cmd_destroy();
+                       do_cmd_destroy(client_ptr);
                        break;
                }
 
                /* Equipment list */
                case 'e':
                {
-                       do_cmd_equip();
+                       do_cmd_equip(client_ptr);
                        break;
                }
 
                /* Inventory list */
                case 'i':
                {
-                       do_cmd_inven();
+                       do_cmd_inven(client_ptr);
                        break;
                }
 
@@ -5520,14 +5472,13 @@ static void store_process_command(void)
                /* Identify an object */
                case 'I':
                {
-                       do_cmd_observe();
+                       do_cmd_observe(client_ptr);
                        break;
                }
 
-               /* Hack -- toggle windows */
                case KTRL('I'):
                {
-                       toggle_inven_equip();
+                       toggle_inven_equip(client_ptr);
                        break;
                }
 
@@ -5536,64 +5487,61 @@ static void store_process_command(void)
                /* Browse a book */
                case 'b':
                {
-                       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, FALSE);
-                       else if (p_ptr->pclass == CLASS_SNIPER)
-                               do_cmd_snipe_browse();
-                       else do_cmd_browse();
+                       if ( (client_ptr->pclass == CLASS_MINDCRAFTER) ||
+                            (client_ptr->pclass == CLASS_BERSERKER) ||
+                            (client_ptr->pclass == CLASS_NINJA) ||
+                            (client_ptr->pclass == CLASS_MIRROR_MASTER) 
+                            ) do_cmd_mind_browse(client_ptr);
+                       else if (client_ptr->pclass == CLASS_SMITH)
+                               do_cmd_kaji(client_ptr, TRUE);
+                       else if (client_ptr->pclass == CLASS_MAGIC_EATER)
+                               do_cmd_magic_eater(client_ptr, TRUE, FALSE);
+                       else if (client_ptr->pclass == CLASS_SNIPER)
+                               do_cmd_snipe_browse(client_ptr);
+                       else do_cmd_browse(client_ptr);
                        break;
                }
 
                /* Inscribe an object */
                case '{':
                {
-                       do_cmd_inscribe();
+                       do_cmd_inscribe(client_ptr);
                        break;
                }
 
                /* Uninscribe an object */
                case '}':
                {
-                       do_cmd_uninscribe();
+                       do_cmd_uninscribe(client_ptr);
                        break;
                }
 
-
-
                /*** Help and Such ***/
 
                /* Help */
                case '?':
                {
-                       do_cmd_help();
+                       do_cmd_help(client_ptr);
                        break;
                }
 
                /* Identify symbol */
                case '/':
                {
-                       do_cmd_query_symbol();
+                       do_cmd_query_symbol(client_ptr);
                        break;
                }
 
                /* Character description */
                case 'C':
                {
-                       p_ptr->town_num = old_town_num;
-                       do_cmd_change_name();
-                       p_ptr->town_num = inner_town_num;
+                       client_ptr->town_num = old_town_num;
+                       do_cmd_player_status(client_ptr);
+                       client_ptr->town_num = inner_town_num;
                        display_store();
                        break;
                }
 
-
                /*** System Commands ***/
 
                /* Hack -- User interface */
@@ -5606,36 +5554,36 @@ static void store_process_command(void)
                /* Single line from a pref file */
                case '"':
                {
-                       p_ptr->town_num = old_town_num;
-                       do_cmd_pref();
-                       p_ptr->town_num = inner_town_num;
+                       client_ptr->town_num = old_town_num;
+                       do_cmd_pref(client_ptr);
+                       client_ptr->town_num = inner_town_num;
                        break;
                }
 
                /* Interact with macros */
                case '@':
                {
-                       p_ptr->town_num = old_town_num;
-                       do_cmd_macros();
-                       p_ptr->town_num = inner_town_num;
+                       client_ptr->town_num = old_town_num;
+                       do_cmd_macros(client_ptr);
+                       client_ptr->town_num = inner_town_num;
                        break;
                }
 
                /* Interact with visuals */
                case '%':
                {
-                       p_ptr->town_num = old_town_num;
-                       do_cmd_visuals();
-                       p_ptr->town_num = inner_town_num;
+                       client_ptr->town_num = old_town_num;
+                       do_cmd_visuals(client_ptr);
+                       client_ptr->town_num = inner_town_num;
                        break;
                }
 
                /* Interact with colors */
                case '&':
                {
-                       p_ptr->town_num = old_town_num;
-                       do_cmd_colors();
-                       p_ptr->town_num = inner_town_num;
+                       client_ptr->town_num = old_town_num;
+                       do_cmd_colors(client_ptr);
+                       client_ptr->town_num = inner_town_num;
                        break;
                }
 
@@ -5644,7 +5592,7 @@ static void store_process_command(void)
                {
                        do_cmd_options();
                        (void)combine_and_reorder_home(STORE_HOME);
-                       do_cmd_redraw();
+                       do_cmd_redraw(client_ptr);
                        display_store();
                        break;
                }
@@ -5668,7 +5616,7 @@ static void store_process_command(void)
                /* Repeat level feeling */
                case KTRL('F'):
                {
-                       do_cmd_feeling();
+                       do_cmd_feeling(client_ptr);
                        break;
                }
 
@@ -5688,14 +5636,14 @@ static void store_process_command(void)
 
                case '|':
                {
-                       do_cmd_nikki();
+                       do_cmd_diary(client_ptr);
                        break;
                }
 
                /* Check artifacts, uniques etc. */
                case '~':
                {
-                       do_cmd_knowledge();
+                       do_cmd_knowledge(client_ptr);
                        break;
                }
 
@@ -5709,7 +5657,7 @@ static void store_process_command(void)
                /* Save "screen dump" */
                case ')':
                {
-                       do_cmd_save_screen();
+                       do_cmd_save_screen(client_ptr);
                        break;
                }
 
@@ -5733,6 +5681,7 @@ static void store_process_command(void)
 /*!
  * @brief 店舗処理全体のメインルーチン /
  * Enter a store, and interact with it. *
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @note
  * <pre>
@@ -5744,7 +5693,7 @@ static void store_process_command(void)
  * (cast magic) into "g" (get), and "s" (search) into "d" (drop).
  * </pre>
  */
-void do_cmd_store(void)
+void do_cmd_store(player_type *player_ptr)
 {
        int which;
        int maintain_num;
@@ -5753,7 +5702,7 @@ void do_cmd_store(void)
        bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */
        TERM_LEN w, h;
 
-       if(p_ptr->wild_mode) return;
+       if(player_ptr->wild_mode) return;
        Term_get_size(&w, &h);
 
        /* Calculate stocks per 1 page */
@@ -5761,7 +5710,7 @@ void do_cmd_store(void)
        store_bottom = MIN_STOCK + xtra_stock;
 
        /* Access the player grid */
-       g_ptr = &grid_array[p_ptr->y][p_ptr->x];
+       g_ptr = &player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x];
 
        /* Verify a store */
        if (!cave_have_flag_grid(g_ptr, FF_STORE))
@@ -5773,22 +5722,22 @@ void do_cmd_store(void)
        /* Extract the store code */
        which = f_info[g_ptr->feat].subtype;
 
-       old_town_num = p_ptr->town_num;
-       if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
-       if (dun_level) p_ptr->town_num = NO_TOWN;
-       inner_town_num = p_ptr->town_num;
+       old_town_num = player_ptr->town_num;
+       if ((which == STORE_HOME) || (which == STORE_MUSEUM)) player_ptr->town_num = 1;
+       if (player_ptr->current_floor_ptr->dun_level) player_ptr->town_num = NO_TOWN;
+       inner_town_num = player_ptr->town_num;
 
        /* Hack -- Check the "locked doors" */
-       if ((town_info[p_ptr->town_num].store[which].store_open >= turn) ||
+       if ((town_info[player_ptr->town_num].store[which].store_open >= current_world_ptr->game_turn) ||
            (ironman_shops))
        {
                msg_print(_("ドアに鍵がかかっている。", "The doors are locked."));
-               p_ptr->town_num = old_town_num;
+               player_ptr->town_num = old_town_num;
                return;
        }
 
        /* Calculate the number of store maintainances since the last visit */
-       maintain_num = (turn - town_info[p_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
+       maintain_num = (current_world_ptr->game_turn - town_info[player_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
 
        /* Maintain the store max. 10 times */
        if (maintain_num > 10) maintain_num = 10;
@@ -5797,17 +5746,17 @@ void do_cmd_store(void)
        {
                /* Maintain the store */
                for (i = 0; i < maintain_num; i++)
-                       store_maint(p_ptr->town_num, which);
+                       store_maint(player_ptr, player_ptr->town_num, which);
 
                /* Save the visit */
-               town_info[p_ptr->town_num].store[which].last_visit = turn;
+               town_info[player_ptr->town_num].store[which].last_visit = current_world_ptr->game_turn;
        }
 
-       forget_lite();
-       forget_view();
+       forget_lite(player_ptr->current_floor_ptr);
+       forget_view(player_ptr->current_floor_ptr);
 
        /* Hack -- Character is in "icky" mode */
-       character_icky = TRUE;
+       current_world_ptr->character_icky = TRUE;
 
        /* command reset */
        command_arg = 0;
@@ -5824,7 +5773,7 @@ void do_cmd_store(void)
        cur_store_feat = g_ptr->feat;
 
        /* Save the store and owner pointers */
-       st_ptr = &town_info[p_ptr->town_num].store[cur_store_num];
+       st_ptr = &town_info[player_ptr->town_num].store[cur_store_num];
        ot_ptr = &owners[cur_store_num][st_ptr->owner];
 
        /* Start at the beginning */
@@ -5842,8 +5791,6 @@ void do_cmd_store(void)
        {
                /* Hack -- Clear line 1 */
                prt("", 1, 0);
-
-               /* Clear */
                clear_from(20 + xtra_stock);
 
                /* Basic commands */
@@ -5898,25 +5845,25 @@ void do_cmd_store(void)
                request_command(TRUE);
 
                /* Process the command */
-               store_process_command();
+               store_process_command(player_ptr);
 
                /*
                 * Hack -- To redraw missiles damage and prices in store
                 * If player's charisma changes, or if player changes a bow, PU_BONUS is set
                 */
-               need_redraw_store_inv = (p_ptr->update & PU_BONUS) ? TRUE : FALSE;
+               need_redraw_store_inv = (player_ptr->update & PU_BONUS) ? TRUE : FALSE;
 
                /* Hack -- Character is still in "icky" mode */
-               character_icky = TRUE;
+               current_world_ptr->character_icky = TRUE;
 
-               handle_stuff();
+               handle_stuff(player_ptr);
 
                /* Pack Overflow */
-               if (inventory[INVEN_PACK].k_idx)
+               if (player_ptr->inventory_list[INVEN_PACK].k_idx)
                {
                        INVENTORY_IDX item = INVEN_PACK;
 
-                       object_type *o_ptr = &inventory[item];
+                       object_type *o_ptr = &player_ptr->inventory_list[item];
 
                        /* Hack -- Flee from the store */
                        if (cur_store_num != STORE_HOME)
@@ -5958,11 +5905,8 @@ void do_cmd_store(void)
 
                                msg_format(_("%sが落ちた。(%c)", "You drop %s (%c)."), o_name, index_to_label(item));
 
-                               /* Remove it from the players inventory */
-                               inven_item_increase(item, -255);
-                               inven_item_describe(item);
-                               inven_item_optimize(item);
-                               handle_stuff();
+                               vary_item(player_ptr, item, -255);
+                               handle_stuff(player_ptr);
 
                                /* Let the home carry it */
                                item_pos = home_carry(q_ptr);
@@ -5981,17 +5925,17 @@ void do_cmd_store(void)
                if (need_redraw_store_inv) display_inventory();
 
                /* Hack -- get kicked out of the store */
-               if (st_ptr->store_open >= turn) leave_store = TRUE;
+               if (st_ptr->store_open >= current_world_ptr->game_turn) leave_store = TRUE;
        }
 
-       select_floor_music();
+       select_floor_music(player_ptr);
 
-       p_ptr->town_num = old_town_num;
+       player_ptr->town_num = old_town_num;
 
-       take_turn(p_ptr, 100);;
+       take_turn(player_ptr, 100);
 
        /* Hack -- Character is no longer in "icky" mode */
-       character_icky = FALSE;
+       current_world_ptr->character_icky = FALSE;
 
        /* Hack -- Cancel automatic command */
        command_new = 0;
@@ -6006,13 +5950,13 @@ void do_cmd_store(void)
        Term_clear();
 
        /* Update everything */
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
-       p_ptr->update |= (PU_MONSTERS);
+       player_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
+       player_ptr->update |= (PU_MONSTERS);
 
        /* Redraw entire screen */
-       p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY);
-       p_ptr->redraw |= (PR_MAP);
-       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+       player_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY);
+       player_ptr->redraw |= (PR_MAP);
+       player_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 }
 
 
@@ -6089,11 +6033,12 @@ void store_shuffle(int which)
 /*!
  * @brief 店の品揃えを変化させる /
  * Maintain the inventory at the stores.
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @param town_num 町のID
  * @param store_num 店舗種類のID
  * @return なし
  */
-void store_maint(int town_num, int store_num)
+void store_maint(player_type *player_ptr, int town_num, int store_num)
 {
        INVENTORY_IDX j;
 
@@ -6130,7 +6075,6 @@ void store_maint(int town_num, int store_num)
                }
        }
 
-
        /* Choose the number of slots to keep */
        j = st_ptr->stock_num;
 
@@ -6166,7 +6110,7 @@ void store_maint(int town_num, int store_num)
        if (j >= st_ptr->stock_size) j = st_ptr->stock_size - 1;
 
        /* Acquire some new items */
-       while (st_ptr->stock_num < j) store_create();
+       while (st_ptr->stock_num < j) store_create(player_ptr);
 }