diff --git a/CHANGELOG.txt b/CHANGELOG.txt index df93538c1..76ae6d8f2 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 -------- diff --git a/d1x.ini b/d1x.ini index 7bdef37f0..55526b906 100644 --- a/d1x.ini +++ b/d1x.ini @@ -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 Use IPX network number -;-ip_hostaddr Use as host ip address ;-ip_baseport Use

as offset from normal port ;-ip_relay Relay players with closed port over host (increases traffic and lag) diff --git a/include/args.h b/include/args.h index f0a019110..96174e99e 100644 --- a/include/args.h +++ b/include/args.h @@ -69,7 +69,6 @@ typedef struct Arg int MplNoRedundancy; int MplPlayerMessages; const char *MplIpxNetwork; - char *MplIpHostAddr; int MplIpBasePort; int MplIpRelay; int DbgVerbose; diff --git a/main/config.c b/main/config.c index 31b587da2..824ee1d16 100644 --- a/main/config.c +++ b/main/config.c @@ -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); diff --git a/main/config.h b/main/config.h index bf38f64d0..e50b2c198 100644 --- a/main/config.h +++ b/main/config.h @@ -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; diff --git a/main/inferno.c b/main/inferno.c index 909d08fa3..567b71625 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -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 %s\n", "Use IPX network number "); - printf( " -ip_hostaddr %s\n", "Use as host ip address"); printf( " -ip_baseport %s\n", "Use 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 diff --git a/main/menu.c b/main/menu.c index fff73d113..583d30971 100644 --- a/main/menu.c +++ b/main/menu.c @@ -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 diff --git a/misc/args.c b/misc/args.c index 841a12da8..771e9b202 100644 --- a/misc/args.c +++ b/misc/args.c @@ -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");