From: Holger Schemel Date: Mon, 30 Jan 2017 08:01:34 +0000 (+0100) Subject: removed preprocessor definition for single or multiple high score entries X-Git-Tag: 4.0.0.2~14 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b85bbf90337a581a6de74005dca2385914ab7003;p=rocksndiamonds.git removed preprocessor definition for single or multiple high score entries --- diff --git a/Makefile b/Makefile index 3e113fd3..5d94cb1a 100644 --- a/Makefile +++ b/Makefile @@ -38,13 +38,6 @@ MAKE = make # uncomment if system has no joystick include file # JOYSTICK = -DNO_JOYSTICK -# choose if more than one global score file entry for one player is allowed -# (default: MANY_PER_NAME) -# uncomment to install game in multi-user environment -# SCORE_ENTRIES = ONE_PER_NAME -# uncomment to install game in single-user environment (default) -# SCORE_ENTRIES = MANY_PER_NAME - # path for cross-compiling (only needed for non-native Windows build) CROSS_PATH_WIN32 = /usr/local/cross-tools/i386-mingw32msvc diff --git a/src/Makefile b/src/Makefile index bb33ce8c..bacc168d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -97,15 +97,10 @@ ifdef RW_GAME_DIR # path to writable game data specified CONFIG_RW_GAME_DIR = -DRW_GAME_DIR="\"$(RW_GAME_DIR)\"" endif -ifdef SCORE_ENTRIES # number of score entries per player -CONFIG_SCORE_ENTRIES = -D$(SCORE_ENTRIES) -endif - -CONFIG_GAME_DIR = $(CONFIG_RO_GAME_DIR) $(CONFIG_RW_GAME_DIR) -CONFIG_GAME = $(CONFIG_GAME_DIR) $(CONFIG_SCORE_ENTRIES) +CONFIG = $(CONFIG_RO_GAME_DIR) $(CONFIG_RW_GAME_DIR) $(JOYSTICK) -CONFIG = $(CONFIG_GAME) $(JOYSTICK) DEBUG = -DDEBUG -g + # PROFILING = $(PROFILING_FLAGS) # OPTIONS = $(DEBUG) -Wall # only for debugging purposes diff --git a/src/game.c b/src/game.c index 1a204ba8..b543e6d2 100644 --- a/src/game.c +++ b/src/game.c @@ -4494,6 +4494,7 @@ int NewHiScore() { int k, l; int position = -1; + boolean one_score_entry_per_name = !program.many_scores_per_name; LoadScore(level_nr); @@ -4511,13 +4512,15 @@ int NewHiScore() { int m = MAX_SCORE_ENTRIES - 1; -#ifdef ONE_PER_NAME - for (l = k; l < MAX_SCORE_ENTRIES; l++) - if (strEqual(setup.player_name, highscore[l].Name)) - m = l; - if (m == k) /* player's new highscore overwrites his old one */ - goto put_into_list; -#endif + if (one_score_entry_per_name) + { + for (l = k; l < MAX_SCORE_ENTRIES; l++) + if (strEqual(setup.player_name, highscore[l].Name)) + m = l; + + if (m == k) /* player's new highscore overwrites his old one */ + goto put_into_list; + } for (l = m; l > k; l--) { @@ -4526,22 +4529,19 @@ int NewHiScore() } } -#ifdef ONE_PER_NAME put_into_list: -#endif + strncpy(highscore[k].Name, setup.player_name, MAX_PLAYER_NAME_LEN); highscore[k].Name[MAX_PLAYER_NAME_LEN] = '\0'; highscore[k].Score = local_player->score_final; position = k; + break; } - -#ifdef ONE_PER_NAME - else if (!strncmp(setup.player_name, highscore[k].Name, + else if (one_score_entry_per_name && + !strncmp(setup.player_name, highscore[k].Name, MAX_PLAYER_NAME_LEN)) break; /* player already there with a higher score */ -#endif - } if (position >= 0)