2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-28 21:10:16 +01:00

engine: net_encode: remove naive clientdata/weapondata copy, only copy fields explicitly listed in deltalst

This commit is contained in:
Alibek Omarov 2022-01-14 14:46:52 +03:00
parent 6e4ab74694
commit ea5937bce0

View File

@ -1605,6 +1605,7 @@ void MSG_ReadClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to, d
delta_t *pField;
delta_info_t *dt;
int i;
qboolean noChanges;
dt = Delta_FindStruct( "clientdata_t" );
Assert( dt && dt->bInitialized );
@ -1612,15 +1613,14 @@ void MSG_ReadClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to, d
pField = dt->pFields;
Assert( pField != NULL );
*to = *from;
if( !cls.legacymode && !MSG_ReadOneBit( msg ))
return; // we have no changes
noChanges = !cls.legacymode && !MSG_ReadOneBit( msg );
// process fields
for( i = 0; i < dt->numFields; i++, pField++ )
{
Delta_ReadField( msg, pField, from, to, timebase );
if( noChanges )
Delta_CopyField( pField, from, to, timebase );
else Delta_ReadField( msg, pField, from, to, timebase );
}
#endif
}
@ -1691,8 +1691,6 @@ void MSG_ReadWeaponData( sizebuf_t *msg, weapon_data_t *from, weapon_data_t *to,
pField = dt->pFields;
Assert( pField != NULL );
*to = *from;
// process fields
for( i = 0; i < dt->numFields; i++, pField++ )
{