[Kde-games-devel] kspaceduel: replace Q3PtrList with QtList
Albert Astals Cid
aacid at kde.org
Thu Jan 4 22:19:56 CET 2007
A Dijous 04 Gener 2007 21:52, Dirk va escriure:
> Hello,
>
> I tried to remove every Q3PtrList from kspaceduel to finally finish
> porting it to Qt4. I replaced Q3PtrList with QList<*> and used
> index-based QLists as recommended by the Qt docs. The resulting patch is
> attached. However, I'm not sure whether it's correct and it would be
> nice if someone could take a short look at it, because if I did
> something wrong it would be hard to find the mistake later when it
> causes trouble.
>
> Thank you.
> Dirk
In
+ for (k=0; k<mines[i]->size(); k++)
+ {
+ ms = mines[i]->value(k);
+ (*(aiMines[i]))[j]=ms->toAiSprite();
+ j++;
+ }
+ // FIXME: use Qlist::count()?
k and j are the same, so you can just kill one of them.
Also don't understand the // FIXME: use Qlist::count()?
Also you have a copy&paste problem on
- h=minesHitByShot.first();
- while(h)
+// h=minesHitByShot.first();
+ i=0;
+ while(i<objectsHitByShip.size())
{
+ h=objectsHitByShip[i];
both the while and h= should be minesHitByShot not objectsHitByShip
For the rest it seems good.
Albert
More information about the kde-games-devel
mailing list