-#include "cmd-io/cmd-gameoption.h"
+#include "cmd-io/cmd-gameoption.h"
#include "autopick/autopick.h"
#include "cmd-io/cmd-autopick.h"
#include "cmd-io/cmd-dump.h"
#include "core/asking-player.h"
-#include "core/player-redraw-types.h"
#include "core/show-file.h"
#include "core/window-redrawer.h"
#include "floor/geometry.h"
#include "main/sound-of-music.h"
#include "system/game-option-types.h"
#include "system/player-type-definition.h"
+#include "system/redrawing-flags-updater.h"
#include "term/gameterm.h"
#include "term/screen-processor.h"
#include "term/term-color-types.h"
}
case '?': {
- (void)show_file(player_ptr, true, _("joption.txt#Autosave", "option.txt#Autosave"), nullptr, 0, 0);
+ (void)show_file(player_ptr, true, _("joption.txt#Autosave", "option.txt#Autosave"), 0, 0);
term_clear();
break;
}
* @brief 指定のサブウィンドウが指定のウィンドウフラグを持つか調べる
* @param x ウィンドウ番号
* @param y ウィンドウフラグ番号
- * @return 持つならTRUE、持たないならFALSE
+ * @return æ\8c\81ã\81¤ã\81ªã\82\89TRUEã\80\81æ\8c\81ã\81\9fã\81ªã\81\84ã\81\8bã\83¡ã\82¤ã\83³ã\82¦ã\82£ã\83³ã\83\89ã\82¦ã\81ªã\82\89FALSE
*/
static bool has_window_flag(int x, int y)
{
- auto flag = i2enum<window_redraw_type>(1UL << y);
- return any_bits(window_flag[x], flag);
+ if (x == 0) {
+ return false;
+ }
+
+ auto flag = i2enum<SubWindowRedrawingFlag>(y);
+ return g_window_flags[x].has(flag);
}
/*!
*/
static void set_window_flag(int x, int y)
{
- auto flag = i2enum<window_redraw_type>(1UL << y);
- if (any_bits(PW_ALL, flag)) {
- set_bits(window_flag[x], flag);
+ if (x == 0) {
+ return;
}
+
+ auto flag = i2enum<SubWindowRedrawingFlag>(y);
+ g_window_flags[x].set(flag);
}
/*!
*/
static void clear_window_flag(int x, int y)
{
- window_flag[x] = 0;
+ g_window_flags[x].clear();
+ if (x == 0) {
+ return;
+ }
- auto flag = i2enum<window_redraw_type>(1UL << y);
- for (int i = 0; i < 8; i++) {
- reset_bits(window_flag[i], flag);
+ auto flag = i2enum<SubWindowRedrawingFlag>(y);
+ for (auto &window_flag : g_window_flags) {
+ window_flag.reset(flag);
}
}
TERM_LEN x = 0;
char ch;
bool go = true;
- uint32_t old_flag[8];
-
- for (j = 0; j < 8; j++) {
- old_flag[j] = window_flag[j];
- }
-
+ const auto old_flags = g_window_flags;
term_clear();
while (go) {
prt(_("ウィンドウ・フラグ (<方向>で移動, 't'でON/OFF,'s'でON(他窓OFF), ESC)", "Window Flags (<dir>, <t>oggle, <s>et, ESC) "), 0, 0);
for (j = 0; j < 8; j++) {
byte a = TERM_WHITE;
- concptr s = angband_term_name[j];
+ auto s = angband_term_name[j];
if (j == x) {
a = TERM_L_BLUE;
}
a = TERM_L_BLUE;
}
- if (window_flag[j] & (1UL << i)) {
+ if (g_window_flags[j].has(i2enum<SubWindowRedrawingFlag>(i))) {
c = 'X';
}
case 't':
case 'T':
has_flag = has_window_flag(x, y);
- window_flag[x] = 0;
+ g_window_flags[x].clear();
if (x > 0 && !has_flag) {
set_window_flag(x, y);
}
if (x == 0) {
break;
}
- window_flag[x] = 0;
+ g_window_flags[x].clear();
clear_window_flag(x, y);
set_window_flag(x, y);
break;
case '?':
- (void)show_file(player_ptr, true, _("joption.txt#Window", "option.txt#Window"), nullptr, 0, 0);
+ (void)show_file(player_ptr, true, _("joption.txt#Window", "option.txt#Window"), 0, 0);
term_clear();
break;
default:
continue;
}
- if (window_flag[term_index] == old_flag[term_index]) {
+ if (g_window_flags[term_index] == old_flags[term_index]) {
continue;
}
a = TERM_L_BLUE;
}
- c_prt(enum2i(a), format("%-48s: %s (%s)", cheat_info[i].o_desc, (*cheat_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")), cheat_info[i].o_text), i + 2, 0);
+ const auto yesno = *cheat_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ");
+ c_prt(enum2i(a), format("%-48s: %s (%s)", cheat_info[i].o_desc, yesno, cheat_info[i].o_text), i + 2, 0);
}
move_cursor(k + 2, 50);
case 'Y':
case '6':
if (!w_ptr->noscore) {
- exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0,
+ exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0,
_("詐欺オプションをONにして、スコアを残せなくなった。", "gave up sending score to use cheating options."));
}
k = (k + 1) % n;
break;
case '?':
- (void)show_file(player_ptr, true, std::string(_("joption.txt#", "option.txt#")).append(cheat_info[k].o_text).data(), nullptr, 0, 0);
+ (void)show_file(player_ptr, true, std::string(_("joption.txt#", "option.txt#")).append(cheat_info[k].o_text), 0, 0);
term_clear();
break;
default:
int os = option_info[i].o_set;
int ob = option_info[i].o_bit;
if (option_info[i].o_var) {
- if (option_flag[os] & (1UL << ob)) {
+ if (g_option_flags[os] & (1UL << ob)) {
(*option_info[i].o_var) = true;
} else {
(*option_info[i].o_var) = false;
case 'W':
case 'w': {
do_cmd_options_win(player_ptr);
- player_ptr->window_flags = PW_ALL;
+ RedrawingFlagsUpdater::get_instance().fill_up_sub_flags();
break;
}
case 'P':
case 'd': {
clear_from(18);
prt(format(_("現在ウェイト量(msec): %d", "Current Delay Factor(msec): %d"), delay_factor), 19, 0);
- (void)get_value(_("コマンド: ウェイト量(msec)", "Command: Delay Factor(msec)"), 0, 1000, &delay_factor);
+ constexpr auto prompt = _("コマンド: ウェイト量(msec)", "Command: Delay Factor(msec)");
+ const auto new_delay_factor = input_integer(prompt, 0, 1000, delay_factor);
+ if (new_delay_factor) {
+ delay_factor = *new_delay_factor;
+ }
+
clear_from(18);
break;
}
if (k == ESCAPE) {
break;
} else if (k == '?') {
- (void)show_file(player_ptr, true, _("joption.txt#Hitpoint", "option.txt#Hitpoint"), nullptr, 0, 0);
+ (void)show_file(player_ptr, true, _("joption.txt#Hitpoint", "option.txt#Hitpoint"), 0, 0);
term_clear();
} else if (isdigit(k)) {
hitpoint_warn = D2I(k);
if (k == ESCAPE) {
break;
} else if (k == '?') {
- (void)show_file(player_ptr, true, _("joption.txt#Manapoint", "option.txt#Manapoint"), nullptr, 0, 0);
+ (void)show_file(player_ptr, true, _("joption.txt#Manapoint", "option.txt#Manapoint"), 0, 0);
term_clear();
} else if (isdigit(k)) {
mana_warn = D2I(k);
break;
}
case '?':
- (void)show_file(player_ptr, true, _("joption.txt", "option.txt"), nullptr, 0, 0);
+ (void)show_file(player_ptr, true, _("joption.txt", "option.txt"), 0, 0);
term_clear();
break;
default: {
}
screen_load();
- player_ptr->redraw |= (PR_EQUIPPY);
+ RedrawingFlagsUpdater::get_instance().set_flag(MainWindowRedrawingFlag::EQUIPPY);
}
/*!
{
char ch;
int i, k = 0, n = 0, l;
- int opt[MAIN_TERM_MIN_ROWS];
+ int opt[MAIN_TERM_MIN_ROWS]{};
bool browse_only = (page == OPT_PAGE_BIRTH) && w_ptr->character_generated && (!w_ptr->wizard || !allow_debug_opts);
for (i = 0; i < MAIN_TERM_MIN_ROWS; i++) {
a = TERM_L_BLUE;
}
- std::string label = format("%-48s: %s (%.19s)", option_info[opt[i]].o_desc, (*option_info[opt[i]].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
- option_info[opt[i]].o_text);
+ const auto reply = *option_info[opt[i]].o_var ? _("はい ", "yes") : _("いいえ", "no ");
+ const auto label = format("%-48s: %s (%.19s)", option_info[opt[i]].o_desc, reply, option_info[opt[i]].o_text);
if ((page == OPT_PAGE_AUTODESTROY) && i > 2) {
c_prt(a, label, i + 5, 0);
} else {
break;
}
case '?': {
- (void)show_file(player_ptr, true, std::string(_("joption.txt#", "option.txt#")).append(option_info[opt[k]].o_text).data(), nullptr, 0, 0);
+ (void)show_file(player_ptr, true, std::string(_("joption.txt#", "option.txt#")).append(option_info[opt[k]].o_text), 0, 0);
term_clear();
break;
}