nSnake
A ncurses implementation of the classic Snake game
Functions | Variables
src/hscores.c File Reference

Definition of the functions related to high scores. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hscores.h"
#include "player.h"
Include dependency graph for hscores.c:

Functions

void hscore_clean ()
 Restore the Highscores to the default.
void hscore_init ()
 Creates/reads from the High Score file.
void hscore_store ()
 Records the player High Score.

Variables

int HIGH_SCORE_DEFAULT = 500
 The Default HighScore.
int HIGH_SCORE_BORDERS
 The separate Highscore for the game mode with borders.
int HIGH_SCORE_BORDERS_OFF
 The separate Highscore for the game mode without borders.

Detailed Description

Definition of the functions related to high scores.


Function Documentation

void hscore_clean ( )

Restore the Highscores to the default.

Note:
If the Highscores file doesn't exist, it is created.
void hscore_init ( )

Creates/reads from the High Score file.

First, we try to open for reading. If it doesn't exist, then we open it for writing, effectively creating it.

Note:
The path to the score file is defined by the Makefile. Currently, it is /var/games/.nsnake.scores
Todo:
clean this code. Lots of useless ifs and elses.

Variable Documentation

The separate Highscore for the game mode with borders.

HighScore of the game mode with borders.

The separate Highscore for the game mode without borders.

HighScore of the game mode without borders.

 All Data Structures Files Functions Variables Enumerations Defines