From c5afe341fb48d6c5e7404197efbbb31dad5cd7b2 Mon Sep 17 00:00:00 2001 From: teru Date: Sat, 27 Feb 2010 14:45:37 +0000 Subject: [PATCH] use same variable/macro name for highscore among plugins. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24941 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/blackjack.c | 22 ++++++++++++---------- apps/plugins/brickmania.c | 25 +++++++++++-------------- apps/plugins/bubbles.c | 10 ++++++---- apps/plugins/clix.c | 6 +++--- apps/plugins/jewels.c | 23 ++++++++++++----------- apps/plugins/rockblox.c | 25 ++++++++++++------------- apps/plugins/snake2.c | 2 +- apps/plugins/spacerocks.c | 8 ++++---- 8 files changed, 61 insertions(+), 60 deletions(-) diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index 9a9c91cb0..a8f92b9f5 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c @@ -29,7 +29,7 @@ PLUGIN_HEADER /* save files */ -#define HIGH_SCORE PLUGIN_GAMES_DIR "/blackjack.score" +#define SCORE_FILE PLUGIN_GAMES_DIR "/blackjack.score" #define SAVE_FILE PLUGIN_GAMES_DIR "/blackjack.save" #define NUM_SCORES 5 @@ -491,7 +491,7 @@ typedef struct game_context { static bool resume = false; static bool resume_file = false; -static struct highscore highest[NUM_SCORES]; +static struct highscore highscores[NUM_SCORES]; /***************************************************************************** * blackjack_init() initializes blackjack data structures. @@ -1200,7 +1200,7 @@ static unsigned int blackjack_menu(void) { resume = false; break; case 2: - highscore_show(NUM_SCORES, highest, NUM_SCORES, false); + highscore_show(-1, highscores, NUM_SCORES, false); break; case 3: if(blackjack_help()) @@ -1488,7 +1488,7 @@ enum plugin_status plugin_start(const void* parameter) #endif /* load high scores */ - highscore_load(HIGH_SCORE,highest,NUM_SCORES); + highscore_load(SCORE_FILE, highscores, NUM_SCORES); resume = blackjack_loadgame(&bj); resume_file = resume; @@ -1504,16 +1504,18 @@ enum plugin_status plugin_start(const void* parameter) if(!resume && bj.player_money > 10) { /* There is no level, so store -1 to blank column */ int position = highscore_update(bj.player_money, -1, "", - highest, NUM_SCORES); - if (position==0) - rb->splash(HZ*2, "New High Score"); + highscores, NUM_SCORES); if (position != -1) - highscore_show(position, highest, NUM_SCORES, false); + { + if (position==0) + rb->splash(HZ*2, "New High Score"); + highscore_show(position, highscores, NUM_SCORES, false); + } } break; case BJ_USB: - highscore_save(HIGH_SCORE,highest,NUM_SCORES); + highscore_save(SCORE_FILE, highscores, NUM_SCORES); return PLUGIN_USB_CONNECTED; case BJ_QUIT: @@ -1529,6 +1531,6 @@ enum plugin_status plugin_start(const void* parameter) break; } } - highscore_save(HIGH_SCORE,highest,NUM_SCORES); + highscore_save(SCORE_FILE, highscores, NUM_SCORES); return PLUGIN_OK; } diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index f39d9b03c..f932e4563 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c @@ -425,8 +425,8 @@ CONFIG_KEYPAD == SANSA_M200_PAD #define CONFIG_FILE_NAME "brickmania.cfg" #define SAVE_FILE PLUGIN_GAMES_DIR "/brickmania.save" -#define HIGH_SCORE_FILE PLUGIN_GAMES_DIR "/brickmania.score" -#define NUM_HIGH_SCORES 5 +#define SCORE_FILE PLUGIN_GAMES_DIR "/brickmania.score" +#define NUM_SCORES 5 /* @@ -981,7 +981,7 @@ static struct configdata config[] = {TYPE_INT, 0, 1, { .int_p = &difficulty }, "difficulty", NULL}, }; -struct highscore highest[NUM_HIGH_SCORES]; +static struct highscore highscores[NUM_SCORES]; /* @@ -1381,7 +1381,7 @@ static int brickmania_menu(void) return 1; break; case 4: - highscore_show(NUM_HIGH_SCORES, highest, NUM_HIGH_SCORES, true); + highscore_show(-1, highscores, NUM_SCORES, true); break; case 5: if (playback_control(NULL)) @@ -2337,7 +2337,7 @@ enum plugin_status plugin_start(const void* parameter) (void)parameter; int last_difficulty; - highscore_load(HIGH_SCORE_FILE,highest,NUM_HIGH_SCORES); + highscore_load(SCORE_FILE, highscores, NUM_SCORES); configfile_load(CONFIG_FILE_NAME,config,1,0); last_difficulty = difficulty; @@ -2360,16 +2360,13 @@ enum plugin_status plugin_start(const void* parameter) { if(!resume) { - int position = highscore_update(score, level+1, "", highest, - NUM_HIGH_SCORES); - if (position == 0) - { - rb->splash(HZ*2, "New High Score"); - } - + int position = highscore_update(score, level+1, "", + highscores, NUM_SCORES); if (position != -1) { - highscore_show(position, highest, NUM_HIGH_SCORES, true); + if (position == 0) + rb->splash(HZ*2, "New High Score"); + highscore_show(position, highscores, NUM_SCORES, true); } else { @@ -2378,7 +2375,7 @@ enum plugin_status plugin_start(const void* parameter) } } - highscore_save(HIGH_SCORE_FILE,highest,NUM_HIGH_SCORES); + highscore_save(SCORE_FILE, highscores, NUM_SCORES); if(last_difficulty != difficulty) configfile_save(CONFIG_FILE_NAME,config,1,0); /* Restore user's original backlight setting */ diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index 2f7ead8d8..e3b74f8dc 100644 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c @@ -1262,7 +1262,7 @@ struct game_context { struct tile playboard[BB_HEIGHT][BB_WIDTH]; }; -struct highscore highscores[NUM_SCORES]; +static struct highscore highscores[NUM_SCORES]; /* used to denote available resume info */ static bool resume = false; @@ -2172,10 +2172,12 @@ static void bubbles_recordscore(struct game_context* bb) { position = highscore_update(bb->score, bb->level-1, "", highscores, NUM_SCORES); - if (position==0) - rb->splash(HZ*2, "New High Score"); if (position != -1) + { + if (position == 0) + rb->splash(HZ*2, "New High Score"); highscore_show(position, highscores, NUM_SCORES, true); + } } /***************************************************************************** @@ -2409,7 +2411,7 @@ static int bubbles_menu(struct game_context* bb) { startlevel--; break; case 3: /* High scores */ - highscore_show(NUM_SCORES, highscores, NUM_SCORES, true); + highscore_show(-1, highscores, NUM_SCORES, true); break; case 4: /* Playback Control */ playback_control(NULL); diff --git a/apps/plugins/clix.c b/apps/plugins/clix.c index 87a5b3e5c..073565683 100644 --- a/apps/plugins/clix.c +++ b/apps/plugins/clix.c @@ -184,7 +184,7 @@ PLUGIN_HEADER #define CLIX_BUTTON_CLICK BUTTON_CENTER #endif -#define HIGHSCORE_FILE PLUGIN_GAMES_DIR "/clix.score" +#define SCORE_FILE PLUGIN_GAMES_DIR "/clix.score" #define NUM_SCORES 5 struct highscore highscores[NUM_SCORES]; @@ -875,12 +875,12 @@ enum plugin_status plugin_start(const void* parameter) rb->touchscreen_set_mode(TOUCHSCREEN_POINT); #endif - highscore_load(HIGHSCORE_FILE, highscores, NUM_SCORES); + highscore_load(SCORE_FILE, highscores, NUM_SCORES); struct clix_game_state_t state; clix_handle_game( &state); - highscore_save(HIGHSCORE_FILE, highscores, NUM_SCORES); + highscore_save(SCORE_FILE, highscores, NUM_SCORES); return PLUGIN_OK; } diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index 8a0ba94a4..74e8d6ec1 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c @@ -435,10 +435,9 @@ struct puzzle_level puzzle_levels[NUM_PUZZLE_LEVELS] = { {4, 7, PUZZLE_TILE_LEFT|PUZZLE_TILE_UP} } }, }; -#define SAVE_FILE PLUGIN_GAMES_DIR "/jewels.save" - -#define HIGH_SCORE PLUGIN_GAMES_DIR "/jewels.score" -struct highscore highest[NUM_SCORES]; +#define SAVE_FILE PLUGIN_GAMES_DIR "/jewels.save" +#define SCORE_FILE PLUGIN_GAMES_DIR "/jewels.score" +struct highscore highscores[NUM_SCORES]; static bool resume_file = false; @@ -1384,7 +1383,7 @@ static int jewels_game_menu(struct game_context* bj, bool ingame) return 1; break; case 4: - highscore_show(NUM_SCORES, highest, NUM_SCORES, true); + highscore_show(-1, highscores, NUM_SCORES, true); break; case 5: playback_control(NULL); @@ -1552,11 +1551,13 @@ static int jewels_main(struct game_context* bj) { rb->lcd_clear_display(); bj->score += (bj->level-1)*LEVEL_PTS; position=highscore_update(bj->score, bj->level, "", - highest, NUM_SCORES); - if (position == 0) - rb->splash(HZ*2, "New High Score"); + highscores, NUM_SCORES); if (position != -1) - highscore_show(position, highest, NUM_SCORES, true); + { + if (position == 0) + rb->splash(HZ*2, "New High Score"); + highscore_show(position, highscores, NUM_SCORES, true); + } break; case GAME_TYPE_PUZZLE: rb->splash(2*HZ, "Game Over"); @@ -1575,7 +1576,7 @@ enum plugin_status plugin_start(const void* parameter) (void)parameter; /* load high scores */ - highscore_load(HIGH_SCORE,highest,NUM_SCORES); + highscore_load(SCORE_FILE, highscores, NUM_SCORES); rb->lcd_setfont(FONT_SYSFIXED); #if LCD_DEPTH > 1 @@ -1585,7 +1586,7 @@ enum plugin_status plugin_start(const void* parameter) struct game_context bj; bj.tmp_type = GAME_TYPE_NORMAL; jewels_main(&bj); - highscore_save(HIGH_SCORE,highest,NUM_SCORES); + highscore_save(SCORE_FILE, highscores, NUM_SCORES); rb->lcd_setfont(FONT_UI); return PLUGIN_OK; diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index e99fcc16e..871a30888 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c @@ -773,12 +773,12 @@ bool resume = false; bool resume_file = false; /* Rockbox File System only supports full filenames inc dir */ -#define HIGH_SCORE PLUGIN_GAMES_DIR "/rockblox.score" +#define SCORE_FILE PLUGIN_GAMES_DIR "/rockblox.score" #define RESUME_FILE PLUGIN_GAMES_DIR "/rockblox.resume" -#define MAX_HIGH_SCORES 5 +#define NUM_SCORES 5 /* Default High Scores... */ -struct highscore highest[MAX_HIGH_SCORES]; +struct highscore highscores[NUM_SCORES]; /* get random number from (0) to (range-1) */ static int t_rand (int range) @@ -831,10 +831,10 @@ static void show_highscores (void) int i; char str[25]; /* for strings */ - for (i = 0; isnprintf (str, sizeof (str), "%06d" _SPACE "L%1d", - highest[i].score, highest[i].level); + highscores[i].score, highscores[i].level); rb->lcd_putsxy (HIGH_LABEL_X, HIGH_SCORE_Y + (10 * i), str); } } @@ -1288,7 +1288,7 @@ static int rockblox_menu(void) return 1; break; case 3: - highscore_show(MAX_HIGH_SCORES, highest, MAX_HIGH_SCORES, true); + highscore_show(-1, highscores, NUM_SCORES, true); break; case 4: if (playback_control(NULL)) @@ -1494,7 +1494,7 @@ enum plugin_status plugin_start (const void *parameter) rb->srand (*rb->current_tick); /* Load HighScore if any */ - highscore_load(HIGH_SCORE, highest, MAX_HIGH_SCORES); + highscore_load(SCORE_FILE, highscores, NUM_SCORES); #if LCD_DEPTH > 1 rb->lcd_set_backdrop(NULL); @@ -1517,12 +1517,11 @@ enum plugin_status plugin_start (const void *parameter) if(!resume) { int position = highscore_update(rockblox_status.score, rockblox_status.level, "", - highest, MAX_HIGH_SCORES); - if (position == 0) { - rb->splash(HZ*2, "New High Score"); - } + highscores, NUM_SCORES); if (position != -1) { - highscore_show(position, highest, MAX_HIGH_SCORES, true); + if (position == 0) + rb->splash(HZ*2, "New High Score"); + highscore_show(position, highscores, NUM_SCORES, true); } } } @@ -1531,7 +1530,7 @@ enum plugin_status plugin_start (const void *parameter) pgfx_release(); #endif /* Save user's HighScore */ - highscore_save(HIGH_SCORE, highest, MAX_HIGH_SCORES); + highscore_save(SCORE_FILE, highscores, NUM_SCORES); backlight_use_settings(); /* backlight control in lib/helper.c */ return PLUGIN_OK; diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index e0393ba8a..136952599 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c @@ -1461,7 +1461,7 @@ void game_init(void) NULL, 1, 1, 10, NULL); break; case 4: - highscore_show(NUM_SCORES, highscores, NUM_SCORES, true); + highscore_show(-1, highscores, NUM_SCORES, true); break; case 5: playback_control(NULL); diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c index 055bd7822..586beb37a 100644 --- a/apps/plugins/spacerocks.c +++ b/apps/plugins/spacerocks.c @@ -371,7 +371,7 @@ PLUGIN_HEADER #define SET_BG(x) #endif -#define HIGH_SCORE PLUGIN_GAMES_DIR "/spacerocks.score" +#define SCORE_FILE PLUGIN_GAMES_DIR "/spacerocks.score" #define NUM_SCORES 5 static struct highscore highscores[NUM_SCORES]; @@ -1799,7 +1799,7 @@ static int spacerocks_menu(void) return PLUGIN_USB_CONNECTED; break; case 3: - highscore_show(NUM_SCORES, highscores, NUM_SCORES, true); + highscore_show(-1, highscores, NUM_SCORES, true); break; case 4: playback_control(NULL); @@ -1985,7 +1985,7 @@ enum plugin_status plugin_start(const void* parameter) rb->lcd_setfont(FONT_SYSFIXED); /* Turn off backlight timeout */ backlight_force_on(); /* backlight control in lib/helper.c */ - highscore_load(HIGH_SCORE, highscores, NUM_SCORES); + highscore_load(SCORE_FILE, highscores, NUM_SCORES); rb->srand(*rb->current_tick); /* create stars once, and once only: */ @@ -1995,7 +1995,7 @@ enum plugin_status plugin_start(const void* parameter) ret = spacerocks_game_loop(); rb->lcd_setfont(FONT_UI); - highscore_save(HIGH_SCORE, highscores, NUM_SCORES); + highscore_save(SCORE_FILE, highscores, NUM_SCORES); /* Turn on backlight timeout (revert to settings) */ backlight_use_settings(); /* backlight control in lib/helper.c */ -- 2.11.4.GIT