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 5e996f33dd1941375631202562a344154e07b000..29f4fd4b130744436de7c7fe4951de2c44035a79 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 3b206b265e3ec2f468b859a3f2a2b06ae40fb21b..00e9c7295edde77c0f1f3fd117c39a29bb69c72a 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 130db06da03f4eb9aa92e96388c2a72d4651406a..fb209d30c3b9b919a92cb814c871ccc884a4395d 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));