[Kde-games-devel] A new highscore manager - KScoreManager

Matt Williams matt at milliams.com
Thu May 1 22:32:10 CEST 2008


On Thursday 01 May 2008 21:17:12 Burkhard Lehner wrote:
> Hi,
>
> Sorry for again throwing in my two cents, although not contributing to the
> actual implementation.

That's ok :) It's good to hear opinions from as many people as possible.

> 2008/5/1 Matt Williams <matt at milliams.com>:
> > > - It's missing an "int numberOfScores() const" method. I don't really
> > > love that name, but I haven't been able to come up with anything much
> > > better. Maybe "scoreBoardLength"?
> >
> > Yes, scoreBoardLength() sounds good. In that case I'll change
> > setNumberOfScores() to setScoreBoardLength().
>
> I just want to remind you that there is a difference between the number of
> highscore entries shown in the highscore dialog, and the number of entries
> stored in the highscore list.

Yes, they're definitely going to have to be kept in sync. 
setScoreBoardLength() in this case would be a function which would set both 
the number of entries saved to file and the number to be displayed. If 
there's only 4 entries saved but scoreBoardLength() is set to 10 then the 
remaining slots will simply be shown blank (as it is at the moment).

> If these two numbers don't match, you may get in trouble:
> 1) display more entries than stored: the lower entries always remain empty
> 2) store more entries than displayed: the player who just won a new low
> highscore doesn't find himself in the list, and the dialog also does not
> show a box where he could enter his name
>
> So, I think there is no sense in using a different number of entries for
> storing and displaying.
> Furthermore, the number should be fix, i.e., set only once in the program,
> and never changed. Otherwise you loose highscore entries, or create empty
> ones.
> Therefore, the number of entries is predestined to be set in the
> constructor of the KScoreManager, isn't it? (Maybe use a default value of
> 10?)

You're right in that it only makes sense to set it once per game but since 
KScoreManager is a singleton we don't have access to its constructor. Now of 
course it doesn't _have_ to be a singleton but since it doesn't make sense to 
have more than one score manager, it seemed logical.

I'm seriously starting to look into a MVC type setup for this though that 
might turn out to be massively overengineering it.

Regards,
Matt Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20080501/cd37d2d8/attachment.pgp 


More information about the kde-games-devel mailing list