OSDN Git Service

[Refactor] #38997 identify_item() に player_type * 引数を追加. / Add player_type * argument...
[hengband/hengband.git] / src / store.c
index 4f60c41..3145583 100644 (file)
@@ -4942,7 +4942,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), 0);
+       o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
        if (!o_ptr) return;
 
        /* Hack -- Cannot remove cursed items */
@@ -5043,7 +5043,7 @@ static void store_sell(void)
                        /* Get the "apparent" value */
                        dummy = object_value(q_ptr) * q_ptr->number;
 
-                       identify_item(o_ptr);
+                       identify_item(p_ptr, o_ptr);
                        q_ptr = &forge;
 
                        /* Get a copy of the object */
@@ -5130,7 +5130,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(p_ptr, q_ptr);
                q_ptr->ident |= IDENT_MENTAL;
 
                /* Distribute charges of wands/rods */
@@ -5183,7 +5183,7 @@ static void store_sell(void)
        if ((choice == 0) && (item >= INVEN_RARM))
        {
                calc_android_exp(p_ptr);
-               kamaenaoshi(item);
+               verify_equip_slot(p_ptr, item);
        }
 }
 
@@ -5322,6 +5322,7 @@ static bool leave_store = FALSE;
 /*!
  * @brief 店舗処理コマンド選択のメインルーチン /
  * Process a command in a store
+ * @param client_ptr 顧客となるクリーチャーの参照ポインタ
  * @return なし
  * @note
  * <pre>
@@ -5331,7 +5332,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();
@@ -5356,7 +5357,7 @@ static void store_process_command(void)
                case '-':
                {
                        if (st_ptr->stock_num <= store_bottom) {
-                               msg_print(_("これで全部です。", "Entire p_ptr->inventory_list is shown."));
+                               msg_print(_("これで全部です。", "Entire client_ptr->inventory_list is shown."));
                        }
                        else{
                                store_top -= store_bottom;
@@ -5374,7 +5375,7 @@ static void store_process_command(void)
                {
                        if (st_ptr->stock_num <= store_bottom)
                        {
-                               msg_print(_("これで全部です。", "Entire p_ptr->inventory_list is shown."));
+                               msg_print(_("これで全部です。", "Entire client_ptr->inventory_list is shown."));
                        }
                        else
                        {
@@ -5404,7 +5405,7 @@ static void store_process_command(void)
 
                case KTRL('R'):
                {
-                       do_cmd_redraw(p_ptr);
+                       do_cmd_redraw(client_ptr);
                        display_store();
                        break;
                }
@@ -5441,35 +5442,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;
                }
 
@@ -5479,13 +5480,13 @@ static void store_process_command(void)
                /* Identify an object */
                case 'I':
                {
-                       do_cmd_observe();
+                       do_cmd_observe(client_ptr);
                        break;
                }
 
                case KTRL('I'):
                {
-                       toggle_inven_equip(p_ptr);
+                       toggle_inven_equip(client_ptr);
                        break;
                }
 
@@ -5494,32 +5495,32 @@ 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) 
+                       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();
-                       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();
+                       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;
                }
 
@@ -5544,9 +5545,9 @@ static void store_process_command(void)
                /* Character description */
                case 'C':
                {
-                       p_ptr->town_num = old_town_num;
-                       do_cmd_player_status(p_ptr);
-                       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;
                }
@@ -5564,36 +5565,36 @@ static void store_process_command(void)
                /* Single line from a pref file */
                case '"':
                {
-                       p_ptr->town_num = old_town_num;
+                       client_ptr->town_num = old_town_num;
                        do_cmd_pref();
-                       p_ptr->town_num = inner_town_num;
+                       client_ptr->town_num = inner_town_num;
                        break;
                }
 
                /* Interact with macros */
                case '@':
                {
-                       p_ptr->town_num = old_town_num;
-                       do_cmd_macros(p_ptr);
-                       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);
-                       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);
-                       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;
                }
 
@@ -5602,7 +5603,7 @@ static void store_process_command(void)
                {
                        do_cmd_options();
                        (void)combine_and_reorder_home(STORE_HOME);
-                       do_cmd_redraw(p_ptr);
+                       do_cmd_redraw(client_ptr);
                        display_store();
                        break;
                }
@@ -5626,7 +5627,7 @@ static void store_process_command(void)
                /* Repeat level feeling */
                case KTRL('F'):
                {
-                       do_cmd_feeling(p_ptr);
+                       do_cmd_feeling(client_ptr);
                        break;
                }
 
@@ -5719,7 +5720,7 @@ void do_cmd_store(void)
        store_bottom = MIN_STOCK + xtra_stock;
 
        /* Access the player grid */
-       g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+       g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
 
        /* Verify a store */
        if (!cave_have_flag_grid(g_ptr, FF_STORE))
@@ -5733,7 +5734,7 @@ void do_cmd_store(void)
 
        old_town_num = p_ptr->town_num;
        if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
-       if (current_floor_ptr->dun_level) p_ptr->town_num = NO_TOWN;
+       if (p_ptr->current_floor_ptr->dun_level) p_ptr->town_num = NO_TOWN;
        inner_town_num = p_ptr->town_num;
 
        /* Hack -- Check the "locked doors" */
@@ -5761,8 +5762,8 @@ void do_cmd_store(void)
                town_info[p_ptr->town_num].store[which].last_visit = current_world_ptr->game_turn;
        }
 
-       forget_lite();
-       forget_view();
+       forget_lite(p_ptr->current_floor_ptr);
+       forget_view(p_ptr->current_floor_ptr);
 
        /* Hack -- Character is in "icky" mode */
        current_world_ptr->character_icky = TRUE;
@@ -5854,7 +5855,7 @@ void do_cmd_store(void)
                request_command(TRUE);
 
                /* Process the command */
-               store_process_command();
+               store_process_command(p_ptr);
 
                /*
                 * Hack -- To redraw missiles damage and prices in store
@@ -5940,7 +5941,7 @@ void do_cmd_store(void)
                if (st_ptr->store_open >= current_world_ptr->game_turn) leave_store = TRUE;
        }
 
-       select_floor_music();
+       select_floor_music(p_ptr);
 
        p_ptr->town_num = old_town_num;