OSDN Git Service

[Refactor] #2124 Changed struct object_type to class ObjectType
[hengbandforosx/hengbandosx.git] / src / store / museum.cpp
1 #include "store/museum.h"
2 #include "core/asking-player.h"
3 #include "flavor/flavor-describer.h"
4 #include "store/home.h"
5 #include "store/store-util.h"
6 #include "store/store.h"
7 #include "system/object-type-definition.h"
8 #include "view/display-messages.h"
9 #include "view/display-store.h"
10
11 /*!
12  * @brief 博物館のアイテムを除去するコマンドのメインルーチン /
13  * Remove an item from museum (Originally from TOband)
14  * @param player_ptr プレイヤーへの参照ポインタ
15  */
16 void museum_remove_object(PlayerType *player_ptr)
17 {
18     if (st_ptr->stock_num <= 0) {
19         msg_print(_("博物館には何も置いてありません。", "The Museum is empty."));
20         return;
21     }
22
23     int i = st_ptr->stock_num - store_top;
24     if (i > store_bottom)
25         i = store_bottom;
26
27     char out_val[160];
28     sprintf(out_val, _("どのアイテムの展示をやめさせますか?", "Which item do you want to order to remove? "));
29
30     COMMAND_CODE item;
31     if (!get_stock(&item, out_val, 0, i - 1))
32         return;
33
34     item = item + store_top;
35     ObjectType *o_ptr;
36     o_ptr = &st_ptr->stock[item];
37
38     GAME_TEXT o_name[MAX_NLEN];
39     describe_flavor(player_ptr, o_name, o_ptr, 0);
40     msg_print(_("展示をやめさせたアイテムは二度と見ることはできません!", "Once removed from the Museum, an item will be gone forever!"));
41     if (!get_check(format(_("本当に%sの展示をやめさせますか?", "Really order to remove %s from the Museum? "), o_name)))
42         return;
43
44     msg_format(_("%sの展示をやめさせた。", "You ordered to remove %s."), o_name);
45     store_item_increase(item, -o_ptr->number);
46     store_item_optimize(item);
47     (void)combine_and_reorder_home(player_ptr, StoreSaleType::MUSEUM);
48     if (st_ptr->stock_num == 0)
49         store_top = 0;
50     else if (store_top >= st_ptr->stock_num)
51         store_top -= store_bottom;
52
53     display_store_inventory(player_ptr);
54 }