From e2e910f1b6fa55cfeff8343335fc53b76eef4408 Mon Sep 17 00:00:00 2001 From: deskull Date: Thu, 2 Jan 2020 08:46:29 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20noscore=20=E3=82=92?= =?utf8?q?=E3=80=80world=5Ftype=20=E3=81=B8=E7=A7=BB=E5=8B=95=EF=BC=8E=20/?= =?utf8?q?=20Move=20noscore=20to=20world=5Ftype=20structure.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/birth.c | 2 +- src/cmd/cmd-basic.c | 3 ++- src/cmd/cmd-gameoption.c | 8 ++++---- src/core.c | 12 ++++++------ src/files.c | 4 ++-- src/load.c | 2 +- src/player-status.c | 2 +- src/player-status.h | 2 -- src/save.c | 4 ++-- src/scores.c | 6 +++--- src/world.h | 1 + 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/birth.c b/src/birth.c index 02301ffb7..1612569f6 100644 --- a/src/birth.c +++ b/src/birth.c @@ -1801,7 +1801,7 @@ static void player_wipe_without_name(player_type *creature_ptr) creature_ptr->panic_save = 0; /* Assume no cheating */ - creature_ptr->noscore = 0; + current_world_ptr->noscore = 0; current_world_ptr->wizard = FALSE; /* Not waiting to report score */ diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index f562728f7..daafc7b44 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -57,6 +57,7 @@ #include "view-mainwindow.h" #include "targeting.h" +#include "world.h" /*! * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理 @@ -2859,7 +2860,7 @@ void do_cmd_suicide(player_type *creature_ptr) if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return; } - if (!creature_ptr->noscore) + if (!current_world_ptr->noscore) { /* Special Verification for suicide */ prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0); diff --git a/src/cmd/cmd-gameoption.c b/src/cmd/cmd-gameoption.c index 0400b924f..df1af10e8 100644 --- a/src/cmd/cmd-gameoption.c +++ b/src/cmd/cmd-gameoption.c @@ -1103,10 +1103,10 @@ static void do_cmd_options_cheat(concptr info) case 'Y': case '6': { - if (!p_ptr->noscore) + if (!current_world_ptr->noscore) exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("詐欺オプションをONにして、スコアを残せなくなった。", "give up sending score to use cheating options.")); - p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit); + current_world_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit); (*cheat_info[k].o_var) = TRUE; k = (k + 1) % n; break; @@ -1195,7 +1195,7 @@ void do_cmd_options(void) int n = OPT_NUM; /* Does not list cheat option when cheat option is off */ - if (!p_ptr->noscore && !allow_debug_opts) n--; + if (!current_world_ptr->noscore && !allow_debug_opts) n--; Term_clear(); /* Why are we here */ @@ -1316,7 +1316,7 @@ void do_cmd_options(void) /* Cheating Options */ case 'C': { - if (!p_ptr->noscore && !allow_debug_opts) + if (!current_world_ptr->noscore && !allow_debug_opts) { /* Cheat options are not permitted */ bell(); diff --git a/src/core.c b/src/core.c index b59fd1ec9..7b014824d 100644 --- a/src/core.c +++ b/src/core.c @@ -3373,7 +3373,7 @@ static void process_world(player_type *player_ptr) static bool enter_wizard_mode(void) { /* Ask first time */ - if (!p_ptr->noscore) + if (!current_world_ptr->noscore) { /* Wizard mode is not permitted */ if (!allow_debug_opts || arg_wizard) @@ -3395,7 +3395,7 @@ static bool enter_wizard_mode(void) exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode.")); /* Mark savefile */ - p_ptr->noscore |= 0x0002; + current_world_ptr->noscore |= 0x0002; } /* Success */ @@ -3413,7 +3413,7 @@ static bool enter_wizard_mode(void) static bool enter_debug_mode(void) { /* Ask first time */ - if (!p_ptr->noscore) + if (!current_world_ptr->noscore) { /* Debug mode is not permitted */ if (!allow_debug_opts) @@ -3436,7 +3436,7 @@ static bool enter_debug_mode(void) exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands.")); /* Mark savefile */ - p_ptr->noscore |= 0x0008; + current_world_ptr->noscore |= 0x0008; } /* Success */ @@ -3461,7 +3461,7 @@ extern void do_cmd_debug(player_type *creature_ptr); static bool enter_borg_mode(void) { /* Ask first time */ - if (!(p_ptr->noscore & 0x0010)) + if (!(current_world_ptr->noscore & 0x0010)) { /* Mention effects */ msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting.")); @@ -3477,7 +3477,7 @@ static bool enter_borg_mode(void) exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands.")); /* Mark savefile */ - p_ptr->noscore |= 0x0010; + current_world_ptr->noscore |= 0x0010; } /* Success */ diff --git a/src/files.c b/src/files.c index 5a44e0f60..aee117d4b 100644 --- a/src/files.c +++ b/src/files.c @@ -4608,7 +4608,7 @@ static void dump_aux_options(FILE *fff) fputc('\n', fff); - if (p_ptr->noscore) + if (current_world_ptr->noscore) fprintf(fff, _("\n 何か不正なことをしてしまっています。\n", "\n You have done something illegal.\n")); fputc('\n', fff); @@ -6080,7 +6080,7 @@ static void make_bones(void) /* Ignore wizards and borgs */ - if (!(p_ptr->noscore & 0x00FF)) + if (!(current_world_ptr->noscore & 0x00FF)) { /* Ignore people who die in town */ if (p_ptr->current_floor_ptr->dun_level) diff --git a/src/load.c b/src/load.c index a63b4bada..a78adaf22 100644 --- a/src/load.c +++ b/src/load.c @@ -2262,7 +2262,7 @@ static void rd_extra(player_type *creature_ptr) /* Special stuff */ rd_u16b(&creature_ptr->panic_save); rd_u16b(&creature_ptr->total_winner); - rd_u16b(&creature_ptr->noscore); + rd_u16b(¤t_world_ptr->noscore); /* Read "death" */ diff --git a/src/player-status.c b/src/player-status.c index 727d4697c..131de5be7 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -5794,7 +5794,7 @@ void cheat_death(player_type *creature_ptr) creature_ptr->age++; /* Mark savefile */ - creature_ptr->noscore |= 0x0001; + current_world_ptr->noscore |= 0x0001; msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death.")); msg_print(NULL); diff --git a/src/player-status.h b/src/player-status.h index 3e3394982..9c08ab091 100644 --- a/src/player-status.h +++ b/src/player-status.h @@ -422,8 +422,6 @@ struct player_type u16b total_winner; /* Total winner */ u16b panic_save; /* Panic save */ - u16b noscore; /* Cheating flags */ - bool wait_report_score; /* Waiting to report score */ bool is_dead; /* Player is dead */ bool now_damaged; diff --git a/src/save.c b/src/save.c index fedd3b86a..ebb50ab7e 100644 --- a/src/save.c +++ b/src/save.c @@ -601,7 +601,7 @@ static void save_quick_start(void) wr_byte(0); /* No quick start after using debug mode or cheat options */ - if (p_ptr->noscore) previous_char.quick_ok = FALSE; + if (current_world_ptr->noscore) previous_char.quick_ok = FALSE; wr_byte((byte)previous_char.quick_ok); } @@ -825,7 +825,7 @@ static void wr_extra(player_type *creature_ptr) /* Special stuff */ wr_u16b(creature_ptr->panic_save); wr_u16b(creature_ptr->total_winner); - wr_u16b(creature_ptr->noscore); + wr_u16b(current_world_ptr->noscore); /* Write death */ diff --git a/src/scores.c b/src/scores.c index 45d594e10..e4177ae9d 100644 --- a/src/scores.c +++ b/src/scores.c @@ -940,7 +940,7 @@ bool check_score(void) #ifndef SCORE_WIZARDS /* Wizard-mode pre-empts scoring */ - if (p_ptr->noscore & 0x000F) + if (current_world_ptr->noscore & 0x000F) { msg_print(_("ウィザード・モードではスコアが記録されません。", "Score not registered for wizards.")); msg_print(NULL); @@ -950,7 +950,7 @@ bool check_score(void) #ifndef SCORE_BORGS /* Borg-mode pre-empts scoring */ - if (p_ptr->noscore & 0x00F0) + if (current_world_ptr->noscore & 0x00F0) { msg_print(_("ボーグ・モードではスコアが記録されません。", "Score not registered for borgs.")); msg_print(NULL); @@ -960,7 +960,7 @@ bool check_score(void) #ifndef SCORE_CHEATERS /* Cheaters are not scored */ - if (p_ptr->noscore & 0xFF00) + if (current_world_ptr->noscore & 0xFF00) { msg_print(_("詐欺をやった人はスコアが記録されません。", "Score not registered for cheaters.")); msg_print(NULL); diff --git a/src/world.h b/src/world.h index 07821d6dd..3a2f321f5 100644 --- a/src/world.h +++ b/src/world.h @@ -11,6 +11,7 @@ typedef struct { GAME_TURN dungeon_turn_limit; /*!< dungeon_turnの最大値 / Limit of game_turn in dungeon */ GAME_TURN arena_start_turn; /*!< 闘技場賭博の開始ターン値 */ u32b start_time; + u16b noscore; /* Cheating flags */ MONSTER_IDX timewalk_m_idx; /*!< 現在時間停止を行っているモンスターのID */ -- 2.11.0