Readded -ip_hostaddr optional to the value stored in descent.cfg for automated program starts or whatever; Fix by Locate: Correctly close UDP sockets on Win32; Fix by Locate: Ability to select Secret levels on Multiplayer in D1X again which was broken in r619
This commit is contained in:
parent
d5da444a40
commit
c09620f160
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
|||
20081020
|
||||
--------
|
||||
main/menu.c: resolution 1440x960 to 1440x900 - typo
|
||||
d1x.ini, include/args.h, main/inferno.c, main/menu.c, main/netdrv_udp.c, main/network.c, misc/args.c: Readded -ip_hostaddr optional to the value stored in descent.cfg for automated program starts or whatever; Fix by Locate: Correctly close UDP sockets on Win32; Fix by Locate: Ability to select Secret levels on Multiplayer in D1X again which was broken in r619
|
||||
|
||||
20081019
|
||||
--------
|
||||
|
|
1
d1x.ini
1
d1x.ini
|
@ -41,3 +41,4 @@
|
|||
;-ipxnetwork <n> Use IPX network number <n>
|
||||
;-ip_baseport <n> Use <p> as offset from normal port
|
||||
;-ip_relay Relay players with closed port over host (increases traffic and lag)
|
||||
;-ip_hostaddr <n> Use <n> as host ip address
|
||||
|
|
|
@ -72,6 +72,7 @@ typedef struct Arg
|
|||
const char *MplIpxNetwork;
|
||||
int MplIpBasePort;
|
||||
int MplIpRelay;
|
||||
char *MplIpHostAddr;
|
||||
int DbgVerbose;
|
||||
int DbgNoRun;
|
||||
int DbgRenderStats;
|
||||
|
|
|
@ -178,6 +178,7 @@ void show_commandline_help()
|
|||
printf( " -ipxnetwork <n> %s\n", "Use IPX network number <n>");
|
||||
printf( " -ip_baseport <n> %s\n", "Use <n> as offset from normal port (allows multiple instances of d1x to be run on a single computer)");
|
||||
printf( " -ip_relay %s\n", "Relay players with closed port over host (increases traffic and lag)");
|
||||
printf( " -ip_hostaddr <n> %s\n", "Use <n> as host ip address");
|
||||
#endif // NETWORK
|
||||
|
||||
#ifdef EDITOR
|
||||
|
|
11
main/menu.c
11
main/menu.c
|
@ -844,6 +844,17 @@ void do_ip_manual_join_menu()
|
|||
}
|
||||
}
|
||||
|
||||
if (*GameArg.MplIpHostAddr) {
|
||||
sprintf(buf,"%s",GameArg.MplIpHostAddr);
|
||||
|
||||
for (j=0; buf[j] != '\0'; j++) {
|
||||
switch (buf[j]) {
|
||||
case ' ':
|
||||
buf[j] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
old_game_mode = Game_mode;
|
||||
num_options = 0;
|
||||
|
|
|
@ -29,9 +29,10 @@
|
|||
#include "key.h"
|
||||
#include "text.h"
|
||||
|
||||
int UDP_sock;
|
||||
int UDP_sock = -1;
|
||||
unsigned int myid=0; // My personal ID which I will get from host and will be used for IPX-Node
|
||||
struct peer_list UDPPeers[MAX_CONNECTIONS]; // The Peer list.
|
||||
void UDPCloseSocket(socket_t *unused);
|
||||
|
||||
// Receive Configuration: Exchanging Peers, doing Handshakes, etc.
|
||||
void UDPReceiveCFG(char *text, struct _sockaddr *sAddr)
|
||||
|
@ -392,8 +393,15 @@ int UDPOpenSocket(socket_t *unused, int port)
|
|||
{
|
||||
int i;
|
||||
|
||||
// close stale socket
|
||||
if( UDP_sock != -1 )
|
||||
UDPCloseSocket(NULL);
|
||||
|
||||
#ifdef _WIN32
|
||||
struct _sockaddr sAddr; // my address information
|
||||
int reuse_on = -1;
|
||||
|
||||
memset( &sAddr, '\0', sizeof( sAddr ) );
|
||||
|
||||
if ((UDP_sock = socket (_af, SOCK_DGRAM, 0)) == -1) {
|
||||
con_printf(CON_URGENT,"UDPOpenSocket: socket creation failed\n");
|
||||
|
@ -401,6 +409,11 @@ int UDPOpenSocket(socket_t *unused, int port)
|
|||
return -1;
|
||||
}
|
||||
|
||||
// this is pretty annoying in win32. Not doing that will lead to
|
||||
// "Could not bind name to socket" errors. It may be suitable for other
|
||||
// socket implementations, too
|
||||
(void)setsockopt( UDP_sock, SOL_SOCKET, SO_REUSEADDR, (const char *) &reuse_on, sizeof( reuse_on ));
|
||||
|
||||
#ifdef IPv6
|
||||
sAddr.sin6_family = _pf; // host byte order
|
||||
sAddr.sin6_port = htons (GameArg.MplIpBasePort+UDP_BASEPORT);; // short, network byte order
|
||||
|
@ -415,9 +428,11 @@ int UDPOpenSocket(socket_t *unused, int port)
|
|||
|
||||
memset (&(sAddr.sin_zero), '\0', 8); // zero the rest of the struct
|
||||
|
||||
if (bind (UDP_sock, (struct sockaddr *) &sAddr, sizeof (struct sockaddr)) == -1) {
|
||||
if (bind (UDP_sock, (struct sockaddr *) &sAddr, sizeof (struct sockaddr)) == -1)
|
||||
{
|
||||
con_printf(CON_URGENT,"UDPOpenSocket: bind name to socket failed\n");
|
||||
nm_messagebox(TXT_ERROR,1,TXT_OK,"Could not bind name to socket");
|
||||
UDPCloseSocket(NULL);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
|
@ -469,7 +484,7 @@ int UDPOpenSocket(socket_t *unused, int port)
|
|||
{
|
||||
con_printf(CON_URGENT,"UDPOpenSocket: bind name to socket failed\n");
|
||||
nm_messagebox(TXT_ERROR,1,TXT_OK,"Could not bind name to socket");
|
||||
close (UDP_sock);
|
||||
UDPCloseSocket(NULL);
|
||||
freeaddrinfo (res);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -2057,12 +2057,18 @@ menu:
|
|||
|
||||
Netgame.levelnum = atoi(slevel);
|
||||
|
||||
if ((Netgame.levelnum < 1) || (Netgame.levelnum > Last_level))
|
||||
if (!strnicmp(slevel, "s", 1))
|
||||
Netgame.levelnum = -atoi(slevel+1);
|
||||
else
|
||||
Netgame.levelnum = atoi(slevel);
|
||||
|
||||
if ((Netgame.levelnum < Last_secret_level) || (Netgame.levelnum > Last_level) || (Netgame.levelnum == 0))
|
||||
{
|
||||
nm_messagebox(TXT_ERROR, 1, TXT_OK, TXT_LEVEL_OUT_RANGE );
|
||||
sprintf(slevel, "1");
|
||||
goto menu;
|
||||
}
|
||||
|
||||
if ( m[opt_mode].value )
|
||||
Netgame.gamemode = NETGAME_ANARCHY;
|
||||
|
||||
|
@ -3746,7 +3752,14 @@ int show_game_stats(int choice)
|
|||
else
|
||||
info+=sprintf(info,Active_games[choice].mission_title);
|
||||
|
||||
info+=sprintf (info," - Lvl %i",Active_games[choice].levelnum);
|
||||
if( Active_games[choice].levelnum >= 0 )
|
||||
{
|
||||
info+=sprintf (info," - Lvl %i",Active_games[choice].levelnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
info+=sprintf (info," - Lvl S%i",(Active_games[choice].levelnum*-1));
|
||||
}
|
||||
#endif
|
||||
info+=sprintf (info,"\n\nDifficulty: %s",MENU_DIFFICULTY_TEXT(Active_games[choice].difficulty));
|
||||
info+=sprintf (info,"\nGame Mode: %s",NetworkModeNames[Active_games[choice].gamemode]);
|
||||
|
|
|
@ -184,6 +184,7 @@ void ReadCmdArgs(void)
|
|||
GameArg.MplIpxNetwork = get_str_arg("-ipxnetwork", NULL);
|
||||
GameArg.MplIpBasePort = get_int_arg("-ip_baseport", 0);
|
||||
GameArg.MplIpRelay = FindArg("-ip_relay");
|
||||
GameArg.MplIpHostAddr = get_str_arg("-ip_hostaddr", "");
|
||||
|
||||
// Editor Options
|
||||
|
||||
|
|
Loading…
Reference in a new issue