OSDN Git Service

[Refactor] #37353 型の置換(C_MAKE)。 / Type replacement(C_MAKE).
[hengband/hengband.git] / src / store.c
index ca43b8a..c88cd8c 100644 (file)
@@ -30,7 +30,7 @@ static s16b inner_town_num = 0;
 
 #define MAX_COMMENT_1  6
 
-static cptr comment_1[MAX_COMMENT_1] =
+static concptr comment_1[MAX_COMMENT_1] =
 {
 #ifdef JP
        "オーケーだ。",
@@ -52,7 +52,7 @@ static cptr comment_1[MAX_COMMENT_1] =
 
 #ifdef JP
 /*! ブラックマーケット追加メッセージ(承諾) */
-static cptr comment_1_B[MAX_COMMENT_1] = {
+static concptr comment_1_B[MAX_COMMENT_1] = {
        "まあ、それでいいや。",
        "今日はそれで勘弁してやる。",
        "分かったよ。",
@@ -63,7 +63,7 @@ static cptr comment_1_B[MAX_COMMENT_1] = {
 #endif
 #define MAX_COMMENT_2A 2
 
-static cptr comment_2a[MAX_COMMENT_2A] =
+static concptr comment_2a[MAX_COMMENT_2A] =
 {
 #ifdef JP
        "私の忍耐力を試しているのかい? $%s が最後だ。",
@@ -77,7 +77,7 @@ static cptr comment_2a[MAX_COMMENT_2A] =
 
 #define MAX_COMMENT_2B 12
 
-static cptr comment_2b[MAX_COMMENT_2B] =
+static concptr comment_2b[MAX_COMMENT_2B] =
 {
 #ifdef JP
        " $%s ぐらいは出さなきゃダメだよ。",
@@ -111,7 +111,7 @@ static cptr comment_2b[MAX_COMMENT_2B] =
 
 #ifdef JP
 /*! ブラックマーケット用追加メッセージ(売るとき) */
-static cptr comment_2b_B[MAX_COMMENT_2B] = {
+static concptr comment_2b_B[MAX_COMMENT_2B] = {
        "いくら俺様がお人好しとはいえ $%s が限界だね。嫌なら帰りな。",
        "金がないのかい、あんた?まずは家に帰って $%s 揃えてきな。",
        "物の価値が分からん奴だな。これは $%s が普通なんだよ。",
@@ -128,7 +128,7 @@ static cptr comment_2b_B[MAX_COMMENT_2B] = {
 #endif
 #define MAX_COMMENT_3A 2
 
-static cptr comment_3a[MAX_COMMENT_3A] =
+static concptr comment_3a[MAX_COMMENT_3A] =
 {
 #ifdef JP
        "私の忍耐力を試しているのかい? $%s が最後だ。",
@@ -143,7 +143,7 @@ static cptr comment_3a[MAX_COMMENT_3A] =
 
 #define MAX_COMMENT_3B 12
 
-static cptr comment_3b[MAX_COMMENT_3B] =
+static concptr comment_3b[MAX_COMMENT_3B] =
 {
 #ifdef JP
        "本音を言うと $%s でいいんだろ?",
@@ -177,7 +177,7 @@ static cptr comment_3b[MAX_COMMENT_3B] =
 
 #ifdef JP
 /*! ブラックマーケット用追加メッセージ(買い取り) */
-static cptr comment_3b_B[MAX_COMMENT_3B] = {
+static concptr comment_3b_B[MAX_COMMENT_3B] = {
        " $%s ってところだね。そのどうしようもないガラクタは。",
        "この俺が $%s って言っているんだから、その通りにした方が身のためだぞ。",
        "俺の優しさに甘えるのもいい加減にしておけ。 $%s だ。",
@@ -194,7 +194,7 @@ static cptr comment_3b_B[MAX_COMMENT_3B] = {
 #endif
 #define MAX_COMMENT_4A 4
 
-static cptr comment_4a[MAX_COMMENT_4A] =
+static concptr comment_4a[MAX_COMMENT_4A] =
 {
 #ifdef JP
        "もうたくさんだ!何度も私をわずらわせないでくれ!",
@@ -212,7 +212,7 @@ static cptr comment_4a[MAX_COMMENT_4A] =
 
 #ifdef JP
 /*! ブラックマーケット用追加メッセージ(怒りの頂点) */
-static cptr comment_4a_B[MAX_COMMENT_4A] = {
+static concptr comment_4a_B[MAX_COMMENT_4A] = {
        "なめやがって!温厚な俺様でも限界があるってことを知れ!",
        "俺をここまで怒らせて...命があるだけでもありがたいと思え!",
        "ふざけてるのか!冷やかしなら相手を見てからにしろ!",
@@ -221,7 +221,7 @@ static cptr comment_4a_B[MAX_COMMENT_4A] = {
 #endif
 #define MAX_COMMENT_4B 4
 
-static cptr comment_4b[MAX_COMMENT_4B] =
+static concptr comment_4b[MAX_COMMENT_4B] =
 {
 #ifdef JP
        "店から出て行け!",
@@ -239,7 +239,7 @@ static cptr comment_4b[MAX_COMMENT_4B] =
 
 #ifdef JP
 /*! ブラックマーケット用追加メッセージ(追い出し) */
-static cptr comment_4b_B[MAX_COMMENT_4B] = {
+static concptr comment_4b_B[MAX_COMMENT_4B] = {
        "二度とうちに来るんじゃねえ!!",
        "とっとと、どっかへ失せろ!!",
        "今すぐ消え失せろ!!",
@@ -248,7 +248,7 @@ static cptr comment_4b_B[MAX_COMMENT_4B] = {
 #endif
 #define MAX_COMMENT_5  8
 
-static cptr comment_5[MAX_COMMENT_5] =
+static concptr comment_5[MAX_COMMENT_5] =
 {
 #ifdef JP
        "考え直してくれ。",
@@ -274,7 +274,7 @@ static cptr comment_5[MAX_COMMENT_5] =
 
 #ifdef JP
 /*! ブラックマーケット用追加メッセージ(怒り) */
-static cptr comment_5_B[MAX_COMMENT_5] = {
+static concptr comment_5_B[MAX_COMMENT_5] = {
        "時間の無駄だな、これは。",
        "厄介なお客様だな!",
        "話して分かる相手じゃなさそうだ。",
@@ -287,7 +287,7 @@ static cptr comment_5_B[MAX_COMMENT_5] = {
 #endif
 #define MAX_COMMENT_6  4
 
-static cptr comment_6[MAX_COMMENT_6] =
+static concptr comment_6[MAX_COMMENT_6] =
 {
 #ifdef JP
        "どうやら聞き間違えたらしい。",
@@ -479,7 +479,7 @@ static void say_comment_6(void)
 
 #define MAX_COMMENT_7A 4
 
-static cptr comment_7a[MAX_COMMENT_7A] =
+static concptr comment_7a[MAX_COMMENT_7A] =
 {
 #ifdef JP
        "うわああぁぁ!",
@@ -497,7 +497,7 @@ static cptr comment_7a[MAX_COMMENT_7A] =
 
 #define MAX_COMMENT_7B 4
 
-static cptr comment_7b[MAX_COMMENT_7B] =
+static concptr comment_7b[MAX_COMMENT_7B] =
 {
 #ifdef JP
        "くそう!",
@@ -515,7 +515,7 @@ static cptr comment_7b[MAX_COMMENT_7B] =
 
 #define MAX_COMMENT_7C 4
 
-static cptr comment_7c[MAX_COMMENT_7C] =
+static concptr comment_7c[MAX_COMMENT_7C] =
 {
 #ifdef JP
        "すばらしい!",
@@ -533,7 +533,7 @@ static cptr comment_7c[MAX_COMMENT_7C] =
 
 #define MAX_COMMENT_7D 4
 
-static cptr comment_7d[MAX_COMMENT_7D] =
+static concptr comment_7d[MAX_COMMENT_7D] =
 {
 #ifdef JP
        "やっほぅ!",
@@ -2245,8 +2245,8 @@ static void display_entry(int pos)
        cur_col = 3;
        if (show_item_graph)
        {
-               byte a = object_attr(o_ptr);
-               char c = object_char(o_ptr);
+               TERM_COLOR a = object_attr(o_ptr);
+               SYMBOL_CODE c = object_char(o_ptr);
 
                Term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
                if (use_bigtile) cur_col++;
@@ -2270,7 +2270,7 @@ static void display_entry(int pos)
                if(show_weights)
                {
                        /* Only show the weight of an individual item */
-                       int wgt = o_ptr->weight;
+                       WEIGHT wgt = o_ptr->weight;
 #ifdef JP
                        sprintf(out_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
                        put_str(out_val, i+6, 67);
@@ -2459,30 +2459,15 @@ static void display_store(void)
        if (cur_store_num == STORE_HOME)
        {
                /* Put the owner name */
-#ifdef JP
-               put_str("我が家", 3, 31);
-#else
-               put_str("Your Home", 3, 30);
-#endif
-
+               put_str(_("我が家", "Your Home"), 3, 31);
 
                /* Label the item descriptions */
-#ifdef JP
-               put_str("アイテムの一覧", 5, 4);
-#else
-               put_str("Item Description", 5, 3);
-#endif
-
+               put_str(_("アイテムの一覧", "Item Description"), 5, 4);
 
                /* If showing weights, show label */
                if (show_weights)
                {
-#ifdef JP
-                       put_str("重さ", 5, 72);
-#else
-                       put_str("Weight", 5, 70);
-#endif
-
+                       put_str(_("  重さ", "Weight"), 5, 70);
                }
        }
 
@@ -2490,39 +2475,24 @@ static void display_store(void)
        else if (cur_store_num == STORE_MUSEUM)
        {
                /* Put the owner name */
-#ifdef JP
-               put_str("博物館", 3, 31);
-#else
-               put_str("Museum", 3, 30);
-#endif
-
+               put_str(_("博物館", "Museum"), 3, 31);
 
                /* Label the item descriptions */
-#ifdef JP
-               put_str("アイテムの一覧", 5, 4);
-#else
-               put_str("Item Description", 5, 3);
-#endif
-
+               put_str(_("アイテムの一覧", "Item Description"), 5, 4);
 
                /* If showing weights, show label */
                if (show_weights)
                {
-#ifdef JP
-                       put_str("重さ", 5, 72);
-#else
-                       put_str("Weight", 5, 70);
-#endif
-
+                       put_str(_("  重さ", "Weight"), 5, 70);
                }
        }
 
        /* Normal stores */
        else
        {
-               cptr store_name = (f_name + f_info[cur_store_feat].name);
-               cptr owner_name = (ot_ptr->owner_name);
-               cptr race_name = race_info[ot_ptr->owner_race].title;
+               concptr store_name = (f_name + f_info[cur_store_feat].name);
+               concptr owner_name = (ot_ptr->owner_name);
+               concptr race_name = race_info[ot_ptr->owner_race].title;
 
                /* Put the owner name and race */
                sprintf(buf, "%s (%s)", owner_name, race_name);
@@ -2533,31 +2503,17 @@ static void display_store(void)
                prt(buf, 3, 50);
 
                /* Label the item descriptions */
-#ifdef JP
-               put_str("商品の一覧", 5, 7);
-#else
-               put_str("Item Description", 5, 3);
-#endif
+               put_str(_("商品の一覧", "Item Description"), 5, 5);
 
 
                /* If showing weights, show label */
                if (show_weights)
                {
-#ifdef JP
-                       put_str("重さ", 5, 62);
-#else
-                       put_str("Weight", 5, 60);
-#endif
-
+                       put_str(_("  重さ", "Weight"), 5, 60);
                }
 
                /* Label the asking price (in stores) */
-#ifdef JP
-               put_str("価格", 5, 73);
-#else
-               put_str("Price", 5, 72);
-#endif
-
+               put_str(_(" 価格", "Price"), 5, 72);
        }
 
        /* Display the current gold */
@@ -2578,11 +2534,11 @@ static void display_store(void)
  * @param j 選択範囲の最大値
  * @return 実際に選択したらTRUE、キャンセルしたらFALSE
  */
-static int get_stock(COMMAND_CODE *com_val, cptr pmt, int i, int j)
+static int get_stock(COMMAND_CODE *com_val, concptr pmt, int i, int j)
 {
-       char    command;
-       char    out_val[160];
-       char    lo, hi;
+       char command;
+       char out_val[160];
+       char lo, hi;
 
        /* Get the item index */
        if (repeat_pull(com_val))
@@ -2598,7 +2554,6 @@ static int get_stock(COMMAND_CODE *com_val, cptr pmt, int i, int j)
        /* Paranoia */
        msg_print(NULL);
 
-
        /* Assume failure */
        *com_val = (-1);
 
@@ -2644,7 +2599,6 @@ static int get_stock(COMMAND_CODE *com_val, cptr pmt, int i, int j)
        /* Clear the prompt */
        prt("", 0, 0);
 
-       /* Cancel */
        if (command == ESCAPE) return (FALSE);
 
        repeat_push(*com_val);
@@ -2737,11 +2691,11 @@ static s32b last_inc = 0L;
  * @param final 最終確定価格ならばTRUE
  * @return プレイヤーを締め出す場合TRUEを返す
  */
-static int get_haggle(cptr pmt, s32b *poffer, PRICE price, int final)
+static int get_haggle(concptr pmt, s32b *poffer, PRICE price, int final)
 {
        s32b            i;
 
-       cptr            p;
+       concptr         p;
 
        char                            buf[128];
        char            out_val[160];
@@ -2896,7 +2850,7 @@ static int get_haggle(cptr pmt, s32b *poffer, PRICE price, int final)
  * @return プレイヤーの価格に対して不服ならばTRUEを返す /
  * Return TRUE if offer is NOT okay
  */
-static bool receive_offer(cptr pmt, s32b *poffer,
+static bool receive_offer(concptr pmt, s32b *poffer,
                          s32b last_offer, int factor,
                          PRICE price, int final)
 {
@@ -2941,9 +2895,9 @@ static bool purchase_haggle(object_type *o_ptr, s32b *price)
        bool            cancel = FALSE;
 
 #ifdef JP
-       cptr pmt = "提示価格";
+       concptr pmt = "提示価格";
 #else
-       cptr            pmt = "Asking";
+       concptr         pmt = "Asking";
 #endif
 
 
@@ -3128,10 +3082,8 @@ static bool purchase_haggle(object_type *o_ptr, s32b *price)
                }
        }
 
-       /* Cancel */
        if (cancel) return (TRUE);
 
-       /* Update bargaining info */
        updatebargain(*price, final_ask, o_ptr->number);
 
        /* Do not cancel */
@@ -3157,9 +3109,9 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
        int     annoyed = 0, final = FALSE;
        bool    cancel = FALSE;
 #ifdef JP
-       cptr pmt = "提示金額";
+       concptr pmt = "提示金額";
 #else
-       cptr    pmt = "Offer";
+       concptr    pmt = "Offer";
 #endif
 
        char    out_val[160];
@@ -3369,10 +3321,8 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
                }
        }
 
-       /* Cancel */
        if (cancel) return (TRUE);
 
-       /* Update bargaining info */
        updatebargain(*price, final_ask, o_ptr->number);
 
        /* Do not cancel */
@@ -3781,7 +3731,7 @@ static void store_sell(void)
 
        object_type *o_ptr;
 
-       cptr q, s;
+       concptr q, s;
 
        GAME_TEXT o_name[MAX_NLEN];
 
@@ -3813,35 +3763,16 @@ static void store_sell(void)
                s = _("欲しい物がないですねえ。", "You have nothing that I want.");
        }
 
-       if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT))) return;
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
-
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return;
 
        /* Hack -- Cannot remove cursed items */
        if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
        {
-#ifdef JP
-               msg_print("ふーむ、どうやらそれは呪われているようだね。");
-#else
-               msg_print("Hmmm, it seems to be cursed.");
-#endif
-
-
+               msg_print(_("ふーむ、どうやらそれは呪われているようだね。", "Hmmm, it seems to be cursed."));
                return;
        }
 
-
        /* Assume one item */
        amt = 1;
 
@@ -3937,7 +3868,6 @@ static void store_sell(void)
                        /* Get the "apparent" value */
                        dummy = object_value(q_ptr) * q_ptr->number;
 
-                       /* Identify it */
                        identify_item(o_ptr);
                        q_ptr = &forge;
 
@@ -4025,7 +3955,6 @@ static void store_sell(void)
 
                if (!get_check(format(_("本当に%sを寄贈しますか?", "Really give %s to the Museum? "), o2_name))) return;
 
-               /* Identify it */
                identify_item(q_ptr);
                q_ptr->ident |= IDENT_MENTAL;
 
@@ -4601,14 +4530,14 @@ static void store_process_command(void)
  */
 void do_cmd_store(void)
 {
-       int         which;
-       int         maintain_num;
-       int         i;
-       cave_type   *c_ptr;
-       bool        need_redraw_store_inv; /* To redraw missiles damage and prices in store */
-       int w, h;
+       int which;
+       int maintain_num;
+       int i;
+       cave_type *c_ptr;
+       bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */
+       TERM_LEN w, h;
 
-       /* Get term size */
+       if(p_ptr->wild_mode) return;
        Term_get_size(&w, &h);
 
        /* Calculate stocks per 1 page */
@@ -4658,24 +4587,15 @@ void do_cmd_store(void)
                town[p_ptr->town_num].store[which].last_visit = turn;
        }
 
-       /* Forget the lite */
        forget_lite();
-
-       /* Forget the view */
        forget_view();
 
-
        /* Hack -- Character is in "icky" mode */
        character_icky = TRUE;
 
-
-       /* No command argument */
+       /* command reset */
        command_arg = 0;
-
-       /* No repeated command */
        command_rep = 0;
-
-       /* No automatic command */
        command_new = 0;
 
        /* Do not expand macros */
@@ -4691,13 +4611,11 @@ void do_cmd_store(void)
        st_ptr = &town[p_ptr->town_num].store[cur_store_num];
        ot_ptr = &owners[cur_store_num][st_ptr->owner];
 
-
        /* Start at the beginning */
        store_top = 0;
 
        play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
 
-       /* Display the store */
        display_store();
 
        /* Do not leave */
@@ -4712,7 +4630,6 @@ void do_cmd_store(void)
                /* Clear */
                clear_from(20 + xtra_stock);
 
-
                /* Basic commands */
                prt(_(" ESC) 建物から出る", " ESC) Exit from Building."), 21 + xtra_stock, 0);
 
@@ -4748,7 +4665,6 @@ void do_cmd_store(void)
                }
 
                /* 基本的なコマンドの追加表示 */
-
                prt(_("i/e) 持ち物/装備の一覧", "i/e) Inventry/Equipment list"), 21 + xtra_stock, 56);
 
                if (rogue_like_commands)
@@ -4763,7 +4679,6 @@ void do_cmd_store(void)
                /* Prompt */
                prt(_("コマンド:", "You may: "), 20 + xtra_stock, 0);
 
-               /* Get a command */
                request_command(TRUE);
 
                /* Process the command */
@@ -5051,8 +4966,7 @@ void store_maint(int town_num, int store_num)
  */
 void store_init(int town_num, int store_num)
 {
-       int             k;
-
+       int k;
        cur_store_num = store_num;
 
        /* Activate that store */