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.