-clientport (it's back!) and -serverport, which is an alias to -port

If you ever need to, you can change the client port number.

(cherry picked from commit 843d9b9f0a345330d97c579e94f208eb2b65c156)
This commit is contained in:
James R 2019-12-18 15:47:47 -08:00
parent b77541b51d
commit 94512c49e4
1 changed files with 11 additions and 7 deletions

View File

@ -246,7 +246,8 @@ static size_t numbans = 0;
static boolean SOCK_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
static boolean init_tcp_driver = false;
static const char *port_name = DEFAULTPORT;
static const char *serverport_name = DEFAULTPORT;
static const char *clientport_name;/* any port */
#ifndef NONET
@ -941,9 +942,9 @@ static boolean UDP_Socket(void)
hints.ai_protocol = IPPROTO_UDP;
if (serverrunning)
serv = port_name;
serv = serverport_name;
else
serv = NULL;/* any port */
serv = clientport_name;
if (M_CheckParm("-bindaddr"))
{
@ -985,8 +986,8 @@ static boolean UDP_Socket(void)
#ifdef HAVE_MINIUPNPC
if (UPNP_support)
{
I_UPnP_rem(port_name, "UDP");
I_UPnP_add(NULL, port_name, "UDP");
I_UPnP_rem(serverport_name, "UDP");
I_UPnP_add(NULL, serverport_name, "UDP");
}
#endif
}
@ -1481,16 +1482,19 @@ boolean I_InitTcpNetwork(void)
if (!I_InitTcpDriver())
return false;
if (M_CheckParm("-port"))
if (M_CheckParm("-port") || M_CheckParm("-serverport"))
// Combined -udpport and -clientport into -port
// As it was really redundant having two seperate parms that does the same thing
/* Sorry Steel, I'm adding these back. But -udpport is a stupid name. */
{
/*
If it's NULL, that's okay! Because then
we'll get a random port from getaddrinfo.
*/
port_name = M_GetNextParm();
serverport_name = M_GetNextParm();
}
if (M_CheckParm("-clientport"))
clientport_name = M_GetNextParm();
// parse network game options,
if (M_CheckParm("-server") || dedicated)