remember the last IP address entered for UDP instead of parsing -ip_hostaddr

This commit is contained in:
kreatordxx 2008-05-16 11:39:27 +00:00
parent dfdea820dc
commit 3aa8f5ece7
8 changed files with 16 additions and 6 deletions

View file

@ -3,6 +3,7 @@ D1X-Rebirth Changelog
20080516
--------
main/multi.c, main/multibot.c, main/netpkt.c, main/network.c: fix remaining endian bugs in network code, now it works on the Mac
d1x.ini, include/args.h, main/config.c, main/config.h, main/inferno.c, main/menu.c, misc/args.c: remember the last IP address entered for UDP instead of parsing -ip_hostaddr
20080510
--------

View file

@ -38,6 +38,5 @@
;-noredundancy Do not send messages when picking up redundant items in multiplayer
;-playermessages View only messages from other players in multi - overrides -noredundancy
;-ipxnetwork <n> Use IPX network number <n>
;-ip_hostaddr <n> Use <n> as host ip address
;-ip_baseport <n> Use <p> as offset from normal port
;-ip_relay Relay players with closed port over host (increases traffic and lag)

View file

@ -69,7 +69,6 @@ typedef struct Arg
int MplNoRedundancy;
int MplPlayerMessages;
const char *MplIpxNetwork;
char *MplIpHostAddr;
int MplIpBasePort;
int MplIpRelay;
int DbgVerbose;

View file

@ -56,6 +56,7 @@ static char *VSyncStr="VSync";
static char *MultisampleStr="Multisample";
static char *JukeboxOnStr="JukeboxOn";
static char *JukeboxPathStr="JukeboxPath";
static char *IPHostAddrStr="IPHostAddr";
int ReadConfigFile()
{
@ -79,6 +80,7 @@ int ReadConfigFile()
GameCfg.Multisample = 0;
GameCfg.JukeboxOn = 0;
memset(GameCfg.JukeboxPath,0,PATH_MAX+1);
memset(GameCfg.MplIpHostAddr, 0, 128);
infile = PHYSFSX_openReadBuffered("descent.cfg");
@ -144,6 +146,12 @@ int ReadConfigFile()
p = strchr( GameCfg.JukeboxPath, '\n');
if ( p ) *p = 0;
}
else if (!strcmp(token, IPHostAddrStr)) {
char * p;
strncpy( GameCfg.MplIpHostAddr, value, 128 );
p = strchr( GameCfg.MplIpHostAddr, '\n');
if ( p ) *p = 0;
}
}
}
@ -188,6 +196,7 @@ int WriteConfigFile()
PHYSFSX_printf(infile, "%s=%i\n", MultisampleStr, GameCfg.Multisample);
PHYSFSX_printf(infile, "%s=%i\n", JukeboxOnStr, GameCfg.JukeboxOn);
PHYSFSX_printf(infile, "%s=%s\n", JukeboxPathStr, GameCfg.JukeboxPath );
PHYSFSX_printf(infile, "%s=%s\n", IPHostAddrStr, GameCfg.MplIpHostAddr );
PHYSFS_close(infile);

View file

@ -42,6 +42,7 @@ typedef struct Cfg
int Multisample;
int JukeboxOn;
char JukeboxPath[PATH_MAX+1];
char MplIpHostAddr[128];
} __pack__ Cfg;
extern struct Cfg GameCfg;

View file

@ -175,7 +175,6 @@ void show_commandline_help()
printf( " -noredundancy %s\n", "Do not send messages when picking up redundant items in multiplayer");
printf( " -playermessages %s\n", "View only messages from other players in multi - overrides -noredundancy");
printf( " -ipxnetwork <n> %s\n", "Use IPX network number <n>");
printf( " -ip_hostaddr <n> %s\n", "Use <n> as host ip address");
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)");
#endif // NETWORK

View file

@ -770,8 +770,8 @@ void do_ip_manual_join_menu()
int old_game_mode;
char buf[128]="";
if (GameArg.MplIpHostAddr) {
sprintf(buf,"%s",GameArg.MplIpHostAddr);
if (*GameCfg.MplIpHostAddr) {
sprintf(buf,"%s",GameCfg.MplIpHostAddr);
for (j=0; buf[j] != '\0'; j++) {
switch (buf[j]) {
@ -794,7 +794,10 @@ void do_ip_manual_join_menu()
}
if (old_game_mode != Game_mode)
{
strncpy(GameCfg.MplIpHostAddr, buf, 128);
break; // leave menu
}
} while( choice > -1 );
}
#endif

View file

@ -176,7 +176,6 @@ void ReadCmdArgs(void)
GameArg.MplNoRedundancy = FindArg("-noredundancy");
GameArg.MplPlayerMessages = FindArg("-playermessages");
GameArg.MplIpxNetwork = get_str_arg("-ipxnetwork", NULL);
GameArg.MplIpHostAddr = get_str_arg("-ip_hostaddr", "");
GameArg.MplIpBasePort = get_int_arg("-ip_baseport", 0);
GameArg.MplIpRelay = FindArg("-ip_relay");