Add wrapper for reading netmsg types

This commit is contained in:
Kawe Mazidjatari 2023-08-21 16:28:04 +02:00
parent 8c87ad219f
commit d528ec69f1
2 changed files with 15 additions and 0 deletions

View File

@ -178,6 +178,19 @@ void NET_RemoveChannel(CClient* pClient, int nIndex, const char* szReason, uint8
g_ServerPlayer[nIndex].Reset(); // Reset ServerPlayer slot.
#endif // !CLIENT_DLL
}
//-----------------------------------------------------------------------------
// Purpose: reads the net message type from buffer
// Input : &outType -
// &buffer -
// Output : true on success, false otherwise
//-----------------------------------------------------------------------------
bool NET_ReadMessageType(int* outType, bf_read* buffer)
{
*outType = buffer->ReadUBitLong(NETMSG_TYPE_BITS);
return !buffer->IsOverflowed();
}
#endif // !NETCONSOLE
//-----------------------------------------------------------------------------

View File

@ -48,6 +48,8 @@ void NET_GenerateKey();
void NET_PrintFunc(const char* fmt, ...);
void NET_RemoveChannel(CClient* pClient, int nIndex, const char* szReason, uint8_t bBadRep, bool bRemoveNow);
bool NET_ReadMessageType(int* outType, bf_read* buffer);
///////////////////////////////////////////////////////////////////////////////
extern netadr_t* g_pNetAdr;
extern netkey_t* g_pNetKey;