if (!cdValid)
{
if(complain)
- Con_Print ("No CD in player.\n");
+ Con_DPrint ("No CD in player.\n");
return false;
}
}
}
else
{
- Con_Print ("No CD in player.\n");
+ Con_DPrint ("No CD in player.\n");
}
return;
}
/*
================
-Con_Print
+Con_MaskPrint
================
*/
extern cvar_t timestamps;
extern cvar_t timeformat;
extern qboolean sys_nostdout;
-void Con_Print(const char *msg)
+void Con_MaskPrint(int additionalmask, const char *msg)
{
static int mask = 0;
static int index = 0;
for (;*msg;msg++)
{
Con_Rcon_AddChar(*msg);
+ if (index == 0)
+ mask |= additionalmask;
// if this is the beginning of a new line, print timestamp
if (index == 0)
{
}
}
+/*
+================
+Con_MaskPrintf
+================
+*/
+void Con_MaskPrintf(int mask, const char *fmt, ...)
+{
+ va_list argptr;
+ char msg[MAX_INPUTLINE];
+
+ va_start(argptr,fmt);
+ dpvsnprintf(msg,sizeof(msg),fmt,argptr);
+ va_end(argptr);
+
+ Con_MaskPrint(mask, msg);
+}
+
+/*
+================
+Con_Print
+================
+*/
+void Con_Print(const char *msg)
+{
+ Con_MaskPrint(CON_MASK_PRINT, msg);
+}
/*
================
dpvsnprintf(msg,sizeof(msg),fmt,argptr);
va_end(argptr);
- Con_Print(msg);
+ Con_MaskPrint(CON_MASK_PRINT, msg);
}
/*
*/
void Con_DPrint(const char *msg)
{
- if (!developer.integer)
- return; // don't confuse non-developers with techie stuff...
- Con_Print(msg);
+ Con_MaskPrint(CON_MASK_DEVELOPER, msg);
}
/*
dpvsnprintf(msg,sizeof(msg),fmt,argptr);
va_end(argptr);
- Con_DPrint(msg);
+ Con_MaskPrint(CON_MASK_DEVELOPER, msg);
}
chatstart = 0; // shut off gcc warning
}
- v = notifystart + con_notifysize.value * Con_DrawNotifyRect(0, CON_MASK_INPUT | CON_MASK_HIDENOTIFY | (numChatlines ? CON_MASK_CHAT : 0), con_notifytime.value, 0, notifystart, vid_conwidth.value, con_notify.value * con_notifysize.value, con_notifysize.value, align, 0.0, "");
+ v = notifystart + con_notifysize.value * Con_DrawNotifyRect(0, CON_MASK_INPUT | CON_MASK_HIDENOTIFY | (numChatlines ? CON_MASK_CHAT : 0) | CON_MASK_DEVELOPER, con_notifytime.value, 0, notifystart, vid_conwidth.value, con_notify.value * con_notifysize.value, con_notifysize.value, align, 0.0, "");
// chat?
if(numChatlines)
//if(con.lines[lineno].mask & CON_MASK_LOADEDHISTORY)
// return 0;
+ if ((con.lines[lineno].mask & CON_MASK_DEVELOPER) && !developer.integer)
+ return 0;
ti.continuationString = "";
ti.alignment = 0;
void Con_Shutdown (void);
void Con_DrawConsole (int lines);
+/// Prints to a chosen console target
+void Con_MaskPrint(int mask, const char *msg);
+
+// Prints to a chosen console target
+void Con_MaskPrintf(int mask, const char *fmt, ...) DP_FUNC_PRINTF(2);
+
/// Prints to all appropriate console targets, and adds timestamps
void Con_Print(const char *txt);
void Log_Printf(const char *logfilename, const char *fmt, ...) DP_FUNC_PRINTF(2);
//@}
+// CON_MASK_PRINT is the default (Con_Print/Con_Printf)
+// CON_MASK_DEVELOPER is used by Con_DPrint/Con_DPrintf
#define CON_MASK_HIDENOTIFY 128
#define CON_MASK_CHAT 1
#define CON_MASK_INPUT 2
+#define CON_MASK_DEVELOPER 4
+#define CON_MASK_PRINT 8
typedef struct con_lineinfo_s
{
Z_Free(cvar);
}
else
- Con_Printf("Can't register variable %s, already defined\n", variable->name);
+ Con_DPrintf("Can't register variable %s, already defined\n", variable->name);
return;
}
if(fnt->req_face != -1)
{
if(!Font_LoadFont(fnt->texpath, fnt))
- Con_Printf("Failed to load font-file for '%s', it will not support as many characters.\n", fnt->texpath);
+ Con_DPrintf("Failed to load font-file for '%s', it will not support as many characters.\n", fnt->texpath);
}
fnt->tex = Draw_CachePic_Flags(fnt->texpath, CACHEPICFLAG_QUIET | CACHEPICFLAG_NOCOMPRESSION)->tex;
svs.perf_offset_avg = svs.perf_acc_offset / svs.perf_acc_offset_samples;
svs.perf_offset_sdev = sqrt(svs.perf_acc_offset_squared / svs.perf_acc_offset_samples - svs.perf_offset_avg * svs.perf_offset_avg);
}
- if(svs.perf_lost > 0)
+ if(svs.perf_lost > 0 && developer_extra.integer)
Con_DPrintf("Server can't keep up: %s\n", Host_TimingReport());
svs.perf_acc_realtime = svs.perf_acc_sleeptime = svs.perf_acc_lost = svs.perf_acc_offset = svs.perf_acc_offset_squared = svs.perf_acc_offset_max = svs.perf_acc_offset_samples = 0;
}
{
cl_sockets[cl_numsockets++] = s;
LHNETADDRESS_ToString(LHNET_AddressFromSocket(s), addressstring2, sizeof(addressstring2), true);
- Con_Printf("Client opened a socket on address %s\n", addressstring2);
+ if (addresstype != LHNETADDRESSTYPE_LOOP)
+ Con_Printf("Client opened a socket on address %s\n", addressstring2);
}
else
{
Con_Printf("Client using port %i\n", port);
NetConn_OpenClientPort(NULL, LHNETADDRESSTYPE_LOOP, 2);
NetConn_OpenClientPort(net_address.string, LHNETADDRESSTYPE_INET4, port);
+#ifdef SUPPORTIPV6
NetConn_OpenClientPort(net_address_ipv6.string, LHNETADDRESSTYPE_INET6, port);
+#endif
}
void NetConn_CloseServerPorts(void)
{
sv_sockets[sv_numsockets++] = s;
LHNETADDRESS_ToString(LHNET_AddressFromSocket(s), addressstring2, sizeof(addressstring2), true);
- Con_Printf("Server listening on address %s\n", addressstring2);
+ if (addresstype != LHNETADDRESSTYPE_LOOP)
+ Con_Printf("Server listening on address %s\n", addressstring2);
return true;
}
else
NetConn_OpenServerPort(NULL, LHNETADDRESSTYPE_LOOP, 1, 1);
if (opennetports)
{
+#ifdef SUPPORTIPV6
qboolean ip4success = NetConn_OpenServerPort(net_address.string, LHNETADDRESSTYPE_INET4, port, 100);
NetConn_OpenServerPort(net_address_ipv6.string, LHNETADDRESSTYPE_INET6, port, ip4success ? 1 : 100);
+#else
+ NetConn_OpenServerPort(net_address.string, LHNETADDRESSTYPE_INET4, port, 100);
+#endif
}
if (sv_numsockets == 0)
Host_Error("NetConn_OpenServerPorts: unable to open any ports!");
svs.csqc_progdata = NULL;
svs.csqc_progdata_deflated = NULL;
- Con_Print("Loading csprogs.dat\n");
-
sv.csqc_progname[0] = 0;
svs.csqc_progdata = FS_LoadFile(csqc_progname.string, sv_mempool, false, &progsize);
if(progsize > 0)
{
size_t deflated_size;
-
+
sv.csqc_progsize = (int)progsize;
sv.csqc_progcrc = CRC_Block(svs.csqc_progdata, progsize);
strlcpy(sv.csqc_progname, csqc_progname.string, sizeof(sv.csqc_progname));
- Con_Printf("server detected csqc progs file \"%s\" with size %i and crc %i\n", sv.csqc_progname, sv.csqc_progsize, sv.csqc_progcrc);
+ Con_DPrintf("server detected csqc progs file \"%s\" with size %i and crc %i\n", sv.csqc_progname, sv.csqc_progsize, sv.csqc_progcrc);
- Con_Print("Compressing csprogs.dat\n");
+ Con_DPrint("Compressing csprogs.dat\n");
//unsigned char *FS_Deflate(const unsigned char *data, size_t size, size_t *deflated_size, int level, mempool_t *mempool);
svs.csqc_progdata_deflated = FS_Deflate(svs.csqc_progdata, progsize, &deflated_size, -1, sv_mempool);
svs.csqc_progsize_deflated = (int)deflated_size;
if(svs.csqc_progdata_deflated)
{
- Con_Printf("Deflated: %g%%\n", 100.0 - 100.0 * (deflated_size / (float)progsize));
+ Con_DPrintf("Deflated: %g%%\n", 100.0 - 100.0 * (deflated_size / (float)progsize));
Con_DPrintf("Uncompressed: %u\nCompressed: %u\n", (unsigned)sv.csqc_progsize, (unsigned)svs.csqc_progsize_deflated);
}
else
- Con_Printf("Cannot compress - need zlib for this. Using uncompressed progs only.\n");
+ Con_DPrintf("Cannot compress - need zlib for this. Using uncompressed progs only.\n");
}
}
dlclose(dllhandle);
goto notfound;
}
- Con_Printf ("All of %s's functions were already linked in! Not loading dynamically...\n", dllnames[0]);
+ Con_DPrintf ("All of %s's functions were already linked in! Not loading dynamically...\n", dllnames[0]);
*handle = dllhandle;
return true;
}
*func->funcvariable = NULL;
// Try every possible name
- Con_Printf ("Trying to load library...");
+ Con_DPrintf ("Trying to load library...");
for (i = 0; dllnames[i] != NULL; i++)
{
- Con_Printf (" \"%s\"", dllnames[i]);
+ Con_DPrintf (" \"%s\"", dllnames[i]);
#ifdef WIN32
dllhandle = LoadLibrary (dllnames[i]);
#else
char temp[MAX_OSPATH];
strlcpy(temp, path, sizeof(temp));
strlcat(temp, dllnames[i], sizeof(temp));
- Con_Printf (" \"%s\"", temp);
+ Con_DPrintf (" \"%s\"", temp);
#ifdef WIN32
dllhandle = LoadLibrary (temp);
#else
// No DLL found
if (! dllhandle)
{
- Con_Printf(" - failed.\n");
+ Con_DPrintf(" - failed.\n");
return false;
}
- Con_Printf(" - loaded.\n");
+ Con_DPrintf(" - loaded.\n");
// Get the function adresses
for (func = fcts; func && func->name != NULL; func++)
if (!(*func->funcvariable = (void *) Sys_GetProcAddress (dllhandle, func->name)))
{
- Con_Printf ("Missing function \"%s\" - broken library!\n", func->name);
+ Con_DPrintf ("Missing function \"%s\" - broken library!\n", func->name);
Sys_UnloadLibrary (&dllhandle);
return false;
}