1
0
Fork 0
forked from fte/fteqw

warning fixes

log_* cvars (readable translation, cycling, custom dir/file, developer, etc)
cl_standardmsg (like cl_standardchat, colors names in standard net messages, defaults to 0 to annoy people)


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1378 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2005-09-26 08:07:26 +00:00
parent d697b1ca2d
commit ad3f2c26ac
22 changed files with 412 additions and 151 deletions

View file

@ -610,7 +610,6 @@ void CL_DrawPrydonCursor(void)
void ML_UnProject(vec3_t in, vec3_t out, vec3_t viewangles, vec3_t vieworg, float wdivh, float fovy);
void CL_UpdatePrydonCursor(usercmd_t *from, float cursor_screen[2], vec3_t cursor_start, vec3_t cursor_impact, int *entnum)
{
float modelview[16];
vec3_t cursor_end;
vec3_t temp;
@ -1053,7 +1052,6 @@ void CL_SendCmd (float frametime)
extern cvar_t cl_maxfps;
vec3_t cursor_start, cursor_impact;
int cursor_entitynumber=0;//I hate warnings as errors
if (cls.demoplayback != DPB_NONE)

View file

@ -117,6 +117,7 @@ cvar_t cl_item_bobbing = {"cl_model_bobbing", "0"};
cvar_t requiredownloads = {"requiredownloads","1", NULL, CVAR_ARCHIVE};
cvar_t cl_standardchat = {"cl_standardchat", "0"};
cvar_t cl_standardmsg = {"cl_standardmsg", "0"};
cvar_t cl_parsewhitetext = {"cl_parsewhitetext", "0"};
cvar_t host_mapname = {"host_mapname", ""};
@ -1794,7 +1795,7 @@ void CL_ConnectionlessPacket (void)
Con_TPrintf (TLC_A2C_PRINT);
s = MSG_ReadString ();
Con_Print (s);
Con_Printf ("%s", s);
return;
}
else if (!strcmp(s, "client_connect"))
@ -1936,7 +1937,7 @@ client_connect: //fixme: make function
if (!strncmp(net_message.data+4, "print\n", 6))
{
Con_TPrintf (TLC_A2C_PRINT);
Con_Print (net_message.data+10);
Con_Printf ("%s", net_message.data+10);
return;
}
}
@ -1945,7 +1946,7 @@ client_connect: //fixme: make function
Con_TPrintf (TLC_A2C_PRINT);
s = MSG_ReadString ();
Con_Print (s);
Con_Printf ("%s", s);
return;
}
if (c == 'r')//dp's reject
@ -2416,6 +2417,7 @@ void CL_Init (void)
Cvar_Register (&requiredownloads, cl_controlgroup);
Cvar_Register (&cl_standardchat, cl_controlgroup);
Cvar_Register (&cl_standardmsg, cl_controlgroup);
Cvar_Register (&cl_parsewhitetext, cl_controlgroup);
Cvar_Register (&cl_nopext, cl_controlgroup);
Cvar_Register (&cl_splitscreen, cl_controlgroup);

View file

@ -1051,7 +1051,7 @@ void CL_ParseDownload (void)
if (!*cls.downloadname) //huh... that's not right...
{
Con_Print("^1Warning: Server sending unknown file.\n");
Con_Printf("^1Warning: Server sending unknown file.\n");
strcpy(cls.downloadname, "unknown.txt");
strcpy(cls.downloadtempname, "unknown.tmp");
}
@ -3004,7 +3004,6 @@ void CLQ2_ParseInventory (void)
}
#endif
int build_number( void );
//return if we want to print the message.
char *CL_ParseChat(char *text, player_info_t **player)
{
@ -3108,11 +3107,80 @@ void CL_ParsePrint(char *msg, int level)
}
}
// CL_PlayerColor: returns color and mask for player_info_t
int CL_PlayerColor(player_info_t *plr, int *name_ormask)
{
char *t;
int c;
*name_ormask = 0;
if (cl.teamfortress) //override based on team
{
// TODO: needs some work
switch (plr->bottomcolor)
{ //translate q1 skin colours to console colours
case 10:
case 1:
*name_ormask = CON_STANDARDMASK;
case 4: //red
c = 1;
break;
case 11:
*name_ormask = CON_STANDARDMASK;
case 3: // green
c = 2;
break;
case 5:
*name_ormask = CON_STANDARDMASK;
case 12:
c = 3;
break;
case 6:
case 7:
*name_ormask = CON_STANDARDMASK;
case 8:
case 9:
c = 5;
break;
case 2: // light blue
*name_ormask = CON_STANDARDMASK;
case 13: //blue
case 14: //blue
c = 6;
break;
default:
*name_ormask = CON_STANDARDMASK;
case 0: // white
c = 7;
break;
}
}
else
{
// override chat color with tc infokey
// 0-6 is standard colors (red to white)
// 7-13 is using secondard charactermask
// 14 and afterwards repeats
t = Info_ValueForKey(plr->userinfo, "tc");
if (*t)
c = atoi(t);
else
c = plr->userid - 1;
if ((c / 7) & 1)
*name_ormask = CON_STANDARDMASK;
c = 1 + (c % 7);
}
return c;
}
// CL_ParseChat: takes chat strings and performs name coloring and cl_parsewhitetext parsing
// NOTE: text in rawmsg/msg is assumed destroyable and should not be used afterwards
void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
{
char *t;
char *name = NULL;
int c;
int name_ormask = 0;
@ -3154,66 +3222,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
}
}
else if (plr)
{
if (cl.teamfortress) //override based on team
{
// TODO: needs some work
switch (plr->bottomcolor)
{ //translate q1 skin colours to console colours
case 10:
case 1:
name_ormask = CON_STANDARDMASK;
case 4: //red
c = 1;
break;
case 11:
name_ormask = CON_STANDARDMASK;
case 3: // green
c = 2;
break;
case 5:
name_ormask = CON_STANDARDMASK;
case 12:
c = 3;
break;
case 6:
case 7:
name_ormask = CON_STANDARDMASK;
case 8:
case 9:
c = 5;
break;
case 2: // light blue
name_ormask = CON_STANDARDMASK;
case 13: //blue
case 14: //blue
c = 6;
break;
default:
name_ormask = CON_STANDARDMASK;
case 0: // white
c = 7;
break;
}
}
else
{
// override chat color with tc infokey
// 0-6 is standard colors (red to white)
// 7-13 is using secondard charactermask
// 14 and afterwards repeats
t = Info_ValueForKey(plr->userinfo, "tc");
if (*t)
c = atoi(t);
else
c = plr->userid - 1;
if ((c / 7) & 1)
name_ormask = CON_STANDARDMASK;
c = 1 + (c % 7);
}
}
c = CL_PlayerColor(plr, &name_ormask);
else
{
// defaults for fake clients
@ -3268,7 +3277,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
con_ormask = CON_STANDARDMASK;
if (cl_parsewhitetext.value && (plrflags & TPM_TEAM))
{
char *u;
char *t, *u;
while (t = strchr(msg, '{'))
{
@ -3297,6 +3306,56 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
}
// CL_PrintStandardMessage: takes non-chat net messages and performs name coloring
// NOTE: msg is considered destroyable
void CL_PrintStandardMessage(char *msg)
{
int i;
player_info_t *p;
extern cvar_t cl_standardmsg;
// search for player names in message
for (i = 0, p = cl.players; i < MAX_CLIENTS; p++, i++)
{
char *v;
char *name;
int len;
int ormask;
char c;
if (!p->name[0])
continue;
name = Info_ValueForKey (p->userinfo, "name");
len = strlen(name);
v = strstr(msg, name);
if (v) // name found
{
*v = 0; // cut off message
con_ormask = 0;
// print msg chunk
Con_Printf("%s", msg);
msg = v + len; // update search point
// get name color
if (p->spectator || cl_standardmsg.value)
{
ormask = 0;
c = '7';
}
else
c = '0' + CL_PlayerColor(p, &ormask);
// print name
con_ormask = ormask;
Con_Printf("^%c%s^7", c, name);
}
}
// print final chunk
con_ormask = 0;
Con_Printf("%s", msg);
}
char stufftext[4096];
void CL_ParseStuffCmd(char *msg, int destsplit) //this protects stuffcmds from network segregation.
{
@ -3474,7 +3533,7 @@ void CL_ParseServerMessage (void)
else
{
CL_ParsePrint(s, i);
Con_TPrintf (TL_ST, Translate(s));
CL_PrintStandardMessage(s);
}
break;
@ -3919,7 +3978,6 @@ void CLQ2_ParseServerMessage (void)
char *msg;
player_info_t *plr = NULL;
S_LocalSound ("misc/talk.wav");
if (msg = CL_ParseChat(s, &plr))
{
CL_ParsePrint(s, i);
@ -3929,7 +3987,7 @@ void CLQ2_ParseServerMessage (void)
else
{
CL_ParsePrint(s, i);
Con_TPrintf (TL_ST, Translate(s));
CL_PrintStandardMessage(s);
}
con_ormask = 0;
break;
@ -4048,7 +4106,6 @@ void CLNQ_ParseServerMessage (void)
char *msg;
player_info_t *plr = NULL;
if (msg = CL_ParseChat(s+1, &plr))
{
CL_ParsePrint(s+1, PRINT_CHAT);
@ -4058,7 +4115,7 @@ void CLNQ_ParseServerMessage (void)
else
{
CL_ParsePrint(s, PRINT_HIGH);
Con_TPrintf (TL_ST, Translate(s));
CL_PrintStandardMessage(s);
}
con_ormask = 0;
break;

View file

@ -462,7 +462,7 @@ int VMQ3_GetFileList(char *path, char *ext, char *output, int buffersize)
vms.found=0;
if (*(char *)path == '$')
{
extern char com_basedir[];
extern char *com_basedir;
vms.skip=0;
Sys_EnumerateFiles(com_basedir, "*", VMEnumMods, &vms);
}

View file

@ -70,6 +70,16 @@ cvar_t con_centernotify = {"con_centernotify", "0"};
cvar_t con_displaypossabilities = {"con_displaypossabilities", "1"};
cvar_t cl_chatmode = {"cl_chatmode", "2"};
#define CONLOGGROUP "Console logging"
cvar_t log_name = {"log_name", "", NULL, CVAR_NOTFROMSERVER};
cvar_t log_dir = {"log_dir", "", NULL, CVAR_NOTFROMSERVER};
cvar_t log_readable = {"log_readable", "0", NULL, CVAR_NOTFROMSERVER};
cvar_t log_enable = {"log_enable", "0", NULL, CVAR_NOTFROMSERVER};
cvar_t log_developer = {"log_developer", "0", NULL, CVAR_NOTFROMSERVER};
cvar_t log_rotate_files = {"log_rotate_files", "0", NULL, CVAR_NOTFROMSERVER};
cvar_t log_rotate_size = {"log_rotate_size", "131072", NULL, CVAR_NOTFROMSERVER};
cvar_t log_dosformat = {"log_dosformat", "0", NULL, CVAR_NOTFROMSERVER};
#define NUM_CON_TIMES 24
float con_times[NUM_CON_TIMES]; // realtime time the line was generated
// for transparent notify lines
@ -77,8 +87,6 @@ float con_times[NUM_CON_TIMES]; // realtime time the line was generated
//int con_vislines;
int con_notifylines; // scan lines to clear for notify lines
qboolean con_debuglog;
#define MAXCMDLINE 256
extern unsigned char key_lines[32][MAXCMDLINE];
extern int edit_line;
@ -87,6 +95,44 @@ extern int key_linepos;
qboolean con_initialized;
// table of readable characters, same as ezquake
char readable[256] =
{
'.', '_', '_', '_', '_', '.', '_', '_',
'_', '_', '\n', '_', '\n', '>', '.', '.',
'[', ']', '0', '1', '2', '3', '4', '5',
'6', '7', '8', '9', '.', '_', '_', '_',
' ', '!', '\"', '#', '$', '%', '&', '\'',
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', '|', '}', '~', '_',
'_', '_', '_', '_', '_', '.', '_', '_',
'_', '_', '_', '_', '_', '>', '.', '.',
'[', ']', '0', '1', '2', '3', '4', '5',
'6', '7', '8', '9', '.', '_', '_', '_',
' ', '!', '\"', '#', '$', '%', '&', '\'',
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', '|', '}', '~', '_'
};
void Con_ResizeCon (console_t *con);
qboolean Con_IsActive (console_t *con)
@ -494,13 +540,6 @@ Con_Init
*/
void Con_Init (void)
{
con_debuglog = COM_CheckParm("-condebug");
#ifdef CRAZYDEBUGGING
con_debuglog = true;
TRACE(("dbg: Con_Init: con_debuglog forced\n"));
#endif
con_current = &con_main;
con_main.linebuffered = Con_ExecuteLine;
con_main.commandcompletion = true;
@ -518,6 +557,15 @@ void Con_Init (void)
Cvar_Register (&con_displaypossabilities, "Console controls");
Cvar_Register (&cl_chatmode, "Console controls");
Cvar_Register (&log_name, CONLOGGROUP);
Cvar_Register (&log_dir, CONLOGGROUP);
Cvar_Register (&log_readable, CONLOGGROUP);
Cvar_Register (&log_enable, CONLOGGROUP);
Cvar_Register (&log_developer, CONLOGGROUP);
Cvar_Register (&log_rotate_size, CONLOGGROUP);
Cvar_Register (&log_rotate_files, CONLOGGROUP);
Cvar_Register (&log_dosformat, CONLOGGROUP);
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
Cmd_AddCommand ("togglechat", Con_ToggleChat_f);
Cmd_AddCommand ("messagemode", Con_MessageMode_f);
@ -527,6 +575,15 @@ void Con_Init (void)
Cmd_AddCommand ("qterm", Con_QTerm_f);
#endif
con_initialized = true;
#ifdef CRAZYDEBUGGING
Cvar_ForceSet(&log_enable, "1");
TRACE(("dbg: Con_Init: log_enable forced\n"));
#endif
if (COM_CheckParm("-condebug"))
Cvar_ForceSet(&log_enable, "1");
}
@ -678,6 +735,7 @@ void Con_PrintCon (console_t *con, char *txt)
}
}
void Con_Print (char *txt)
{
Con_PrintCon(&con_main, txt); //client console
@ -690,6 +748,169 @@ void Con_CycleConsole(void)
con_current = &con_main;
}
// Con_Log: log string to console log
int COM_FileSize(char *path);
extern char gamedirfile[];
extern char *com_basedir;
void Con_Log (char *s)
{
char *d; // directory
char *f; // filename
char *t;
char logbuf[1024];
int i;
if (!log_enable.value)
return;
// cvar sanity checks
if (log_dir.modified)
{
t = log_dir.string;
if (strstr(t, "..") || strstr(t, ":") || *t == '/' || *t == '\\')
{
Con_Print("log_dir forced to default due to invalid characters.\n");
Cvar_ForceSet(&log_dir, log_dir.defaultstr);
}
log_dir.modified = false;
}
if (log_name.modified)
{
t = log_name.string;
if (strstr(t, "..") || strstr(t, ":") || strstr(t, "/") || strstr(t, "\\"))
{
Con_Print("log_name forced to default due to invalid characters.\n");
Cvar_ForceSet(&log_name, log_name.defaultstr);
}
log_name.modified = false;
}
// get directory/filename
d = gamedirfile;
if (log_dir.string[0])
d = log_dir.string;
f = "qconsole";
if (log_name.string[0])
f = log_name.string;
// readable translation and Q3 code removal, use t for final string to write
t = logbuf;
// max debuglog buf is 1024
for (i = 0; i < 1023; i++, s++)
{
if (*s == 0)
break;
else if (log_readable.value >= 2 && *s == '^')
{
// log_readable 2 removes Q3 codes as well
char c;
c = *(s+1);
if ((c >= '0' && c < '8') || c == 'a' || c == 'b' || c == 's' || c == 'r')
{
i--;
s++;
}
else
{
*t = '^';
t++;
}
}
else if (log_dosformat.value && *s == '\n')
{
// convert \n to \r\n
*t = '\r';
t++;
i++;
if (i < 1023)
{
*t = '\n';
t++;
}
}
else
{
// use readable table to convert quake chars to reabable text
if (log_readable.value)
*t = readable[(unsigned char)(*s)]; // translate
else
*t = *s; // copy
t++;
}
}
*t = 0;
f = va("%s/%s/%s.log",com_basedir,d,f); // temp string in va()
// file rotation
if (log_rotate_size.value >= 4096 && log_rotate_files.value >= 1)
{
int x;
FILE *fi;
// check file size, use x as temp
if (fi = fopen(f, "rb"))
{
x = COM_filelength(fi);
fclose(fi);
}
else
x = 0;
if (x > (int)log_rotate_size.value)
{
char newf[MAX_OSPATH];
char oldf[MAX_OSPATH];
i = log_rotate_files.value;
// unlink file at the top of the chain
_snprintf(oldf, sizeof(oldf)-1, "%s.%i", f, i);
unlink(oldf);
// rename files through chain
for (x = i-1; x > 0; x--)
{
strcpy(newf, oldf);
_snprintf(oldf, sizeof(oldf)-1, "%s.%i", f, x);
// check if file exists, otherwise skip
if (fi = fopen(oldf, "rb"))
fclose(fi);
else
continue; // skip nonexistant files
if (rename(oldf, newf))
{
// rename failed, disable log and bug out
Cvar_ForceSet(&log_enable, "0");
Con_Print("Unable to rotate log files. Logging disabled.\n");
return;
}
}
// TODO: option to compress file somewhere in here?
// rename our base file, which better exist...
if (rename(f, oldf))
{
// rename failed, disable log and bug out
Cvar_ForceSet(&log_enable, "0");
Con_Print("Unable to rename base log file. Logging disabled.\n");
return;
}
}
}
// write to log file
Sys_DebugLog(f, "%s", logbuf);
}
/*
================
Con_Printf
@ -731,8 +952,7 @@ void VARGS Con_Printf (const char *fmt, ...)
Sys_Printf ("%s", msg); // also echo to debugging console
// log all messages to file
if (con_debuglog)
Sys_DebugLog(va("%s/qconsole.log",com_gamedir), "%s", msg);
Con_Log (msg);
if (!con_initialized)
return;
@ -814,14 +1034,17 @@ void VARGS Con_DPrintf (char *fmt, ...)
va_list argptr;
char msg[MAXPRINTMSG];
if (!developer.value)
return; // don't confuse non-developers with techie stuff...
if (!developer.value && !log_developer.value)
return; // early exit
va_start (argptr,fmt);
_vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
va_end (argptr);
Con_Printf ("%s", msg);
if (!developer.value)
Con_Log(msg);
else
Con_Printf("%s", msg);
}
/*

View file

@ -973,7 +973,7 @@ typedef struct {
METHODDEF(void) jpeg_error_exit (j_common_ptr cinfo) {
longjmp(((jpeg_error_mgr_wrapper *) cinfo->err)->setjmp_buffer, 1);
}
extern char com_basedir[];
extern char *com_basedir;
void screenshotJPEG(char *filename, qbyte *screendata, int screenwidth, int screenheight) //input is rgb NOT rgba
{
char name[MAX_OSPATH];

View file

@ -9,7 +9,7 @@
#define DPF_DISPLAYVERSION 4 //some sort of conflict, the package is listed twice, so show versions so the user knows what's old.
#define DPF_DELETEONUNINSTALL 8 //for previously installed packages, remove them from the list
extern char com_basedir[];
extern char *com_basedir;
char *downloadablelist[256] = {

View file

@ -37,6 +37,7 @@ void M_Menu_Options_f (void)
{
int mgt;
extern cvar_t cl_standardchat;
extern cvar_t cl_standardmsg;
#ifdef _WIN32
extern qboolean vid_isfullscreen;
#endif
@ -81,6 +82,7 @@ void M_Menu_Options_f (void)
MC_AddCheckBox(menu, 16, y, " Use old status bar", &cl_sbar,0); y+=8;
MC_AddCheckBox(menu, 16, y, " HUD on left side", &cl_hudswap,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Old-style chatting", &cl_standardchat,0);y+=8;
MC_AddCheckBox(menu, 16, y, " Old-style messages", &cl_standardmsg,0);y+=8;
y+=4;MC_AddEditCvar(menu, 16, y, " Imitate FPS", "cl_netfps"); y+=8+4;
MC_AddConsoleCommand(menu, 16, y, " Video Options", "menu_video\n"); y+=8;
@ -492,7 +494,7 @@ void M_Menu_FPS_f (void)
MC_AddCheckBox(menu, 48, y, " Dynamic lights", &r_dynamic,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Stainmaps", &r_stains,0);y+=8;
y+=4;MC_AddEditCvar(menu, 48, y, " Skybox", &gl_skyboxname);y+=8;y+=4;
y+=4;MC_AddEditCvar(menu, 48, y, " Skybox", "gl_skyboxname");y+=8;y+=4;
switch(qrenderer)
{
#ifdef RGLQUAKE

View file

@ -547,7 +547,7 @@ void Master_AddMasterHTTP (char *address, int servertype, char *description)
//build a linked list of masters. Doesn't duplicate addresses.
qboolean Master_LoadMasterList (char *filename, int defaulttype, int depth)
{
extern char com_basedir[MAX_OSPATH];
extern char *com_basedir;
FILE *f;
char line[1024];
char file[1024];

View file

@ -2558,7 +2558,6 @@ void P_RunParticleCube(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int co
{
vec3_t org;
int i, j;
vec3_t nvel;
float num;
float invcount;
@ -2593,7 +2592,6 @@ void P_RunParticleWeather(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int
{
vec3_t org;
int i, j;
vec3_t nvel;
float num;
float invcount;

View file

@ -123,7 +123,7 @@ void S_SoundInfo_f(void)
if (!sndcardinfo)
{
Con_Print("No sound cards\n");
Con_Printf ("No sound cards\n");
return;
}
for (sc = sndcardinfo; sc; sc = sc->next)

View file

@ -77,7 +77,7 @@ static int SDL_InitCard(soundcardinfo_t *sc, int cardnum)
Con_Printf("SDL AUDIO INITING\n");
if(SDL_InitSubSystem(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE))
{
Con_Print("Couldn't initialize SDL audio subsystem\n");
Con_Printf("Couldn't initialize SDL audio subsystem\n");
return false;
}

View file

@ -3227,7 +3227,6 @@ void CL_Say (qboolean team, char *extra)
strlcat (sendtext, text, sizeof(sendtext));
if (suppress)
{
extern cvar_t cl_standardchat;
//print it locally:
char *d;
for (s = sendtext, d = text; *s; s++, d++)

View file

@ -86,8 +86,6 @@ extern qboolean con_initialized;
extern qbyte *con_chars;
extern int con_notifylines; // scan lines to clear for notify lines
extern qboolean con_debuglog;
void Con_DrawCharacter (int cx, int line, int num);
void Con_CheckResize (void);

View file

@ -6,7 +6,6 @@
static char *defaultlanguagetext =
"STL_LANGUAGENAME \"English\"\n"
"TL_NL \"\\n\"\n"
"TL_ST \"%s\"\n"
"TL_STNL \"%s\\n\"\n"
"STL_CLIENTCONNECTED \"client %s connected\\n\"\n"
"STL_SPECTATORCONNECTED \"spectator %s connected\\n\"\n"

View file

@ -2,7 +2,6 @@
NAME(STL_LANGUAGENAME)
NAME(TL_NL)
NAME(TL_ST)
NAME(TL_STNL)
NAME(STL_CLIENTCONNECTED)

View file

@ -1410,7 +1410,7 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
if (!RegisterClass (&wc) )
{
Con_Print("^1Couldn't register window class\n");
Con_Printf("^1Couldn't register window class\n");
return false;
}

View file

@ -863,7 +863,6 @@ extern char localmodels[MAX_MODELS][5]; // inline model names for precache
extern char localinfo[MAX_LOCALINFO_STRING+1];
extern int host_hunklevel;
extern FILE *sv_logfile;
extern FILE *sv_fraglogfile;
//===========================================================

View file

@ -139,6 +139,9 @@ SV_SetMaster_f
Make a master server current
====================
*/
void Master_ClearAll(void);
void Master_Add(char *stringadr);
void SV_SetMaster_f (void)
{
int i;
@ -182,21 +185,33 @@ SV_Logfile_f
*/
void SV_Logfile_f (void)
{
char name[MAX_OSPATH];
extern cvar_t log_enable, log_dir, log_name;
extern char gamedirfile[];
extern char *com_basedir;
if (con_debuglog)
if (log_enable.value)
{
Con_TPrintf (STL_LOGGINGOFF);
con_debuglog = false;
return;
Cvar_SetValue(&log_enable, 0);
Con_Print("Logging disabled.\n");
}
else
{
char *d, *f;
sprintf (name, "%s/qconsole.log", com_gamedir);
Con_TPrintf (STL_LOGGINGTO, name);
con_debuglog = true;
d = gamedirfile;
if (log_dir.string[0])
d = log_dir.string;
f = "qconsole";
if (log_name.string[0])
f = log_name.string;
Cvar_SetValue(&log_enable, 1);
Con_Print(va("Logging to %s/%s/%s.log.\n", com_basedir, d, f));
}
}
/*
============
SV_Fraglogfile_f
@ -1262,6 +1277,13 @@ void SV_SaveInfos(FILE *f)
SV_SaveInfo(f, localinfo, "localinfo");
}
/*
void SV_ResetInfos(void)
{
// TODO: add me
}
*/
/*
===========
SV_User_f

View file

@ -171,7 +171,6 @@ char cvargroup_serverinfo[] = "serverinfo variables";
char cvargroup_serverphysics[] = "server physics variables";
char cvargroup_servercontrol[] = "server control variables";
FILE *sv_logfile;
FILE *sv_fraglogfile;
void SV_FixupName(char *in, char *out);
@ -195,11 +194,6 @@ Quake calls this before calling Sys_Quit or Sys_Error
void SV_Shutdown (void)
{
Master_Shutdown ();
if (sv_logfile)
{
fclose (sv_logfile);
sv_logfile = NULL;
}
if (sv_fraglogfile)
{
fclose (sv_fraglogfile);

View file

@ -134,7 +134,6 @@ Handles cursor positioning, line wrapping, etc
#define MAXPRINTMSG 4096
// FIXME: make a buffer size safe vsprintf?
#ifdef SERVERONLY
qboolean con_debuglog;
void VARGS Con_Printf (const char *fmt, ...)
{
va_list argptr;
@ -155,9 +154,7 @@ void VARGS Con_Printf (const char *fmt, ...)
}
Sys_Printf ("%s", msg); // also echo to debugging console
if (con_debuglog)
Sys_DebugLog(va("%s/qconsole.log",com_gamedir), "%s", msg);
Con_Log(msg); // log to console
}
void Con_TPrintf (translation_t stringnum, ...)
{
@ -186,9 +183,7 @@ void Con_TPrintf (translation_t stringnum, ...)
va_end (argptr);
Sys_Printf ("%s", msg); // also echo to debugging console
if (con_debuglog)
Sys_DebugLog(va("%s/qconsole.log",com_gamedir), "%s", msg);
Con_Log(msg); // log to console
}
/*
================

View file

@ -260,12 +260,6 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void
return go;
}
void Sys_ErrorLog(char *text, FILE *f)
{
fprintf(f, "---------------\nSYS_ERROR:\n%s\n", text);
}
/*
================
Sys_Error
@ -277,7 +271,6 @@ void Sys_Error (const char *error, ...)
va_list argptr;
char text[1024];
double end;
FILE *crashlog;
va_start (argptr,error);
_vsnprintf (text,sizeof(text)-1, error,argptr);
@ -287,24 +280,7 @@ void Sys_Error (const char *error, ...)
// MessageBox(NULL, text, "Error", 0 /* MB_OK */ );
Sys_Printf ("ERROR: %s\n", text);
if (sv_logfile)
{
Sys_ErrorLog(text, sv_logfile);
}
else
{
char name[1024];
sprintf (name, "%s/qconsole.log", com_gamedir);
Con_TPrintf (STL_LOGGINGTO, name);
crashlog = fopen (name, "wb");
if (!crashlog)
Con_TPrintf (STL_ERRORCOULDNTOPEN);
else
Sys_ErrorLog(text, crashlog);
}
Con_Log(text);
NET_Shutdown(); //free sockets and stuff.