Added the UDP Port Option to the game

origin
stpohle 23 years ago
parent 9d9f4e113f
commit cd75bbcefc

@ -146,7 +146,6 @@ ReadConfig ()
value[LEN_GAMENAME - 1] = 0; value[LEN_GAMENAME - 1] = 0;
strcpy (bman.gamename, value); strcpy (bman.gamename, value);
} }
if (!strcmp (keyword, "askplayername")) { if (!strcmp (keyword, "askplayername")) {
bman.askplayername = atoi (value); bman.askplayername = atoi (value);
} }
@ -171,6 +170,15 @@ ReadConfig ()
if (!strcmp (keyword, "firewall")) { if (!strcmp (keyword, "firewall")) {
bman.firewall = atoi (value); 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")) { if (!strcmp (keyword, "ai_players")) {
bman.ai_players = atoi (value); bman.ai_players = atoi (value);
} }
@ -240,6 +248,7 @@ WriteConfig ()
fprintf (config, "tileset=%s\n", gfx.tileset); fprintf (config, "tileset=%s\n", gfx.tileset);
fprintf (config, "fieldpath=%s\n", bman.fieldpath); fprintf (config, "fieldpath=%s\n", bman.fieldpath);
fprintf (config, "firewall=%d\n", bman.firewall); 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, "ai_players=%d\n", bman.ai_players);
fprintf (config, "fieldsizex=%d\n", bman.fieldsize.x); fprintf (config, "fieldsizex=%d\n", bman.fieldsize.x);
fprintf (config, "fieldsizey=%d\n", bman.fieldsize.y); fprintf (config, "fieldsizey=%d\n", bman.fieldsize.y);

@ -77,10 +77,11 @@ networkmenu_options ()
{1, "Game Name:"}, {1, "Game Name:"},
{1, "Max Players:"}, {1, "Max Players:"},
{2, "Network"}, {2, "Network"},
{3, "Notify Masterserver"}, {3, "UDP Port"},
{4, "Masterserver"}, {4, "Notify Masterserver"},
{5, "Behind a Firewall"}, {5, "Masterserver"},
{6, "Return To Multiplayer Menu"}, {6, "Behind a Firewall"},
{7, "Return To Multiplayer Menu"},
{-1, ""} {-1, ""}
}; };
#ifdef _WIN32 #ifdef _WIN32
@ -96,17 +97,19 @@ networkmenu_options ()
else else
sprintf (menu[2].text, "Network: IPv6"); sprintf (menu[2].text, "Network: IPv6");
if (bman.firewall) sprintf (menu[3].text, "UDP Port: %s", bman.port);
sprintf (menu[5].text, "Firewall: ON");
else
sprintf (menu[5].text, "Firewall: OFF");
if (bman.notifygamemaster) if (bman.notifygamemaster)
sprintf (menu[3].text, "Notify MasterServer: Yes"); sprintf (menu[4].text, "Notify MasterServer: Yes");
else 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); menuselect = menu_loop ("Multiplayer Options", menu, menuselect);
@ -135,26 +138,31 @@ networkmenu_options ()
#endif #endif
break; 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) if (bman.notifygamemaster)
bman.notifygamemaster = 0; bman.notifygamemaster = 0;
else else
bman.notifygamemaster = 1; bman.notifygamemaster = 1;
break; break;
case (4): // Masterserver Address case (5): // Masterserver Address
menu_get_text ("Address of the MasterServer", bman.gamemaster, menu_get_text ("Address of the MasterServer", bman.gamemaster,
LEN_SERVERNAME + LEN_PORT + 2); LEN_SERVERNAME + LEN_PORT + 2);
break; break;
case (5): // Firewall Option case (6): // Firewall Option
if (bman.firewall) if (bman.firewall)
bman.firewall = 0; bman.firewall = 0;
else else
bman.firewall = 1; bman.firewall = 1;
break; break;
case (6): case (7):
menuselect = -1; menuselect = -1;
break; break;
} }

Loading…
Cancel
Save