OSDN Git Service

[Refactor] #1008 Reparated score-util.cpp/h from scores.cpp/h
[hengbandforosx/hengbandosx.git] / src / core / score-util.cpp
1 #include "core/score-util.h"
2 #include "util/angband-files.h"
3
4 /*
5  * The "highscore" file descriptor, if available.
6  */
7 int highscore_fd = -1;
8
9 /*!
10  * @brief i番目のスコア情報にバッファ位置をシークする / Seek score 'i' in the highscore file
11  * @param i スコア情報ID
12  * @return 問題がなければ0を返す
13  */
14 int highscore_seek(int i)
15 {
16     return (fd_seek(highscore_fd, (huge)(i) * sizeof(high_score)));
17 }
18
19 /*!
20  * @brief 所定ポインタからスコア情報を読み取る / Read one score from the highscore file
21  * @param score スコア情報参照ポインタ
22  * @return エラーコード
23  */
24 errr highscore_read(high_score *score)
25 {
26     return (fd_read(highscore_fd, (char *)(score), sizeof(high_score)));
27 }