Don't truncate player name in savefile name or log message.

The player name is stored in whoami[], which is length 80 in most games
(1024 in rogue5).  Only the first 10 chars were used to create
file_name, because that buffer is the same length.  Increasing the size
of file_name to 256 permits using all of whoami.

The name is also no longer truncated to 20 chars when writing the log.

All games should now be able to handle 79-character names without
collisions.  Anything more would break save compatibility.
This commit is contained in:
John "Elwin" Edwards 2014-03-23 21:27:14 -07:00
parent 082cd54126
commit 67ec840c3c
16 changed files with 23 additions and 23 deletions

View file

@ -49,7 +49,7 @@ main(int argc, char **argv)
use_savedir = TRUE;
strncpy(whoami, argv[2], MAXSTR);
whoami[MAXSTR-1] = '\0';
snprintf(file_name, MAXSTR, "%s/%d-%.10s.r5sav", SAVEDIR,
snprintf(file_name, MAXSTR, "%s/%d-%.80s.r5sav", SAVEDIR,
md_getuid(), whoami);
}
#endif

View file

@ -226,7 +226,7 @@ score(int amount, int flags, int monst)
void writelog(int amount, int flags, int monst)
{
#ifdef LOGFILE
char logmessage[160], ltemp[80];
char logmessage[220], ltemp[80];
if (logfi == NULL)
return;
@ -237,7 +237,7 @@ void writelog(int amount, int flags, int monst)
return;
}
#endif
sprintf(logmessage, "%d %d %.20s %d ", time(NULL), amount, whoami,
sprintf(logmessage, "%d %d %.80s %d ", time(NULL), amount, whoami,
pstats.s_lvl);
if (flags == 0) /* dead */
{