OSDN Git Service

[Refactor] ネット機能のオプトアウトをスコア送信機能から切り離す
authorHabu <habu1010+github@gmail.com>
Tue, 4 Jul 2023 12:30:24 +0000 (21:30 +0900)
committerHabu <habu1010+github@gmail.com>
Fri, 7 Jul 2023 12:16:22 +0000 (21:16 +0900)
これまでスコア送信機能(WORLD_SCOREマクロの定義)によりネット機能もオプト
イン/アウトを切り替えていたが、スコア送信機能を切っていてもネット機能を
使えるようにするため、WORLD_SCOREマクロの定義とは切り離し、DISABLE_NET
マクロを新設しこれが定義されていればオプトアウトするように変更する。

configure.ac
src/net/curl-easy-session.cpp
src/net/curl-easy-session.h
src/net/curl-slist.cpp
src/net/curl-slist.h
src/net/http-client.cpp
src/net/http-client.h

index 131453c..3bd7df7 100644 (file)
@@ -57,6 +57,8 @@ AC_ARG_ENABLE(fontset,
 [  --disable-fontset       disable fontset support], use_fontset=no, use_fontset=yes)
 AC_ARG_ENABLE([xft],
        AS_HELP_STRING([--enable-xft], [Enable xft support]))
+AC_ARG_ENABLE(net,
+[  --disable-net           disable networking support], use_net=no)
 AC_ARG_ENABLE(worldscore,
 [  --disable-worldscore    disable worldscore support], worldscore=no)
 AC_ARG_ENABLE([pch],
@@ -79,12 +81,18 @@ fi
 
 AC_CHECK_LIB(iconv, iconv_open)
 
+if test "$use_net" = no; then
+  AC_DEFINE(DISABLE_NET, 1, [Disable networking support])
+  worldscore=no;
+else
+  PKG_CHECK_MODULES(libcurl, [libcurl])
+fi
+
 dnl The world score server is currently only available in Japanese.
 if test "$use_japanese" = no; then
   worldscore=no
 fi
 if test "$worldscore" != no; then
-  PKG_CHECK_MODULES(libcurl, [libcurl])
   AC_DEFINE(WORLD_SCORE, 1, [Allow the game to send scores to the score server])
 fi
 
index 20e687b..87fa034 100644 (file)
@@ -1,6 +1,6 @@
 #include "net/curl-easy-session.h"
 
-#if defined(WORLD_SCORE)
+#if !defined(DISABLE_NET)
 
 namespace libcurl {
 
index 1ec0bac..5f1f9ac 100644 (file)
@@ -5,7 +5,7 @@
 #include <memory>
 #include <string>
 
-#if defined(WORLD_SCORE)
+#if !defined(DISABLE_NET)
 
 #ifdef WINDOWS
 #define CURL_STATICLIB
index 97148b7..433a8f6 100644 (file)
@@ -1,6 +1,6 @@
 #include "net/curl-slist.h"
 
-#if defined(WORLD_SCORE)
+#if !defined(DISABLE_NET)
 
 namespace libcurl {
 
index 6ad8ac1..b3c2ee0 100644 (file)
@@ -4,7 +4,7 @@
 #include <memory>
 #include <string>
 
-#if defined(WORLD_SCORE)
+#if !defined(DISABLE_NET)
 
 #ifdef WINDOWS
 #define CURL_STATICLIB
index f614423..0870d35 100644 (file)
@@ -4,7 +4,7 @@
 #include <fstream>
 #include <string_view>
 
-#if defined(WORLD_SCORE)
+#if !defined(DISABLE_NET)
 
 namespace http {
 
index f26a367..5703a30 100644 (file)
@@ -6,7 +6,7 @@
 #include <optional>
 #include <string>
 
-#if defined(WORLD_SCORE)
+#if !defined(DISABLE_NET)
 
 namespace http {