commit 874c37b13ab3b9c246123be9ea71638db4a73a0c
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sun Apr 19 23:32:43 2020 +0100

    Allow the server to correct our notion of country.

diff --git a/src/main/java/org/distorted/scores/RubikScores.java b/src/main/java/org/distorted/scores/RubikScores.java
index 6d334222..54ed4661 100644
--- a/src/main/java/org/distorted/scores/RubikScores.java
+++ b/src/main/java/org/distorted/scores/RubikScores.java
@@ -82,7 +82,7 @@ public class RubikScores
     try
       {
       String s = UUID.randomUUID().toString();
-      id = (s!=null ? s.hashCode():0);
+      id = s.hashCode();
       }
     catch(Exception ex)
       {
@@ -333,12 +333,21 @@ public class RubikScores
       }
 
     // Special case: Dominicana. Its ISO-3166-alpha-2 country code is 'do' which we can't have here
-    // because we later on map this to a resource name (the flag) and 'do' is a resevred Java keyword
+    // because we later on map this to a resource name (the flag) and 'do' is a reserved Java keyword
     // and can't be a resource name.
 
     if( mCountry.equals("do") ) mCountry = "dm";
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void setCountry(String country)
+    {
+    mCountry = country;
+
+    if( mCountry.equals("do") ) mCountry = "dm";  // see above
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public long getRecord(int object, int size, int level)
diff --git a/src/main/java/org/distorted/scores/RubikScoresDownloader.java b/src/main/java/org/distorted/scores/RubikScoresDownloader.java
index 2f6fda8f..7fbcb819 100644
--- a/src/main/java/org/distorted/scores/RubikScoresDownloader.java
+++ b/src/main/java/org/distorted/scores/RubikScoresDownloader.java
@@ -204,6 +204,20 @@ public class RubikScoresDownloader implements Runnable
           }
         }
       }
+    else
+      {
+      if( row.startsWith("comm") )
+        {
+        int colon = row.indexOf(':');
+
+        if( colon>0 )
+          {
+          String country = row.substring(colon+1);
+          RubikScores scores = RubikScores.getInstance();
+          scores.setCountry(country);
+          }
+        }
+      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -311,9 +325,10 @@ public class RubikScoresDownloader implements Runnable
     String veri = scores.isVerified() ? name : "";
     int numRuns = scores.getNumRuns();
     int numPlay = scores.getNumPlays();
+    String country = scores.getCountry();
 
     String url="https://distorted.org/magic/cgi-bin/download.cgi";
-    url += "?n="+name+"&v="+veri+"&r="+numRuns+"&p="+numPlay+"&e="+mVersion+"d";
+    url += "?n="+name+"&v="+veri+"&r="+numRuns+"&p="+numPlay+"&c="+country+"&e="+mVersion+"d";
     url += "&o="+RubikObjectList.getObjectList()+"&min=0&max="+MAX_LEVEL+"&l="+MAX_PLACES;
 
     return url;
