Theo Buehler wrote: > On Wed, Nov 25, 2015 at 03:22:27PM -0500, Ted Unangst wrote: > > Theo Buehler wrote: > > > > > > If you're not going to maintain a list of high scores of the user, you > > > could still simplify snscore() further: The score file will just > > > contain the user's score as a short, so you could get the user name > > > using getlogin(2) instead of doing getuid() getpwuid(), etc. > > > Keeping the struct player also seems unnecessary. > > > > I think this is the way to go, throughout games. The only things we need to > > know are username (getlogin() or even $USER) and home dir ($HOME). Digging > > the > > home dir out of passwd seems unnecessary (or even wrong, if i've set HOME to > > be something else). > > > > For that matter, I'm not sure to prefer USER or getlogin. I'm leaning > > towards > > USER precisely *because* it allows overriding. If I want to keep a set of > > scores for different users by setting USER that seems reasonable to me. > > I like this. I do prefer probing the environment and not touch the > password file at all. So here's an implementation of a highscore file > with ten top scores and entry customizable via $USER. The logic is > simplistic: you only get an entry in the hall of fame if you strictly > beat a previous score. If $USER is unset, default to "???". > > This is loosely based on Ricardo's patch and what was done in tetris.
oh, i just found out i'm a little behind on mail. probably why i was repeating myself in other emails. definitely ok (with any LOGNAME changes too).