if (!isalpha(rc_ptr->choice)) {
rc_ptr->ask = FALSE;
rc_ptr->command_code = rc_ptr->choice - '0' + 26;
- return;
+ return;
}
rc_ptr->ask = (isupper(rc_ptr->choice));
rc_ptr->command_code = (islower(rc_ptr->choice) ? A2I(rc_ptr->choice) : -1);
}
+static bool ask_invoke_racial_power(rc_type *rc_ptr)
+{
+ if ((rc_ptr->command_code < 0) || (rc_ptr->command_code >= rc_ptr->num)) {
+ bell();
+ return FALSE;
+ }
+
+ if (!rc_ptr->ask)
+ return TRUE;
+
+ char tmp_val[160];
+ (void)strnfmt(tmp_val, 78, _("%sを使いますか? ", "Use %s? "), rc_ptr->power_desc[rc_ptr->command_code].racial_name);
+ return get_check(tmp_val);
+}
+
/*!
* @brief レイシャル・パワーコマンドのメインルーチン / Allow user to choose a power (racial / mutation) to activate
* @param creature_ptr プレーヤーへの参照ポインタ
continue;
decide_racial_command(rc_ptr);
- if ((rc_ptr->command_code < 0) || (rc_ptr->command_code >= rc_ptr->num)) {
- bell();
+ if (!ask_invoke_racial_power(rc_ptr))
continue;
- }
-
- if (rc_ptr->ask) {
- char tmp_val[160];
- (void)strnfmt(tmp_val, 78, _("%sを使いますか? ", "Use %s? "), rc_ptr->power_desc[rc_ptr->command_code].racial_name);
- if (!get_check(tmp_val))
- continue;
- }
rc_ptr->flag = TRUE;
}