projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
03a51cf
)
added runtime flag to store if high score server is available
author
Holger Schemel
<info@artsoft.org>
Mon, 3 May 2021 10:50:11 +0000
(12:50 +0200)
committer
Holger Schemel
<info@artsoft.org>
Mon, 3 May 2021 10:50:11 +0000
(12:50 +0200)
src/files.c
patch
|
blob
|
history
src/libgame/http.c
patch
|
blob
|
history
src/libgame/system.c
patch
|
blob
|
history
src/libgame/system.h
patch
|
blob
|
history
src/screens.c
patch
|
blob
|
history
diff --git
a/src/files.c
b/src/files.c
index 38b19f83c58c1429a246a833fef20bcdac685407..d5118422d940e2021debdd88ac70a7793830aaf3 100644
(file)
--- a/
src/files.c
+++ b/
src/files.c
@@
-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);
// (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)
{
// 2nd step: download server scores from score server to cache file
// (as thread, as it might time out if the server is not reachable)
@@
-9253,7
+9253,7
@@
static void UploadScoreToServerAsThread(int nr)
void SaveServerScore(int nr)
{
void SaveServerScore(int nr)
{
- if (!
setup
.api_server)
+ if (!
runtime
.api_server)
return;
UploadScoreToServerAsThread(nr);
return;
UploadScoreToServerAsThread(nr);
diff --git
a/src/libgame/http.c
b/src/libgame/http.c
index 30f4c03a572aa7be5e4d043b31df6c4b4f592690..592aeb17c0a4220a7688527a0a01293ae92e93b5 100644
(file)
--- a/
src/libgame/http.c
+++ b/
src/libgame/http.c
@@
-290,5
+290,7
@@
boolean DoHttpRequest(struct HttpRequest *request,
checked_free(send_buffer);
checked_free(recv_buffer);
checked_free(send_buffer);
checked_free(recv_buffer);
+ runtime.api_server = success;
+
return success;
}
return success;
}
diff --git
a/src/libgame/system.c
b/src/libgame/system.c
index 3d23f5fad085a43384e3f091935e9f89d89ef266..edae9c60944407647aa230587271253dba7938fd 100644
(file)
--- a/
src/libgame/system.c
+++ b/
src/libgame/system.c
@@
-127,6
+127,8
@@
void InitRuntimeInfo()
#else
runtime.uses_touch_device = FALSE;
#endif
#else
runtime.uses_touch_device = FALSE;
#endif
+
+ runtime.api_server = setup.api_server;
}
void InitScoresInfo(void)
}
void InitScoresInfo(void)
diff --git
a/src/libgame/system.h
b/src/libgame/system.h
index 4d738a10f98fc69ddb2c844233954b7d7b54ffb3..94ebe7a561a628136ae85ec34da76a028763ef55 100644
(file)
--- a/
src/libgame/system.h
+++ b/
src/libgame/system.h
@@
-1039,6
+1039,8
@@
struct NetworkInfo
struct RuntimeInfo
{
boolean uses_touch_device;
struct RuntimeInfo
{
boolean uses_touch_device;
+
+ boolean api_server;
};
struct OptionInfo
};
struct OptionInfo
diff --git
a/src/screens.c
b/src/screens.c
index cb3ada371284778f4cf0b087a0594e41bf81128b..2f3ff410f4818b63a661bcb5ec257fd349b7586d 100644
(file)
--- a/
src/screens.c
+++ b/
src/screens.c
@@
-7358,6
+7358,10
@@
static void changeSetupValue(int screen_pos, int setup_info_pos_raw, int dx)
if (si->value == &setup.network_mode)
ToggleNetworkModeIfNeeded();
if (si->value == &setup.network_mode)
ToggleNetworkModeIfNeeded();
+ // API server mode may have changed at this point
+ if (si->value == &setup.api_server)
+ runtime.api_server = setup.api_server;
+
// game speed list may have changed at this point
if (si->value == &setup.game_speed_extended)
ToggleGameSpeedsListIfNeeded();
// game speed list may have changed at this point
if (si->value == &setup.game_speed_extended)
ToggleGameSpeedsListIfNeeded();