Fixes and improvements on -ip_hostaddr

This commit is contained in:
zicodxx 2007-08-09 12:28:28 +00:00
parent 0b523c15be
commit 1d2b2bb614
2 changed files with 19 additions and 6 deletions

View file

@ -3,6 +3,7 @@ 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
main/menu.c: Fixes and improvements on -ip_hostaddr
20070808
--------

View file

@ -1006,23 +1006,35 @@ void do_ip_manual_join_menu()
{
int menu_choice[3];
newmenu_item m[3];
int choice = 0, num_options = 0;
int choice = 0, num_options = 0, j = 0;
int old_game_mode;
// char buf[128]="";
char buf[128]="";
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;
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++;
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++;
choice = newmenu_do1( NULL, "ENTER IP OR HOSTNAME", num_options, m, NULL, choice );
if ( choice > -1 )
ip_connect_manual(GameArg.MplIpHostAddr);
if ( choice > -1 ){
ip_connect_manual(buf);
}
if (old_game_mode != Game_mode)
break; // leave menu
break; // leave menu
} while( choice > -1 );
}
#endif // NETWORK