1
0
Fork 0
forked from fte/fteqw

fix for NQ mods that write out strings using WriteByte (such as conquest)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2319 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-06-08 02:04:41 +00:00
parent 323dec50b8
commit 7830dc402a

View file

@ -207,12 +207,13 @@ void NPP_NQFlush(void)
} }
bufferlen = 0; bufferlen = 0;
protocollen=0; protocollen=0;
nullterms = 0;
multicastpos=0; multicastpos=0;
requireextension=0; requireextension=0;
} }
void NPP_NQCheckFlush(void) void NPP_NQCheckFlush(void)
{ {
if (bufferlen >= protocollen && protocollen) if (bufferlen >= protocollen && protocollen && !nullterms)
NPP_NQFlush(); NPP_NQFlush();
} }
@ -268,6 +269,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
} else } else
MSG_WriteByte (NQWriteDest(dest), data); MSG_WriteByte (NQWriteDest(dest), data);
#endif #endif
if (!bufferlen) //new message section if (!bufferlen) //new message section
{ {
switch(data) switch(data)
@ -284,6 +286,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
protocollen = sizeof(qbyte)*1 + sizeof(short); protocollen = sizeof(qbyte)*1 + sizeof(short);
break; break;
case svc_updatename: case svc_updatename:
nullterms = 1;
break; break;
case svc_setfrags: case svc_setfrags:
protocollen = 4; //or this protocollen = 4; //or this
@ -293,6 +296,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
break; break;
case svc_print: case svc_print:
protocollen = 3; protocollen = 3;
nullterms = 1;
break; break;
case svc_cdtrack: case svc_cdtrack:
protocollen = sizeof(qbyte)*3; protocollen = sizeof(qbyte)*3;
@ -321,6 +325,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
break; break;
case svc_stufftext: case svc_stufftext:
case svc_centerprint: case svc_centerprint:
nullterms = 1;
break; break;
case svc_clearviewflags: case svc_clearviewflags:
protocollen = 2; protocollen = 2;
@ -483,6 +488,9 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
} }
NPP_AddData(&data, sizeof(qbyte)); NPP_AddData(&data, sizeof(qbyte));
if (!data && bufferlen>=protocollen)
if (nullterms)
nullterms--;
NPP_NQCheckFlush(); NPP_NQCheckFlush();
} }
@ -630,6 +638,8 @@ void NPP_NQWriteString(int dest, char *data) //replacement write func (nq to qw)
} }
} }
if (nullterms)
nullterms--;
NPP_NQCheckFlush(); NPP_NQCheckFlush();
} }
void NPP_NQWriteEntity(int dest, short data) //replacement write func (nq to qw) void NPP_NQWriteEntity(int dest, short data) //replacement write func (nq to qw)