From 0b523c15be0a72c1fdc1ab00655f4e909ee4d530 Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Wed, 8 Aug 2007 21:11:51 +0000 Subject: [PATCH] Added -ip_hostaddr argument to specify a host IP address via command-line/INI --- CHANGELOG.txt | 4 ++++ d2x.ini | 1 + include/args.h | 1 + main/inferno.c | 1 + main/menu.c | 6 +++--- misc/args.c | 5 +++++ 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 211303ebd..b6cab9934 100755 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D2X-Rebirth Changelog +20070809 +-------- +d2x.ini, include/args.h, main/inferno.c, main/menu.c, misc/args.c: Added -ip_hostaddr argument to specify a host IP address via command-line/INI + 20070808 -------- main/config.c, main/game.c, main/menu.c, main/movie.c, main/piggy.c, main/polyobj.c, main/titles.c, main/titles.h: Set default value for Game_screen_mode which is necessary if there's no config file yet; Made resolution switching more failsafe by not allowing resolutions below 320x200; Cleaned up briefings code (I hope so) diff --git a/d2x.ini b/d2x.ini index f496d45b5..2ac62e2dd 100755 --- a/d2x.ini +++ b/d2x.ini @@ -54,6 +54,7 @@ ;-playermessages View only messages from other players in multi - overrides -noredundancy ;-packets Specifies the number of packets per second ;-ipxnetwork Use IPX network number +;-ip_hostaddr Use as host ip address ;-ip_nogetmyaddr Prevent autodetection of local ip address ;-ip_myaddr Use as local ip address ;-ip_bind_addr Bind to instead of INADDR_ANY diff --git a/include/args.h b/include/args.h index 84876168f..74bbf5e30 100755 --- a/include/args.h +++ b/include/args.h @@ -82,6 +82,7 @@ typedef struct Arg int MplPlayerMessages; int MplPacketsPerSec; const char *MplIpxNetwork; + char *MplIpHostAddr; int MplIpNoGetMyAddr; char *MplIpMyAddr; int MplIpBasePort; diff --git a/main/inferno.c b/main/inferno.c index 265a30d3e..f5f291d06 100755 --- a/main/inferno.c +++ b/main/inferno.c @@ -203,6 +203,7 @@ void print_commandline_help() printf( " -playermessages %s\n", "View only messages from other players in multi - overrides -noredundancy"); printf( " -packets %s\n", "Specifies the number of packets per second\n"); printf( " -ipxnetwork %s\n", "Use IPX network number "); + printf( " -ip_hostaddr %s\n", "Use as host ip address"); printf( " -ip_nogetmyaddr %s\n", "Prevent autodetection of local ip address"); printf( " -ip_myaddr %s\n", "Use as local 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)"); diff --git a/main/menu.c b/main/menu.c index 7f78d5e09..a6b9b1c0b 100755 --- a/main/menu.c +++ b/main/menu.c @@ -1008,18 +1008,18 @@ void do_ip_manual_join_menu() newmenu_item m[3]; int choice = 0, num_options = 0; int old_game_mode; - char buf[128]=""; +// char buf[128]=""; do { old_game_mode = Game_mode; num_options = 0; - m[num_options].type = NM_TYPE_INPUT; m[num_options].text=buf; m[num_options].text_len=128;menu_choice[num_options]=-1; num_options++; + m[num_options].type = NM_TYPE_INPUT; m[num_options].text=GameArg.MplIpHostAddr; m[num_options].text_len=128;menu_choice[num_options]=-1; num_options++; choice = newmenu_do1( NULL, "ENTER IP OR HOSTNAME", num_options, m, NULL, choice ); if ( choice > -1 ) - ip_connect_manual(buf); + ip_connect_manual(GameArg.MplIpHostAddr); if (old_game_mode != Game_mode) break; // leave menu diff --git a/misc/args.c b/misc/args.c index 5df89f63d..198bbfb37 100755 --- a/misc/args.c +++ b/misc/args.c @@ -345,6 +345,11 @@ void ReadCmdArgs(void) else GameArg.MplIpxNetwork = NULL; + if ((t=FindArg("-ip_hostaddr"))) + GameArg.MplIpHostAddr = Args[t+1]; + else + GameArg.MplIpHostAddr = ""; + if (FindArg("-ip_nogetmyaddr")) GameArg.MplIpNoGetMyAddr = 1; else