set net_player_name in config, cleanup (#590)

This commit is contained in:
Roman Fomin 2022-06-09 22:15:56 +07:00 committed by GitHub
parent 3068ea2a46
commit ee09f76a24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 13 deletions

View File

@ -103,6 +103,8 @@ extern boolean brightmaps;
extern char *chat_macros[], *wad_files[], *deh_files[]; // killough 10/98
extern char *net_player_name;
// Designated initializers
#if defined(_MSC_VER) && _MSC_VER < 1800
#define SFINIT(f, v) v
@ -1485,6 +1487,13 @@ default_t defaults[] = {
"chat string associated with 9 key"
},
{
"net_player_name",
(config_t *) &net_player_name, NULL,
{SFINIT(.s, "none")}, {0}, string, ss_chat, wad_no,
"network setup player name"
},
//jff 1/7/98 defaults for automap colors
//jff 4/3/98 remove -1 in lower range, 0 now disables new map features
{ // black //jff 4/6/98 new black

View File

@ -22,22 +22,21 @@
#include "config.h"
#include "doomtype.h"
#include "i_system.h"
#include "i_video.h" // I_Sleep
#include "i_timer.h" // I_Sleep
#include "m_argv.h"
#include "m_fixed.h"
#include "m_misc2.h"
#include "net_client.h"
#include "net_common.h"
#include "net_defs.h"
//#include "net_gui.h"
#include "net_io.h"
#include "net_packet.h"
#include "net_query.h"
#include "net_server.h"
#include "net_structrw.h"
#include "net_petname.h"
//#include "w_checksum.h"
#include "w_wad.h"
#include "d_io.h" // strcasecmp
extern void D_ReceiveTic(ticcmd_t *ticcmds, boolean *playeringame);
@ -1206,10 +1205,7 @@ void NET_CL_Disconnect(void)
void NET_CL_Init(void)
{
// Try to set from the USER and USERNAME environment variables
// Otherwise, fallback to "Player"
if (net_player_name == NULL)
if (net_player_name == NULL || !strcasecmp("none", net_player_name))
{
net_player_name = NET_GetRandomPetName();
}
@ -1220,9 +1216,3 @@ void NET_Init(void)
NET_OpenLog();
NET_CL_Init();
}
/*
void NET_BindVariables(void)
{
M_BindStringVariable("player_name", &net_player_name);
}
*/