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

Parker Coates parker.coates at gmail.com
Thu May 1 22:32:37 CEST 2008


2008/5/1 Burkhard Lehner <burkhard.lehner at googlemail.com>:
> 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.
>
> 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.

My thought was that the display class would not store the number of
entries to display itself, but instead would read the length from
KScoreManager. So I can't see the two getting out of sync, unless the
scoreBoardLength was changed at runtime...

> 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?)

I think the intention, is to set scoreBoardLength only once after
creating the KScoreManager, much like addField() and setOptions().
Yes, theoretically you could change their values at different points
in your program, but that doesn't make any sense and would likely
break things. Setting the value in a separate method produces much
more readable code than setting if in constructor.

I agree that 10 is a reasonable default.

Parker


More information about the kde-games-devel mailing list