X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/43c3922bb01aacbb1e2e85c0cd7009618c83434a..991d57f8443fc8a31c2ad3e3a8180af08a6394d6:/demos/bombs/game.cpp diff --git a/demos/bombs/game.cpp b/demos/bombs/game.cpp index eed0dc622c..ae07b7dac0 100644 --- a/demos/bombs/game.cpp +++ b/demos/bombs/game.cpp @@ -2,17 +2,13 @@ // Name: bombs1.cpp // Purpose: Implementation of the class BombsGame // Author: P. Foggia 1996 -// Modified by: Wlodzimierz Skiba (ABX) 2003 +// Modified by: Wlodzimierz Skiba (ABX) since 2003 // Created: 1996 // RCS-ID: $Id$ // Copyright: (c) 1996 P. Foggia // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -# pragma implementation -#endif - #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -99,6 +95,7 @@ bool BombsGame::Init(int aWidth, int aHeight, bool easyCorner) } m_numRemainingCells = m_height*m_width-m_numBombCells; + m_numMarkedCells = 0; return true; } @@ -106,15 +103,22 @@ bool BombsGame::Init(int aWidth, int aHeight, bool easyCorner) void BombsGame::Mark(int x, int y) { m_field[x+y*m_width] ^= BG_MARKED; + if (IsMarked(x, y)) + m_numMarkedCells++; + else + m_numMarkedCells--; } -void BombsGame::Unhide(int x, int y) +void BombsGame::Unhide(int x, int y, bool b_selected) { if (!IsHidden(x,y)) { return; } + if (b_selected) + m_field[x+y*m_width] |= BG_SELECTED; + m_field[x+y*m_width] &= ~BG_HIDDEN; if (!IsBomb(x,y))