mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-20 01:11:18 +00:00
total nukage of Sys_Printf calls in the client and server source. this paves
the way for libQFutil using Sys_Printf exlusively.
This commit is contained in:
parent
bff5a4b4b4
commit
4416404982
11 changed files with 22 additions and 247 deletions
|
@ -269,9 +269,11 @@ Con_Print (const char *txt)
|
|||
{
|
||||
int mask, c, l, y;
|
||||
static int cr;
|
||||
const char *s;
|
||||
|
||||
// echo to debugging console
|
||||
Sys_Printf ("%s", txt);
|
||||
for (s = txt; *s; s++)
|
||||
fputc (sys_char_map[(byte)*s], stdout);
|
||||
|
||||
// log all messages to file
|
||||
if (con_debuglog)
|
||||
|
|
|
@ -385,7 +385,7 @@ SV_DropClient (qboolean crash)
|
|||
*sv_globals.self = saveSelf;
|
||||
}
|
||||
|
||||
Sys_Printf ("Client %s removed\n", host_client->name);
|
||||
Con_Printf ("Client %s removed\n", host_client->name);
|
||||
}
|
||||
// break the net connection
|
||||
NET_Close (host_client->netconnection);
|
||||
|
@ -998,7 +998,7 @@ Host_Init (quakeparms_t *parms)
|
|||
|
||||
host_initialized = true;
|
||||
|
||||
Sys_Printf ("========Quake Initialized=========\n");
|
||||
Con_Printf ("========Quake Initialized=========\n");
|
||||
|
||||
CL_UpdateScreen (cl.time);
|
||||
}
|
||||
|
|
|
@ -774,7 +774,7 @@ Host_Say (qboolean teamonly)
|
|||
}
|
||||
host_client = save;
|
||||
|
||||
Sys_Printf ("%s", &text[1]);
|
||||
Con_Printf ("%s", &text[1]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -974,7 +974,7 @@ Host_Spawn_f (void)
|
|||
sv_funcs.ClientConnect);
|
||||
|
||||
if ((Sys_DoubleTime () - host_client->netconnection->connecttime) <=
|
||||
sv.time) Sys_Printf ("%s entered the game\n", host_client->name);
|
||||
sv.time) Con_Printf ("%s entered the game\n", host_client->name);
|
||||
|
||||
PR_ExecuteProgram (&sv_pr_state,
|
||||
sv_funcs.PutClientInServer);
|
||||
|
|
|
@ -454,7 +454,7 @@ SV_ReadClientMessage (void)
|
|||
nextmsg:
|
||||
ret = NET_GetMessage (host_client->netconnection);
|
||||
if (ret == -1) {
|
||||
Sys_Printf ("SV_ReadClientMessage: NET_GetMessage failed\n");
|
||||
Con_Printf ("SV_ReadClientMessage: NET_GetMessage failed\n");
|
||||
return false;
|
||||
}
|
||||
if (!ret)
|
||||
|
@ -467,7 +467,7 @@ SV_ReadClientMessage (void)
|
|||
return false; // a command caused an error
|
||||
|
||||
if (net_message->badread) {
|
||||
Sys_Printf ("SV_ReadClientMessage: badread\n");
|
||||
Con_Printf ("SV_ReadClientMessage: badread\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -478,11 +478,11 @@ SV_ReadClientMessage (void)
|
|||
goto nextmsg; // end of message
|
||||
|
||||
default:
|
||||
Sys_Printf ("SV_ReadClientMessage: unknown command char\n");
|
||||
Con_Printf ("SV_ReadClientMessage: unknown command char\n");
|
||||
return false;
|
||||
|
||||
case clc_nop:
|
||||
// Sys_Printf ("clc_nop\n");
|
||||
// Con_Printf ("clc_nop\n");
|
||||
break;
|
||||
|
||||
case clc_stringcmd:
|
||||
|
@ -538,7 +538,7 @@ SV_ReadClientMessage (void)
|
|||
break;
|
||||
|
||||
case clc_disconnect:
|
||||
// Sys_Printf ("SV_ReadClientMessage: client disconnected\n");
|
||||
// Con_Printf ("SV_ReadClientMessage: client disconnected\n");
|
||||
return false;
|
||||
|
||||
case clc_move:
|
||||
|
|
|
@ -1,229 +0,0 @@
|
|||
/*
|
||||
sys_null.c
|
||||
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "errno.h"
|
||||
|
||||
#define MAX_HANDLES 10
|
||||
|
||||
VFile *sys_handles[MAX_HANDLES];
|
||||
|
||||
|
||||
// VFile IO ===================================================================
|
||||
|
||||
int
|
||||
findhandle (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; i < MAX_HANDLES; i++)
|
||||
if (!sys_handles[i])
|
||||
return i;
|
||||
Sys_Error ("out of handles");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
filelength (VFile *f)
|
||||
{
|
||||
int pos, end;
|
||||
|
||||
pos = ftell (f);
|
||||
fseek (f, 0, SEEK_END);
|
||||
end = ftell (f);
|
||||
fseek (f, pos, SEEK_SET);
|
||||
|
||||
return end;
|
||||
}
|
||||
|
||||
int
|
||||
Sys_FileOpenRead (char *path, int *hndl)
|
||||
{
|
||||
VFile *f;
|
||||
int i;
|
||||
|
||||
i = findhandle ();
|
||||
|
||||
f = Qopen (path, "rb");
|
||||
if (!f) {
|
||||
*hndl = -1;
|
||||
return -1;
|
||||
}
|
||||
sys_handles[i] = f;
|
||||
*hndl = i;
|
||||
|
||||
return filelength (f);
|
||||
}
|
||||
|
||||
int
|
||||
Sys_FileOpenWrite (char *path)
|
||||
{
|
||||
VFile *f;
|
||||
int i;
|
||||
|
||||
i = findhandle ();
|
||||
|
||||
f = Qopen (path, "wb");
|
||||
if (!f)
|
||||
Sys_Error ("Error opening %s: %s", path, strerror (errno));
|
||||
sys_handles[i] = f;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void
|
||||
Sys_FileClose (int handle)
|
||||
{
|
||||
Qclose (sys_handles[handle]);
|
||||
sys_handles[handle] = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
Sys_FileSeek (int handle, int position)
|
||||
{
|
||||
fseek (sys_handles[handle], position, SEEK_SET);
|
||||
}
|
||||
|
||||
int
|
||||
Sys_FileRead (int handle, void *dest, int count)
|
||||
{
|
||||
return fread (dest, 1, count, sys_handles[handle]);
|
||||
}
|
||||
|
||||
int
|
||||
Sys_FileWrite (int handle, void *data, int count)
|
||||
{
|
||||
return fwrite (data, 1, count, sys_handles[handle]);
|
||||
}
|
||||
|
||||
int
|
||||
Sys_FileTime (char *path)
|
||||
{
|
||||
VFile *f;
|
||||
|
||||
f = Qopen (path, "rb");
|
||||
if (f) {
|
||||
Qclose (f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
Sys_mkdir (char *path)
|
||||
{
|
||||
}
|
||||
|
||||
// SYSTEM IO ==================================================================
|
||||
|
||||
void
|
||||
Sys_Error (char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
|
||||
printf ("Sys_Error: ");
|
||||
va_start (argptr, error);
|
||||
vprintf (error, argptr);
|
||||
va_end (argptr);
|
||||
printf ("\n");
|
||||
|
||||
exit (1);
|
||||
}
|
||||
|
||||
void
|
||||
Sys_Printf (char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vprintf (fmt, argptr);
|
||||
va_end (argptr);
|
||||
}
|
||||
|
||||
void
|
||||
Sys_Quit (void)
|
||||
{
|
||||
exit (0);
|
||||
}
|
||||
|
||||
double
|
||||
Sys_DoubleTime (void)
|
||||
{
|
||||
static double t;
|
||||
|
||||
t += 0.1;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
char *
|
||||
Sys_ConsoleInput (void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
IN_SendKeyEvents (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Sys_HighFPPrecision (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Sys_LowFPPrecision (void)
|
||||
{
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
static quakeparms_t parms;
|
||||
|
||||
parms.memsize = 8 * 1024 * 1024;
|
||||
parms.membase = malloc (parms.memsize);
|
||||
|
||||
COM_InitArgv (argc, argv);
|
||||
|
||||
parms.argc = com_argc;
|
||||
parms.argv = com_argv;
|
||||
|
||||
printf ("Host_Init\n");
|
||||
Host_Init (&parms);
|
||||
while (1) {
|
||||
Host_Frame (0.1);
|
||||
}
|
||||
}
|
|
@ -501,7 +501,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||
// because sound is off until we become active
|
||||
//XXX S_BlockSound ();
|
||||
|
||||
Sys_Printf ("Host_Init\n");
|
||||
Con_Printf ("Host_Init\n");
|
||||
Host_Init (&parms);
|
||||
|
||||
Sys_Init_Cvars ();
|
||||
|
|
|
@ -409,7 +409,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||
// because sound is off until we become active
|
||||
// XXX S_BlockSound ();
|
||||
|
||||
Sys_Printf ("Host_Init\n");
|
||||
Con_Printf ("Host_Init\n");
|
||||
Host_Init ();
|
||||
|
||||
oldtime = Sys_DoubleTime ();
|
||||
|
|
|
@ -270,9 +270,11 @@ Con_Print (const char *txt)
|
|||
{
|
||||
int mask, c, l, y;
|
||||
static int cr;
|
||||
const char *s;
|
||||
|
||||
// echo to debugging console
|
||||
Sys_Printf ("%s", txt);
|
||||
for (s = txt; *s; s++)
|
||||
fputc (sys_char_map[(byte)*s], stdout);
|
||||
|
||||
// log all messages to file
|
||||
if (con_debuglog)
|
||||
|
|
|
@ -276,7 +276,7 @@ NET_GetPacket (void)
|
|||
#endif /* _WIN32 */
|
||||
if (err == EWOULDBLOCK)
|
||||
return false;
|
||||
Sys_Printf ("NET_GetPacket: %s\n", strerror (err));
|
||||
Con_Printf ("NET_GetPacket: %s\n", strerror (err));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ NET_SendPacket (int length, void *data, netadr_t to)
|
|||
if (err == EWOULDBLOCK)
|
||||
return;
|
||||
|
||||
Sys_Printf ("NET_SendPacket: %s\n", strerror (errno));
|
||||
Con_Printf ("NET_SendPacket: %s\n", strerror (errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -380,7 +380,7 @@ NET_GetPacket (void)
|
|||
#endif /* _WIN32 */
|
||||
if (err == EWOULDBLOCK)
|
||||
return false;
|
||||
Sys_Printf ("NET_GetPacket: %s\n", strerror (err));
|
||||
Con_Printf ("NET_GetPacket: %s\n", strerror (err));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ NET_SendPacket (int length, void *data, netadr_t to)
|
|||
if (err == EWOULDBLOCK)
|
||||
return;
|
||||
|
||||
Sys_Printf ("NET_SendPacket: %s\n", strerror (err));
|
||||
Con_Printf ("NET_SendPacket: %s\n", strerror (err));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1643,7 +1643,7 @@ SV_RestorePenaltyFilter (client_t *cl, filtertype_t type)
|
|||
// search for existing penalty filter of same type
|
||||
for (i = 0; i < numipfilters; i++) {
|
||||
if (type == ipfilters[i].type && SV_IPCompare (ip, ipfilters[i].ip)) {
|
||||
Sys_Printf ("Penalty restored for user %d\n", cl->userid);
|
||||
Con_Printf ("Penalty restored for user %d\n", cl->userid);
|
||||
return ipfilters[i].time;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue