added using hostname for high score server from setup file
[rocksndiamonds.git] / src / files.c
index 38b19f83c58c1429a246a833fef20bcdac685407..dafea37167ee94680f5c6179c898cbab6d92f593 100644 (file)
@@ -8929,7 +8929,7 @@ static void DownloadServerScoreToCacheExt(struct HttpRequest *request,
                                          struct HttpResponse *response,
                                          int nr)
 {
-  request->hostname = API_SERVER_HOSTNAME;
+  request->hostname = setup.api_server_hostname;
   request->port     = API_SERVER_PORT;
   request->method   = API_SERVER_METHOD;
   request->uri      = API_SERVER_URI_GET;
@@ -9094,7 +9094,7 @@ void LoadServerScore(int nr, boolean download_score)
   // (this should prevent reading it while the thread is writing to it)
   LoadServerScoreFromCache(nr);
 
-  if (download_score)
+  if (download_score && runtime.api_server)
   {
     // 2nd step: download server scores from score server to cache file
     // (as thread, as it might time out if the server is not reachable)
@@ -9162,7 +9162,7 @@ static void UploadScoreToServerExt(struct HttpRequest *request,
 {
   struct ScoreEntry *score_entry = &scores.entry[scores.last_added];
 
-  request->hostname = API_SERVER_HOSTNAME;
+  request->hostname = setup.api_server_hostname;
   request->port     = API_SERVER_PORT;
   request->method   = API_SERVER_METHOD;
   request->uri      = API_SERVER_URI_ADD;
@@ -9253,7 +9253,7 @@ static void UploadScoreToServerAsThread(int nr)
 
 void SaveServerScore(int nr)
 {
-  if (!setup.api_server)
+  if (!runtime.api_server)
     return;
 
   UploadScoreToServerAsThread(nr);