avoid segfault from the 'viewpos' and 'viewtrace' commands when not

connected (e.g. right after the engine boots.)  make the 'entities'
command to only print when connected.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1479 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2017-08-20 23:15:43 +00:00
parent e65466405a
commit 9c26054be9

View file

@ -258,6 +258,9 @@ void CL_PrintEntities_f (void)
entity_t *ent; entity_t *ent;
int i; int i;
if (cls.state != ca_connected)
return;
for (i=0,ent=cl_entities ; i<cl.num_entities ; i++,ent++) for (i=0,ent=cl_entities ; i<cl.num_entities ; i++,ent++)
{ {
Con_Printf ("%3i:",i); Con_Printf ("%3i:",i);
@ -717,6 +720,9 @@ void CL_Tracepos_f (void)
{ {
vec3_t v, w; vec3_t v, w;
if (cls.state != ca_connected)
return;
VectorMA(r_refdef.vieworg, 8192.0, vpn, v); VectorMA(r_refdef.vieworg, 8192.0, vpn, v);
TraceLine(r_refdef.vieworg, v, w); TraceLine(r_refdef.vieworg, v, w);
@ -735,6 +741,8 @@ display client's position and angles
*/ */
void CL_Viewpos_f (void) void CL_Viewpos_f (void)
{ {
if (cls.state != ca_connected)
return;
#if 0 #if 0
//camera position //camera position
Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n", Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n",