-/*!
+/*!
* @brief 剣術の実装 / Blade arts
* @date 2014/01/17
* @author
*/
static int get_hissatsu_power(PlayerType *player_ptr, SPELL_IDX *sn)
{
- SPELL_IDX i;
int j = 0;
int num = 0;
POSITION y = 1;
POSITION x = 15;
PLAYER_LEVEL plev = player_ptr->lev;
char choice;
- char out_val[160];
- SPELL_IDX sentaku[32];
concptr p = _("必殺剣", "special attack");
COMMAND_CODE code;
magic_type spell;
- bool flag, redraw;
int menu_line = (use_menu ? 1 : 0);
/* Assume cancelled */
}
}
- flag = false;
- redraw = false;
+ auto flag = false;
+ auto redraw = false;
+ int i;
+ int selections[32]{};
for (i = 0; i < 32; i++) {
if (technic_info[TECHNIC_HISSATSU][i].slevel <= PY_MAX_LEVEL) {
- sentaku[num] = i;
+ selections[num] = i;
num++;
}
}
constexpr auto fmt = _("(%s^ %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%s^s %c-%c, *=List, ESC=exit) Use which %s? ");
- (void)strnfmt(out_val, 78, fmt, p, I2A(0), "abcdefghijklmnopqrstuvwxyz012345"[num - 1], p);
+ const auto prompt = format(fmt, p, I2A(0), "abcdefghijklmnopqrstuvwxyz012345"[num - 1], p);
if (use_menu) {
screen_save();
while (!flag) {
if (choice == ESCAPE) {
choice = ' ';
- } else if (!get_com(out_val, &choice, false)) {
- break;
+ } else {
+ const auto new_choice = input_command(prompt);
+ if (!new_choice) {
+ break;
+ }
+
+ choice = *new_choice;
}
auto should_redraw_cursor = true;
}
/* Totally Illegal */
- if ((i < 0) || (i >= 32) || !(player_ptr->spell_learned1 & (1U << sentaku[i]))) {
+ if ((i < 0) || (i >= 32) || !(player_ptr->spell_learned1 & (1U << selections[i]))) {
bell();
continue;
}
- j = sentaku[i];
+ j = selections[i];
/* Stop the loop */
flag = true;
constexpr auto q = _("どの書から学びますか? ", "Study which book? ");
constexpr auto s = _("読める書がない。", "You have no books that you can read.");
constexpr auto options = USE_INVEN | USE_FLOOR;
- short item;
- const auto *o_ptr = choose_object(player_ptr, &item, q, s, options, TvalItemTester(ItemKindType::HISSATSU_BOOK));
+ short i_idx;
+ const auto *o_ptr = choose_object(player_ptr, &i_idx, q, s, options, TvalItemTester(ItemKindType::HISSATSU_BOOK));
if (o_ptr == nullptr) {
return;
}
- const auto sval = o_ptr->bi_key.sval().value();
+ const auto sval = *o_ptr->bi_key.sval();
auto gain = false;
for (auto i = sval * 8; i < sval * 8 + 8; i++) {
if (player_ptr->spell_learned1 & (1UL << i)) {