[Kde-games-devel] KGameDifficulty API notes and suggestions
Nicolas Roffet
nicolas-kde at roffet.com
Thu Jul 12 00:53:29 CEST 2007
Hi Dmitry,
Am Dienstag, 10. Juli 2007 23:36:41 schrieben Sie:
> Ah, I missed that you can change insertion place through mygameui.rc file.
> Ok then :)
Well. OK for now, but on the long-term, I think we should do like for the
KStandardGameAction s and add a line in the following file:
http://websvn.kde.org/trunk/KDE/kdelibs/kdeui/ui_standards.rc?view=markup
But we have to discuss more about this before doing anything.
> Well, how useful to see 4 for the reader of the code? I got your point, so
> perhaps we should replace that int by enum? Then it will be clearer. For
> example something like this:
>
> enum DifficultyLevelsCount
> {
> ThreeDifficultyLevels, // easy, normal, hard
> FourDifficultyLevels, /// etc
> FiveDifficultyLevels
> // etc until how many we support
> }
>
> Yes, that's basicly the same, and perhaps naming isn't that great, but IMO
> it is much more clearer to read this:
> new KGameDifficulty( this, false, KGameDifficulty::ThreeDifficultyLevels);
>
> Moreover, this way will put clear restriction on how much predefined levels
> we support - so passing arbitrary int such as 99 won't work (without brute
> force of spell^W casts, of course).
> And such code is pretty self documenting :)
>
> I'd even go further (wrt qt lib guidelines), and replaced bool in
> constructor with simple enum too:
> enum { RestartOnChange, NoRestartOnChange } // naming from head
>
> Then
> new KGameDifficulty( this,
> KGameDifficulty::NoRestartOnChange,
> KGameDifficulty::ThreeDifficultyLevels);
>
> is even more understandable for code reader (while being more lengthy, yes)
This is a really good point and I tried to consider this by the rewrite of the
class. (It's now in SVN).
> That's great we can cooperate in such a nice way to create
> something really useful by learning from eachother :)
Yes it is! :)
> > I personally prefer tabs.
>
> Well, I think it should be discussed in another thread.
OK.
Next step would be now to try to use this API in other games. KBlackBox was
here a kind of proof of concept. Dmitry, Mauricio, is it OK if I do this in
KMines now?
--
Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20070712/6f686856/attachment.pgp
More information about the kde-games-devel
mailing list