diff --git a/src/configuration.c b/src/configuration.c index 9dba98a..1ed6484 100644 --- a/src/configuration.c +++ b/src/configuration.c @@ -146,7 +146,6 @@ ReadConfig () value[LEN_GAMENAME - 1] = 0; strcpy (bman.gamename, value); } - if (!strcmp (keyword, "askplayername")) { bman.askplayername = atoi (value); } @@ -166,11 +165,20 @@ ReadConfig () 510); } value[511] = 0; - strcpy(bman.fieldpath,value); + strcpy(bman.fieldpath,value); } if (!strcmp (keyword, "firewall")) { bman.firewall = atoi (value); } + if (!strcmp (keyword, "udpport")) { + if (strlen (value) > LEN_PORT) { + d_printf + ("*** Error - servername too long (maximum size permitted is %d characters)!\n\n", + LEN_PORT); + } + value[LEN_PORT - 1] = 0; + strcpy (bman.port, value); + } if (!strcmp (keyword, "ai_players")) { bman.ai_players = atoi (value); } @@ -240,6 +248,7 @@ WriteConfig () fprintf (config, "tileset=%s\n", gfx.tileset); fprintf (config, "fieldpath=%s\n", bman.fieldpath); fprintf (config, "firewall=%d\n", bman.firewall); + fprintf (config, "udpport=%s\n", bman.port); fprintf (config, "ai_players=%d\n", bman.ai_players); fprintf (config, "fieldsizex=%d\n", bman.fieldsize.x); fprintf (config, "fieldsizey=%d\n", bman.fieldsize.y); diff --git a/src/netmenu.c b/src/netmenu.c index ae7f03d..330c84f 100644 --- a/src/netmenu.c +++ b/src/netmenu.c @@ -77,10 +77,11 @@ networkmenu_options () {1, "Game Name:"}, {1, "Max Players:"}, {2, "Network"}, - {3, "Notify Masterserver"}, - {4, "Masterserver"}, - {5, "Behind a Firewall"}, - {6, "Return To Multiplayer Menu"}, + {3, "UDP Port"}, + {4, "Notify Masterserver"}, + {5, "Masterserver"}, + {6, "Behind a Firewall"}, + {7, "Return To Multiplayer Menu"}, {-1, ""} }; #ifdef _WIN32 @@ -96,17 +97,19 @@ networkmenu_options () else sprintf (menu[2].text, "Network: IPv6"); - if (bman.firewall) - sprintf (menu[5].text, "Firewall: ON"); - else - sprintf (menu[5].text, "Firewall: OFF"); + sprintf (menu[3].text, "UDP Port: %s", bman.port); if (bman.notifygamemaster) - sprintf (menu[3].text, "Notify MasterServer: Yes"); + sprintf (menu[4].text, "Notify MasterServer: Yes"); else - sprintf (menu[3].text, "Notify MasterServer: No"); + sprintf (menu[4].text, "Notify MasterServer: No"); - sprintf (menu[4].text, "MasterServer %s", bman.gamemaster); + sprintf (menu[5].text, "MasterServer %s", bman.gamemaster); + + if (bman.firewall) + sprintf (menu[6].text, "Firewall: ON"); + else + sprintf (menu[6].text, "Firewall: OFF"); menuselect = menu_loop ("Multiplayer Options", menu, menuselect); @@ -135,26 +138,31 @@ networkmenu_options () #endif break; - case (3): // Change the Notification + case (3): // UDP Port + menu_get_text ("UDP Port", bman.port, + LEN_PORT + 1); + break; + + case (4): // Change the Notification if (bman.notifygamemaster) bman.notifygamemaster = 0; else bman.notifygamemaster = 1; break; - case (4): // Masterserver Address + case (5): // Masterserver Address menu_get_text ("Address of the MasterServer", bman.gamemaster, LEN_SERVERNAME + LEN_PORT + 2); break; - case (5): // Firewall Option + case (6): // Firewall Option if (bman.firewall) bman.firewall = 0; else bman.firewall = 1; break; - case (6): + case (7): menuselect = -1; break; }