-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHighScore.h
More file actions
53 lines (44 loc) · 1.31 KB
/
HighScore.h
File metadata and controls
53 lines (44 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* HighScore.h
* --------
* This header file contains definitions for high score functionality.
* Methods can be used here to save/load the high scores from disk.
*
* High scores are to be always saved in pp.hisc in the local directory.
*/
#ifndef SCORE_H
#define SCORE_H
#define NUMBER_OF_HIGH_SCORE_SLOTS 3
// this structure is used for passing highscore data; it's size is always 8 bytes(!)
typedef struct
{
char playerCount; //1 or 2
char name[3]; //3 characters used for the player initals (eg: AAA, DAN, KIM, etc.)
int score;
} HighScore;
/* getHighScoreList()
* Purpose: Fills an empty list with high scores.
* Returns: n/a
*/
void getHighScoreList(HighScore* scoreList);
/* isHighScore()
* Purpose: Determines if a score is high or not
* Returns: 0 if false, 1 if true
*/
int isHighScore(int score);
/* pushHighScore()
* Purpose: Pushes a high score to the high scores list, provided it's high enough.
* Returns: n/a
*/
void pushHighScore(HighScore h);
/* loadHighScores()
* Purpose: Loads the high scores from disk onto RAM. If there are no high scores found on disk, then a default list is created.
* Returns: 0 on failure, 1 on success
*/
int loadHighScores();
/* saveHighScores()
* Purpose: Saves the high scores onto disk.
* Returns: 0 on failure, 1 on success
*/
int saveHighScores();
#endif