Fixed linux stuff

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1980 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-02-21 19:02:42 +00:00
parent f3a67176f4
commit 5e2c8dac61
2 changed files with 16 additions and 4 deletions

View File

@ -38,11 +38,13 @@ void NET_SendPacket(cluster_t *cluster, SOCKET sock, int length, char *data, net
int Netchan_IsLocal (netadr_t adr)
{
struct sockaddr_in *sadr = (struct sockaddr_in *)adr;
unsigned char *bytes;
bytes = (char *)&sadr->sin_addr;
if (sadr->sin_addr.S_un.S_un_b.s_b1 == 127 &&
sadr->sin_addr.S_un.S_un_b.s_b2 == 0 &&
sadr->sin_addr.S_un.S_un_b.s_b3 == 0 &&
sadr->sin_addr.S_un.S_un_b.s_b4 == 1)
if (bytes[0] == 127 &&
bytes[1] == 0 &&
bytes[2] == 0 &&
bytes[3] == 1)
return true;
return false;
}

View File

@ -1078,7 +1078,12 @@ void QTV_Say(cluster_t *cluster, sv_t *qtv, viewer_t *v, char *message)
}
else if (!strcmp(v->expectcommand, "addserver"))
{
#ifdef _WIN32
_snprintf(buf, sizeof(buf), "tcp:%s", message);
buf[suzeof(buf)-1] = '\0';
#else
snprintf(buf, sizeof(buf), "tcp:%s", message);
#endif
qtv = QTV_NewServerConnection(cluster, buf, false);
if (qtv)
{
@ -1105,7 +1110,12 @@ void QTV_Say(cluster_t *cluster, sv_t *qtv, viewer_t *v, char *message)
}
else if (!strcmp(v->expectcommand, "adddemo"))
{
#ifdef _WIN32
_snprintf(buf, sizeof(buf), "file:%s", message);
buf[sizeof(buf)-1] = '\0';
#else
snprintf(buf, sizeof(buf), "file:%s", message);
#endif
qtv = QTV_NewServerConnection(cluster, buf, false);
if (!qtv)
QW_PrintfToViewer(v, "Failed to play demo \"%s\"\n", message);