}
const auto command_opt = input_command(prompt, true);
- if (!command_opt.has_value()) {
+ if (!command_opt) {
break;
}
constexpr auto prompt = _("方向 (ESCで中断)? ", "Direction (Escape to cancel)? ");
while (dir == 0) {
const auto command = input_command(prompt, true);
- if (!command.has_value()) {
+ if (!command) {
return false;
}
: _("方向 (ESCで中断)? ", "Direction (Escape to cancel)? ");
while (dir == 0) {
const auto command = input_command(prompt, true);
- if (!command.has_value()) {
+ if (!command) {
return false;
}
static std::optional<Xoshiro128StarStar> urbg_external;
- if (!urbg_external.has_value()) {
+ if (!urbg_external) {
/* Initialize with new seed */
auto seed = static_cast<uint32_t>(time(nullptr));
urbg_external = Xoshiro128StarStar(seed);
return;
}
- if (x.has_value()) {
+ if (x) {
this->term->offset_x = (x.value() > 0) ? x.value() : 0;
}
- if (y.has_value()) {
+ if (y) {
this->term->offset_y = (y.value() > 0) ? y.value() : 0;
}
}
return;
}
- const auto offset_x = width.has_value() ? (game_term->wid - width.value()) / 2 : 0;
- const auto offset_y = height.has_value() ? (game_term->hgt - height.value()) / 2 : 0;
+ const auto offset_x = width ? (game_term->wid - width.value()) / 2 : 0;
+ const auto offset_y = height ? (game_term->hgt - height.value()) / 2 : 0;
this->tos.emplace(offset_x, offset_y);
game_term->centered_wid = (width < game_term->wid) ? width : std::nullopt;
if (argc > 1) {
for (auto arg : std::span(argv, argc).subspan(1)) {
auto hash = util::SHA256::compute_filehash(arg);
- if (!hash.has_value()) {
+ if (!hash) {
std::cout << "cannot open file: " << arg << std::endl;
continue;
}
static std::string decide_current_floor(PlayerType *player_ptr)
{
if (auto death_cause = search_death_cause(player_ptr);
- death_cause.has_value() || !w_ptr->character_dungeon) {
+ death_cause || !w_ptr->character_dungeon) {
return death_cause.value_or("");
}
return format(_("…あなたは現在、 %s にいる。", "...Now, you are in %s."), map_name(player_ptr).data());
}
- if (auto decision = decide_death_in_quest(player_ptr); decision.has_value()) {
+ if (auto decision = decide_death_in_quest(player_ptr); decision) {
return decision.value();
}
term_erase(col, y, max_width);
}
- if (!monster_idx.has_value()) {
+ if (!monster_idx) {
return;
}
auto &quest_list = QuestList::get_instance();
const auto quest_max = enum2i(quest_list.rbegin()->first);
const auto quest_num = input_numerics("QuestID", 0, quest_max - 1, QuestId::NONE);
- if (!quest_num.has_value()) {
+ if (!quest_num) {
return;
}
{
if (!MonsterRace(r_idx).is_valid()) {
const auto restore_monrace_id = input_numerics("MonsterID", 1, monraces_info.size() - 1, MonsterRaceId::FILTHY_URCHIN);
- if (!restore_monrace_id.has_value()) {
+ if (!restore_monrace_id) {
return;
}
}
const auto input_artifact_id = input_numerics("Artifact ID", 1, max_a_idx, FixedArtifactId::GALADRIEL_PHIAL);
- if (!input_artifact_id.has_value()) {
+ if (!input_artifact_id) {
return;
}
constexpr auto min = enum2i(RandomArtActType::NONE);
constexpr auto max = enum2i(RandomArtActType::MAX) - 1;
const auto act_id = input_numerics<RandomArtActType>("Activation ID", min, max);
- if (!act_id.has_value()) {
+ if (!act_id) {
return;
}
while (true) {
wiz_display_item(player_ptr, o_ptr);
const auto command = input_command(prompt);
- if (!command.has_value()) {
+ if (!command) {
break;
}
constexpr auto p = "Enter number of items to roll: ";
const auto rolls_opt = input_numerics(p, 0, MAX_INT, rolls);
- if (rolls_opt.has_value()) {
+ if (rolls_opt) {
rolls = rolls_opt.value();
}
while (true) {
wiz_display_item(player_ptr, q_ptr);
const auto command = input_command(prompt);
- if (!command.has_value()) {
+ if (!command) {
if (q_ptr->is_fixed_artifact()) {
q_ptr->get_fixed_artifact().is_generated = false;
q_ptr->fixed_artifact_idx = FixedArtifactId::NONE;
}
const auto pval = input_numerics("Enter new 'pval' setting: ", -MAX_SHORT, MAX_SHORT, o_ptr->pval);
- if (!pval.has_value()) {
+ if (!pval) {
return;
}
o_ptr->pval = pval.value();
wiz_display_item(player_ptr, o_ptr);
const auto bonus_ac = input_numerics("Enter new AC Bonus setting: ", -MAX_SHORT, MAX_SHORT, o_ptr->to_a);
- if (!bonus_ac.has_value()) {
+ if (!bonus_ac) {
return;
}
o_ptr->to_a = bonus_ac.value();
wiz_display_item(player_ptr, o_ptr);
const auto bonus_hit = input_numerics("Enter new Hit Bonus setting: ", -MAX_SHORT, MAX_SHORT, o_ptr->to_h);
- if (!bonus_hit.has_value()) {
+ if (!bonus_hit) {
return;
}
o_ptr->to_h = bonus_hit.value();
wiz_display_item(player_ptr, o_ptr);
const auto bonus_damage = input_numerics("Enter new Damage Bonus setting: ", -MAX_SHORT, MAX_SHORT, o_ptr->to_d);
- if (!bonus_damage.has_value()) {
+ if (!bonus_damage) {
return;
}
}
const auto quantity_opt = input_numerics("Quantity: ", 1, 99, o_ptr->number);
- if (!quantity_opt.has_value()) {
+ if (!quantity_opt) {
return;
}
while (true) {
wiz_display_item(player_ptr, q_ptr);
const auto command = input_command(prompt);
- if (!command.has_value()) {
+ if (!command) {
changed = false;
break;
}
std::string pray;
while (true) {
const auto pray_opt = input_string(_("何をお望み? ", "For what do you wish?"), MAX_NLEN);
- if (pray_opt.has_value()) {
+ if (pray_opt) {
pray = pray_opt.value();
break;
}
}
const auto item_type_opt = input_command(_("アイテム種別を選んで下さい", "Get what type of object? "));
- if (!item_type_opt.has_value()) {
+ if (!item_type_opt) {
return std::nullopt;
}
auto max_num = num;
const auto prompt = format(_("%s群の具体的なアイテムを選んで下さい", "What Kind of %s? "), tval_description.data());
const auto command = input_command(prompt);
- if (!command.has_value()) {
+ if (!command) {
return 0;
}
{
term_clear();
auto selection = wiz_select_tval();
- if (!selection.has_value()) {
+ if (!selection) {
return 0;
}
const auto max_max_ability_score = player_ptr->stat_max_max[i];
const auto max_ability_score = player_ptr->stat_max[i];
const auto new_ability_score = input_numerics(stat_names[i], 3, max_max_ability_score, max_ability_score);
- if (!new_ability_score.has_value()) {
+ if (!new_ability_score) {
return;
}
const auto unskilled = PlayerSkill::weapon_exp_at(PlayerSkillRank::UNSKILLED);
const auto master = PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER);
const auto proficiency_opt = input_numerics(_("熟練度", "Proficiency"), unskilled, master, static_cast<short>(master));
- if (!proficiency_opt.has_value()) {
+ if (!proficiency_opt) {
return;
}
}
const auto gold = input_numerics("Gold: ", 0, MAX_INT, player_ptr->au);
- if (!gold.has_value()) {
+ if (!gold) {
return;
}
}
const auto experience_opt = input_numerics("Experience: ", 0, MAX_INT, player_ptr->max_exp);
- if (!experience_opt.has_value()) {
+ if (!experience_opt) {
return;
}
auto &grid = player_ptr->current_floor_ptr->get_grid(pos);
const int max = TerrainList::get_instance().size() - 1;
const auto f_val1 = input_numerics(_("実地形ID", "FeatureID"), 0, max, grid.feat);
- if (!f_val1.has_value()) {
+ if (!f_val1) {
return;
}
const auto f_val2 = input_numerics(_("偽装地形ID", "FeatureID"), 0, max, f_val1.value());
- if (!f_val2.has_value()) {
+ if (!f_val2) {
return;
}
while (true) {
const auto dungeon_id = input_numerics("Jump which dungeon", DUNGEON_ANGBAND, DUNGEON_DARKNESS, initial_dungeon_id);
- if (!dungeon_id.has_value()) {
+ if (!dungeon_id) {
return std::nullopt;
}
const auto is_in_dungeon = floor.is_in_dungeon();
const auto dungeon_idx = is_in_dungeon ? floor.dungeon_idx : static_cast<short>(DUNGEON_ANGBAND);
const auto dungeon_id_opt = select_debugging_dungeon(dungeon_idx);
- if (!dungeon_id_opt.has_value()) {
+ if (!dungeon_id_opt) {
if (!is_in_dungeon) {
return;
}
const auto dungeon_id = dungeon_id_opt.value();
const auto level_opt = select_debugging_floor(floor, dungeon_id);
- if (!level_opt.has_value()) {
+ if (!level_opt) {
return;
}
void wiz_reset_race(PlayerType *player_ptr)
{
const auto new_race = input_numerics("RaceID", 0, MAX_RACES - 1, player_ptr->prace);
- if (!new_race.has_value()) {
+ if (!new_race) {
return;
}
void wiz_reset_class(PlayerType *player_ptr)
{
const auto new_class_opt = input_numerics("ClassID", 0, PLAYER_CLASS_TYPE_MAX - 1, player_ptr->pclass);
- if (!new_class_opt.has_value()) {
+ if (!new_class_opt) {
return;
}
void wiz_reset_realms(PlayerType *player_ptr)
{
const auto new_realm1 = input_numerics("1st Realm (None=0)", 0, MAX_REALM - 1, player_ptr->realm1);
- if (!new_realm1.has_value()) {
+ if (!new_realm1) {
return;
}
const auto new_realm2 = input_numerics("2nd Realm (None=0)", 0, MAX_REALM - 1, player_ptr->realm2);
- if (!new_realm2.has_value()) {
+ if (!new_realm2) {
return;
}
void set_gametime(void)
{
const auto game_time = input_integer("Dungeon Turn", 0, w_ptr->dungeon_turn_limit - 1);
- if (!game_time.has_value()) {
+ if (!game_time) {
return;
}
void wiz_debug_spell(PlayerType *player_ptr)
{
const auto spell = input_string("SPELL: ", 50);
- if (!spell.has_value()) {
+ if (!spell) {
return;
}
return;
case 3: {
const auto power = input_integer("POWER", -MAX_INT, MAX_INT);
- if (!power.has_value()) {
+ if (!power) {
return;
}
{
if (!MonsterRace(r_idx).is_valid()) {
const auto new_monrace_id = input_numerics("MonsterID", 1, monraces_info.size() - 1, MonsterRaceId::FILTHY_URCHIN);
- if (!new_monrace_id.has_value()) {
+ if (!new_monrace_id) {
return;
}
{
if (!MonsterRace(r_idx).is_valid()) {
const auto new_monrace_id = input_numerics("MonsterID", 1, monraces_info.size() - 1, MonsterRaceId::FILTHY_URCHIN);
- if (!new_monrace_id.has_value()) {
+ if (!new_monrace_id) {
return;
}
auto dam = initial_dam;
if (dam <= 0) {
const auto input_dam = input_integer("Damage", 1, 1000000, 1000000);
- if (!input_dam.has_value()) {
+ if (!input_dam) {
return;
}
}
const auto input_effect_id = input_numerics("EffectID", 1, max - 1, idx);
- if (!input_effect_id.has_value()) {
+ if (!input_effect_id) {
screen_load();
return;
}