• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

変愚蛮怒のメインリポジトリです


Commit MetaInfo

修訂52643e62c770df70ce16c0c2af9e5c5511aa55c4 (tree)
時間2020-03-08 17:59:00
作者Hourier <hourier@user...>
CommiterHourier

Log Message

[Refactor] #40236 Separated write_floor() from exe_write_diary()

Change Summary

差異

--- a/src/io/write-diary.c
+++ b/src/io/write-diary.c
@@ -22,15 +22,15 @@ bool write_level;
2222 * @param disable_diary 日記への追加を無効化する場合TRUE
2323 * @return ファイルがあったらTRUE、なかったらFALSE
2424 */
25-static bool open_diary_file(FILE *fff, bool *disable_diary)
25+static bool open_diary_file(FILE **fff, bool *disable_diary)
2626 {
2727 GAME_TEXT file_name[MAX_NLEN];
2828 sprintf(file_name, _("playrecord-%s.txt", "playrec-%s.txt"), savefile_base);
2929 char buf[1024];
3030 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
3131 FILE_TYPE(FILE_TYPE_TEXT);
32- fff = my_fopen(buf, "a");
33- if (fff) return TRUE;
32+ *fff = my_fopen(buf, "a");
33+ if (*fff) return TRUE;
3434
3535 msg_format(_("%s を開くことができませんでした。プレイ記録を一時停止します。", "Failed to open %s. Play-Record is disabled temporarily."), buf);
3636 msg_format(NULL);
@@ -40,6 +40,38 @@ static bool open_diary_file(FILE *fff, bool *disable_diary)
4040
4141
4242 /*!
43+ * @brief フロア情報を日記に追加する
44+ * @param creature_ptr プレーヤーへの参照ポインタ
45+ * @return クエストID
46+ */
47+static QUEST_IDX write_floor(player_type *creature_ptr, concptr *note_level)
48+{
49+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
50+ QUEST_IDX q_idx = quest_number(creature_ptr, floor_ptr->dun_level);
51+ if (!write_level) return q_idx;
52+
53+ if (floor_ptr->inside_arena)
54+ *note_level = _("アリーナ:", "Arane:");
55+ else if (!floor_ptr->dun_level)
56+ *note_level = _("地上:", "Surface:");
57+ else if (q_idx && (is_fixed_quest_idx(q_idx) && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
58+ *note_level = _("クエスト:", "Quest:");
59+ else
60+ {
61+ char note_level_buf[40];
62+#ifdef JP
63+ sprintf(note_level_buf, "%d階(%s):", (int)floor_ptr->dun_level, d_name + d_info[creature_ptr->dungeon_idx].name);
64+#else
65+ sprintf(note_level_buf, "%s L%d:", d_name + d_info[creature_ptr->dungeon_idx].name, (int)floor_ptr->dun_level);
66+#endif
67+ *note_level = note_level_buf;
68+ }
69+
70+ return q_idx;
71+}
72+
73+
74+/*!
4375 * @brief ペットに関する日記を追加する
4476 * @param fff 日記ファイル
4577 * @param num 日記へ追加する内容番号
@@ -133,30 +165,10 @@ errr exe_write_diary(player_type *creature_ptr, int type, int num, concptr note)
133165 }
134166
135167 FILE *fff = NULL;
136- if (!open_diary_file(fff, &disable_diary)) return -1;
168+ if (!open_diary_file(&fff, &disable_diary)) return -1;
137169
138- QUEST_IDX q_idx = quest_number(creature_ptr, creature_ptr->current_floor_ptr->dun_level);
139170 concptr note_level = "";
140- if (write_level)
141- {
142- if (creature_ptr->current_floor_ptr->inside_arena)
143- note_level = _("アリーナ:", "Arane:");
144- else if (!creature_ptr->current_floor_ptr->dun_level)
145- note_level = _("地上:", "Surface:");
146- else if (q_idx && (is_fixed_quest_idx(q_idx)
147- && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
148- note_level = _("クエスト:", "Quest:");
149- else
150- {
151- char note_level_buf[40];
152-#ifdef JP
153- sprintf(note_level_buf, "%d階(%s):", (int)creature_ptr->current_floor_ptr->dun_level, d_name + d_info[creature_ptr->dungeon_idx].name);
154-#else
155- sprintf(note_level_buf, "%s L%d:", d_name + d_info[creature_ptr->dungeon_idx].name, (int)creature_ptr->current_floor_ptr->dun_level);
156-#endif
157- note_level = note_level_buf;
158- }
159- }
171+ QUEST_IDX q_idx = write_floor(creature_ptr, &note_level);
160172
161173 bool do_level = TRUE;
162174 switch (type)