リビジョン | 235dec773df1e697e9fb7a5cd11dcc3b185b0670 (tree) |
---|---|
日時 | 2020-02-24 19:59:52 |
作者 | Hourier <hourier@user...> |
コミッター | Hourier |
[Refactor] #39962 make_character_dump() にupdate_playtime() のコールバックを追加 / Added call-back update_playtime() to make_character_dump()
@@ -4326,7 +4326,7 @@ void play_game(player_type *player_ptr, bool new_game) | ||
4326 | 4326 | |
4327 | 4327 | /* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */ |
4328 | 4328 | process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x); |
4329 | - success = send_world_score(player_ptr, TRUE); | |
4329 | + success = send_world_score(player_ptr, TRUE, update_playtime); | |
4330 | 4330 | |
4331 | 4331 | if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY)) |
4332 | 4332 | { |
@@ -4703,7 +4703,7 @@ void close_game(player_type *player_ptr) | ||
4703 | 4703 | |
4704 | 4704 | if (check_score(player_ptr)) |
4705 | 4705 | { |
4706 | - if ((!send_world_score(player_ptr, do_send))) | |
4706 | + if ((!send_world_score(player_ptr, do_send, update_playtime))) | |
4707 | 4707 | { |
4708 | 4708 | if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "), |
4709 | 4709 | (CHECK_NO_ESCAPE | CHECK_NO_HISTORY))) |
@@ -3769,7 +3769,7 @@ static void dump_aux_home_museum(player_type *creature_ptr, FILE *fff) | ||
3769 | 3769 | * @param fff ファイルポインタ |
3770 | 3770 | * @return エラーコード |
3771 | 3771 | */ |
3772 | -errr make_character_dump(player_type *creature_ptr, FILE *fff) | |
3772 | +errr make_character_dump(player_type *creature_ptr, FILE *fff, void(*update_playtime)(void)) | |
3773 | 3773 | { |
3774 | 3774 | #ifdef JP |
3775 | 3775 | fprintf(fff, " [変愚蛮怒 %d.%d.%d キャラクタ情報]\n\n", |
@@ -3778,7 +3778,7 @@ errr make_character_dump(player_type *creature_ptr, FILE *fff) | ||
3778 | 3778 | fprintf(fff, " [Hengband %d.%d.%d Character Dump]\n\n", |
3779 | 3779 | FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH); |
3780 | 3780 | #endif |
3781 | - update_playtime(); | |
3781 | + (*update_playtime)(); | |
3782 | 3782 | |
3783 | 3783 | dump_aux_display_player(creature_ptr, fff); |
3784 | 3784 | dump_aux_last_message(creature_ptr, fff); |
@@ -3838,7 +3838,11 @@ errr file_character(player_type *creature_ptr, concptr name) | ||
3838 | 3838 | return -1; |
3839 | 3839 | } |
3840 | 3840 | |
3841 | - (void)make_character_dump(creature_ptr, fff); | |
3841 | + /* | |
3842 | + * todo view-mainwindow への依存があるが、file_character() 自体関数ポインタなのでよそから呼び出されるので何とかするのは辛い | |
3843 | + * ついでに他の関数でもview(略) は参照されているので、簡単に除去することはできない… | |
3844 | + */ | |
3845 | + (void)make_character_dump(creature_ptr, fff, update_playtime); | |
3842 | 3846 | my_fclose(fff); |
3843 | 3847 | msg_print(_("キャラクタ情報のファイルへの書き出しに成功しました。", "Character dump successful.")); |
3844 | 3848 | msg_print(NULL); |
@@ -21,7 +21,7 @@ extern concptr ANGBAND_DIR_XTRA; | ||
21 | 21 | |
22 | 22 | extern s16b tokenize(char *buf, s16b num, char **tokens, BIT_FLAGS mode); |
23 | 23 | extern void display_player(player_type *creature_ptr, int mode); |
24 | -extern errr make_character_dump(player_type *creature_ptr, FILE *fff); | |
24 | +extern errr make_character_dump(player_type *creature_ptr, FILE *fff, void(*update_playtime)(void)); | |
25 | 25 | extern errr file_character(player_type *creature_ptr, concptr name); |
26 | 26 | extern errr process_pref_file_command(player_type *creature_ptr, char *buf); |
27 | 27 | extern concptr process_pref_file_expr(player_type *creature_ptr, char **sp, char *fp); |
@@ -220,7 +220,7 @@ static bool http_post(int sd, concptr url, BUF *buf) | ||
220 | 220 | * @param dumpbuf 伝送内容バッファ |
221 | 221 | * @return エラーコード |
222 | 222 | */ |
223 | -static errr make_dump(player_type *creature_ptr, BUF* dumpbuf) | |
223 | +static errr make_dump(player_type *creature_ptr, BUF* dumpbuf, void(*update_playtime)(void)) | |
224 | 224 | { |
225 | 225 | char buf[1024]; |
226 | 226 | FILE *fff; |
@@ -240,7 +240,7 @@ static errr make_dump(player_type *creature_ptr, BUF* dumpbuf) | ||
240 | 240 | } |
241 | 241 | |
242 | 242 | /* 一旦一時ファイルを作る。通常のダンプ出力と共通化するため。 */ |
243 | - (void)make_character_dump(creature_ptr, fff); | |
243 | + (void)make_character_dump(creature_ptr, fff, update_playtime); | |
244 | 244 | my_fclose(fff); |
245 | 245 | |
246 | 246 | /* Open for read */ |
@@ -385,7 +385,7 @@ concptr make_screen_dump(player_type *creature_ptr) | ||
385 | 385 | * @param creature_ptr プレーヤーへの参照ポインタ |
386 | 386 | * @return 正常終了の時0、異常があったら1 |
387 | 387 | */ |
388 | -errr report_score(player_type *creature_ptr) | |
388 | +errr report_score(player_type *creature_ptr, void(*update_playtime)(void)) | |
389 | 389 | { |
390 | 390 | #ifdef WINDOWS |
391 | 391 | WSADATA wsaData; |
@@ -426,7 +426,7 @@ errr report_score(player_type *creature_ptr) | ||
426 | 426 | buf_sprintf(score, "killer: %s\n", creature_ptr->died_from); |
427 | 427 | buf_sprintf(score, "-----charcter dump-----\n"); |
428 | 428 | |
429 | - make_dump(creature_ptr, score); | |
429 | + make_dump(creature_ptr, score, update_playtime); | |
430 | 430 | |
431 | 431 | if (screen_dump) |
432 | 432 | { |
@@ -3,7 +3,6 @@ | ||
3 | 3 | extern concptr screen_dump; |
4 | 4 | |
5 | 5 | #ifdef WORLD_SCORE |
6 | -/* report.c */ | |
7 | -extern errr report_score(player_type *creature_ptr); | |
6 | +extern errr report_score(player_type *creature_ptr, void(*update_playtime)(void)); | |
8 | 7 | extern concptr make_screen_dump(player_type *creature_ptr); |
9 | 8 | #endif |
@@ -429,7 +429,7 @@ void display_scores(int from, int to) | ||
429 | 429 | * @param do_send 実際に転送ア処置を行うか否か |
430 | 430 | * @return 転送が成功したらTRUEを返す |
431 | 431 | */ |
432 | -bool send_world_score(player_type *current_player_ptr, bool do_send) | |
432 | +bool send_world_score(player_type *current_player_ptr, bool do_send, void(*update_playtime)(void)) | |
433 | 433 | { |
434 | 434 | #ifdef WORLD_SCORE |
435 | 435 | if (send_score && do_send) |
@@ -449,7 +449,7 @@ bool send_world_score(player_type *current_player_ptr, bool do_send) | ||
449 | 449 | prt(_("送信中..", "Sending..."), 0, 0); |
450 | 450 | Term_fresh(); |
451 | 451 | screen_save(); |
452 | - err = report_score(current_player_ptr); | |
452 | + err = report_score(current_player_ptr, update_playtime); | |
453 | 453 | screen_load(); |
454 | 454 | if (err) return FALSE; |
455 | 455 |
@@ -40,7 +40,7 @@ extern int highscore_fd; | ||
40 | 40 | extern void display_scores_aux(int from, int to, int note, high_score *score); |
41 | 41 | extern void display_scores(int from, int to); |
42 | 42 | extern void kingly(player_type *winner_ptr); |
43 | -extern bool send_world_score(player_type *current_player_ptr, bool do_send); | |
43 | +extern bool send_world_score(player_type *current_player_ptr, bool do_send, void(*update_playtime)(void)); | |
44 | 44 | extern errr top_twenty(player_type *current_player_ptr); |
45 | 45 | extern errr predict_score(player_type *current_player_ptr); |
46 | 46 | extern void race_legends(player_type *current_player_ptr); |