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 a73153d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
6 changes: 3 additions & 3 deletions dlls/enginecallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ EXPORT void DEBUG_MSG(ALERT_TYPE target, const char* format, ...);

#if defined(PLUGIN_BUILD) && defined(PLUGIN_NAME)
#define ALERT(target, fmt, ...) { \
DEBUG_MSG(target, "[" PLUGIN_NAME "] "); \
DEBUG_MSG(target, fmt, ##__VA_ARGS__ ); \
DEBUG_MSG(target, "[" PLUGIN_NAME "] ", NULL); \
DEBUG_MSG(target, fmt, ##__VA_ARGS__, NULL); \
}
#else
#define ALERT DEBUG_MSG
#endif

#define print(...) {ALERT(at_console, __VA_ARGS__);}
#define println(...) {ALERT(at_console, __VA_ARGS__); DEBUG_MSG(at_console, "\n");}
#define println(...) {ALERT(at_console, __VA_ARGS__); DEBUG_MSG(at_console, "\n", NULL);}
#define ENGINE_FPRINTF (*g_engfuncs.pfnEngineFprintf)
#define ALLOC_PRIVATE (*g_engfuncs.pfnPvAllocEntPrivateData)
inline void *GET_PRIVATE( const edict_t *pent )
Expand Down
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
8 changes: 4 additions & 4 deletions 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 Expand Up @@ -101,7 +101,7 @@ Socket::Socket(int socketType, IPV4 addr)
if (ret == 0)
{
ALERT(at_console, "inet_aton() failed\n");
delete sock;
delete (SocketData*)sock;
return;
}
ALERT(at_console, "Created client socket on %s\n", addr.getString().c_str());
Expand All @@ -114,7 +114,7 @@ Socket::~Socket(void)
if (sock != NULL)
{
close(sock->sock);
delete sock;
delete (SocketData*)sock;
}
}

Expand Down Expand Up @@ -224,7 +224,7 @@ bool Socket::bind()
{
ALERT(at_console, "Socket listen failed with error: %s\n", strerror_r( err, buff, 256 ));
close(sock->sock);
delete skt;
delete (SocketData*)skt;
skt = NULL;
return false;
}
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 a73153d

Please sign in to comment.