Commit c6301cdf authored by Jonathon Fowler's avatar Jonathon Fowler Committed by NY00123
Browse files

SW: correctly accept a player name on the command line and save to config

parent d496daf5
......@@ -62,8 +62,7 @@ int g_noSetup;
// Comm variables
//
char CommPlayerName[32];
int32_t NumberPlayers,CommPort,PortSpeed,IrqNumber,UartAddress;
char CommPlayerName[MAXPLAYERNAMELENGTH];
//
// Sound variables
......@@ -687,7 +686,6 @@ void CONFIG_SetupJoystick(void)
int32_t CONFIG_ReadSetup(void)
{
int32_t dummy;
extern char PlayerNameArg[32];
char waveformtrackname[MAXWAVEFORMTRACKLENGTH] = {0};
......@@ -754,10 +752,6 @@ int32_t CONFIG_ReadSetup(void)
//CONFIG_SetupMouse(scripthandle);
//CONFIG_SetupJoystick(scripthandle);
if (PlayerNameArg[0] != '\0')
{
strcpy(CommPlayerName, PlayerNameArg);
}
return 0;
}
......@@ -834,6 +828,8 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(scripthandle, "Controls","UseJoystick",ud_setup.UseJoystick,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Controls","MouseSensitivity",gs.MouseSpeed,FALSE,FALSE);
SCRIPT_PutString(scripthandle, "Comm Setup", "PlayerName", CommPlayerName);
WriteGameSetup(scripthandle);
for (dummy=0; dummy<NUMGAMEFUNCTIONS; dummy++)
......
......@@ -87,24 +87,11 @@ extern int32_t MidiPort; // Midi Port
extern int32_t ReverseStereo; // Reverse Stereo Channels
// comm externs
extern int32_t ComPort;
extern int32_t IrqNumber;
extern int32_t UartAddress;
extern int32_t PortSpeed;
extern int32_t ToneDial;
extern char ModemName[MAXMODEMSTRING];
extern char InitString[MAXMODEMSTRING];
extern char HangupString[MAXMODEMSTRING];
extern char DialoutString[MAXMODEMSTRING];
extern int32_t SocketNumber;
extern char CommbatMacro[MAXMACROS][MAXMACROLENGTH];
extern char PhoneNames[MAXPHONEENTRIES][PHONENAMELENGTH];
extern char PhoneNumbers[MAXPHONEENTRIES][PHONENUMBERLENGTH];
extern char PhoneNumber[PHONENUMBERLENGTH];
extern int32_t NumberPlayers;
extern int32_t ConnectType;
extern char PlayerName[MAXPLAYERNAMELENGTH];
extern char CommPlayerName[MAXPLAYERNAMELENGTH];
extern char RTSName[MAXRTSNAMELENGTH];
extern char UserLevel[MAXUSERLEVELNAMELENGTH];
extern char RTSPath[MAXRTSPATHLENGTH];
......
......@@ -139,7 +139,6 @@ short IntroAnimCount = 0;
short PlayingLevel = -1;
SWBOOL GraphicsMode = FALSE;
char CacheLastLevel[32] = "";
char PlayerNameArg[32] = "";
SWBOOL CleanExit = FALSE;
SWBOOL DemoModeMenuInit = FALSE;
SWBOOL FinishAnim = 0;
......@@ -3742,8 +3741,8 @@ int32_t app_main(int32_t argc, char const * const * argv)
{
if (cnt <= argc-2)
{
strncpy(PlayerNameArg, argv[++cnt], SIZ(PlayerNameArg)-1);
PlayerNameArg[SIZ(PlayerNameArg)-1] = '\0';
strncpy(CommPlayerName, argv[++cnt], SIZ(CommPlayerName)-1);
CommPlayerName[SIZ(CommPlayerName)-1] = '\0';
}
}
else if (Bstrncasecmp(arg, "f8",2) == 0)
......
......@@ -102,7 +102,7 @@ extern "C" {
// Max Player Name length
#define MAXPLAYERNAMELENGTH 11
#define MAXPLAYERNAMELENGTH 32
// Max RTS Name length
......
Supports Markdown
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