summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2012-08-05 19:23:24 +0400
committerAndrey Nazarov <skuller@skuller.net>2012-08-05 19:23:24 +0400
commit85bfaaba79c518a6833d08733784af4049aa1b95 (patch)
treea0c3fbb438946379aa2ad66e4afc8331b320f312
parentadd23e4a1d6f7131d5bc0c1db3159a92cdb7472f (diff)
Remove some ‘#if USE_CLIENT’ tests.
-rw-r--r--inc/client/client.h29
-rw-r--r--src/client/null.c9
-rw-r--r--src/common/cmd.c17
-rw-r--r--src/common/common.c23
-rw-r--r--src/common/cvar.c4
-rw-r--r--src/common/files.c8
-rw-r--r--src/common/net/net.c2
-rw-r--r--src/server/init.c4
8 files changed, 31 insertions, 65 deletions
diff --git a/inc/client/client.h b/inc/client/client.h
index 7e8d368..6f1e062 100644
--- a/inc/client/client.h
+++ b/inc/client/client.h
@@ -23,6 +23,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common/net/net.h"
#include "common/utils.h"
+#define CHAR_WIDTH 8
+#define CHAR_HEIGHT 8
+
+#if USE_CLIENT
+
#define MAX_LOCAL_SERVERS 16
#define MAX_STATUS_PLAYERS 64
@@ -97,9 +102,6 @@ void SCR_UpdateScreen(void);
#define U32_MAGENTA MakeColor(255, 0, 255, 255)
#define U32_WHITE MakeColor(255, 255, 255, 255)
-#define CHAR_WIDTH 8
-#define CHAR_HEIGHT 8
-
#define UI_LEFT 0x00000001
#define UI_RIGHT 0x00000002
#define UI_CENTER (UI_LEFT | UI_RIGHT)
@@ -120,4 +122,25 @@ qboolean SCR_ParseColor(const char *s, color_t *color);
float V_CalcFov(float fov_x, float width, float height);
+#else // USE_CLIENT
+
+#define CL_Init() (void)0
+#define CL_Disconnect(type) (void)0
+#define CL_Shutdown() (void)0
+#define CL_UpdateUserinfo(var, from) (void)0
+#define CL_ErrorEvent(from) (void)0
+#define CL_RestartFilesystem(total) FS_Restart(total)
+#define CL_ForwardToServer() qfalse
+#define CL_CheatsOK() (!!Cvar_VariableInteger("cheats"))
+
+#define Con_Init() (void)0
+#define Con_SetColor(color) (void)0
+#define Con_Print(text) (void)0
+
+#define SCR_DebugGraph(value, color) (void)0
+#define SCR_BeginLoadingPlaque() (void)0
+#define SCR_EndLoadingPlaque() (void)0
+
+#endif // !USE_CLIENT
+
#endif // CLIENT_H
diff --git a/src/client/null.c b/src/client/null.c
index 2b489bc..43a2fae 100644
--- a/src/client/null.c
+++ b/src/client/null.c
@@ -23,15 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common/cvar.h"
#include "client/client.h"
-qboolean CL_CheatsOK(void)
-{
- // developer option
- if (Cvar_VariableInteger("cheats")) {
- return qtrue;
- }
- return qfalse;
-}
-
static void Key_Bind_Null_f(void)
{
}
diff --git a/src/common/cmd.c b/src/common/cmd.c
index e611e64..03a2836 100644
--- a/src/common/cmd.c
+++ b/src/common/cmd.c
@@ -26,9 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common/files.h"
#include "common/prompt.h"
#include "common/utils.h"
-#if USE_CLIENT
#include "client/client.h"
-#endif
#define Cmd_Malloc(size) Z_TagMalloc(size, TAG_CMD)
#define Cmd_CopyString(string) Z_TagCopyString(string, TAG_CMD)
@@ -1612,13 +1610,9 @@ void Cmd_ExecuteCommand(cmdbuf_t *buf)
if (cmd) {
if (cmd->function) {
cmd->function();
- } else
-#if USE_CLIENT
- if (!CL_ForwardToServer())
-#endif
- {
- Com_Printf("Can't \"%s\", not connected\n", cmd_argv[0]);
- }
+ } else if (!CL_ForwardToServer()) {
+ Com_Printf("Can't \"%s\", not connected\n", cmd_argv[0]);
+ }
return;
}
@@ -1644,11 +1638,8 @@ void Cmd_ExecuteCommand(cmdbuf_t *buf)
return;
}
-#if USE_CLIENT
// send it as a server command if we are connected
- if (!CL_ForwardToServer())
-#endif
- {
+ if (!CL_ForwardToServer()) {
Com_Printf("Unknown command \"%s\"\n", cmd_argv[0]);
}
}
diff --git a/src/common/common.c b/src/common/common.c
index 1fab1cc..36de5be 100644
--- a/src/common/common.c
+++ b/src/common/common.c
@@ -363,10 +363,8 @@ void Com_SetColor(color_index_t color)
if (rd_target) {
return;
}
-#if USE_CLIENT
// graphical console
Con_SetColor(color);
-#endif
#if USE_SYSCON
// debugging console
Sys_SetConsoleColor(color);
@@ -452,10 +450,8 @@ void Com_LPrintf(print_type_t type, const char *fmt, ...)
break;
}
-#if USE_CLIENT
// graphical console
Con_Print(msg);
-#endif
#if USE_SYSCON
// debugging console
@@ -528,9 +524,7 @@ void Com_Error(error_type_t code, const char *fmt, ...)
if (code == ERR_DISCONNECT || code == ERR_RECONNECT) {
Com_WPrintf("%s\n", com_errorMsg);
SV_Shutdown(va("Server was killed: %s\n", com_errorMsg), code);
-#if USE_CLIENT
CL_Disconnect(code);
-#endif
goto abort;
}
@@ -550,9 +544,7 @@ void Com_Error(error_type_t code, const char *fmt, ...)
"ERROR: %s\n"
"********************\n", com_errorMsg);
SV_Shutdown(va("Server crashed: %s\n", com_errorMsg), ERR_DROP);
-#if USE_CLIENT
CL_Disconnect(ERR_DROP);
-#endif
goto abort;
}
@@ -561,9 +553,7 @@ void Com_Error(error_type_t code, const char *fmt, ...)
}
SV_Shutdown(va("Server fatal crashed: %s\n", com_errorMsg), ERR_FATAL);
-#if USE_CLIENT
CL_Shutdown();
-#endif
Qcommon_Shutdown();
Sys_Error("%s", com_errorMsg);
@@ -606,12 +596,8 @@ void Com_Quit(const char *reason, error_type_t type)
}
SV_Shutdown(buffer, type);
-
-#if USE_CLIENT
CL_Shutdown();
-#endif
Qcommon_Shutdown();
-
Sys_Quit();
}
@@ -897,9 +883,7 @@ void Qcommon_Init(int argc, char **argv)
Cvar_Init();
Key_Init();
Prompt_Init();
-#if USE_CLIENT
Con_Init();
-#endif
//
// init commands and vars
@@ -1013,9 +997,7 @@ void Qcommon_Init(int argc, char **argv)
BSP_Init();
CM_Init();
SV_Init();
-#if USE_CLIENT
CL_Init();
-#endif
TST_Init();
#if USE_SYSCON
@@ -1030,14 +1012,11 @@ void Qcommon_Init(int argc, char **argv)
Cbuf_AddText(&cmd_buffer, cmd);
Cbuf_Execute(&cmd_buffer);
}
- }
-#if USE_CLIENT
- else {
+ } else {
// the user asked for something explicit
// so drop the loading plaque
SCR_EndLoadingPlaque();
}
-#endif
// even not given a starting map, dedicated server starts
// listening for rcon commands (create socket after all configs
diff --git a/src/common/cvar.c b/src/common/cvar.c
index 9bc312d..d429aaf 100644
--- a/src/common/cvar.c
+++ b/src/common/cvar.c
@@ -178,11 +178,9 @@ static void change_string_value(cvar_t *var, const char *value, from_t from)
var->string = Z_CvarCopyString(value);
parse_string_value(var);
-#if USE_CLIENT
if (var->flags & CVAR_USERINFO) {
CL_UpdateUserinfo(var, from);
}
-#endif
var->modified = qtrue;
if (from != FROM_CODE) {
@@ -448,13 +446,11 @@ cvar_t *Cvar_FullSet(const char *var_name, const char *value, int flags, from_t
Cvar_SetByVar(var, value, from);
-#if USE_CLIENT
// force retransmit of userinfo variables
// needed for compatibility with q2admin
if ((var->flags | flags) & CVAR_USERINFO) {
CL_UpdateUserinfo(var, from);
}
-#endif
var->flags &= ~CVAR_INFOMASK;
var->flags |= flags;
diff --git a/src/common/files.c b/src/common/files.c
index 72fa164..e689e93 100644
--- a/src/common/files.c
+++ b/src/common/files.c
@@ -3395,11 +3395,7 @@ Console command to fully re-start the file system.
*/
static void FS_Restart_f(void)
{
-#if USE_CLIENT
CL_RestartFilesystem(qtrue);
-#else
- FS_Restart(qtrue);
-#endif
}
static const cmdreg_t c_fs[] = {
@@ -3485,11 +3481,7 @@ static void fs_game_changed(cvar_t *self)
}
// otherwise, restart the filesystem
-#if USE_CLIENT
CL_RestartFilesystem(qfalse);
-#else
- FS_Restart(qfalse);
-#endif
// exec autoexec.cfg (must be a real file within the game directory)
ret = Cmd_ExecuteFile(COM_AUTOEXEC_CFG, FS_TYPE_REAL | FS_PATH_GAME);
diff --git a/src/common/net/net.c b/src/common/net/net.c
index 87f1565..f11ce8d 100644
--- a/src/common/net/net.c
+++ b/src/common/net/net.c
@@ -546,11 +546,9 @@ static void NET_ErrorEvent(netsrc_t sock, netadr_t *from,
case NS_SERVER:
SV_ErrorEvent(from, ee_errno, ee_info);
break;
-#if USE_CLIENT
case NS_CLIENT:
CL_ErrorEvent(from);
break;
-#endif
default:
break;
}
diff --git a/src/server/init.c b/src/server/init.c
index 8ed70c6..12c6937 100644
--- a/src/server/init.c
+++ b/src/server/init.c
@@ -141,9 +141,7 @@ void SV_SpawnServer(cm_t *cm, const char *server, const char *spawnpoint)
int i;
client_t *client;
-#if USE_CLIENT
SCR_BeginLoadingPlaque(); // for local system
-#endif
Com_Printf("------- Server Initialization -------\n");
Com_Printf("SpawnServer: %s\n", server);
@@ -277,11 +275,9 @@ void SV_InitGame(unsigned mvd_spawn)
// cause any connected clients to reconnect
SV_Shutdown("Server restarted\n", ERR_RECONNECT | mvd_spawn);
} else {
-#if USE_CLIENT
// make sure the client is down
CL_Disconnect(ERR_RECONNECT);
SCR_BeginLoadingPlaque();
-#endif
CM_FreeMap(&sv.cm);
SV_FreeFile(sv.entitystring);