engine: common: net_encode: directly access delta description struct than searching for it every time

This commit is contained in:
Alibek Omarov
2023-06-27 19:56:30 +03:00
parent 82addf11bb
commit f5b9826fd9
3 changed files with 98 additions and 96 deletions

View File

@@ -1567,27 +1567,6 @@ void SV_BuildReconnect( sizebuf_t *msg )
MSG_WriteString( msg, "reconnect\n" );
}
/*
==================
SV_WriteDeltaDescriptionToClient
send delta communication encoding
==================
*/
void SV_WriteDeltaDescriptionToClient( sizebuf_t *msg )
{
int tableIndex;
int fieldIndex;
for( tableIndex = 0; tableIndex < Delta_NumTables(); tableIndex++ )
{
delta_info_t *dt = Delta_FindStructByIndex( tableIndex );
for( fieldIndex = 0; fieldIndex < dt->numFields; fieldIndex++ )
Delta_WriteTableField( msg, tableIndex, &dt->pFields[fieldIndex] );
}
}
/*
================
SV_SendServerdata
@@ -1632,7 +1611,7 @@ void SV_SendServerdata( sizebuf_t *msg, sv_client_t *cl )
}
// send delta-encoding
SV_WriteDeltaDescriptionToClient( msg );
Delta_WriteDescriptionToClient( msg );
// now client know delta and can reading encoded messages
SV_FullUpdateMovevars( cl, msg );