comparison srogue/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 15f8229f38c1
children 458df24e973d
comparison
equal deleted inserted replaced
111:7f8f43943b1f 112:ee250e3646fd
221 showtop(prflags); /* print top ten list */ 221 showtop(prflags); /* print top ten list */
222 } 222 }
223 223
224 void writelog(int amount, int aflag, char monst) 224 void writelog(int amount, int aflag, char monst)
225 { 225 {
226 char logmessage[160], ltemp[80], mlev[40]; 226 char logmessage[220], ltemp[80], mlev[40];
227 char *killer; 227 char *killer;
228 FILE *logfi; 228 FILE *logfi;
229 229
230 if (waswizard) 230 if (waswizard)
231 return; 231 return;
232 #ifdef LOGFILE 232 #ifdef LOGFILE
233 sprintf(logmessage, "%d %d %.20s %d ", time(NULL), amount, whoami, 233 sprintf(logmessage, "%d %d %s %d ", time(NULL), amount, whoami,
234 him->s_lvl); 234 him->s_lvl);
235 if (amulet) 235 if (amulet)
236 sprintf(mlev, " [max %d] with the Amulet", max_level); 236 sprintf(mlev, " [max %d] with the Amulet", max_level);
237 else 237 else
238 mlev[0] = '\0'; 238 mlev[0] = '\0';