Use arg_port_number for -udp_hostport

This commit is contained in:
Kp 2015-01-25 05:32:44 +00:00
parent 9597147283
commit 3ca442cb33
2 changed files with 6 additions and 7 deletions

View file

@ -23,9 +23,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifndef _ARGS_H
#define _ARGS_H
#pragma once
#ifdef __cplusplus
#include <cstdint>
@ -84,7 +82,7 @@ struct Arg
int OglFixedFont;
#endif
const char *MplUdpHostAddr;
int MplUdpHostPort;
uint16_t MplUdpHostPort;
uint16_t MplUdpMyPort;
#ifdef USE_TRACKER
uint16_t MplTrackerPort;
@ -133,5 +131,3 @@ static inline const char *PLAYER_DIRECTORY_STRING(const char *s, const char *)
#endif
#endif
#endif

View file

@ -216,7 +216,10 @@ static void ReadCmdArgs(void)
else if (!d_stricmp(p, "-udp_hostaddr"))
GameArg.MplUdpHostAddr = arg_string(pp, end);
else if (!d_stricmp(p, "-udp_hostport"))
GameArg.MplUdpHostPort = arg_integer(pp, end);
/* Peers use -udp_myport to change, so peer cannot set a
* privileged port.
*/
arg_port_number(pp, end, GameArg.MplUdpHostPort, false);
else if (!d_stricmp(p, "-udp_myport"))
{
arg_port_number(pp, end, GameArg.MplUdpMyPort, false);