added command line option for anonymous player name for score uploads
[rocksndiamonds.git] / src / libgame / misc.c
index bd93e1ce170af1cc4f74a2a2a37b5869f11e50f6..e7c2e098f513cfebe52a6a97a01e45de043900f2 100644 (file)
@@ -557,7 +557,7 @@ boolean getTokenValueFromString(char *string, char **token, char **value)
 #define UUID_CHARS             (UUID_BYTES * 2)
 #define UUID_LENGTH            (UUID_CHARS + 4)
 
-static char *getUUID(void)
+char *getUUID(void)
 {
   static char uuid[UUID_LENGTH + 1];
   int data[UUID_BYTES];
@@ -582,27 +582,6 @@ static char *getUUID(void)
   return uuid;
 }
 
-char *GetPlayerUUID(void)
-{
-  return getUUID();
-}
-
-char *GetSystemUUID(void)
-{
-  if (program.system_uuid != NULL)
-    return program.system_uuid;
-
-  return getUUID();
-}
-
-void SetSystemUUID(char *uuid)
-{
-  if (program.system_uuid != NULL)
-    checked_free(program.system_uuid);
-
-  program.system_uuid = getStringCopy(uuid);
-}
-
 
 // ----------------------------------------------------------------------------
 // counter functions
@@ -1320,6 +1299,7 @@ void GetOptions(int argc, char *argv[],
   options.tape_log_filename = NULL;
   options.special_flags = NULL;
   options.debug_mode = NULL;
+  options.player_name = NULL;
 
   options.mytapes = FALSE;
   options.serveronly = FALSE;
@@ -1457,6 +1437,15 @@ void GetOptions(int argc, char *argv[],
       if (option_arg != next_option)
        options.debug_mode = getStringCopy(option_arg);
     }
+    else if (strncmp(option, "-player-name", option_len) == 0)
+    {
+      if (option_arg == NULL)
+       FailWithHelp("option '%s' requires an argument", option_str);
+
+      options.player_name = getStringCopy(option_arg);
+      if (option_arg == next_option)
+       options_left++;
+    }
     else if (strncmp(option, "-verbose", option_len) == 0)
     {
       options.verbose = TRUE;