tSupport NETWORKING option with cmake. - vaccinewars - be a doctor and try to v… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit ad47d9c630d8d3b0261beb097a282c97aaa4ca16 | |
parent 5ca34b73b01bf6ab190feafbb474d4d31258c66d | |
Author: Ben Webb <[email protected]> | |
Date: Sat, 28 Mar 2015 23:48:38 -0700 | |
Support NETWORKING option with cmake. | |
Diffstat: | |
M CMakeLists.txt | 2 ++ | |
M config-cmake.h.in | 2 +- | |
M src/AIPlayer.c | 2 +- | |
M src/curses_client/curses_client.c | 10 +++++----- | |
M src/dopewars.c | 6 +++--- | |
M src/message.c | 10 +++++----- | |
M src/serverside.c | 6 +++--- | |
7 files changed, 20 insertions(+), 18 deletions(-) | |
--- | |
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
t@@ -26,6 +26,8 @@ check_include_files(stdlib.h HAVE_STDLIB_H) | |
option(GUI_CLIENT "include graphical client (GTK+/Win32)" ON) | |
option(CURSES_CLIENT "include curses client" ON) | |
option(GUI_SERVER "use a simple GTK+/Win32 GUI for the server" "probe") | |
+option(NETWORKING | |
+ "should dopewars use TCP/IP networking to connect to servers?" ON) | |
option(WITH_ESD "support ESD sound output" ON) | |
option(WITH_SDL "support SDL sound output" ON) | |
diff --git a/config-cmake.h.in b/config-cmake.h.in | |
t@@ -140,7 +140,7 @@ | |
#undef LT_OBJDIR | |
/* Define if dopewars should use TCP/IP networking to connect to servers */ | |
-#undef NETWORKING | |
+#cmakedefine NETWORKING | |
/* Name of package */ | |
#define PACKAGE "@PROJECT_NAME@" | |
diff --git a/src/AIPlayer.c b/src/AIPlayer.c | |
t@@ -37,7 +37,7 @@ | |
#include "util.h" | |
#include "AIPlayer.h" | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
static int HandleAIMessage(char *Message, Player *AIPlay); | |
static void PrintAIMessage(char *Text); | |
static void AIDealDrugs(Player *AIPlay); | |
diff --git a/src/curses_client/curses_client.c b/src/curses_client/curses_clien… | |
t@@ -2307,7 +2307,7 @@ static void Curses_DoGame(Player *Play) | |
int i, c; | |
char IsCarrying; | |
-#if NETWORKING || HAVE_SELECT | |
+#if defined(NETWORKING) || defined(HAVE_SELECT) | |
fd_set readfs; | |
#endif | |
#ifdef NETWORKING | |
t@@ -2350,7 +2350,7 @@ static void Curses_DoGame(Player *Play) | |
get_ui_area_top() + 1, 1, FALSE, OldName, '\0'); | |
} while (buf[0] == 0); | |
} | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
if (WantNetwork) { | |
if (!ConnectToServer(Play)) { | |
end_curses(); | |
t@@ -2454,7 +2454,7 @@ static void Curses_DoGame(Player *Play) | |
if (QuitRequest) | |
return; | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
FD_ZERO(&readfs); | |
FD_ZERO(&writefs); | |
FD_SET(0, &readfs); | |
t@@ -2529,7 +2529,7 @@ static void Curses_DoGame(Player *Play) | |
} else | |
c = 0; | |
-#if ! (NETWORKING || HAVE_SELECT) | |
+#if ! (defined(NETWORKING) || defined(HAVE_SELECT)) | |
CheckForResize(Play); | |
#endif | |
if (DisplayMode == DM_STREET) { | |
t@@ -2657,7 +2657,7 @@ static void Curses_DoGame(Player *Play) | |
break; | |
} | |
} | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
} | |
#endif | |
curs_set(0); | |
diff --git a/src/dopewars.c b/src/dopewars.c | |
t@@ -895,7 +895,7 @@ GSList *AddPlayer(int fd, Player *NewPlayer, GSList *First) | |
NewPlayer->Health = 100; | |
NewPlayer->CoatSize = 100; | |
NewPlayer->Flags = 0; | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
InitNetworkBuffer(&NewPlayer->NetBuf, '\n', '\r', | |
UseSocks ? &Socks : NULL); | |
if (Server) | |
t@@ -938,7 +938,7 @@ GSList *RemovePlayer(Player *Play, GSList *First) | |
g_assert(First); | |
First = g_slist_remove(First, (gpointer)Play); | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
if (!IsCop(Play)) | |
ShutdownNetworkBuffer(&Play->NetBuf); | |
#endif | |
t@@ -2892,7 +2892,7 @@ void StripTerminators(gchar *str) | |
#ifndef CYGWIN | |
-#if NETWORKING && !GUI_SERVER | |
+#if defined(NETWORKING) && !defined(GUI_SERVER) | |
static void ServerLogMessage(const gchar *log_domain, | |
GLogLevelFlags log_level, | |
const gchar *message, gpointer user_data) | |
diff --git a/src/message.c b/src/message.c | |
t@@ -152,7 +152,7 @@ void DoSendClientMessage(Player *From, AICode AI, MsgCode … | |
To ? GetPlayerName(To) : "", AI, Code, | |
Data ? Data : ""); | |
} | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
if (!Network) { | |
#endif | |
if (From) | |
t@@ -164,7 +164,7 @@ void DoSendClientMessage(Player *From, AICode AI, MsgCode … | |
FirstServer = AddPlayer(0, ServerFrom, FirstServer); | |
} | |
HandleServerMessage(text->str, ServerFrom); | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
} else { | |
QueuePlayerMessageForSend(BufOwn, text->str); | |
} | |
t@@ -213,12 +213,12 @@ void SendServerMessage(Player *From, AICode AI, MsgCode … | |
To ? GetPlayerName(To) : "", AI, Code, | |
Data ? Data : ""); | |
} | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
if (!Network) { | |
#endif | |
if (ClientMessageHandlerPt) | |
(*ClientMessageHandlerPt)(text->str, (Player *)(FirstClient->data)); | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
} else { | |
QueuePlayerMessageForSend(To, text->str); | |
} | |
t@@ -349,7 +349,7 @@ gboolean HaveAbility(Player *Play, gint Type) | |
return (Play->Abil.Shared[Type]); | |
} | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
/* | |
* Reads and writes player data from/to the network if it is ready. | |
* If any data were read, TRUE is returned. "DoneOK" is set TRUE | |
diff --git a/src/serverside.c b/src/serverside.c | |
t@@ -225,7 +225,7 @@ static void ServerNetBufAuth(NetworkBuffer *netbuf, gpoint… | |
void RegisterWithMetaServer(gboolean Up, gboolean SendData, | |
gboolean RespectTimeout) | |
{ | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
struct HISCORE MultiScore[NUMHISCORE], AntiqueScore[NUMHISCORE]; | |
GString *headers, *body; | |
gchar *prstr; | |
t@@ -680,7 +680,7 @@ void CleanUpServer() | |
while (FirstServer) { | |
FirstServer = RemovePlayer((Player *)FirstServer->data, FirstServer); | |
} | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
if (Server) | |
CloseSocket(ListenSock); | |
#endif | |
t@@ -770,7 +770,7 @@ void ServerHelp(void) | |
g_string_free(VarName, TRUE); | |
} | |
-#if NETWORKING | |
+#ifdef NETWORKING | |
static NetworkBuffer *reply_netbuf; | |
static void ServerReply(const gchar *msg) | |
{ |