void LoadServerScore(int nr, boolean download_score)
{
+ if (!setup.api_server)
+ return;
+
// always start with reliable default values
setServerScoreInfoToDefaults();
void SaveServerScore(int nr)
{
+ if (!setup.api_server)
+ return;
+
UploadScoreToServerAsThread(nr);
}
// restore last added local score entry (before merging server scores)
scores.last_added = scores.last_added_local = last_added_local;
- LoadServerScore(nr, download_score);
+ if (setup.api_server)
+ {
+ // load server scores from cache file and trigger update from server
+ LoadServerScore(nr, download_score);
- MergeServerScore();
+ // merge local scores with scores from server
+ MergeServerScore();
+ }
}
TYPE_STRING,
&setup.network_server_hostname, "network_server_hostname"
},
+ {
+ TYPE_SWITCH,
+ &setup.api_server, "api_server"
+ },
+ {
+ TYPE_STRING,
+ &setup.api_server_hostname, "api_server_hostname"
+ },
{
TYPE_STRING,
&setup.touch.control_type, "touch.control_type"
si->network_player_nr = 0; // first player
si->network_server_hostname = getStringCopy(STR_NETWORK_AUTO_DETECT);
+ si->api_server = TRUE;
+ si->api_server_hostname = getStringCopy(API_SERVER_HOSTNAME);
+
si->touch.control_type = getStringCopy(TOUCH_CONTROL_DEFAULT);
si->touch.move_distance = TOUCH_MOVE_DISTANCE_DEFAULT; // percent
si->touch.drop_distance = TOUCH_DROP_DISTANCE_DEFAULT; // percent
global_setup_tokens[i].value == &setup.graphics_set ||
global_setup_tokens[i].value == &setup.volume_simple ||
global_setup_tokens[i].value == &setup.network_mode ||
+ global_setup_tokens[i].value == &setup.api_server ||
global_setup_tokens[i].value == &setup.touch.control_type ||
global_setup_tokens[i].value == &setup.touch.grid_xsize[0] ||
global_setup_tokens[i].value == &setup.touch.grid_xsize[1])
{ TYPE_PLAYER, &setup.network_player_nr,"Preferred Network Player:" },
{ TYPE_TEXT_INPUT, execGadgetNetworkServer, "Network Server Hostname:" },
{ TYPE_STRING, &network_server_text, "" },
+ { TYPE_SWITCH, &setup.api_server, "Use Highscore Server:" },
{ TYPE_SWITCH, &setup.multiple_users, "Multiple Users/Teams:" },
{ TYPE_YES_NO, &setup.input_on_focus, "Only Move Focussed Player:" },
{ TYPE_SWITCH, &setup.time_limit, "Time Limit:" },