From 40a84e324d23edf6e48ac996ac311c0f8f917d06 Mon Sep 17 00:00:00 2001 From: deskull Date: Thu, 2 Jan 2020 16:16:30 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20total=5Fwinner=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=20total=5Fwinner=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 | 6 +++--- src/core.c | 2 +- src/files.c | 6 +++--- src/load.c | 2 +- src/monster1.c | 2 +- src/player-damage.c | 4 ++-- src/player-status.c | 2 +- src/player-status.h | 1 - src/realm-hissatsu.c | 5 +++-- src/save.c | 2 +- src/scores.c | 4 ++-- src/view-mainwindow.c | 2 +- src/wild.c | 4 ++-- src/world.h | 1 + 15 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/birth.c b/src/birth.c index 1612569f6..ef1a61b77 100644 --- a/src/birth.c +++ b/src/birth.c @@ -1793,7 +1793,7 @@ static void player_wipe_without_name(player_type *creature_ptr) cheat_turn = FALSE; /* Assume no winning game */ - creature_ptr->total_winner = FALSE; + current_world_ptr->total_winner = FALSE; creature_ptr->timewalk = FALSE; diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index daafc7b44..5919a1cdf 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -2847,7 +2847,7 @@ void do_cmd_suicide(player_type *creature_ptr) flush(); /* Verify Retirement */ - if (creature_ptr->total_winner) + if (current_world_ptr->total_winner) { /* Verify */ if (!get_check_strict(_("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return; @@ -2878,7 +2878,7 @@ void do_cmd_suicide(player_type *creature_ptr) creature_ptr->last_message = NULL; /* Hack -- Note *winning* message */ - if (creature_ptr->total_winner && last_words) + if (current_world_ptr->total_winner && last_words) { char buf[1024] = ""; play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER); @@ -2901,7 +2901,7 @@ void do_cmd_suicide(player_type *creature_ptr) creature_ptr->is_dead = TRUE; creature_ptr->leaving = TRUE; - if (!creature_ptr->total_winner) + if (!current_world_ptr->total_winner) { exe_write_diary(creature_ptr, NIKKI_BUNSHOU, 0, _("ダンジョンの探索に絶望して自殺した。", "give up all hope to commit suicide.")); exe_write_diary(creature_ptr, NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------")); diff --git a/src/core.c b/src/core.c index 7b014824d..a5f4cde28 100644 --- a/src/core.c +++ b/src/core.c @@ -5787,7 +5787,7 @@ void close_game(void) if (p_ptr->is_dead) { /* Handle retirement */ - if (p_ptr->total_winner) kingly(p_ptr); + if (current_world_ptr->total_winner) kingly(p_ptr); /* Save memories */ if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? "))) diff --git a/src/files.c b/src/files.c index aee117d4b..362b3c656 100644 --- a/src/files.c +++ b/src/files.c @@ -3952,7 +3952,7 @@ void display_player(player_type *creature_ptr, int mode) if (creature_ptr->is_dead) { - if (creature_ptr->total_winner) + if (current_world_ptr->total_winner) { #ifdef JP sprintf(statmsg, "…あなたは勝利の後%sした。", streq(creature_ptr->died_from, "Seppuku") ? "切腹" : "引退"); @@ -4505,7 +4505,7 @@ static void dump_aux_last_message(FILE *fff) { if (p_ptr->is_dead) { - if (!p_ptr->total_winner) + if (!current_world_ptr->total_winner) { int i; @@ -6187,7 +6187,7 @@ void print_tomb(void) } /* King or Queen */ - if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL)) + if (current_world_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL)) { #ifdef JP /* 英日切り替え */ diff --git a/src/load.c b/src/load.c index a78adaf22..4dd967736 100644 --- a/src/load.c +++ b/src/load.c @@ -2261,7 +2261,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(¤t_world_ptr->total_winner); rd_u16b(¤t_world_ptr->noscore); diff --git a/src/monster1.c b/src/monster1.c index 8462763ba..02f9b3e74 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -3092,7 +3092,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) if ((m_ptr->r_idx == MON_SERPENT) && !cloned) { /* Total winner */ - p_ptr->total_winner = TRUE; + current_world_ptr->total_winner = TRUE; /* Redraw the "title" */ p_ptr->redraw |= (PR_TITLE); diff --git a/src/player-damage.c b/src/player-damage.c index 30a4b933d..01e3f727c 100644 --- a/src/player-damage.c +++ b/src/player-damage.c @@ -511,7 +511,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp { QUEST_IDX q_idx = quest_number(p_ptr->current_floor_ptr->dun_level); bool seppuku = streq(hit_from, "Seppuku"); - bool winning_seppuku = creature_ptr->total_winner && seppuku; + bool winning_seppuku = current_world_ptr->total_winner && seppuku; play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER); @@ -540,7 +540,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp } /* No longer a winner */ - creature_ptr->total_winner = FALSE; + current_world_ptr->total_winner = FALSE; if (winning_seppuku) { diff --git a/src/player-status.c b/src/player-status.c index 131de5be7..650d07a6f 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -5777,7 +5777,7 @@ long calc_score(player_type *creature_ptr) if ((creature_ptr->pseikaku == SEIKAKU_MUNCHKIN) && point) { point = 1; - if (creature_ptr->total_winner) point = 2; + if (current_world_ptr->total_winner) point = 2; } if (easy_band) point = (0 - point); diff --git a/src/player-status.h b/src/player-status.h index 9c08ab091..87738d207 100644 --- a/src/player-status.h +++ b/src/player-status.h @@ -419,7 +419,6 @@ struct player_type concptr last_message; /* Last message on death or retirement */ char history[4][60]; /* Textual "history" for the Player */ - u16b total_winner; /* Total winner */ u16b panic_save; /* Panic save */ bool wait_report_score; /* Waiting to report score */ diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 4ce6c8942..82e33f157 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -20,6 +20,7 @@ #include "targeting.h" #include "view-mainwindow.h" #include "spells-floor.h" +#include "world.h" /*! * @brief 剣術の各処理を行う @@ -938,10 +939,10 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo i = inkey(); prt("", 0, 0); if (i != '@') return NULL; - if (caster_ptr->total_winner) + if (current_world_ptr->total_winner) { take_hit(caster_ptr, DAMAGE_FORCE, 9999, "Seppuku", -1); - caster_ptr->total_winner = TRUE; + current_world_ptr->total_winner = TRUE; } else { diff --git a/src/save.c b/src/save.c index ebb50ab7e..48c0b497b 100644 --- a/src/save.c +++ b/src/save.c @@ -824,7 +824,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(current_world_ptr->total_winner); wr_u16b(current_world_ptr->noscore); diff --git a/src/scores.c b/src/scores.c index e4177ae9d..64c036cbf 100644 --- a/src/scores.c +++ b/src/scores.c @@ -969,7 +969,7 @@ bool check_score(void) #endif /* Interupted */ - if (!p_ptr->total_winner && streq(p_ptr->died_from, _("強制終了", "Interrupting"))) + if (!current_world_ptr->total_winner && streq(p_ptr->died_from, _("強制終了", "Interrupting"))) { msg_print(_("強制終了のためスコアが記録されません。", "Score not registered due to interruption.")); msg_print(NULL); @@ -977,7 +977,7 @@ bool check_score(void) } /* Quitter */ - if (!p_ptr->total_winner && streq(p_ptr->died_from, _("途中終了", "Quitting"))) + if (!current_world_ptr->total_winner && streq(p_ptr->died_from, _("途中終了", "Quitting"))) { msg_print(_("途中終了のためスコアが記録されません。", "Score not registered due to quitting.")); msg_print(NULL); diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 2a1e566cc..1a8a18bfc 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -749,7 +749,7 @@ static void prt_title(player_type *creature_ptr) { p = _("[ウィザード]", "[=-WIZARD-=]"); } - else if (creature_ptr->total_winner || (creature_ptr->lev > PY_MAX_LEVEL)) + else if (current_world_ptr->total_winner || (creature_ptr->lev > PY_MAX_LEVEL)) { if (creature_ptr->arena_number > MAX_ARENA_MONS + 2) { diff --git a/src/wild.c b/src/wild.c index 9224c5d34..b1d658525 100644 --- a/src/wild.c +++ b/src/wild.c @@ -435,7 +435,7 @@ static void generate_area(floor_type *floor_ptr, POSITION y, POSITION x, bool bo } } - if (wilderness[y][x].entrance && !wilderness[y][x].town && (p_ptr->total_winner || !(d_info[wilderness[y][x].entrance].flags1 & DF1_WINNER))) + if (wilderness[y][x].entrance && !wilderness[y][x].town && (current_world_ptr->total_winner || !(d_info[wilderness[y][x].entrance].flags1 & DF1_WINNER))) { int dy, dx; u32b state_backup[4]; @@ -732,7 +732,7 @@ void wilderness_gen_small(player_type *creature_ptr, floor_type *floor_ptr) floor_ptr->grid_array[j][i].special = (s16b)wilderness[j][i].town; } else if (wilderness[j][i].road) floor_ptr->grid_array[j][i].feat = feat_floor; - else if (wilderness[j][i].entrance && (creature_ptr->total_winner || !(d_info[wilderness[j][i].entrance].flags1 & DF1_WINNER))) + else if (wilderness[j][i].entrance && (current_world_ptr->total_winner || !(d_info[wilderness[j][i].entrance].flags1 & DF1_WINNER))) { floor_ptr->grid_array[j][i].feat = feat_entrance; floor_ptr->grid_array[j][i].special = (byte)wilderness[j][i].entrance; diff --git a/src/world.h b/src/world.h index 3a2f321f5..70211e0e0 100644 --- a/src/world.h +++ b/src/world.h @@ -12,6 +12,7 @@ typedef struct { GAME_TURN arena_start_turn; /*!< 闘技場賭博の開始ターン値 */ u32b start_time; u16b noscore; /* Cheating flags */ + u16b total_winner; /* Total winner */ MONSTER_IDX timewalk_m_idx; /*!< 現在時間停止を行っているモンスターのID */ -- 2.11.0