Commit 949c1be7 authored by Richard Gobeille's avatar Richard Gobeille
Browse files

Duke3d: don't overwrite player name passed with -name parameter with that...

Duke3d: don't overwrite player name passed with -name parameter with that stored in the cfg, and don't save a name entered with -name to the cfg
parent 43ed8c87
......@@ -328,7 +328,8 @@ void CONFIG_SetDefaults(void)
Bstrcpy(ud.rtsname, G_DefaultRtsFile());
Bstrcpy(szPlayerName, "Player");
if (!CommandName)
Bstrcpy(szPlayerName, "Player");
#ifndef EDUKE32_STANDALONE
Bstrcpy(ud.ridecule[0], "An inspiration for birth control.");
......@@ -715,15 +716,18 @@ int CONFIG_ReadSetup(void)
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[i][0]);
}
Bmemset(tempbuf, 0, sizeof(tempbuf));
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
if (!CommandName)
{
Bmemset(tempbuf, 0, sizeof(tempbuf));
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
char nameBuf[64];
char nameBuf[64];
while (Bstrlen(OSD_StripColors(nameBuf, tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf) - 1] = '\0';
while (Bstrlen(OSD_StripColors(nameBuf, tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf) - 1] = '\0';
Bstrncpyz(szPlayerName, tempbuf, sizeof(szPlayerName));
Bstrncpyz(szPlayerName, tempbuf, sizeof(szPlayerName));
}
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
......@@ -983,7 +987,8 @@ void CONFIG_WriteSetup(uint32_t flags)
}
}
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]);
if (!CommandName)
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]);
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
......
......@@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "al_midi.h"
#include "cheats.h"
#include "cmdline.h"
#include "communityapi.h"
#include "compat.h"
#include "demo.h"
......@@ -3771,7 +3772,12 @@ static void Menu_EntryOptionDidModify(MenuEntry_t *entry)
entry == &ME_PLAYER_NAME ||
entry == &ME_PLAYER_COLOR ||
entry == &ME_PLAYER_TEAM)
{
if (entry == &ME_PLAYER_NAME)
CommandName = nullptr;
G_UpdatePlayerFromMenu();
}
else if (entry == &ME_DISPLAYSETUP_UPSCALING)
{
if (in3dmode())
......
......@@ -1150,7 +1150,7 @@ static int osdcmd_name(osdcmdptr_t parm)
Bstrncpy(szPlayerName,tempbuf,sizeof(szPlayerName)-1);
szPlayerName[sizeof(szPlayerName)-1] = '\0';
CommandName = nullptr;
OSD_Printf("name %s\n",szPlayerName);
Net_SendClientInfo();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment