improve 343cf73d29, force net send via dedicated thread loop

replace Sys_Sleep()
This commit is contained in:
Garux
2025-01-04 04:08:06 +05:00
parent c24359215c
commit 3e1871d0ef
5 changed files with 51 additions and 84 deletions
+8 -4
View File
@@ -378,13 +378,17 @@ void NMSG_WriteFloat( netmessage_t *msg, float c ){
// Returns: -
// Changes Globals: -
//===========================================================================
void NMSG_WriteString( netmessage_t *msg, char *string ){
if ( msg->size + strlen( string ) + 1 >= MAX_NETMESSAGE ) {
void NMSG_WriteString_n( netmessage_t *msg, const char *string, int n ){
if ( msg->size + n >= MAX_NETMESSAGE ) {
WinPrint( "NMSG_WriteString: overflow\n" );
return;
} //end if
memcpy( &msg->data[msg->size], string, strlen( string ) + 1 );
msg->size += strlen( string ) + 1;
memcpy( &msg->data[msg->size], string, n );
msg->size += n;
}
void NMSG_WriteString( netmessage_t *msg, const char *string ){
NMSG_WriteString_n( msg, string, strlen( string ) );
} //end of the function NMSG_WriteString
//===========================================================================
//
+2 -1
View File
@@ -90,7 +90,8 @@ void NMSG_WriteByte( netmessage_t *msg, int c );
void NMSG_WriteShort( netmessage_t *msg, int c );
void NMSG_WriteLong( netmessage_t *msg, int c );
void NMSG_WriteFloat( netmessage_t *msg, float c );
void NMSG_WriteString( netmessage_t *msg, char *string );
void NMSG_WriteString_n( netmessage_t *msg, const char *string, int n );
void NMSG_WriteString( netmessage_t *msg, const char *string );
void NMSG_ReadStart( netmessage_t *msg );
int NMSG_ReadChar( netmessage_t *msg );
int NMSG_ReadByte( netmessage_t *msg );