added detection of global (common/system-wide) scores directory
authorHolger Schemel <info@artsoft.org>
Tue, 10 Jan 2017 07:11:20 +0000 (08:11 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 10 Jan 2017 07:11:20 +0000 (08:11 +0100)
src/init.c
src/libgame/system.c
src/libgame/system.h

index 5e996f3..29f4fd4 100644 (file)
@@ -5891,6 +5891,8 @@ void OpenAll()
 
   print_timestamp_time("[init setup/config stuff (1)]");
 
+  InitScoresInfo();
+
   if (options.execute_command)
     Execute_Command(options.execute_command);
 
index 3b206b2..00e9c72 100644 (file)
@@ -98,6 +98,16 @@ void InitProgramInfo(char *argv0, char *config_filename, char *userdata_subdir,
   program.log_file[LOG_ERR_ID] = program.log_file_default[LOG_ERR_ID] = stderr;
 }
 
+void InitScoresInfo()
+{
+  char *global_scores_dir = getPath2(getCommonDataDir(), SCORES_DIRECTORY);
+
+  program.global_scores = directoryExists(global_scores_dir);
+  program.many_scores_per_name = !program.global_scores;
+
+  free(global_scores_dir);
+}
+
 void SetWindowTitle()
 {
   program.window_title = program.window_title_function();
index 130db06..fb209d3 100644 (file)
@@ -760,6 +760,9 @@ struct ProgramInfo
   char *(*window_title_function)(void);
   void (*exit_message_function)(char *, va_list);
   void (*exit_function)(int);
+
+  boolean global_scores;
+  boolean many_scores_per_name;
 };
 
 struct OptionInfo
@@ -1415,6 +1418,7 @@ extern int                        FrameCounter;
 void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
                     int);
 
+void InitScoresInfo();
 void SetWindowTitle();
 
 void InitWindowTitleFunction(char *(*window_title_function)(void));