Revision 1280163

Go back to digest for 19th February 2012

Bug Fixes in Games

Parker Coates committed changes in /trunk/KDE/kdegames/kpat:

Make KCardDeck card IDs unique, even for cards with same suit and rank.

Previously, two KCards having the same suit and rank would have
identical IDs, leaving no real way (other than their addresses) to tell
them apart at run time. This makes implementing some changes I have
planned a real hassle.

Since KCardDeck was only using the lowest 6 bits of the 32 available in
the ID, we have plenty of room to store the card's position within the
deck. The new layout is 8 bits for the rank, 8 for the suit, and the
remaining 16 for the number. So that's support for 256 different ranks,
256 different suits and 65536 different cards.

This change is also made to KPat's slightly custom ID generation code.

File Changes

Modified 3 files
  • /trunk/KDE/kdegames/kpat
  •   /dealer.cpp
  •   /libkcardgame/kcarddeck.cpp
  •   /libkcardgame/kcarddeck.h
3 files changed in total