OSDN Git Service

Merge branch 'master' into For2.2.2-Refactoring
[hengband/hengband.git] / src / store.c
index d3608dc..7edda25 100644 (file)
@@ -19,6 +19,7 @@
 #include "cmd-spell.h"
 #include "rumor.h"
 #include "player-status.h"
+#include "object-hook.h"
 
 #define MIN_STOCK 12
 
@@ -2253,7 +2254,7 @@ static void mass_produce(object_type *o_ptr)
        int size = 1;
        DISCOUNT_RATE discount = 0;
 
-       s32b cost = object_value(o_ptr);
+       PRICE cost = object_value(o_ptr);
 
 
        /* Analyze the type */
@@ -2522,7 +2523,7 @@ static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
  */
 static int store_check_num(object_type *o_ptr)
 {
-       int        i;
+       int i;
        object_type *j_ptr;
 
        /* The "home" acts like the player */
@@ -3005,9 +3006,9 @@ bool combine_and_reorder_home(int store_num)
  */
 static int home_carry(object_type *o_ptr)
 {
-       int                             slot;
-       s32b                       value;
-       int     i;
+       int slot;
+       PRICE value;
+       int i;
        object_type *j_ptr;
        bool old_stack_force_notes = stack_force_notes;
        bool old_stack_force_costs = stack_force_costs;
@@ -3110,8 +3111,8 @@ static int home_carry(object_type *o_ptr)
  */
 static int store_carry(object_type *o_ptr)
 {
-       int     i, slot;
-       s32b    value, j_value;
+       int i, slot;
+       PRICE value, j_value;
        object_type *j_ptr;
 
 
@@ -3276,7 +3277,7 @@ static void store_item_optimize(INVENTORY_IDX item)
  */
 static bool black_market_crap(object_type *o_ptr)
 {
-       int     i, j;
+       int i, j;
 
        /* Ego items are never crap */
        if (object_is_ego(o_ptr)) return (FALSE);
@@ -3468,8 +3469,8 @@ static void store_create(void)
  */
 static bool noneedtobargain(PRICE minprice)
 {
-       s32b good = st_ptr->good_buy;
-       s32b bad = st_ptr->bad_buy;
+       PRICE good = st_ptr->good_buy;
+       PRICE bad = st_ptr->bad_buy;
 
        /* Cheap items are "boring" */
        if (minprice < 10L) return (TRUE);
@@ -3531,12 +3532,12 @@ static void updatebargain(PRICE price, PRICE minprice, int num)
  */
 static void display_entry(int pos)
 {
-       int             i, cur_col;
+       int i, cur_col;
        object_type *o_ptr;
-       s32b            x;
+       s32b x;
 
        GAME_TEXT o_name[MAX_NLEN];
-       char            out_val[160];
+       char out_val[160];
 
        int maxwid = 75;
 
@@ -3626,11 +3627,10 @@ static void display_entry(int pos)
 
                        /* Actually draw the price (not fixed) */
 #ifdef JP
-(void)sprintf(out_val, "%9ld固", (long)x);
+                       (void)sprintf(out_val, "%9ld固", (long)x);
 #else
                        (void)sprintf(out_val, "%9ld F", (long)x);
 #endif
-
                        put_str(out_val, i+6, 68);
                }
 
@@ -3984,10 +3984,10 @@ static s32b last_inc = 0L;
  */
 static int get_haggle(concptr pmt, s32b *poffer, PRICE price, int final)
 {
-       s32b            i;
-       concptr         p;
-       char                            buf[128];
-       char            out_val[160];
+       s32b i;
+       concptr p;
+       GAME_TEXT buf[128];
+       GAME_TEXT out_val[160];
 
        /* Clear old increment if necessary */
        if (!allow_inc) last_inc = 0L;
@@ -4330,18 +4330,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);
@@ -4364,12 +4358,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 */
@@ -4379,12 +4368,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);
                }
 
@@ -4392,12 +4376,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);
                }
 
@@ -4406,12 +4385,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 */
@@ -4444,12 +4418,7 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
 
                        (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)
@@ -4502,11 +4471,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)
@@ -4531,12 +4496,7 @@ 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);
                        }
@@ -4577,11 +4537,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;
        }
 
@@ -4589,23 +4545,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);
 
@@ -5755,7 +5700,7 @@ void do_cmd_store(void)
        int which;
        int maintain_num;
        int i;
-       cave_type *c_ptr;
+       grid_type *g_ptr;
        bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */
        TERM_LEN w, h;
 
@@ -5767,17 +5712,17 @@ void do_cmd_store(void)
        store_bottom = MIN_STOCK + xtra_stock;
 
        /* Access the player grid */
-       c_ptr = &cave[p_ptr->y][p_ptr->x];
+       g_ptr = &grid_array[p_ptr->y][p_ptr->x];
 
        /* Verify a store */
-       if (!cave_have_flag_grid(c_ptr, FF_STORE))
+       if (!cave_have_flag_grid(g_ptr, FF_STORE))
        {
                msg_print(_("ここには店がありません。", "You see no store here."));
                return;
        }
 
        /* Extract the store code */
-       which = f_info[c_ptr->feat].subtype;
+       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;
@@ -5827,7 +5772,7 @@ void do_cmd_store(void)
        cur_store_num = which;
 
        /* Hack -- save the store feature */
-       cur_store_feat = c_ptr->feat;
+       cur_store_feat = g_ptr->feat;
 
        /* Save the store and owner pointers */
        st_ptr = &town_info[p_ptr->town_num].store[cur_store_num];