removed preprocessor definition for single or multiple high score entries
authorHolger Schemel <info@artsoft.org>
Mon, 30 Jan 2017 08:01:34 +0000 (09:01 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 30 Jan 2017 08:01:34 +0000 (09:01 +0100)
Makefile
src/Makefile
src/game.c

index 3e113fd3012de16f7876a34450298f1d8d347dbc..5d94cb1aee478da11ffa7d5732b51bca8b974a41 100644 (file)
--- 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
 
index bb33ce8ca879edb73d58b27d31d43afc3e01c589..bacc168d1e95b9b1f6b1a864646e17eb7c9c4b96 100644 (file)
@@ -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
index 1a204ba844a32892dfbe820aef484ab388aef870..b543e6d2e14132d345e14aca528e069efdc98e54 100644 (file)
@@ -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)