From 7a513aa6be79690dbf3aa77bfdb2415ee8b08ca0 Mon Sep 17 00:00:00 2001 From: Hourier <66951241+Hourier@users.noreply.github.com> Date: Sat, 26 Nov 2022 21:02:47 +0900 Subject: [PATCH] [Refactor] #2839 Reshaped cmd-item.cpp --- src/cmd-item/cmd-item.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/cmd-item/cmd-item.cpp b/src/cmd-item/cmd-item.cpp index 428e191db..481713210 100644 --- a/src/cmd-item/cmd-item.cpp +++ b/src/cmd-item/cmd-item.cpp @@ -240,19 +240,17 @@ void do_cmd_inscribe(PlayerType *player_ptr) */ void do_cmd_use(PlayerType *player_ptr) { - OBJECT_IDX item; - ItemEntity *o_ptr; if (player_ptr->wild_mode || cmd_limit_arena(player_ptr)) { return; } PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU, SamuraiStanceType::KOUKIJIN }); - - concptr q = _("どれを使いますか?", "Use which item? "); - concptr s = _("使えるものがありません。", "You have nothing to use."); - o_ptr = choose_object( - player_ptr, &item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT), FuncItemTester(item_tester_hook_use, player_ptr)); - if (!o_ptr) { + const auto q = _("どれを使いますか?", "Use which item? "); + const auto s = _("使えるものがありません。", "You have nothing to use."); + const auto options = USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT; + short item; + const auto *o_ptr = choose_object(player_ptr, &item, q, s, options, FuncItemTester(item_tester_hook_use, player_ptr)); + if (o_ptr == nullptr) { return; } -- 2.11.0