@ -8,7 +8,7 @@
/**
* indexes for different tetris variants
*/
enum tetris_highscore_index
enum tetris_highscore_index_e
{
TETRIS_HISCORE_TETRIS , /**< high score index for the standard variant */
TETRIS_HISCORE_BASTET , /**< high score index for the bastet variant */
@ -23,10 +23,21 @@ enum tetris_highscore_index
# endif
// global array for the high score
extern uint16_t tetris_highscore [ TETRIS_HISCORE_END ] EEMEM ;
// global array for the champion's initials
extern uint16_t tetris_highscore_name [ TETRIS_HISCORE_END ] EEMEM ;
/**
* type for global high score table
*/
typedef struct tetris_highscore_table_s
{
uint16_t nHighScoreName [ TETRIS_HISCORE_END ] ; /**< champions' initials */
uint16_t nHighScore [ TETRIS_HISCORE_END ] ; /**< actual high scores */
}
tetris_highscore_table_t ;
/**
* the actual high score table
*/
extern tetris_highscore_table_t g_highScoreTable EEMEM ;
/**
@ -41,7 +52,7 @@ uint16_t tetris_highscore_inputName(void);
* @ param nIndex the variant dependent index of the high score
* @ return the high score
*/
uint16_t tetris_highscore_retrieveHighs core ( tetris_highscore_index_t nIndex ) ;
uint16_t tetris_highscore_retrieveHighS core ( tetris_highscore_index_t nIndex ) ;
/**
@ -50,12 +61,12 @@ uint16_t tetris_highscore_retrieveHighscore(tetris_highscore_index_t nIndex);
* @ param nHighscoreName the high score
*/
inline static
void tetris_highscore_saveHighs core ( tetris_highscore_index_t nIndex ,
uint16_t nHighs core )
void tetris_highscore_saveHighS core ( tetris_highscore_index_t nIndex ,
uint16_t nHighS core )
{
if ( nHighscore > tetris_highscore_retrieveHighs core ( nIndex ) )
if ( nHighScore > tetris_highscore_retrieveHighS core ( nIndex ) )
{
eeprom_write_word ( & tetris_highs core[ nIndex ] , nHighs core ) ;
eeprom_write_word ( & g_highScoreTable . nHighS core[ nIndex ] , nHighS core ) ;
}
}
@ -66,12 +77,12 @@ void tetris_highscore_saveHighscore(tetris_highscore_index_t nIndex,
* @ return the initials of the champion packed into a uint16_t
*/
inline static
uint16_t tetris_highscore_retrieveHighs coreName ( tetris_highscore_index_t nIdx )
uint16_t tetris_highscore_retrieveHighS coreName ( tetris_highscore_index_t nIdx )
{
uint16_t nHighs coreName =
eeprom_read_word ( & tetris_highscore_n ame[ nIdx ] ) ;
uint16_t nHighS coreName =
eeprom_read_word ( & g_highScoreTable . nHighScoreN ame[ nIdx ] ) ;
return nHighs coreName ;
return nHighS coreName ;
}
@ -81,10 +92,10 @@ uint16_t tetris_highscore_retrieveHighscoreName(tetris_highscore_index_t nIdx)
* @ param nHighscoreName the initials of the champion packed into a uint16_t
*/
inline static
void tetris_highscore_saveHighs coreName ( tetris_highscore_index_t nIndex ,
void tetris_highscore_saveHighS coreName ( tetris_highscore_index_t nIndex ,
uint16_t nHighscoreName )
{
eeprom_write_word ( & tetris_highscore_n ame[ nIndex ] , nHighscoreName ) ;
eeprom_write_word ( & g_highScoreTable . nHighScoreN ame[ nIndex ] , nHighscoreName ) ;
}