]> Shamusworld >> Repos - warehouse-man-deluxe/commitdiff
Added board titles.
authorShamus Hammons <jlhamm@acm.org>
Fri, 6 Jun 2014 00:58:41 +0000 (19:58 -0500)
committerShamus Hammons <jlhamm@acm.org>
Fri, 6 Jun 2014 00:58:41 +0000 (19:58 -0500)
src/boards.cpp
src/boards.h
src/gameboard.cpp
src/gameboard.h
src/gamewidget.cpp
src/gamewidget.h

index d8c2a42d3f2d6cc640258ee30144e9ecbe7e13e3..7ade8327eb75ddb4f5f90c9048392fcac6f27a70 100644 (file)
 //   . = Spot to move box to
 //   + = Spot to move box to, that already has a box on it
 //   o = Player initial position
+//   - = Do not draw anything here
 //
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[5 * 5 + 1]; } board001 = { 5, 5,
+       unsigned char state[5 * 5 + 40 + 1]; } board001 = { 5, 5,
+//     const char * state; } board001 = { 5, 5,
        "@@@@@"
        "@o  @"
        "@ X @"
        "@ . @"
        "@@@@@"
+       "Neophyte"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[7 * 7 + 1]; } board002 = { 7, 7,
+       unsigned char state[7 * 7 + 40 + 1]; } board002 = { 7, 7,
        "@@@@@@@"
        "@     @"
        "@ X.X @"
@@ -44,210 +47,227 @@ static const struct {
        "@ X.X @"
        "@o    @"
        "@@@@@@@"
+       "A Little Bit Harder..."
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[7 * 5 + 1]; } board003 = { 7, 5,
+       unsigned char state[7 * 5 + 40 + 1]; } board003 = { 7, 5,
        "@@@@@@@"
        "@. X .@"
        "@ XoX @"
        "@. X .@"
        "@@@@@@@"
+       "Boxed In"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[8 * 5 + 1]; } board004 = { 8, 5,
+       unsigned char state[8 * 5 + 40 + 1]; } board004 = { 8, 5,
        "@@@@@@@@"
        "@  ..X @"
        "@ Xo X @"
        "@ X..  @"
        "@@@@@@@@"
+       "Edging Out"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[8 * 7 + 1]; } board005 = { 8, 7,
-       " @@@@@@@"
-       " @     @"
+       unsigned char state[8 * 7 + 40 + 1]; } board005 = { 8, 7,
+       "-@@@@@@@"
+       "-@     @"
        "@@ .X. @"
        "@o X X @"
        "@  .X. @"
        "@@     @"
-       " @@@@@@@"
+       "-@@@@@@@"
+       "Rotation"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[8 * 8 + 1]; } board006 = { 8, 8,
-       " @@@@@  "
+       unsigned char state[8 * 8 + 40 + 1]; } board006 = { 8, 8,
+       "-@@@@@--"
        "@@   @@@"
        "@  @   @"
        "@ @  @ @"
        "@ X X@ @"
        "@.@    @"
        "@. o@@@@"
-       "@@@@@   "
+       "@@@@@---"
+       "Headless Chicken"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[8 * 6 + 1]; } board007 = { 8, 6,
+       unsigned char state[8 * 6 + 40 + 1]; } board007 = { 8, 6,
        "@@@@@@@@"
        "@ X. X.@"
        "@o.X X.@"
        "@ X. X.@"
        "@ .X X.@"
        "@@@@@@@@"
+       "Two Lines"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[10 * 8 + 1]; } board008 = { 10, 8,
-       "   @@@@@@@"
-       "  @@  @ o@"
-       "  @   @  @"
-       "  @X X X @"
-       "  @ X@@  @"
+       unsigned char state[10 * 8 + 40 + 1]; } board008 = { 10, 8,
+       "---@@@@@@@"
+       "--@@  @ o@"
+       "--@   @  @"
+       "--@X X X @"
+       "--@ X@@  @"
        "@@@ X @ @@"
-       "@.....  @ "
-       "@@@@@@@@@ "
+       "@.....  @-"
+       "@@@@@@@@@-"
+       "Easy Does It"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[9 * 7 + 1]; } board009 = { 9, 7,
+       unsigned char state[9 * 7 + 40 + 1]; } board009 = { 9, 7,
        "@@@@@@@@@"
        "@   +   @"
        "@ X.@.X @"
        "@  X.X  @"
        "@@@.X.@@@"
-       "  @@o@@  "
-       "   @@@   "
+       "--@@o@@--"
+       "---@@@---"
+       "Claustrophobia"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[7 * 7 + 1]; } board010 = { 7, 7,
-       "  @@@@@"
+       unsigned char state[7 * 7 + 40 + 1]; } board010 = { 7, 7,
+       "--@@@@@"
        "@@@   @"
        "@o .X.@"
        "@  X X@"
        "@@@.X.@"
-       "  @   @"
-       "  @@@@@"
+       "--@   @"
+       "--@@@@@"
+       "Tight Squeeze"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[10 * 8 + 1]; } board011 = { 10, 8,
-       "  @@@@    "
-       "  @  @    "
+       unsigned char state[10 * 8 + 40 + 1]; } board011 = { 10, 8,
+       "--@@@@----"
+       "--@  @----"
        "@@@  @@@@@"
        "@  ..X   @"
        "@oX.. X  @"
        "@@@ X@@@@@"
-       "  @  @    "
-       "  @@@@    "
+       "--@  @----"
+       "--@@@@----"
+       "Crossroads"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[10 * 6 + 1]; } board012 = { 10, 6,
-       " @@@@@@@@@"
+       unsigned char state[10 * 6 + 40 + 1]; } board012 = { 10, 6,
+       "-@@@@@@@@@"
        "@@       @"
        "@   @X@X @"
        "@ XX  .X.@"
        "@ o@@@...@"
-       "@@@@ @@@@@"
+       "@@@@-@@@@@"
+       "In The Corner"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[9 * 7 + 1]; } board013 = { 9, 7,
-       "   @@@@@ "
+       unsigned char state[9 * 7 + 40 + 1]; } board013 = { 9, 7,
+       "---@@@@@-"
        "@@@@   @@"
        "@ X X X @"
        "@o......@"
        "@ X X X @"
        "@@@@   @@"
-       "   @@@@@ "
+       "---@@@@@-"
+       "Get In Line"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[8 * 7 + 1]; } board014 = { 8, 7,
-       "  @@@@@ "
-       "@@@  o@ "
+       unsigned char state[8 * 7 + 40 + 1]; } board014 = { 8, 7,
+       "--@@@@@-"
+       "@@@  o@-"
        "@  X. @@"
        "@  .X. @"
        "@@@ +X @"
-       "  @   @@"
-       "  @@@@@ "
+       "--@   @@"
+       "--@@@@@-"
+       "Tighter Squeeze"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[8 * 7 + 1]; } board015 = { 8, 7,
-       "@@@@@@@ "
+       unsigned char state[8 * 7 + 40 + 1]; } board015 = { 8, 7,
+       "@@@@@@@-"
        "@ .X. @@"
        "@ X X  @"
        "@ .X.  @"
        "@ @@@ @@"
-       "@  o  @ "
-       "@@@@@@@ "
+       "@  o  @-"
+       "@@@@@@@-"
+       "Rotation #2"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[10 * 7 + 1]; } board016 = { 10, 7,
-       "   @@@@@@ "
-       " @@@    @ "
+       unsigned char state[10 * 7 + 40 + 1]; } board016 = { 10, 7,
+       "---@@@@@@-"
+       "-@@@    @-"
        "@@. X@@ @@"
        "@..X X  o@"
        "@.. X X @@"
-       "@@@@@@  @ "
-       "     @@@@ "
+       "@@@@@@  @-"
+       "-----@@@@-"
+       "Up Against A Wall"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[7 * 7 + 1]; } board017 = { 7, 7,
-       " @@@@@ "
+       unsigned char state[7 * 7 + 40 + 1]; } board017 = { 7, 7,
+       "-@@@@@-"
        "@@ . @@"
        "@ X.X @"
        "@  .Xo@"
        "@ X.X @"
        "@@ . @@"
-       " @@@@@ "
+       "-@@@@@-"
+       "Lizard Eye"
 };
 
 
 static const struct {
        unsigned int width, height;
-       unsigned char state[12 * 6 + 1]; } board018 = { 12, 6,
-       " @@@@@@@@@@ "
+       unsigned char state[12 * 6 + 40 + 1]; } board018 = { 12, 6,
+       "-@@@@@@@@@@-"
        "@@   @o   @@"
        "@ X ....X  @"
        "@  X@@@@ X @"
-       "@   @  @  @@"
-       "@@@@@  @@@@ "
+       "@   @--@  @@"
+       "@@@@@--@@@@-"
+       "Two Rooms"
 };
 
 
index fde5fccee6cc927f7ac2c7fb324b784bdd391a2f..f2a8a2f7b195bffeff1b47049cd7b6e145b396bf 100644 (file)
@@ -9,8 +9,6 @@
 struct Board {
        unsigned int width;             // Width of the board
        unsigned int height;    // Height of the board
-//     unsigned int x;                 // Initial X position of player
-//     unsigned int y;                 // Initial Y position of player
        unsigned char state[];  // Board data
 };
 
index 0656e74a96425d9577185090bff4c891926ad640..92a0bab05dc5dd8bd59643a298601d1ef677415d 100644 (file)
@@ -31,8 +31,7 @@ GameBoard::GameBoard(int boardNumber)
        boardLength = width * height;
        board = new char[boardLength];
        initialBoard = new char[boardLength];
-//     initialX = boardToUse->x;
-//     initialY = boardToUse->y;
+       name = (const char *)&(boardToUse->state[boardLength]);
 
        for(int i=0; i<boardLength; i++)
        {
@@ -53,6 +52,8 @@ GameBoard::GameBoard(int boardNumber)
                        initialBoard[i] = GTSpace;
                        initialX = i % width, initialY = i / width;
                }
+               else
+                       initialBoard[i] = GTNull;
        }
 
        ResetGame();
index 9f59480e961c7a42a632552f4aee66b01fbd1813..229feb7272c564b3769ca46fbe09fe873bd071d5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __GAMEBOARD_H__
 #define __GAMEBOARD_H__
 
-enum { GTSpace=0x00, GTWall=0x01, GTBox=0x02, GTBoxSpot=0x04 };
+enum { GTSpace=0x00, GTWall=0x01, GTBox=0x02, GTBoxSpot=0x04, GTNull=0x08 };
 enum { PMInvalid, PMWalk, PMPush };
 
 struct UndoMove
@@ -37,6 +37,7 @@ class GameBoard
                int playerX, playerY;           // Player X/Y are zero-based
                int width, height;
                char * board;
+               const char * name;
 
        private:
                char * initialBoard;
index 1b815f0fb6ec74ccc2395417826c56533e166269..037a26f71471a76d8462354801fa83c53acb6916 100644 (file)
@@ -23,8 +23,6 @@ GameWidget::GameWidget(QWidget * parent/*= 0*/): QWidget(parent),
 {
        CreateBackground();
 //     score->setTextFormat(Qt::PlainText);
-//     setFixedSize(580, 520);
-//     gameBoard = new GameBoard(1);
 }
 
 
@@ -35,18 +33,15 @@ GameWidget::~GameWidget(void)
 
 void GameWidget::paintEvent(QPaintEvent * /*event*/)
 {
-       // TO DO:
-       // Optimizations: Create a member variable that has a bitmap in it,
-       // tile it with the felt in OnCreate(), blit as background instead of
-       // FillRect(r, brWhite). Also need to keep track of client rect.
-       // Possibly have 2 bitmaps as member vars, so keep bm construction to a minimum...
-
        QPainter painter(this);
-//     QRect rcUpdate = dc.m_ps.rcPaint; // Update rect...
-//     QRect rcUpdate = QRect(0, 0, 580, 520);                 // Update rect?
+       QFont font;
+
+       font.setPixelSize(titleBox.height() - 8);
+       painter.setFont(font);
+       painter.setPen(QPen(Qt::black, 1.0, Qt::SolidLine));
+       painter.drawText(titleBox, Qt::AlignCenter, gameBoard->name);
 
        painter.translate(QPoint(offsetX, offsetY));
-//     maxLength = 60;
        int ptr = 0;
 
        for(int y=0; y<gameBoard->height; y++)
@@ -69,28 +64,6 @@ void GameWidget::paintEvent(QPaintEvent * /*event*/)
                                painter.setBrush(QBrush(tile & GTBoxSpot ? Qt::green : Qt::red));
                                painter.drawRect(x * maxLength, y * maxLength, maxLength, maxLength);
                        }
-#if 0
-                       else if (tile == GTBoxSpot)
-                       {
-                               painter.setBrush(QBrush(Qt::magenta));
-//                             painter.drawRect((x * maxLength) + 20, (y * maxLength) + 20, maxLength - 40, maxLength - 40);
-                               painter.drawRect((x * maxLength) + (int)(20.0/60.0*(float)maxLength), (y * maxLength) + (int)(20.0/60.0*(float)maxLength), maxLength - (int)(40.0/60.0*(float)maxLength), maxLength - (int)(40.0/60.0*(float)maxLength));
-                       }
-                       else if (tile == (GTBox | GTBoxSpot))
-                       {
-                               if (!(boxMoving && (movingBoxPositionX == x) && (movingBoxPositionY == y)))
-                               {
-                                       painter.setBrush(QBrush(Qt::green));
-                                       painter.drawRect(x * maxLength, y * maxLength, maxLength, maxLength);
-                               }
-                               else
-                               {
-                                       painter.setBrush(QBrush(Qt::magenta));
-//                                     painter.drawRect((x * maxLength) + 20, (y * maxLength) + 20, maxLength - 40, maxLength - 40);
-                               painter.drawRect((x * maxLength) + (int)(20.0/60.0*(float)maxLength), (y * maxLength) + (int)(20.0/60.0*(float)maxLength), maxLength - (int)(40.0/60.0*(float)maxLength), maxLength - (int)(40.0/60.0*(float)maxLength));
-                               }
-                       }
-#endif
                        else if ((tileType == GTSpace)
                                || ((tileType == GTBox) && (boxMoving && (movingBoxPositionX == x) && (movingBoxPositionY == y))))
                        {
@@ -364,12 +337,8 @@ void GameWidget::UndoLastMove(void)
 
        if (boxMoving)
        {
-//             movingBoxPositionX = gameBoard->playerX + (int)deltaX;
-//             movingBoxPositionY = gameBoard->playerY + (int)deltaY;
                movingBoxPositionX = gameBoard->playerX + dx;
                movingBoxPositionY = gameBoard->playerY + dy;
-//             bx += deltaX * (float)maxLength;
-//             by += deltaY * (float)maxLength;
                bx += (float)(dx * maxLength);
                by += (float)(dy * maxLength);
        }
@@ -397,1077 +366,23 @@ void GameWidget::UndoLastMove(void)
 }
 
 
-#if 0
-void GameWidget::DrawBoard(QPainter * painter, QRect r)
-{
-       // Use "r" as clipping rect--only draw what's necessary
-
-//     pDC->BitBlt(r.left, r.top, r.Width(), r.Height(), pDC2, r.left, r.top, SRCCOPY);
-
-       // Draw the solitaire board...
-
-       for(int i=0; i<7; i++)
-       {
-               int y = 126; //130-4;
-
-               for(int j=0; j<19; j++)
-               {
-                       int card = solBoard[i][j];
-
-                       if (card != -1 && !(hitStack && (i == stackStart.x()) && (j >= stackStart.y())))
-                       {
-                               int nLinesToDraw = 0; // Default--draws whole card
-
-                               if (solBoard[i][j + 1] != -1 && !(hitStack && (i == stackStart.x()) && (j + 1 >= stackStart.y())))
-                               {
-                                       nLinesToDraw = 6;
-
-                                       if (myDeck.IsFaceUp(card))
-                                               nLinesToDraw += 14;
-                               }
-
-                               int x = 10 + (i * (CARD_WIDTH + 8));//, y = 130 + (j * 4);
-                               y += 4;
-
-                               if (j > 0)
-                               {
-                                       if (myDeck.IsFaceUp(solBoard[i][j - 1]))  // Previous card...
-                                               y += 14;
-                               }
-
-                               //wil wok??? mebbe... YESH!!!!!!!!!!!!!
-                               QRect cardRect(x, y, CARD_WIDTH, (nLinesToDraw ? nLinesToDraw : CARD_HEIGHT));
-
-                               if (r.intersects(cardRect))
-                                       cdtDraw(painter, x, y, (myDeck.IsFaceUp(card) ? myDeck.GetCardAtPos(card)
-                                               : nCardBack), FACEUP, nLinesToDraw);
-                       }
-               }
-       }
-
-       for(int i=0; i<4; i++)
-       {
-               if (nHitAce == i + 1)
-               {
-                       if (((nAce[i] - 1) % 13) != 0)
-                               cdtDraw(painter, 200 + ((CARD_WIDTH + 4) * i), 7, nAce[i] - 1, FACEUP);
-                       else
-                               cdtDraw(painter, 200 + ((CARD_WIDTH + 4) * i), 7, 0, INVISIBLEGHOST);
-               }
-               else
-               {
-                       if (nAce[i] != -1)
-                               cdtDraw(painter, 200 + ((CARD_WIDTH + 4) * i), 7, nAce[i], FACEUP);
-                       else
-                               cdtDraw(painter, 200 + ((CARD_WIDTH + 4) * i), 7, 0, INVISIBLEGHOST);
-               }
-       }
-       
-       if (stack1p != -1)
-               cdtDraw(painter, 5, 7, nCardBack, FACEUP);
-       else
-       {
-#if 0
-               if (m_bShowX)
-                       cdtDraw(painter, 5, 7, 0, DECKX);
-               else
-                       cdtDraw(painter, 5, 7, 0, DECKO);
-#else
-               cdtDraw(painter, 5, 7, 0, (m_bShowX ? DECKX : DECKO));
-#endif
-       }
-
-       if (stack2p != -1)
-       {
-               if (!hitDiscard)
-               {
-                       for(int k=0; k<m_nNumToSplay; k++)
-                               cdtDraw(painter, 5 + CARD_WIDTH + 6 + (k * 12), 7 + (k * 2),
-                                       myDeck.GetCardAtPos(stack2[stack2p - (m_nNumToSplay - k - 1)]), FACEUP);
-               }
-               else
-               {
-                       if (stack2p != 0)
-                       {
-                               if (m_nNumToSplay == 1)
-                                       cdtDraw(painter, 5 + CARD_WIDTH + 6, 7, myDeck.GetCardAtPos(stack2[stack2p - 1]), FACEUP);
-                               else
-                                       for(int k=0; k<m_nNumToSplay-1; k++)
-                                               cdtDraw(painter, 5 + CARD_WIDTH + 6 + (k * 12), 7 + (k * 2),
-                                                       myDeck.GetCardAtPos(stack2[stack2p - (m_nNumToSplay - k - 1)]), FACEUP);
-                       }
-               }
-       }
-}
-
-
-void GameWidget::OnLButtonDown(QPoint point) 
-{
-       dcHitStack = dcHitDiscard = false;  // For double clicking...
-       m_bTouchedGame = true;              // Game has been attempted!
-
-       if (!allowUserInput)
-               return;
-
-       mouseDown = true;
-
-       // Set undo up...
-       for(int i=0; i<7; i++)
-               for(int j=0; j<20; j++)
-                       solBoardUndo[i][j] = solBoard[i][j];
-
-       for(int i=0; i<24; i++)
-               stack1Undo[i] = stack1[i], stack2Undo[i] = stack2[i];
-
-       for(int i=0; i<4; i++)
-               nAceUndo[i] = nAce[i];
-
-       stack1pUndo = stack1p, stack2pUndo = stack2p;
-       m_nScoreUndo = m_nScore;
-       m_nExhaustedDeckUndo = m_nExhaustedDeck;
-       m_nNumToSplayUndo = m_nNumToSplay;
-       m_bShowXUndo = m_bShowX;
-       m_bCanUndo = false;
-
-       // Check for a hit on the tableaux...
-
-       for(int i=0; i<7; i++)
-       {
-               QRect r;
-               r.setLeft(10 + (i * (CARD_WIDTH + 8)));
-               r.setRight(r.left() + CARD_WIDTH - 1);
-               r.setTop(130);
-               int nCards = 0;
-
-               for(int j=0; j<19; j++)
-               {
-                       if (solBoard[i][j] != -1)
-                       {
-                               if (myDeck.IsFaceUp(solBoard[i][j]))
-                               {
-                                       if ((j == 18) || (solBoard[i][j + 1] == -1))
-                                               r.setBottom(r.top() + CARD_HEIGHT - 1);
-                                       else
-                                               r.setBottom(r.top() + 17);
-
-                                       if (r.contains(point))
-                                       {
-                                               hitStack = dcHitStack = true;
-                                               stackStart = QPoint(i, j);
-                                               mouseOffset = QPoint(point.x() - r.left(), point.y() - r.top());
-                                               stackPos = QPoint(point.x() - mouseOffset.x(), point.y() - mouseOffset.y());
-                                               QRect rcUpdate(r.left(), r.top(), r.width(), CARD_HEIGHT - 1); //wil wok?
-                                               return;
-                                       }
-
-                                       r.setTop(r.top() + 18);
-                               }
-                               else
-                               {
-                                       if (j != 18)
-                                       {
-                                               if (solBoard[i][j + 1] == -1)
-                                               {
-                                                       r.setBottom(r.top() + CARD_HEIGHT - 1);
-
-                                                       if (r.contains(point))
-                                                       {
-                                                               myDeck.ToggleCardFacing(solBoard[i][j]);  // Turn over that last card
-
-#if HAVE_SOUND
-                                                               if (bSoundOn)
-                                                                       PlaySound(IDW_CARDFLIP);
-#endif
-
-                                                               update(r); //wil wok?
-
-                                                               // Scoring...
-                                                               if (!m_bVegasStyle)
-                                                               {
-                                                                       m_nScore += 5;
-                                                                       emit UpdateScore(m_nScore);
-                                                               }
-
-                                                               return;
-                                                       }
-                                               }
-                                       }
-
-                                       r.setTop(r.top() + 4);
-                               }
-
-                               nCards++;
-                       }
-               }
-       }
-
-       // Check for hit on discard stack
-
-       int nCX = 5 + CARD_WIDTH + 6 + ((m_nNumToSplay - 1) * 12);
-       int nCY = 7 + ((m_nNumToSplay - 1) * 2);
-
-       if (QRect(nCX, nCY, CARD_WIDTH - 1, CARD_HEIGHT - 1).contains(point))
-       {
-               if (stack2p != -1)
-               {
-                       hitDiscard = dcHitDiscard = true;
-                       mouseOffset = QPoint(point.x() - (5 + CARD_WIDTH + 6 + ((m_nNumToSplay - 1) * 12)),
-                               point.y() - (7 + ((m_nNumToSplay - 1) * 2)));
-                       stackPos = QPoint(point.x() - mouseOffset.x(), point.y() - mouseOffset.y());
-                       return;
-               }
-       }
-
-       // Check for hit on remaining deck
-
-       if (QRect(5, 7, 5 + CARD_WIDTH - 1, 7 + CARD_HEIGHT - 1).contains(point))
-       {
-               m_bCanUndo = true;
-
-               if (stack1p == -1)  // I.e. it's empty...
-               {
-                       // Scoring...
-                       if ((m_bDrawThree && (m_nExhaustedDeck == 3))
-                               || (!m_bDrawThree && (m_nExhaustedDeck == 1)))
-                       {
-                               if (!m_bVegasStyle)
-                               {
-                                       m_nExhaustedDeck = 0;
-                                       m_nScore -= (m_bDrawThree ? 20 : 100);
-
-                                       if (m_nScore < 0)
-                                               m_nScore = 0;
-
-                                       emit UpdateScore(m_nScore);
-                               }
-                       }
-                       if (!m_bVegasStyle || (m_bVegasStyle && ((m_bDrawThree && (m_nExhaustedDeck < 3))
-                                       || (!m_bDrawThree && (m_nExhaustedDeck < 1)))))
-                       {
-                               for(; stack2p != -1; stack2p--)
-                               {
-                                       stack1p++;
-                                       stack1[stack1p] = stack2[stack2p];
-                               }
-
-#if HAVE_SOUND
-                               if (bSoundOn)
-                                       PlaySound(IDW_CARDKNOCK);
-#endif
-                       }
-               }
-               else
-               {
-                       m_nNumToSplay = 0;
-
-                       for(int i=0; i<(m_bDrawThree ? 3 : 1); i++)
-                       {
-                               if (stack1p != -1)  // I.e., there are cards left...
-                               {
-                                       stack2[++stack2p] = stack1[stack1p--];
-
-#if HAVE_SOUND
-                                       if (bSoundOn)
-                                       {
-                                               PlaySound(IDW_CARDFLIP);
-                                               // Pause
-                                               Pause(55);
-                                       }
-#endif
-
-                                       m_nNumToSplay++;
-                               }
-                       }
-
-                       if (stack1p == -1)  // This is done here because it's right!
-                       {
-                               m_nExhaustedDeck++;
-
-                               if (m_bVegasStyle && ((m_bDrawThree && (m_nExhaustedDeck == 3))
-                                       || (!m_bDrawThree && (m_nExhaustedDeck == 1))))
-                                       m_bShowX = true;
-                       }
-               }
-
-               mouseOffset = QPoint(point.x() - 5, point.y() - 7);
-
-               QRect inv1(5, 7, CARD_WIDTH, CARD_HEIGHT),
-                       inv2(5 + CARD_WIDTH + 6, 7, (2 * 12) + CARD_WIDTH, (2 * 2) + CARD_HEIGHT);
-               update(inv1);
-               update(inv2);
-       }
-
-       // Check for hit on ace piles
-
-       for(int i=0; i<4; i++)
-       {
-               QRect aceRect(200 + ((CARD_WIDTH + 4) * i), 7, CARD_WIDTH - 1, CARD_HEIGHT - 1);
-
-               if (aceRect.contains(point) && (nAce[i] > -1))
-               {
-                       nHitAce = i + 1;
-//                     mouseOffset = QPoint(point.x() - (200 + ((CARD_WIDTH + 4) * i)), point.y() - 7);
-                       mouseOffset = QPoint(point.x() - aceRect.x(), point.y() - aceRect.y());
-                       stackPos = QPoint(point.x() - mouseOffset.x(), point.y() - mouseOffset.y());
-                       return;
-               }
-       }
-}
-
-
-void GameWidget::OnLButtonUp(QPoint point) 
-{
-       if (!allowUserInput)
-               return;
-
-       point -= mouseOffset; // ?? bad form!
-
-       if (hitStack || hitDiscard || (nHitAce != 0))
-       {
-               QRect tabl[7];
-
-               for(int i=0; i<7; i++)  // Compute valid rects at bottoms of stacks...
-               {
-                       tabl[i].setLeft(10 + (i * (CARD_WIDTH + 8)));
-                       tabl[i].setRight(tabl[i].left() + CARD_WIDTH - 1);
-                       tabl[i].setTop(130);
-
-                       for(int j=0; j<19; j++)
-                       {
-                               if ((solBoard[i][j] == -1)
-                                       || (hitStack && (i == stackStart.x()) && (j == stackStart.y())))
-                               {
-                                       if (j > 0)
-                                       {
-                                               for(int k=0; k<j-1; k++)
-                                               {
-                                                       if (!myDeck.IsFaceUp(solBoard[i][k]))
-                                                               tabl[i].setTop(tabl[i].top() + 4);
-                                                       else
-                                                               tabl[i].setTop(tabl[i].top() + 17);
-                                               }
-                                       }
-
-                                       tabl[i].setBottom(tabl[i].top() + CARD_HEIGHT - 1);
-                                       break;
-                               }
-                       }
-               }
-
-//             stackPos = QPoint(point.x() - mouseOffset.x(), point.y() - mouseOffset.y());
-//             QRect c(point.x(), point.y(), CARD_WIDTH - 1, CARD_HEIGHT - 1);
-//             QRect c(point.x() - mouseOffset.x(), point.y() - mouseOffset.y(), CARD_WIDTH - 1, CARD_HEIGHT - 1);
-               QRect c(stackPos.x(), stackPos.y(), CARD_WIDTH - 1, CARD_HEIGHT - 1);
-               QRect a[4];
-               a[0] = QRect(200, 7, CARD_WIDTH - 1, CARD_HEIGHT - 1);
-               a[1] = QRect(200 + ((CARD_WIDTH + 4) * 1), 7, CARD_WIDTH - 1, CARD_HEIGHT - 1);
-               a[2] = QRect(200 + ((CARD_WIDTH + 4) * 2), 7, CARD_WIDTH - 1, CARD_HEIGHT - 1);
-               a[3] = QRect(200 + ((CARD_WIDTH + 4) * 3), 7, CARD_WIDTH - 1, CARD_HEIGHT - 1);
-
-               bool bHitAce[4];
-               bHitAce[0] = c.intersects(a[0]);
-               bHitAce[1] = c.intersects(a[1]);
-               bHitAce[2] = c.intersects(a[2]);
-               bHitAce[3] = c.intersects(a[3]);
-
-               // Check to see if hit more than one ace & pick the one that's closer
-               for(int i=0; i<3; i++)
-               {
-                       if (bHitAce[i] && bHitAce[i + 1] && (nAce[i] == -1) && (nAce[i + 1] == -1))
-                       {
-                               if (c.intersected(a[i]).width() > c.intersected(a[i + 1]).width())
-                                       bHitAce[i + 1] = false;
-                               else
-                                       bHitAce[i] = false;
-
-                               break;
-                       }
-               }
-
-               bool bMovedToAce = false;
-
-               for(int i=0; i<4; i++)
-               {
-                       if (bHitAce[i] && IsValidMoveToAce(nAce[i]))
-                       {
-                               m_bCanUndo = true;
-
-                               if (hitStack)
-                                       nAce[i] = myDeck.GetCardAtPos(solBoard[stackStart.x()][stackStart.y()]),
-                                       solBoard[stackStart.x()][stackStart.y()] = -1;
-
-                               if (hitDiscard)
-                               {
-                                       nAce[i] = myDeck.GetCardAtPos(stack2[stack2p--]);
-
-                                       if (m_nNumToSplay != 1)
-                                               m_nNumToSplay--;
-                               }
-
-                               if (nHitAce != 0)
-                               {
-                                       nAce[i] = nAce[nHitAce - 1];
-                                       int nCard = nAce[nHitAce - 1];
-                                       nAce[nHitAce - 1] = ((nCard - 1) % 13 == 0 ? -1 : nCard - 1);
-                                       break;
-                               }
-
-#if HAVE_SOUND
-                               if (bSoundOn)
-                                       PlaySound(IDW_CARDPLACE);
-#endif
-
-                               bMovedToAce = true;
-
-                               // Scoring...
-#if 0
-                               if (m_bVegasStyle)
-                                       m_nScore += 5;
-                               else
-                                       m_nScore += 10;
-#else
-                               m_nScore += (m_bVegasStyle ? 5 : 10);
-#endif
-
-                               emit UpdateScore(m_nScore);
-                               break;
-                       }
-               }
-
-               if (!bMovedToAce) // No aces, so check for stacks
-               {
-                       for(int i=0; i<7; i++)
-                       {
-                               if (c.intersects(tabl[i]) && IsValidMoveToTableaux(i))
-                               {
-                                       m_bCanUndo = true;
-
-#if HAVE_SOUND
-                                       if (bSoundOn)
-                                               PlaySound(IDW_CARDPLACE);
-#endif
-
-                                       if (hitStack && (i != stackStart.x()))
-                                       {
-                                               int cnt = stackStart.y();
-
-                                               for(int k=0; k<19; k++)
-                                               {
-                                                       if (solBoard[i][k] == -1)
-                                                       {
-                                                               solBoard[i][k] = solBoard[stackStart.x()][cnt];
-                                                               solBoard[stackStart.x()][cnt] = -1;
-                                                               cnt++;
-                                                       }
-
-                                                       if (solBoard[stackStart.x()][cnt] == -1) // Done copying?
-                                                               break;
-                                               }
-
-                                               break;
-                                       }
-
-                                       if (hitDiscard)
-                                       {
-                                               for(int k=0; k<19; k++)
-                                               {
-                                                       if (solBoard[i][k] == -1)
-                                                       {
-                                                               solBoard[i][k] = stack2[stack2p--];
-                                                               myDeck.SetCardFaceUp(solBoard[i][k]);
-
-                                                               // Scoring...
-                                                               if (!m_bVegasStyle)
-                                                               {
-                                                                       m_nScore += 5;
-                                                                       emit UpdateScore(m_nScore);
-                                                               }
-
-                                                               if (m_nNumToSplay != 1)
-                                                                       m_nNumToSplay--;
-
-                                                               break;
-                                                       }
-                                               }
-
-                                               break;
-                                       }
-
-                                       if (nHitAce != 0)
-                                       {
-                                               // handle moving to tableaux here...
-                                               for(int k=0; k<19; k++)
-                                               {
-                                                       if (solBoard[i][k] == -1)
-                                                       {
-                                                               int nCard = nAce[nHitAce - 1];
-
-                                                               for(int t=0; t<52; t++)  // We have to find da damn thing...
-                                                               {
-                                                                       if (myDeck.GetCardAtPos(t) == nCard)
-                                                                       {
-                                                                               solBoard[i][k] = t;
-                                                                               break;
-                                                                       }
-                                                               }
-
-                                                               nAce[nHitAce - 1] = ((nCard - 1) % 13 == 0 ? -1 : nCard - 1);
-                                                               myDeck.SetCardFaceUp(solBoard[i][k]);
-
-                                                               // Scoring...
-#if 0
-                                                               if (!m_bVegasStyle)
-                                                                       m_nScore -= 15;
-                                                               else
-                                                                       m_nScore -= 5;
-#else
-                                                               m_nScore -= (m_bVegasStyle ? 5 : 15);
-#endif
-
-                                                               emit UpdateScore(m_nScore);
-                                                               break;
-                                                       }
-                                               }
-
-                                               break;
-                                       }
-                               }
-                       }
-               }
-
-               update();
-       }
-
-       mouseDown = hitStack = hitDiscard = false;
-       nHitAce = 0;
-
-       if (bAutoRemove)
-               HandleAutoRemove();
-
-       if (PlayerWon())
-       {
-               emit UpdateScore(m_nScore);
-               HandleStatistics();
-               m_bWonLastGame = true;
-               m_bCanUndo = false;
-
-#if HAVE_SOUND
-               if (bSoundOn)
-               {
-                       QString id[] = { IDW_WINNER1, IDW_WINNER2, IDW_WINNER3, IDW_WINNER4, IDW_WINNER5 };
-                       srand((unsigned)time(NULL));
-                       int nWaveNum = rand() % 5;
-                       PlaySound(id[nWaveNum]);
-               }
-#endif
-
-               QMessageBox::information(this, "MAC Solitaire", "Congratulations!\nYou won!");
-               allowUserInput = false;
-       }
-}
-
-
-void GameWidget::OnMouseMove(QPoint point) 
-{
-       if (mouseDown && (hitStack || hitDiscard || (nHitAce != 0)))
-       {
-               int nHeight = 0;
-
-               if (hitStack)
-               {
-                       for(int i=stackStart.y(); i<19; i++)
-                               if (solBoard[stackStart.x()][i] != -1)
-                                       nHeight += 18;
-               }
-               else
-                       nHeight = 18;
-
-               nHeight += CARD_HEIGHT - 18;
-
-               QRect rcOld(stackPos.x(), stackPos.y(), CARD_WIDTH,
-                       nHeight); // Find old position for repainting...
-
-               stackPos = QPoint(point.x() - mouseOffset.x(), point.y() - mouseOffset.y());
-
-               QRect rcNew(stackPos.x(), stackPos.y(), CARD_WIDTH,
-                       nHeight); // Find new position
-               QRect rcUpdate = rcOld.united(rcNew);
-               update(rcUpdate); //wil wok? YESH!
-       }
-}
-
-
-void GameWidget::OnLButtonDblClk(QPoint point) 
-{
-       if (dcHitStack || dcHitDiscard)
-       {
-               hitStack = dcHitStack, hitDiscard = dcHitDiscard;
-
-               for(int i=0; i<4; i++)
-               {
-                       if (IsValidMoveToAce(nAce[i]))
-                       {
-                               if (hitStack)
-                               {
-                                       nAce[i] = myDeck.GetCardAtPos(solBoard[stackStart.x()][stackStart.y()]);
-                                       solBoard[stackStart.x()][stackStart.y()] = -1;
-                               }
-                               else
-                               {
-                                       nAce[i] = myDeck.GetCardAtPos(stack2[stack2p--]);
-
-                                       if (m_nNumToSplay != 1)
-                                               m_nNumToSplay--;
-                               }
-
-                               update();
-
-#if HAVE_SOUND
-                               if (bSoundOn)
-                                       PlaySound(IDW_ZIP);
-#endif
-
-                               // Scoring...
-#if 0
-                               if (m_bVegasStyle)
-                                       m_nScore += 5;
-                               else
-                                       m_nScore += 10;
-#else
-                               m_nScore += (m_bVegasStyle ? 5 : 10);
-#endif
-
-                               emit UpdateScore(m_nScore);
-                               break;
-                       }
-               }
-               
-               dcHitStack = hitStack = dcHitDiscard = hitDiscard = false;
-       }
-       else
-               OnLButtonDown(point); // Either was on draw pile or somewhere else...
-}
-
-
-// It's behaving strangely, especially with kings in the ace piles...
-// It's becuase of the mod 13 function: kings(13) get whacked to 0 this way...
-void GameWidget::HandleAutoRemove(void)
-{
-       bool bCheck = true;
-
-       while (bCheck)
-       {
-               bCheck = false;
-
-               int nLowestAce = (nAce[0] == -1 ? 0 : ((nAce[0] - 1) % 13) + 1); // Aces are 1-based, cards 1-based
-
-               for(int i=1; i<4; i++)
-               {
-                       int nTemp = (nAce[i] == -1 ? 0 : ((nAce[i] - 1) % 13) + 1);
-
-                       if (nTemp < nLowestAce)
-                               nLowestAce = nTemp;
-               }
-
-               for(int i=0; i<7; i++)  // Compare cards that *can* go
-               {
-                       for(int j=18; j>=0; j--)
-                       {
-                               if (solBoard[i][j] != -1)
-                               {
-                                       if (myDeck.IsFaceUp(solBoard[i][j]))
-                                       {
-                                               int nCard = myDeck.GetCardAtPos(solBoard[i][j]);
-
-                                               for(int k=0; k<4; k++)
-                                               {
-                                                       if (IsValidMoveToAce(nAce[k], nCard))
-                                                       {
-                                                               // Ranking/suiting doesn't work if nAce == -1... FIX!
-                                                               // Should be fixed now...
-                                                               // Figure out some way to simplify this tortuous logic, for cryin' out loud!
-                                                               int nSuit[4], nRank[4];
-
-                                                               for(int t=0; t<4; t++)
-                                                               {
-                                                                       if (nAce[t] != -1)
-                                                                               nSuit[t] = ((nAce[t] > 13) && (nAce[t] < 40) ? 0 : 1);
-                                                                       else
-                                                                               nSuit[t] = -1;
-
-                                                                       nRank[t] = ((nAce[t] - 1) % 13) + 1;
-                                                               }
-
-                                                               int nCardSuit = ((nCard > 13) && (nCard < 40) ? 0 : 1),
-                                                                       nCardRank = ((nCard - 1) % 13) + 1;
-                                                               bool bSpecial = false;
-                                                               int nCR[2], nCnt = 0;
-
-                                                               for(int t=0; t<4; t++)
-                                                                       if ((nCardSuit != nSuit[t]) && (t != k) && (nSuit[t] != -1))
-                                                                               nCR[nCnt++] = nRank[t];
-
-                                                               if ((nCnt == 2) && (nCR[0] == nCR[1])
-                                                                       && (nCR[0] - nLowestAce == 2) && (nCardRank - nLowestAce == 3))
-                                                                       bSpecial = true;
-
-                                                               if (((((nCard - 1) % 13) + 1) - nLowestAce) <= 2 || bSpecial)
-                                                               // OR difference is 3 and both opposite color are at 2
-//                                                             if (((nCard%13) - nLowestAce) <= 2)
-                                                               {
-                                                                       solBoard[i][j] = -1;
-
-                                                                       if (m_bAnimationsOn)
-                                                                               AnimateCards(nCard, k, i, j);
-
-                                                                       nAce[k] = nCard;
-                                                                       bCheck = true;
-
-                                                                       // Scoring...
-#if 0
-                                                                       if (m_bVegasStyle)
-                                                                               m_nScore += 5;
-                                                                       else
-                                                                               m_nScore += 10;
-#else
-                                                                       m_nScore += (m_bVegasStyle ? 5 : 10);
-#endif
-                                                                       emit UpdateScore(m_nScore);
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                       }
-
-                                       break;
-                               }
-                       }
-               }
-
-               if (stack2p != -1)
-               {
-                       int nCard = myDeck.GetCardAtPos(stack2[stack2p]);
-
-                       for(int k=0; k<4; k++)
-                       {
-                               if (IsValidMoveToAce(nAce[k], nCard))
-                               {
-                                       // Ranking/suiting doesn't work if nAce == -1... FIX!
-                                       // Should be fixed now...
-                                       // Figure out some way to simplify this tortuous logic, for cryin' out loud!
-                                       int nSuit[4], nRank[4];
-
-                                       for(int t=0; t<4; t++)
-                                       {
-                                               if (nAce[t] != -1)
-                                                       nSuit[t] = ((nAce[t] > 13) && (nAce[t] < 40) ? 0 : 1);
-                                               else
-                                                       nSuit[t] = -1;
-
-                                               nRank[t] = ((nAce[t] - 1) % 13) + 1;
-                                       }
-
-                                       int nCardSuit = ((nCard > 13) && (nCard < 40) ? 0 : 1),
-                                               nCardRank = ((nCard - 1) % 13) + 1;
-                                       bool bSpecial = false;
-                                       int nCR[2], nCnt = 0;
-
-                                       for(int t=0; t<4; t++)
-                                       {
-                                               if ((nCardSuit != nSuit[t]) && (t != k) && (nSuit[t] != -1))
-                                                       nCR[nCnt++] = nRank[t];
-                                       }
-
-                                       if ((nCnt == 2) && (nCR[0] == nCR[1])
-                                               && (nCR[0] - nLowestAce == 2) && (nCardRank - nLowestAce == 3))
-                                               bSpecial = true;
-
-                                       if (((((nCard - 1) % 13) + 1) - nLowestAce) <= 2 || bSpecial)
-                                       // OR difference is 3 and both opposite color are at 2 (tortuously checked above)
-                                       {
-                                               stack2p--;
-
-                                               if (m_nNumToSplay != 1)
-                                                       m_nNumToSplay--;
-
-                                               if (m_bAnimationsOn)
-                                                       AnimateCards(nCard, k, -1, -1);
-
-                                               nAce[k] = nCard;
-                                               bCheck = true;
-
-                                               // Scoring...
-#if 0
-                                               if (m_bVegasStyle)
-                                                       m_nScore += 5;
-                                               else
-                                                       m_nScore += 10;
-#else
-                                               m_nScore += (m_bVegasStyle ? 5 : 10);
-#endif
-
-                                               emit UpdateScore(m_nScore);
-                                               break;
-                                       }
-                               }
-                       }
-               }
-       }
-}
-
-
-// Have two routines? One to initiate, the other to handle card movements?
-// Good idea! Implement it, you schmendrick!
-void GameWidget::AnimateCards(int nCard, int nAce, int nTabX, int nTabY)
-{
-//no mas--jeff no likee        CWaitCursor wc;   // Automagically reverts when it goes out of scope
-       int nCX, nCY, nDX, nDY;
-
-       // Step 1: figure out where card started from
-       if (nTabX == -1)
-       {
-//             nCX = 5+CARD_WIDTH+6, nCY = 5;
-               nCX = 5 + CARD_WIDTH + 6 + ((m_nNumToSplay - 1) * 12);
-               nCY = 7 + ((m_nNumToSplay - 1) * 2);
-       }
-       else
-       {
-               nCX = 10 + (nTabX * (CARD_WIDTH + 8)), nCY = 130;
-
-               for(int j=0; j<nTabY; j++)
-               {
-                       if (solBoard[nTabX][j] != -1)
-                       {
-                               if (myDeck.IsFaceUp(solBoard[nTabX][j]))
-                                       nCY += 18;
-                               else
-                                       nCY += 4;
-                       }
-               }
-       }
-       // Step 2: figure out where card is going
-       nDX = 200 + ((CARD_WIDTH + 4) * nAce), nDY = 7;
-       // Step 3: animate card flying from start to destination
-       // Use Bresenham's algorithm to figure path...
-       // (ideas for movement: increasing acceleration, curved paths, more than one at a time)
-       m_bFreeCard = true;
-       m_pFirstCard = new SCardInfo(nCard);
-       int nDeltaX = nDX - nCX, nDeltaY = nDY - nCY;
-       int nError = 0;
-       int nUpdate = 0;
-       update(); //will do it??? Seems to...
-//Doing this causes an image of the card to be drawn at (0, 0) :-/
-//     repaint();
-       QRect rcOld(nCX, nCY, CARD_WIDTH, CARD_HEIGHT), rcNew, rcUpdate;
-
-       if (abs(nDeltaX) > abs(nDeltaY))
-       {
-               for(int i=0; i<abs(nDeltaX); i++)
-               {
-                       // Put card draw stuff into OnDraw? (probably best way to do it...)
-                       nError += abs(nDeltaY);
-
-                       if (nError > abs(nDeltaX))
-                               nCY += (nDeltaY < 0 ? -1 : +1), nError -= abs(nDeltaX);
-
-                       m_pFirstCard->nXPos = nCX + (nDeltaX < 0 ? -i : +i), m_pFirstCard->nYPos = nCY;
-                       // Draw card
-                       nUpdate++;
-
-                       if (nUpdate == 10)
-                       {
-                               rcNew = QRect(m_pFirstCard->nXPos, m_pFirstCard->nYPos,
-                                       CARD_WIDTH, CARD_HEIGHT);
-                               rcUpdate = rcOld.united(rcNew);
-                               nUpdate = 0;
-                               repaint(rcUpdate);
-                               rcOld = rcNew;
-                               // Pause
-                               Pause(3);
-                       }
-                       // calc new positions
-               }
-
-               m_pFirstCard->nXPos = nDX, m_pFirstCard->nYPos = nDY;
-               rcNew = QRect(nDX, nDY, CARD_WIDTH, CARD_HEIGHT);
-               rcUpdate = rcOld.united(rcNew);
-               repaint(rcUpdate);
-       }
-       else
-       {
-               for(int i=0; i<abs(nDeltaY); i++)
-               {
-                       // Put card draw stuff into OnDraw? (probably best way to do it...)
-                       nError += abs(nDeltaX);
-
-                       if (nError > abs(nDeltaY))
-                               nCX += (nDeltaX < 0 ? -1 : +1), nError -= abs(nDeltaY);
-
-                       m_pFirstCard->nXPos = nCX, m_pFirstCard->nYPos = nCY + (nDeltaY < 0 ? -i : +i);
-                       // Draw card
-                       nUpdate++;
-
-                       if (nUpdate == 10)
-                       {
-                               rcNew = QRect(m_pFirstCard->nXPos, m_pFirstCard->nYPos,
-                                       CARD_WIDTH, CARD_HEIGHT);
-                               rcUpdate = rcOld.united(rcNew);
-                               nUpdate = 0;
-                               repaint(rcUpdate);//this is crappy. should only update what's needed!
-                               rcOld = rcNew;
-                               // Pause
-                               Pause(3);
-                       }
-                       // calc new positions
-               }
-
-               m_pFirstCard->nXPos = nDX, m_pFirstCard->nYPos = nDY;
-               rcNew = QRect(nDX, nDY, CARD_WIDTH, CARD_HEIGHT);
-               rcUpdate = rcOld.united(rcNew);
-               repaint(rcUpdate);
-       }
-
-       m_bFreeCard = false;
-       delete m_pFirstCard;
-}
-
-
-bool GameWidget::IsValidMoveToAce(int nAceM)
-{
-       int nCards = 0;
-
-       for(int k=stackStart.y(); k<19; k++)
-       {
-               if (solBoard[stackStart.x()][k] != -1)
-                       nCards++;
-       }
-
-       if ((hitStack && (nCards == 1)) || hitDiscard)
-       {
-               int nCardHit = (hitStack ? myDeck.GetCardAtPos(solBoard[stackStart.x()][stackStart.y()])
-                       : myDeck.GetCardAtPos(stack2[stack2p]));
-               return IsValidMoveToAce(nAceM, nCardHit);
-       }
-       else if (nHitAce != 0)
-       {
-               return IsValidMoveToAce(nAceM, nAce[nHitAce - 1]);
-       }
-
-       return false;
-}
-
-
-bool GameWidget::IsValidMoveToAce(int nAce, int nCard)
-{
-       if (((nAce == -1) && ((nCard % 13) == 1))
-               || ((nAce == (nCard - 1)) && ((nAce % 13) != 0)))
-               return true;
-
-       return false;
-}
-
-
-bool GameWidget::IsValidMoveToTableaux(int nStack)
-{
-       int nBottomCard = -1, nTopCard;
-
-       for(int i=0; i<19; i++)
-       {
-               if ((solBoard[nStack][i] != -1) && (myDeck.IsFaceUp(solBoard[nStack][i])))
-                       nBottomCard = myDeck.GetCardAtPos(solBoard[nStack][i]);
-       }
-
-       if (hitStack)
-               nTopCard = myDeck.GetCardAtPos(solBoard[stackStart.x()][stackStart.y()]);
-       else if (hitDiscard)
-               nTopCard = myDeck.GetCardAtPos(stack2[stack2p]);
-       else if (nHitAce != 0)
-               nTopCard = nAce[nHitAce - 1];
-
-       int colorBC = ((nBottomCard > 13) && (nBottomCard < 40) ? 0 : 1);
-       int colorTC = ((nTopCard > 13) && (nTopCard < 40) ? 0 : 1);
-       int rankBC = (nBottomCard - 1) % 13;
-       int rankTC = (nTopCard - 1) % 13;
-
-       if (((rankBC == (rankTC + 1)) && (colorBC != colorTC))
-               || ((nBottomCard == -1) && (rankTC == 12)))
-               return true;
-       
-       return false;
-}
-
-
-bool GameWidget::PlayerWon(void)
-{
-       for(int i=0; i<7; i++)
-               if (solBoard[i][0] != -1)
-                 return false;
-
-       if ((stack1p != -1) || (stack2p != -1))
-               return false;
-
-       return true;
-}
-
-
-void GameWidget::HandleStatistics(void)
-{
-       if (PlayerWon())
-       {
-               m_nWins++;
-
-               if (m_bWonLastGame)
-                       m_nStreakC++;
-               else
-                       m_nStreakC = 1;
-       }
-       else
-       {
-               m_nLosses++;
-
-               if (!m_bWonLastGame)
-                       m_nStreakC--;
-               else
-                       m_nStreakC = -1;
-       }
-
-       if (m_nStreakC < 0)    // Beat largest losing streak?
-       {
-               if (abs(m_nStreakC) > m_nStreakL)
-                       m_nStreakL = abs(m_nStreakC);
-       }
-       else                   // Check for longest winning streak
-       {
-               if (m_nStreakC > m_nStreakW)
-                       m_nStreakW = m_nStreakC;
-       }
-
-       if (m_bVegasStyle)     // Check for high score
-       {
-               if (m_nScore > m_nVHiScore)
-                       m_nVHiScore = m_nScore;
-       }
-       else
-       {
-               if (m_nScore > m_nHiScore)
-                       m_nHiScore = m_nScore;
-       }
-}
-#endif
-
-
 void GameWidget::ResizeGrid(void)
 {
        QSize s = size();
 
+       // Set some room for the board title (7.5%)
+       float titleHeight = s.height() * 0.075;
+
        // Find the constraints
        float boxSizeX = s.width() / gameBoard->width;
-       float boxSizeY = s.height() / gameBoard->height;
+       float boxSizeY = (s.height() - titleHeight) / gameBoard->height;
 
        maxLength = (int)(boxSizeX > boxSizeY ? boxSizeY : boxSizeX);
 
        offsetX = (s.width() - (maxLength * gameBoard->width)) / 2;
-       offsetY = (s.height() - (maxLength * gameBoard->height)) / 2;
+       offsetY = ((s.height() - titleHeight) - (maxLength * gameBoard->height)) / 2;
+       titleBox.setRect(0, offsetY, s.width(), titleHeight);
+       offsetY += titleHeight; // Add in the title's height
 }
 
 
index 28ff3b4096a3d479b669b57b511efdededb75fb7..f6ba76bf6cb883189501c362b907a386240bebb3 100644 (file)
@@ -58,6 +58,7 @@ class GameWidget: public QWidget
                int movingBoxPositionX;
                int movingBoxPositionY;
                int offsetX, offsetY;
+               QRect titleBox;
 };
 
 #endif // __GAMEWIDGET_H__