Revision 874c37b1
Added by Leszek Koltunski over 5 years ago
| src/main/java/org/distorted/scores/RubikScores.java | ||
|---|---|---|
| 82 | 82 |
try |
| 83 | 83 |
{
|
| 84 | 84 |
String s = UUID.randomUUID().toString(); |
| 85 |
id = (s!=null ? s.hashCode():0);
|
|
| 85 |
id = s.hashCode();
|
|
| 86 | 86 |
} |
| 87 | 87 |
catch(Exception ex) |
| 88 | 88 |
{
|
| ... | ... | |
| 333 | 333 |
} |
| 334 | 334 |
|
| 335 | 335 |
// Special case: Dominicana. Its ISO-3166-alpha-2 country code is 'do' which we can't have here |
| 336 |
// because we later on map this to a resource name (the flag) and 'do' is a resevred Java keyword
|
|
| 336 |
// because we later on map this to a resource name (the flag) and 'do' is a reserved Java keyword
|
|
| 337 | 337 |
// and can't be a resource name. |
| 338 | 338 |
|
| 339 | 339 |
if( mCountry.equals("do") ) mCountry = "dm";
|
| 340 | 340 |
} |
| 341 | 341 |
|
| 342 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 343 |
|
|
| 344 |
public void setCountry(String country) |
|
| 345 |
{
|
|
| 346 |
mCountry = country; |
|
| 347 |
|
|
| 348 |
if( mCountry.equals("do") ) mCountry = "dm"; // see above
|
|
| 349 |
} |
|
| 350 |
|
|
| 342 | 351 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 343 | 352 |
|
| 344 | 353 |
public long getRecord(int object, int size, int level) |
| src/main/java/org/distorted/scores/RubikScoresDownloader.java | ||
|---|---|---|
| 204 | 204 |
} |
| 205 | 205 |
} |
| 206 | 206 |
} |
| 207 |
else |
|
| 208 |
{
|
|
| 209 |
if( row.startsWith("comm") )
|
|
| 210 |
{
|
|
| 211 |
int colon = row.indexOf(':');
|
|
| 212 |
|
|
| 213 |
if( colon>0 ) |
|
| 214 |
{
|
|
| 215 |
String country = row.substring(colon+1); |
|
| 216 |
RubikScores scores = RubikScores.getInstance(); |
|
| 217 |
scores.setCountry(country); |
|
| 218 |
} |
|
| 219 |
} |
|
| 220 |
} |
|
| 207 | 221 |
} |
| 208 | 222 |
|
| 209 | 223 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 311 | 325 |
String veri = scores.isVerified() ? name : ""; |
| 312 | 326 |
int numRuns = scores.getNumRuns(); |
| 313 | 327 |
int numPlay = scores.getNumPlays(); |
| 328 |
String country = scores.getCountry(); |
|
| 314 | 329 |
|
| 315 | 330 |
String url="https://distorted.org/magic/cgi-bin/download.cgi"; |
| 316 |
url += "?n="+name+"&v="+veri+"&r="+numRuns+"&p="+numPlay+"&e="+mVersion+"d"; |
|
| 331 |
url += "?n="+name+"&v="+veri+"&r="+numRuns+"&p="+numPlay+"&c="+country+"&e="+mVersion+"d";
|
|
| 317 | 332 |
url += "&o="+RubikObjectList.getObjectList()+"&min=0&max="+MAX_LEVEL+"&l="+MAX_PLACES; |
| 318 | 333 |
|
| 319 | 334 |
return url; |
Also available in: Unified diff
Allow the server to correct our notion of country.