Set port on global netadr object

Set the port so it could be used to compare addresses.
This commit is contained in:
Kawe Mazidjatari 2023-04-16 11:58:37 +02:00
parent 35e0d9e8c8
commit a11012f3bf

View File

@ -75,6 +75,15 @@ unsigned int NET_Decompress(CLZSS* lzss, unsigned char* pInput, unsigned char* p
return lzss->SafeUncompress(pInput, pOutput, unBufSize);
}
//-----------------------------------------------------------------------------
// Purpose: configures the network system
//-----------------------------------------------------------------------------
void NET_Config()
{
v_NET_Config();
g_pNetAdr->SetPort(htons(u_short(hostport->GetInt())));
}
//-----------------------------------------------------------------------------
// Purpose: sets the user specified encryption key
// Input : svNetKey -
@ -300,6 +309,7 @@ const char* NET_ErrorString(int iCode)
///////////////////////////////////////////////////////////////////////////////
void VNet::Attach() const
{
DetourAttach((LPVOID*)&v_NET_Config, &NET_Config);
DetourAttach((LPVOID*)&v_NET_ReceiveDatagram, &NET_ReceiveDatagram);
DetourAttach((LPVOID*)&v_NET_SendDatagram, &NET_SendDatagram);
DetourAttach((LPVOID*)&v_NET_Decompress, &NET_Decompress);
@ -311,6 +321,7 @@ void VNet::Attach() const
void VNet::Detach() const
{
DetourDetach((LPVOID*)&v_NET_Config, &NET_Config);
DetourDetach((LPVOID*)&v_NET_ReceiveDatagram, &NET_ReceiveDatagram);
DetourDetach((LPVOID*)&v_NET_SendDatagram, &NET_SendDatagram);
DetourDetach((LPVOID*)&v_NET_Decompress, &NET_Decompress);