From 36f756feeb151681b16954ce19ae92abb662e3dc Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 14 Apr 2018 02:51:00 +0300 Subject: [PATCH] Avoid some struct declarations inside paramater list, it makes even GCC7 confusing --- engine/common/net_encode.h | 41 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/engine/common/net_encode.h b/engine/common/net_encode.h index aa7bf02f..d372666e 100644 --- a/engine/common/net_encode.h +++ b/engine/common/net_encode.h @@ -26,6 +26,7 @@ GNU General Public License for more details. #define DT_STRING BIT( 7 ) // A null terminated string, sent as 8 byte chars #define DT_SIGNED BIT( 8 ) // sign modificator +#undef offsetof #define offsetof( s, m ) (size_t)&(((s *)0)->m) #define NUM_FIELDS( x ) ((sizeof( x ) / sizeof( x[0] )) - 1) @@ -95,8 +96,8 @@ void Delta_AddEncoder( char *name, pfnDeltaEncode encodeFunc ); int Delta_FindField( delta_t *pFields, const char *fieldname ); void Delta_SetField( delta_t *pFields, const char *fieldname ); void Delta_UnsetField( delta_t *pFields, const char *fieldname ); -void Delta_SetFieldByIndex( struct delta_s *pFields, int fieldNumber ); -void Delta_UnsetFieldByIndex( struct delta_s *pFields, int fieldNumber ); +void Delta_SetFieldByIndex( delta_t *pFields, int fieldNumber ); +void Delta_UnsetFieldByIndex( delta_t *pFields, int fieldNumber ); // send table over network void Delta_WriteTableField( sizebuf_t *msg, int tableIndex, const delta_t *pField ); @@ -104,18 +105,24 @@ void Delta_ParseTableField( sizebuf_t *msg ); // encode routines -void MSG_WriteDeltaUsercmd( sizebuf_t *msg, struct usercmd_s *from, struct usercmd_s *to ); -void MSG_ReadDeltaUsercmd( sizebuf_t *msg, struct usercmd_s *from, struct usercmd_s *to ); -void MSG_WriteDeltaEvent( sizebuf_t *msg, struct event_args_s *from, struct event_args_s *to ); -void MSG_ReadDeltaEvent( sizebuf_t *msg, struct event_args_s *from, struct event_args_s *to ); -qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, struct movevars_s *from, struct movevars_s *to ); -void MSG_ReadDeltaMovevars( sizebuf_t *msg, struct movevars_s *from, struct movevars_s *to ); -void MSG_WriteClientData( sizebuf_t *msg, struct clientdata_s *from, struct clientdata_s *to, float timebase ); -void MSG_ReadClientData( sizebuf_t *msg, struct clientdata_s *from, struct clientdata_s *to, float timebase ); -void MSG_WriteWeaponData( sizebuf_t *msg, struct weapon_data_s *from, struct weapon_data_s *to, float timebase, int index ); -void MSG_ReadWeaponData( sizebuf_t *msg, struct weapon_data_s *from, struct weapon_data_s *to, float timebase ); -void MSG_WriteDeltaEntity( struct entity_state_s *from, struct entity_state_s *to, sizebuf_t *msg, qboolean force, qboolean pl, float tbase, int bl ); -qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, struct entity_state_s *from, struct entity_state_s *to, int num, qboolean player, float timebase ); -int Delta_TestBaseline( struct entity_state_s *from, struct entity_state_s *to, qboolean player, float timebase ); - -#endif//NET_ENCODE_H \ No newline at end of file +typedef struct entity_state_s entity_state_t; +typedef struct usercmd_s usercmd_t; +typedef struct event_args_s event_args_t; +typedef struct movevars_s movevars_t; +typedef struct clientdata_s clientdata_t; +typedef struct weapon_data_s weapon_data_t; +void MSG_WriteDeltaUsercmd( sizebuf_t *msg, usercmd_t *from, usercmd_t *to ); +void MSG_ReadDeltaUsercmd( sizebuf_t *msg, usercmd_t *from, usercmd_t *to ); +void MSG_WriteDeltaEvent( sizebuf_t *msg, event_args_t *from, event_args_t *to ); +void MSG_ReadDeltaEvent( sizebuf_t *msg, event_args_t *from, event_args_t *to ); +qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *to ); +void MSG_ReadDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *to ); +void MSG_WriteClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to, float timebase ); +void MSG_ReadClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to, float timebase ); +void MSG_WriteWeaponData( sizebuf_t *msg, weapon_data_t *from, weapon_data_t *to, float timebase, int index ); +void MSG_ReadWeaponData( sizebuf_t *msg, weapon_data_t *from, weapon_data_t *to, float timebase ); +void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, qboolean pl, float tbase, int bl ); +qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state_t *to, int num, qboolean player, float timebase ); +int Delta_TestBaseline( entity_state_t *from, entity_state_t *to, qboolean player, float timebase ); + +#endif//NET_ENCODE_H