Mercurial > hg > early-roguelike
comparison rogue4/rip.c @ 112:ee250e3646fd
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.
author | John "Elwin" Edwards |
---|---|
date | Sun, 23 Mar 2014 21:27:14 -0700 |
parents | 0ef99244acb8 |
children | 1b73a8641b37 |
comparison
equal
deleted
inserted
replaced
111:7f8f43943b1f | 112:ee250e3646fd |
---|---|
237 } | 237 } |
238 | 238 |
239 void writelog(int amount, int flags, char monst) | 239 void writelog(int amount, int flags, char monst) |
240 { | 240 { |
241 FILE *logfi; | 241 FILE *logfi; |
242 char logmessage[160], ltemp[80]; | 242 char logmessage[220], ltemp[80]; |
243 char *killer; | 243 char *killer; |
244 if (noscore) | 244 if (noscore) |
245 return; | 245 return; |
246 #ifdef LOGFILE | 246 #ifdef LOGFILE |
247 if (lfd >= 0) | 247 if (lfd >= 0) |
249 else | 249 else |
250 return; | 250 return; |
251 if (logfi == NULL) | 251 if (logfi == NULL) |
252 return; | 252 return; |
253 /* otherwise writing should work */ | 253 /* otherwise writing should work */ |
254 sprintf(logmessage, "%d %d %.20s %d ", time(NULL), amount, whoami, | 254 sprintf(logmessage, "%d %d %s %d ", time(NULL), amount, whoami, |
255 pstats.s_lvl); | 255 pstats.s_lvl); |
256 if (flags == 0) /* died */ | 256 if (flags == 0) /* died */ |
257 { | 257 { |
258 strcat(logmessage, "killed by "); | 258 strcat(logmessage, "killed by "); |
259 killer = killname(monst, TRUE); | 259 killer = killname(monst, TRUE); |