Skip to content

Commit

Permalink
fix warnings + net msg type
Browse files Browse the repository at this point in the history
  • Loading branch information
wootguy committed Nov 3, 2024
1 parent f85e1fa commit d2b7dcb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions dlls/monster/CShockTrooper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,7 @@ void CShockTrooper::HandleAnimEvent(MonsterEvent_t* pEvent)

GetAttachment(0, vecArmPos, vecArmAngles);

//MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, vecArmPos);
MESSAGE_BEGIN(MSG_ALL, SVC_TEMPENTITY, vecArmPos);
MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, vecArmPos);
WRITE_BYTE(TE_SPRITE);
WRITE_COORD(vecArmPos.x);
WRITE_COORD(vecArmPos.y);
Expand Down
2 changes: 1 addition & 1 deletion dlls/net/Socket_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SocketData * Socket::createSocket(const char * addr, const char * port)
if (sock->sock == -1)
{
ALERT(at_console, "Socket creation failed\n");
delete sock;
delete (SocketData*)sock;
return NULL;
}

Expand Down
18 changes: 9 additions & 9 deletions dlls/net/Socket_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ struct SocketData

SocketData * Socket::createSocket(const char * addr, const char * port)
{
SocketData * skt = new SocketData;
SocketData * sdat = new SocketData;
// Resolve the local address and port to be used by the server
addrinfo * hints = (socketType & SOCKET_TCP) ? &tcphints : &udphints;
int ret = getaddrinfo(addr, port, hints, &skt->addr);
int ret = getaddrinfo(addr, port, hints, &sdat->addr);

if (ret != 0)
{
Expand All @@ -45,12 +45,12 @@ SocketData * Socket::createSocket(const char * addr, const char * port)
}

// create the socket
skt->sock = socket(skt->addr->ai_family, skt->addr->ai_socktype, skt->addr->ai_protocol);
sdat->sock = socket(sdat->addr->ai_family, sdat->addr->ai_socktype, sdat->addr->ai_protocol);

if (skt->sock == INVALID_SOCKET)
if (sdat->sock == INVALID_SOCKET)
{
ALERT(at_console, "Socket creation failed at socket(): %d\n", WSAGetLastError());
freeaddrinfo(skt->addr);
freeaddrinfo(sdat->addr);
delete skt;
return NULL;
}
Expand All @@ -59,11 +59,11 @@ SocketData * Socket::createSocket(const char * addr, const char * port)
if (!(socketType & SOCKET_BLOCKING))
{
u_long iMode = 1;
ret = ioctlsocket(skt->sock, FIONBIO, &iMode);
ret = ioctlsocket(sdat->sock, FIONBIO, &iMode);
if (ret == SOCKET_ERROR)
{
ALERT(at_console, "Failed to set socket to non-blocking: %d\n", WSAGetLastError());
freeaddrinfo(skt->addr);
freeaddrinfo(sdat->addr);
delete skt;
return NULL;
}
Expand All @@ -72,10 +72,10 @@ SocketData * Socket::createSocket(const char * addr, const char * port)
if (socketType & SOCKET_UDP) {
BOOL bNewBehavior = FALSE;
DWORD dwBytesReturned = 0;
WSAIoctl(skt->sock, WSAECONNRESET, &bNewBehavior, sizeof bNewBehavior, NULL, 0, &dwBytesReturned, NULL, NULL);
WSAIoctl(sdat->sock, WSAECONNRESET, &bNewBehavior, sizeof bNewBehavior, NULL, 0, &dwBytesReturned, NULL, NULL);
}

return skt;
return sdat;
}

Socket::Socket()
Expand Down

0 comments on commit d2b7dcb

Please sign in to comment.