ReactOS  0.4.15-dev-3163-gf17c2c0
solitaire.h File Reference
#include <cardlib.h>
Include dependency graph for solitaire.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define OPTION_SHOW_STATUS   4
 
#define OPTION_THREE_CARDS   8
 
#define OPTION_SHOW_TIME   16
 
#define OPTION_KEEP_SCORE   32
 
#define OPTION_SCORE_STD   64
 
#define OPTION_SCORE_VEGAS   128
 
#define CARDBACK_START   IDC_CARDBACK1
 
#define CARDBACK_END   IDC_CARDBACK12
 
#define NUM_CARDBACKS   (CARDBACK_END - CARDBACK_START + 1)
 
#define CARDBACK_RES_START   53
 
#define CARDBACK_OPTIONS_WIDTH   72
 
#define CARDBACK_OPTIONS_HEIGHT   112
 
#define IDT_PLAYTIMER   1000
 
#define NUM_ROW_STACKS   7
 
#define DECK_ID   1
 
#define PILE_ID   2
 
#define SUIT_ID   4
 
#define ROW_ID   10
 
#define SCORE_NONE   0
 
#define SCORE_STD   1
 
#define SCORE_VEGAS   2
 
#define X_BORDER   20
 
#define X_PILE_BORDER   18
 
#define X_ROWSTACK_BORDER   10
 
#define X_SUITSTACK_BORDER   10
 
#define Y_BORDER   30
 
#define Y_BORDERWITHFRAME   20
 
#define Y_ROWSTACK_BORDER   32
 

Functions

void CreateSol (void)
 
void NewGame (void)
 
void UpdateStatusBar (void)
 
void SetPlayTimer (void)
 
int GetScoreMode (void)
 
void SetUndoMenuState (bool enable)
 
bool CARDLIBPROC RowStackDragProc (CardRegion &stackobj, int iNumCards)
 
bool CARDLIBPROC RowStackDropProc (CardRegion &stackobj, CardStack &dragcards)
 
bool CARDLIBPROC SuitStackDropProc (CardRegion &stackobj, CardStack &dragcards)
 
void CARDLIBPROC SuitStackAddProc (CardRegion &stackobj, const CardStack &added)
 
void CARDLIBPROC SuitStackClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC RowStackClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC RowStackDblClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC DeckClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC PileDblClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC PileClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC PileRemoveProc (CardRegion &stackobj, int iRemoved)
 
void SetUndo (int set_source_id, int set_destination_id, int set_number_of_cards, int set_prev_score, int set_prev_visible_pile_cards)
 
void ClearUndo (void)
 
void Undo (void)
 

Variables

CardWindow SolWnd
 
TCHAR szAppName []
 
bool fGameStarted
 
DWORD dwOptions
 
DWORD dwTime
 
DWORD dwWasteCount
 
DWORD dwWasteTreshold
 
DWORD dwPrevMode
 
long lScore
 
HWND hwndMain
 
UINT_PTR PlayTimer
 
int yRowStackCardOffset
 
int VisiblePileCards
 
CardRegionpDeck
 
CardRegionpPile
 
CardRegionpSuitStack []
 
CardRegionpRowStack []
 
CardStack activepile
 

Macro Definition Documentation

◆ CARDBACK_END

#define CARDBACK_END   IDC_CARDBACK12

Definition at line 17 of file solitaire.h.

◆ CARDBACK_OPTIONS_HEIGHT

#define CARDBACK_OPTIONS_HEIGHT   112

Definition at line 21 of file solitaire.h.

◆ CARDBACK_OPTIONS_WIDTH

#define CARDBACK_OPTIONS_WIDTH   72

Definition at line 20 of file solitaire.h.

◆ CARDBACK_RES_START

#define CARDBACK_RES_START   53

Definition at line 19 of file solitaire.h.

◆ CARDBACK_START

#define CARDBACK_START   IDC_CARDBACK1

Definition at line 16 of file solitaire.h.

◆ DECK_ID

#define DECK_ID   1

Definition at line 39 of file solitaire.h.

◆ IDT_PLAYTIMER

#define IDT_PLAYTIMER   1000

Definition at line 33 of file solitaire.h.

◆ NUM_CARDBACKS

#define NUM_CARDBACKS   (CARDBACK_END - CARDBACK_START + 1)

Definition at line 18 of file solitaire.h.

◆ NUM_ROW_STACKS

#define NUM_ROW_STACKS   7

Definition at line 38 of file solitaire.h.

◆ OPTION_KEEP_SCORE

#define OPTION_KEEP_SCORE   32

Definition at line 13 of file solitaire.h.

◆ OPTION_SCORE_STD

#define OPTION_SCORE_STD   64

Definition at line 14 of file solitaire.h.

◆ OPTION_SCORE_VEGAS

#define OPTION_SCORE_VEGAS   128

Definition at line 15 of file solitaire.h.

◆ OPTION_SHOW_STATUS

#define OPTION_SHOW_STATUS   4

Definition at line 10 of file solitaire.h.

◆ OPTION_SHOW_TIME

#define OPTION_SHOW_TIME   16

Definition at line 12 of file solitaire.h.

◆ OPTION_THREE_CARDS

#define OPTION_THREE_CARDS   8

Definition at line 11 of file solitaire.h.

◆ PILE_ID

#define PILE_ID   2

Definition at line 40 of file solitaire.h.

◆ ROW_ID

#define ROW_ID   10

Definition at line 42 of file solitaire.h.

◆ SCORE_NONE

#define SCORE_NONE   0

Definition at line 44 of file solitaire.h.

◆ SCORE_STD

#define SCORE_STD   1

Definition at line 45 of file solitaire.h.

◆ SCORE_VEGAS

#define SCORE_VEGAS   2

Definition at line 46 of file solitaire.h.

◆ SUIT_ID

#define SUIT_ID   4

Definition at line 41 of file solitaire.h.

◆ X_BORDER

#define X_BORDER   20

Definition at line 49 of file solitaire.h.

◆ X_PILE_BORDER

#define X_PILE_BORDER   18

Definition at line 50 of file solitaire.h.

◆ X_ROWSTACK_BORDER

#define X_ROWSTACK_BORDER   10

Definition at line 51 of file solitaire.h.

◆ X_SUITSTACK_BORDER

#define X_SUITSTACK_BORDER   10

Definition at line 52 of file solitaire.h.

◆ Y_BORDER

#define Y_BORDER   30

Definition at line 53 of file solitaire.h.

◆ Y_BORDERWITHFRAME

#define Y_BORDERWITHFRAME   20

Definition at line 54 of file solitaire.h.

◆ Y_ROWSTACK_BORDER

#define Y_ROWSTACK_BORDER   32

Definition at line 55 of file solitaire.h.

Function Documentation

◆ ClearUndo()

void ClearUndo ( void  )

Definition at line 45 of file solundo.cpp.

46 {
47  source_id = -1;
48  destination_id = -1;
49  number_of_cards = 0;
50  SetUndoMenuState(false);
51 }
void SetUndoMenuState(bool enable)
Definition: solitaire.cpp:182
static int source_id
Definition: solundo.cpp:15
static int number_of_cards
Definition: solundo.cpp:19
static int destination_id
Definition: solundo.cpp:16

Referenced by NewGame(), RowStackClickProc(), SuitStackAddProc(), and Undo().

◆ CreateSol()

void CreateSol ( void  )

Definition at line 12 of file solcreate.cpp.

13 {
14  int i;
15 
16 // hbmBitmap = (HBITMAP)LoadImage(0,"test.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
17 // SolWnd.SetBackImage(hbmBitmap);
18 
19  activepile.Clear();
20 
21  // Compute the value for yRowStackCardOffset based on the height of the card, so the card number isn't hidden on larger cards
23 
32 
40 
41  //
42  // Create the suit stacks
43  //
44  for(i = 0; i < 4; i++)
45  {
49 
53 
55  }
56 
57  //
58  // Create the row stacks
59  //
60  for(i = 0; i < NUM_ROW_STACKS; i++)
61  {
65 
68 
70 
75  }
76 }
bool CARDLIBPROC SuitStackDropProc(CardRegion &stackobj, CardStack &dragcards)
Definition: solgame.cpp:235
void CARDLIBPROC PileRemoveProc(CardRegion &stackobj, int iItems)
Definition: solgame.cpp:481
void SetFaceDirection(UINT uDirType, int nOption)
Definition: cardregion.cpp:258
void CARDLIBPROC SuitStackAddProc(CardRegion &stackobj, const CardStack &added)
Definition: solgame.cpp:346
#define X_BORDER
Definition: solitaire.h:49
#define SUIT_ID
Definition: solitaire.h:41
bool CARDLIBPROC RowStackDropProc(CardRegion &stackobj, CardStack &dragcards)
Definition: solgame.cpp:128
#define CS_DRAG_NONE
Definition: cardlib.h:28
#define CS_DRAG_CALLBACK
Definition: cardlib.h:31
#define CS_EI_SUNK
Definition: cardlib.h:19
void Clear()
Definition: cardstack.cpp:37
int yRowStackCardOffset
Definition: solcreate.cpp:10
void SetPlacement(UINT xJustify, UINT yJustify, int xAdjust, int yAdjust)
Definition: cardregion.cpp:250
CardRegion * pDeck
Definition: solcreate.cpp:3
CardRegion * pSuitStack[4]
Definition: solcreate.cpp:5
#define Y_ROWSTACK_BORDER
Definition: solitaire.h:55
void CARDLIBPROC SuitStackClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:276
void CARDLIBPROC RowStackClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:291
void SetDblClickProc(pClickProc proc)
Definition: cardregion.cpp:192
#define DECK_ID
Definition: solitaire.h:39
#define CS_EI_NONE
Definition: cardlib.h:18
#define ROW_ID
Definition: solitaire.h:42
void SetEmptyImage(UINT uImage)
Definition: cardregion.cpp:366
#define CS_EI_CIRC
Definition: cardlib.h:20
bool SetThreedCount(int count)
Definition: cardregion.cpp:215
#define Y_BORDERWITHFRAME
Definition: solitaire.h:54
#define X_ROWSTACK_BORDER
Definition: solitaire.h:51
bool SetDragRule(UINT uDragType, pCanDragProc proc=0)
Definition: cardregion.cpp:146
#define X_SUITSTACK_BORDER
Definition: solitaire.h:52
#define CS_XJUST_CENTER
Definition: cardlib.h:39
#define PILE_ID
Definition: solitaire.h:40
#define NUM_ROW_STACKS
Definition: solitaire.h:38
#define CS_FACE_DOWN
Definition: cardlib.h:52
void CARDLIBPROC DeckClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:504
void CARDLIBPROC RowStackDblClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:403
#define CS_DRAG_TOP
Definition: cardlib.h:29
#define CS_DEFXOFF
Definition: cardlib.h:23
#define CS_DROP_NONE
Definition: cardlib.h:33
void CARDLIBPROC PileClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:438
CardRegion * CreateRegion(int id, bool fVisible, int x, int y, int xoffset, int yoffset)
Definition: cardregion.cpp:104
void SetClickProc(pClickProc proc)
Definition: cardregion.cpp:182
CardStack activepile
Definition: solgame.cpp:12
int __cardwidth
Definition: cardlib.cpp:25
#define CS_DROP_CALLBACK
Definition: cardlib.h:35
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CS_FACE_DOWNUP
Definition: cardlib.h:53
void CARDLIBPROC PileDblClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:452
#define X_PILE_BORDER
Definition: solitaire.h:50
void SetAddCardProc(pAddProc proc)
Definition: cardregion.cpp:197
void SetRemoveCardProc(pRemoveProc proc)
Definition: cardregion.cpp:202
bool SetDropRule(UINT uDropType, pCanDropProc proc=0)
Definition: cardregion.cpp:164
int __cardheight
Definition: cardlib.cpp:26
CardRegion * pRowStack[NUM_ROW_STACKS]
Definition: solcreate.cpp:6
bool CARDLIBPROC RowStackDragProc(CardRegion &stackobj, int iNumDragCards)
Definition: solgame.cpp:104
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
CardWindow SolWnd
Definition: solitaire.cpp:33
CardRegion * pPile
Definition: solcreate.cpp:4

Referenced by WndProc().

◆ DeckClickProc()

void CARDLIBPROC DeckClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 504 of file solgame.cpp.

505 {
506  TRACE("ENTER DeckClickProc()\n");
507 
508  SetPlayTimer();
509 
510  CardStack cardstack = stackobj.GetCardStack();
511  CardStack pile = pPile->GetCardStack();
512 
513  fGameStarted = true;
514  SetPlayTimer();
515 
516  //reset the face-up pile to represent 3 cards
519 
520  if(cardstack.NumCards() == 0)
521  {
522  if (GetScoreMode() == SCORE_VEGAS)
523  {
525  {
526  pile.Clear();
527 
529  cardstack.Push(activepile);
530  activepile.Clear();
532  VisiblePileCards = 0;
533  }
534  }
535  else if (GetScoreMode() == SCORE_STD)
536  {
538  if ((dwWasteCount >= dwWasteTreshold) && (activepile.NumCards() != 0))
539  {
541  lScore = lScore >= 20 ? lScore - 20 : 0;
542  else
543  lScore = lScore >= 100 ? lScore - 100 : 0;
544  }
545 
546  pile.Clear();
547 
549  cardstack.Push(activepile);
550  activepile.Clear();
551  VisiblePileCards = 0;
552 
553  UpdateStatusBar();
554  }
555  else
556  {
557  pile.Clear();
558 
560  cardstack.Push(activepile);
561  activepile.Clear();
563  VisiblePileCards = 0;
564  }
565 
566  dwWasteCount++;
567  }
568  else
569  {
570  int numcards = min((dwOptions & OPTION_THREE_CARDS) ? 3 : 1, cardstack.NumCards());
571 
573 
574  //make a "visible" copy of these cards
575  CardStack temp;
576  temp = cardstack.Pop(numcards);
577  temp.Reverse();
578 
580  pile.Clear();
581 
582  pile.Push(temp);
583 
584  //remove the top 3 from deck
586 
587  VisiblePileCards = numcards;
588  }
589 
590  activepile.Print();
591 
592  pDeck->SetCardStack(cardstack);
593  pPile->SetCardStack(pile);
594 
596 
597  SolWnd.Redraw();
598  TRACE("EXIT DeckClickProc()\n");
599 }
void Print()
Definition: cardstack.cpp:222
DWORD dwOptions
Definition: solitaire.cpp:24
long lScore
Definition: solitaire.cpp:30
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
void Clear()
Definition: cardstack.cpp:37
void Push(const Card card)
Definition: cardstack.cpp:83
CardRegion * pDeck
Definition: solcreate.cpp:3
#define DECK_ID
Definition: solitaire.h:39
void Redraw(void)
Definition: cardwindow.cpp:553
int GetScoreMode(void)
Definition: solitaire.cpp:129
void Reverse()
Definition: cardstack.cpp:73
int VisiblePileCards
Definition: solgame.cpp:13
#define PILE_ID
Definition: solitaire.h:40
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:171
#define CS_DEFXOFF
Definition: cardlib.h:23
Card Pop()
Definition: cardstack.cpp:127
#define OPTION_THREE_CARDS
Definition: solitaire.h:11
CardStack activepile
Definition: solgame.cpp:12
void SetCardStack(const CardStack &cs)
Definition: cardregion.cpp:390
void SetUndo(int set_source_id, int set_destination_id, int set_number_of_cards, int set_prev_score, int set_prev_visible_pile_cards)
Definition: solundo.cpp:27
void SetOffsets(int x, int y)
Definition: cardregion.cpp:228
bool fGameStarted
Definition: solgame.cpp:15
static calc_node_t temp
Definition: rpn_ieee.c:38
#define min(a, b)
Definition: monoChain.cc:55
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:311
DWORD dwWasteCount
Definition: solitaire.cpp:27
#define SCORE_STD
Definition: solitaire.h:45
#define SCORE_VEGAS
Definition: solitaire.h:46
void FixIfOneCardLeft(void)
Definition: solgame.cpp:465
int NumCards() const
Definition: cardstack.h:14
DWORD dwWasteTreshold
Definition: solitaire.cpp:28
CardWindow SolWnd
Definition: solitaire.cpp:33
CardRegion * pPile
Definition: solcreate.cpp:4

◆ GetScoreMode()

int GetScoreMode ( void  )

Definition at line 129 of file solitaire.cpp.

130 {
132  {
133  return SCORE_NONE;
134  }
135 
137  {
138  return SCORE_STD;
139  }
140 
142  {
143  return SCORE_VEGAS;
144  }
145 
146  return 0;
147 }
DWORD dwOptions
Definition: solitaire.cpp:24
#define OPTION_SCORE_VEGAS
Definition: solitaire.h:15
#define SCORE_NONE
Definition: solitaire.h:44
#define OPTION_SCORE_STD
Definition: solitaire.h:14
#define SCORE_STD
Definition: solitaire.h:45
#define SCORE_VEGAS
Definition: solitaire.h:46

Referenced by _tWinMain(), DeckClickProc(), NewGame(), OptionsDlgProc(), RowStackClickProc(), RowStackDropProc(), ShowGameOptionsDlg(), SuitStackAddProc(), SuitStackDropProc(), Undo(), UpdateStatusBar(), and WndProc().

◆ NewGame()

void NewGame ( void  )

Definition at line 18 of file solgame.cpp.

19 {
20  TRACE("ENTER NewGame()\n");
21  int i, j;
22 
23  if (GetScoreMode() == SCORE_VEGAS)
24  {
26  lScore = lScore - 52;
27  else
28  lScore = -52;
29 
31  dwWasteTreshold = 2;
32  else
33  dwWasteTreshold = 0;
34 
35  }
36  else
37  {
39  dwWasteTreshold = 3;
40  else
41  dwWasteTreshold = 0;
42 
43  lScore = 0;
44  }
45 
46  dwTime = 0;
47  dwWasteCount = 0;
48  LastId = 0;
49 
51 
52  //create a new card-stack
54  deck.NewDeck();
55  deck.Shuffle();
56  activepile.Clear();
57  VisiblePileCards = 0;
58 
59  //deal to each row stack..
60  for(i = 0; i < NUM_ROW_STACKS; i++)
61  {
63  temp.Clear();
64 
66 
67  for(j = 0; j <= i; j++)
68  {
69  temp.Push(deck.Pop());
70  }
71 
73  }
74 
75  //put the other cards onto the deck
77  pDeck->Update();
78 
79  // For the 1-card-mode, all cards need to be completely overlapped
81  pPile->SetOffsets(0, 0);
82 
83  SolWnd.Redraw();
84 
85  fGameStarted = false;
86 
88 
90  ClearUndo();
91 
92  TRACE("EXIT NewGame()\n");
93 
94 }
DWORD dwOptions
Definition: solitaire.cpp:24
#define OPTION_KEEP_SCORE
Definition: solitaire.h:13
void SetFaceDirection(UINT uDirType, int nOption)
Definition: cardregion.cpp:258
long lScore
Definition: solitaire.cpp:30
void EmptyStacks(void)
Definition: cardwindow.cpp:607
void Clear()
Definition: cardstack.cpp:37
CardRegion * pDeck
Definition: solcreate.cpp:3
void Redraw(void)
Definition: cardwindow.cpp:553
int GetScoreMode(void)
Definition: solitaire.cpp:129
void NewDeck()
Definition: cardstack.cpp:42
void Update()
Definition: cardregion.cpp:207
int VisiblePileCards
Definition: solgame.cpp:13
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
DWORD dwTime
Definition: solitaire.cpp:26
#define NUM_ROW_STACKS
Definition: solitaire.h:38
#define TRACE(s)
Definition: solgame.cpp:4
void Shuffle()
Definition: cardstack.cpp:50
void ClearUndo(void)
Definition: solundo.cpp:45
DWORD dwPrevMode
Definition: solitaire.cpp:29
Card Pop()
Definition: cardstack.cpp:127
#define OPTION_THREE_CARDS
Definition: solitaire.h:11
CardStack activepile
Definition: solgame.cpp:12
int LastId
Definition: solgame.cpp:14
void SetCardStack(const CardStack &cs)
Definition: cardregion.cpp:390
void SetOffsets(int x, int y)
Definition: cardregion.cpp:228
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
bool fGameStarted
Definition: solgame.cpp:15
static calc_node_t temp
Definition: rpn_ieee.c:38
#define CS_FACE_DOWNUP
Definition: cardlib.h:53
CardStack deck
Definition: spigame.cpp:18
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:311
DWORD dwWasteCount
Definition: solitaire.cpp:27
#define SCORE_VEGAS
Definition: solitaire.h:46
CardRegion * pRowStack[NUM_ROW_STACKS]
Definition: solcreate.cpp:6
DWORD dwWasteTreshold
Definition: solitaire.cpp:28
CardWindow SolWnd
Definition: solitaire.cpp:33
CardRegion * pPile
Definition: solcreate.cpp:4

◆ PileClickProc()

void CARDLIBPROC PileClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 438 of file solgame.cpp.

439 {
440  TRACE("ENTER SuitStackClickProc()\n");
441 
442  fGameStarted = true;
443 
444  LastId = stackobj.Id();
445 
446  TRACE("EXIT SuitStackClickProc()\n");
447 }
#define TRACE(s)
Definition: solgame.cpp:4
int LastId
Definition: solgame.cpp:14
bool fGameStarted
Definition: solgame.cpp:15

Referenced by CreateSol().

◆ PileDblClickProc()

void CARDLIBPROC PileDblClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 452 of file solgame.cpp.

453 {
454  TRACE("ENTER PileDblClickProc()\n");
455 
456  SetPlayTimer();
457 
458  RowStackDblClickProc(stackobj, iNumClicked);
459  TRACE("EXIT PileDblClickProc()\n");
460 }
#define TRACE(s)
Definition: solgame.cpp:4
void CARDLIBPROC RowStackDblClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:403
void SetPlayTimer(void)
Definition: solitaire.cpp:171

◆ PileRemoveProc()

void CARDLIBPROC PileRemoveProc ( CardRegion stackobj,
int  iRemoved 
)

Definition at line 481 of file solgame.cpp.

482 {
483  TRACE("ENTER PileRemoveProc()\n");
484 
485  SetPlayTimer();
486 
487  //modify our "virtual" pile by removing the same card
488  //that was removed from the physical card stack
489  activepile.Pop(iItems);
491  {
493  }
494 
496 
497  TRACE("EXIT PileRemoveProc()\n");
498 }
DWORD dwOptions
Definition: solitaire.cpp:24
int VisiblePileCards
Definition: solgame.cpp:13
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:171
Card Pop()
Definition: cardstack.cpp:127
#define OPTION_THREE_CARDS
Definition: solitaire.h:11
CardStack activepile
Definition: solgame.cpp:12
void FixIfOneCardLeft(void)
Definition: solgame.cpp:465

◆ RowStackClickProc()

void CARDLIBPROC RowStackClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 291 of file solgame.cpp.

292 {
293  TRACE("ENTER RowStackClickProc()\n");
294  int numfacedown;
295 
296  stackobj.GetFaceDirection(&numfacedown);
297 
298  //if all face-down, then make top card face-up
299  if(stackobj.NumCards() == numfacedown)
300  {
301  if(numfacedown > 0) numfacedown--;
302  stackobj.SetFaceDirection(CS_FACE_DOWNUP, numfacedown);
303  stackobj.Redraw();
304 
305  if (GetScoreMode() == SCORE_STD)
306  {
307  lScore = lScore + 5;
308  UpdateStatusBar();
309  }
310  ClearUndo();
311  }
312 
313  LastId = stackobj.Id();
314 
315  fGameStarted = true;
316 
317  TRACE("EXIT RowStackClickProc()\n");
318 }
void SetFaceDirection(UINT uDirType, int nOption)
Definition: cardregion.cpp:258
long lScore
Definition: solitaire.cpp:30
void Redraw()
int GetScoreMode(void)
Definition: solitaire.cpp:129
#define TRACE(s)
Definition: solgame.cpp:4
void ClearUndo(void)
Definition: solundo.cpp:45
int NumCards() const
Definition: cardregion.cpp:544
int LastId
Definition: solgame.cpp:14
bool fGameStarted
Definition: solgame.cpp:15
#define CS_FACE_DOWNUP
Definition: cardlib.h:53
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:311
#define SCORE_STD
Definition: solitaire.h:45
UINT GetFaceDirection(int *pnOption)
Definition: cardregion.cpp:273

◆ RowStackDblClickProc()

void CARDLIBPROC RowStackDblClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 403 of file solgame.cpp.

404 {
405  TRACE("ENTER RowStackDblClickProc()\n");
406 
407  SetPlayTimer();
408 
409  //can only move 1 card at a time
410  if(iNumClicked != 1)
411  {
412  TRACE("EXIT RowStackDblClickProc()\n");
413  return;
414  }
415 
416  //find a suit-stack to move the card to...
417  const CardStack &cardstack = stackobj.GetCardStack();
418  CardRegion *pDest = FindSuitStackFromCard(cardstack[0]);
419 
420  if(pDest != 0)
421  {
422  fGameStarted = true;
423  SetPlayTimer();
424 
425  //stackobj.MoveCards(pDest, 1, true);
426  //use the SimulateDrag function, because we get the
427  //AddProc callbacks called for us on the destination stacks...
428  bAutoroute = true;
429  stackobj.SimulateDrag(pDest, 1, true);
430  bAutoroute = false;
431  }
432  TRACE("EXIT RowStackDblClickProc()\n");
433 }
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
CardRegion * FindSuitStackFromCard(Card card)
Definition: solgame.cpp:323
bool SimulateDrag(CardRegion *pDestStack, int nNumCards, bool fAnimate)
Definition: cardregion.cpp:636
bool bAutoroute
Definition: solgame.cpp:16
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:171
bool fGameStarted
Definition: solgame.cpp:15

Referenced by CreateSol(), and PileDblClickProc().

◆ RowStackDragProc()

bool CARDLIBPROC RowStackDragProc ( CardRegion stackobj,
int  iNumCards 
)

Definition at line 104 of file solgame.cpp.

105 {
106  TRACE("ENTER RowStackDragProc()\n");
107  int numfacedown;
108  int numcards;
109 
110  SetPlayTimer();
111 
112  stackobj.GetFaceDirection(&numfacedown);
113 
114  numcards = stackobj.NumCards();
115 
116  TRACE("EXIT RowStackDragProc()\n");
117  if(iNumDragCards <= numcards-numfacedown)
118  return true;
119  else
120  return false;
121 
122 }
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:171
int NumCards() const
Definition: cardregion.cpp:544
UINT GetFaceDirection(int *pnOption)
Definition: cardregion.cpp:273

◆ RowStackDropProc()

bool CARDLIBPROC RowStackDropProc ( CardRegion stackobj,
CardStack dragcards 
)

Definition at line 128 of file solgame.cpp.

129 {
130  TRACE("ENTER RowStackDropProc()\n");
131  Card dragcard = dragcards[dragcards.NumCards() - 1];
132 
133  SetPlayTimer();
134 
135  //if we are empty, can only drop a stack with a King at bottom
136  if(stackobj.NumCards() == 0)
137  {
138  if(dragcard.LoVal() != 13)
139  {
140  TRACE("EXIT RowStackDropProc(false)\n");
141  return false;
142  }
143  }
144  else
145  {
146  const CardStack &mystack = stackobj.GetCardStack();
147 
148  //can only drop if card is 1 less
149  if(mystack[0].LoVal() != dragcard.LoVal() + 1)
150  {
151  TRACE("EXIT RowStackDropProc(false)\n");
152  return false;
153  }
154 
155  //can only drop if card is different colour
156  if( (mystack[0].IsBlack() && !dragcard.IsRed()) ||
157  (!mystack[0].IsBlack() && dragcard.IsRed()) )
158  {
159  TRACE("EXIT RowStackDropProc(false)\n");
160  return false;
161  }
162  }
163 
164  fGameStarted = true;
165 
166  SetUndo(LastId, stackobj.Id(), dragcards.NumCards(), lScore, VisiblePileCards);
167 
168  if (LastId == PILE_ID)
169  {
170  if (GetScoreMode() == SCORE_STD)
171  {
172  lScore = lScore + 5;
173  }
174  }
175  else if ((LastId >= SUIT_ID) && (LastId <= SUIT_ID + 3))
176  {
177  if (GetScoreMode() == SCORE_STD)
178  {
179  lScore = lScore >= 15 ? lScore - 15 : 0;
180  }
181  else if (GetScoreMode() == SCORE_VEGAS)
182  {
183  lScore = lScore >= -47 ? lScore - 5 : -52;
184  }
185  }
186 
187  UpdateStatusBar();
188 
189  TRACE("EXIT RowStackDropProc(true)\n");
190  return true;
191 }
long lScore
Definition: solitaire.cpp:30
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
#define SUIT_ID
Definition: solitaire.h:41
int GetScoreMode(void)
Definition: solitaire.cpp:129
int VisiblePileCards
Definition: solgame.cpp:13
#define PILE_ID
Definition: solitaire.h:40
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:171
int NumCards() const
Definition: cardregion.cpp:544
bool IsRed() const
Definition: card.h:94
int LastId
Definition: solgame.cpp:14
void SetUndo(int set_source_id, int set_destination_id, int set_number_of_cards, int set_prev_score, int set_prev_visible_pile_cards)
Definition: solundo.cpp:27
Definition: card.h:27
bool fGameStarted
Definition: solgame.cpp:15
int LoVal() const
Definition: card.h:59
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:311
#define SCORE_STD
Definition: solitaire.h:45
#define SCORE_VEGAS
Definition: solitaire.h:46
int NumCards() const
Definition: cardstack.h:14

Referenced by CreateSol().

◆ SetPlayTimer()

void SetPlayTimer ( void  )

Definition at line 171 of file solitaire.cpp.

172 {
174  {
175  if (!PlayTimer)
176  {
178  }
179  }
180 }
DWORD dwOptions
Definition: solitaire.cpp:24
HWND hwndMain
Definition: solitaire.cpp:12
UINT_PTR PlayTimer
Definition: solitaire.cpp:31
#define IDT_PLAYTIMER
Definition: solitaire.h:33
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define NULL
Definition: types.h:112
#define OPTION_SHOW_TIME
Definition: solitaire.h:12

Referenced by CanDrop(), DeckClickProc(), PileDblClickProc(), PileRemoveProc(), RowStackDblClickProc(), RowStackDragProc(), RowStackDropProc(), SuitStackAddProc(), and SuitStackDropProc().

◆ SetUndo()

void SetUndo ( int  set_source_id,
int  set_destination_id,
int  set_number_of_cards,
int  set_prev_score,
int  set_prev_visible_pile_cards 
)

Definition at line 27 of file solundo.cpp.

33 {
34  if ((set_source_id == set_destination_id) || (set_number_of_cards == 0))
35  return;
36 
37  source_id = set_source_id;
38  destination_id = set_destination_id;
39  number_of_cards = set_number_of_cards;
40  prev_score = set_prev_score;
41  prev_visible_pile_cards = set_prev_visible_pile_cards;
42  SetUndoMenuState(true);
43 }
static int prev_score
Definition: solundo.cpp:22
void SetUndoMenuState(bool enable)
Definition: solitaire.cpp:182
static int prev_visible_pile_cards
Definition: solundo.cpp:25
static int source_id
Definition: solundo.cpp:15
static int number_of_cards
Definition: solundo.cpp:19
static int destination_id
Definition: solundo.cpp:16

Referenced by DeckClickProc(), RowStackDropProc(), and SuitStackDropProc().

◆ SetUndoMenuState()

void SetUndoMenuState ( bool  enable)

Definition at line 182 of file solitaire.cpp.

183 {
184  if (enable)
185  {
187  }
188  else
189  {
191  }
192 }
#define MF_BYCOMMAND
Definition: winuser.h:202
HMENU hGameMenu
Definition: solitaire.cpp:15
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_ENABLED
Definition: winuser.h:128
GLboolean enable
Definition: glext.h:11120
#define MF_GRAYED
Definition: winuser.h:129
#define IDM_GAME_UNDO
Definition: resource.h:11

Referenced by ClearUndo(), and SetUndo().

◆ SuitStackAddProc()

void CARDLIBPROC SuitStackAddProc ( CardRegion stackobj,
const CardStack added 
)

Definition at line 346 of file solgame.cpp.

347 {
348  TRACE("ENTER SuitStackAddProc()\n");
349  bool fGameOver = true;
350 
351  SetPlayTimer();
352 
353  for(int i = 0; i < 4; i++)
354  {
355  if(pSuitStack[i]->NumCards() != 13)
356  {
357  fGameOver = false;
358 
359  break;
360  }
361  }
362 
363  if(fGameOver)
364  {
366  PlayTimer = 0;
367 
369  {
370  lScore = lScore + (700000 / dwTime);
371  }
372 
373  UpdateStatusBar();
374  ClearUndo();
375 
377 
378  for(int i = 0; i < 4; i++)
379  {
380  pSuitStack[i]->Flash(11, 100);
381  }
382 
384  {
385  NewGame();
386  }
387  else
388  {
390 
391  fGameStarted = false;
392  }
393  }
394 
395  TRACE("EXIT SuitStackAddProc()\n");
396 }
DWORD dwOptions
Definition: solitaire.cpp:24
#define IDYES
Definition: winuser.h:829
HWND hwndMain
Definition: solitaire.cpp:12
long lScore
Definition: solitaire.cpp:30
void EmptyStacks(void)
Definition: cardwindow.cpp:607
CardRegion * pSuitStack[4]
Definition: solcreate.cpp:5
UINT_PTR PlayTimer
Definition: solitaire.cpp:31
void Flash(int count, int timeout)
Definition: cardregion.cpp:322
void NewGame(void)
Definition: solgame.cpp:18
int GetScoreMode(void)
Definition: solitaire.cpp:129
TCHAR MsgWin[128]
Definition: solitaire.cpp:22
#define IDT_PLAYTIMER
Definition: solitaire.h:33
#define MB_YESNO
Definition: winuser.h:811
#define MB_ICONQUESTION
Definition: winuser.h:783
DWORD dwTime
Definition: solitaire.cpp:26
#define TRACE(s)
Definition: solgame.cpp:4
void ClearUndo(void)
Definition: solundo.cpp:45
void SetPlayTimer(void)
Definition: solitaire.cpp:171
#define MB_ICONINFORMATION
Definition: winuser.h:796
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define MessageBox
Definition: winuser.h:5798
TCHAR szAppName[128]
Definition: solitaire.cpp:17
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
bool fGameStarted
Definition: solgame.cpp:15
#define MB_OK
Definition: winuser.h:784
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:311
TCHAR MsgDeal[128]
Definition: solitaire.cpp:23
#define SCORE_STD
Definition: solitaire.h:45
#define OPTION_SHOW_TIME
Definition: solitaire.h:12
CardWindow SolWnd
Definition: solitaire.cpp:33

Referenced by CreateSol().

◆ SuitStackClickProc()

void CARDLIBPROC SuitStackClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 276 of file solgame.cpp.

277 {
278  TRACE("ENTER SuitStackClickProc()\n");
279 
280  fGameStarted = true;
281 
282  LastId = stackobj.Id();
283 
284  TRACE("EXIT SuitStackClickProc()\n");
285 }
#define TRACE(s)
Definition: solgame.cpp:4
int LastId
Definition: solgame.cpp:14
bool fGameStarted
Definition: solgame.cpp:15

Referenced by CreateSol().

◆ SuitStackDropProc()

bool CARDLIBPROC SuitStackDropProc ( CardRegion stackobj,
CardStack dragcards 
)

Definition at line 235 of file solgame.cpp.

236 {
237  TRACE("ENTER SuitStackDropProc()\n");
238 
239  SetPlayTimer();
240 
241  //only drop 1 card at a time
242  if (!bAutoroute && dragcards.NumCards() != 1)
243  {
244  TRACE("EXIT SuitStackDropProc()\n");
245  return false;
246  }
247 
248  bool b = CanDrop(stackobj, dragcards[0]);
249  TRACE("EXIT SuitStackDropProc()\n");
250 
251  if (b)
252  {
253  SetUndo(LastId, stackobj.Id(), 1, lScore, VisiblePileCards);
254 
255  if ((LastId == PILE_ID) || (LastId >= ROW_ID))
256  {
257  if (GetScoreMode() == SCORE_VEGAS)
258  {
259  lScore = lScore + 5;
260  }
261  else if (GetScoreMode() == SCORE_STD)
262  {
263  lScore = lScore + 10;
264  }
265 
266  UpdateStatusBar();
267  }
268  }
269 
270  return b;
271 }
long lScore
Definition: solitaire.cpp:30
#define ROW_ID
Definition: solitaire.h:42
int GetScoreMode(void)
Definition: solitaire.cpp:129
int VisiblePileCards
Definition: solgame.cpp:13
#define b
Definition: ke_i.h:79
#define PILE_ID
Definition: solitaire.h:40
bool bAutoroute
Definition: solgame.cpp:16
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:171
int LastId
Definition: solgame.cpp:14
void SetUndo(int set_source_id, int set_destination_id, int set_number_of_cards, int set_prev_score, int set_prev_visible_pile_cards)
Definition: solundo.cpp:27
bool CanDrop(CardRegion &stackobj, Card card)
Definition: solgame.cpp:197
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:311
#define SCORE_STD
Definition: solitaire.h:45
#define SCORE_VEGAS
Definition: solitaire.h:46
int NumCards() const
Definition: cardstack.h:14

Referenced by CreateSol().

◆ Undo()

void Undo ( void  )

Definition at line 53 of file solundo.cpp.

54 {
56  CardRegion *destination = NULL;
57 
58  if ((source_id < 1) ||
59  (source_id > (ROW_ID + NUM_ROW_STACKS - 1)) ||
60  (destination_id < 1) ||
61  (destination_id > (ROW_ID + NUM_ROW_STACKS - 1)) ||
62  (number_of_cards < 1))
63  {
64  ClearUndo();
65  return;
66  }
67 
68  if (source_id >= ROW_ID)
70  else if ((source_id >= SUIT_ID) && (source_id < SUIT_ID + 4))
72  else if (source_id == PILE_ID)
73  source = pPile;
74  else if (source_id == DECK_ID)
75  source = pDeck;
76 
77  if (destination_id >= ROW_ID)
78  destination = pRowStack[destination_id - ROW_ID];
79  else if ((destination_id >= SUIT_ID) && (destination_id < SUIT_ID + 4))
80  destination = pSuitStack[destination_id - SUIT_ID];
81  else if (destination_id == PILE_ID)
82  destination = pPile;
83  else if (destination_id == DECK_ID)
84  destination = pDeck;
85 
86  if (destination == NULL || source == NULL)
87  {
88  ClearUndo();
89  return;
90  }
91 
92  // If the player clicked on the deck.
93  if (destination == pPile && source == pDeck)
94  {
95  // Put back the cards on the deck in reversed order.
97  tmp.Reverse();
98  source->Push(tmp);
99  // Restore the pile to be the top cards in the active pile.
100  destination->Clear();
101  if (prev_visible_pile_cards <= 1)
102  {
103  destination->SetOffsets(0,0);
104  destination->SetCardStack(activepile);
105  }
106  else
107  {
109  destination->SetOffsets(CS_DEFXOFF, 1);
110  destination->Push(tmp);
111  }
113  }
114 
115  // If the player clicked on the empty deck.
116  else if (source == pPile && destination == pDeck)
117  {
118  // Put back all the cards from the deck to the active pile in reversed order.
119  destination->Reverse();
120  activepile.Push(destination->GetCardStack());
121  destination->Clear();
122  if (prev_visible_pile_cards <= 1)
123  {
124  source->SetOffsets(0,0);
125  source->SetCardStack(activepile);
126  }
127  else
128  {
130  source->SetOffsets(CS_DEFXOFF, 1);
131  source->Push(tmp);
132  }
134  }
135 
136  // If the player moved one card from the pile.
137  else if (source == pPile)
138  {
139  CardStack tmp = destination->Pop(1);
140  activepile.Push(tmp);
141  if (prev_visible_pile_cards <= 1)
142  {
143  source->Push(tmp);
144  }
145  else
146  {
147  source->Clear();
149  source->Push(tmp);
150  source->SetOffsets(CS_DEFXOFF, 1);
151  }
153  }
154 
155  // If the player moved cards between row stacks / suit stacks.
156  else
157  {
158  destination->MoveCard(source, number_of_cards, false);
159  }
160 
161  lScore = prev_score;
162 
163  // -2 points for the undo in standard score mode.
164  if (GetScoreMode() == SCORE_STD)
165  lScore = lScore >= 2 ? lScore - 2 : 0;
166 
167  UpdateStatusBar();
168 
169  SolWnd.Redraw();
170  ClearUndo();
171 }
static int prev_score
Definition: solundo.cpp:22
bool MoveCard(CardRegion *pDestStack, int nNumCards, bool fAnimate)
Definition: cardregion.cpp:477
long lScore
Definition: solitaire.cpp:30
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
#define SUIT_ID
Definition: solitaire.h:41
static int prev_visible_pile_cards
Definition: solundo.cpp:25
void Push(const Card card)
Definition: cardstack.cpp:83
Card Top()
Definition: cardstack.cpp:151
CardRegion * pDeck
Definition: solcreate.cpp:3
CardRegion * pSuitStack[4]
Definition: solcreate.cpp:5
static int source_id
Definition: solundo.cpp:15
Card Pop()
Definition: cardregion.h:91
#define DECK_ID
Definition: solitaire.h:39
#define ROW_ID
Definition: solitaire.h:42
void Redraw(void)
Definition: cardwindow.cpp:553
int GetScoreMode(void)
Definition: solitaire.cpp:129
void Reverse()
Definition: cardstack.cpp:73
void ClearUndo(void)
Definition: solundo.cpp:45
void Reverse()
Definition: cardregion.h:86
int VisiblePileCards
Definition: solgame.cpp:13
#define PILE_ID
Definition: solitaire.h:40
#define NUM_ROW_STACKS
Definition: solitaire.h:38
#define CS_DEFXOFF
Definition: cardlib.h:23
Card Pop()
Definition: cardstack.cpp:127
CardStack activepile
Definition: solgame.cpp:12
static int number_of_cards
Definition: solundo.cpp:19
void SetCardStack(const CardStack &cs)
Definition: cardregion.cpp:390
void SetOffsets(int x, int y)
Definition: cardregion.cpp:228
void Clear()
Definition: cardregion.h:84
void Push(const Card card)
Definition: cardregion.h:88
#define NULL
Definition: types.h:112
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:311
#define SCORE_STD
Definition: solitaire.h:45
CardRegion * pRowStack[NUM_ROW_STACKS]
Definition: solcreate.cpp:6
static int destination_id
Definition: solundo.cpp:16
CardWindow SolWnd
Definition: solitaire.cpp:33
CardRegion * pPile
Definition: solcreate.cpp:4

Referenced by WndProc().

◆ UpdateStatusBar()

void UpdateStatusBar ( void  )

Definition at line 149 of file solitaire.cpp.

150 {
151  TCHAR szStatusText[128];
152  TCHAR szTempText[64];
153 
154  ZeroMemory(szStatusText, sizeof(szStatusText));
155 
156  if (GetScoreMode() != SCORE_NONE)
157  {
158  _stprintf(szStatusText, szScore, lScore);
159  _tcscat(szStatusText, _T(" "));
160  }
161 
163  {
164  _stprintf(szTempText, szTime, dwTime);
165  _tcscat(szStatusText, szTempText);
166  }
167 
169 }
DWORD dwOptions
Definition: solitaire.cpp:24
TCHAR szTime[64]
Definition: solitaire.cpp:19
long lScore
Definition: solitaire.cpp:30
#define ZeroMemory
Definition: winbase.h:1664
CHAR * LPTSTR
Definition: xmlstorage.h:192
int GetScoreMode(void)
Definition: solitaire.cpp:129
#define SCORE_NONE
Definition: solitaire.h:44
HWND hwndStatus
Definition: solitaire.cpp:13
LONG_PTR LPARAM
Definition: windef.h:208
DWORD dwTime
Definition: solitaire.cpp:26
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define SB_SETTEXT
Definition: commctrl.h:1949
#define _stprintf
Definition: utility.h:124
TCHAR szScore[64]
Definition: solitaire.cpp:18
#define SendMessage
Definition: winuser.h:5819
_TCHAR * _tcscat(_TCHAR *s, const _TCHAR *append)
Definition: tcscat.h:8
#define OPTION_SHOW_TIME
Definition: solitaire.h:12
#define SBT_NOBORDERS
Definition: commctrl.h:1971

Variable Documentation

◆ activepile

CardStack activepile

Definition at line 12 of file solgame.cpp.

Referenced by CreateSol(), DeckClickProc(), FixIfOneCardLeft(), NewGame(), PileRemoveProc(), and Undo().

◆ dwOptions

DWORD dwOptions

Definition at line 24 of file solitaire.cpp.

Referenced by AboutProtocol_Abort(), AboutProtocol_LockRequest(), AboutProtocol_Terminate(), BindProtocol_Abort(), BindProtocol_LockRequest(), BindProtocol_Terminate(), ATL::CRegKey::Create(), CreateHKCRKey(), CreateNestedKey(), DeckClickProc(), DuplicateConsoleHandle(), DuplicateHandle(), FileProtocol_Abort(), FileProtocol_LockRequest(), FileProtocol_Terminate(), FilterConnectCommunicationPort(), FixIfOneCardLeft(), FtpProtocol_Abort(), FtpProtocol_LockRequest(), FtpProtocol_Terminate(), GetScoreMode(), GopherProtocol_Abort(), GopherProtocol_LockRequest(), GopherProtocol_Terminate(), GUIDisplayStatusMessage(), HitTestThemeBackground(), HttpProtocol_Abort(), HttpProtocol_LockRequest(), HttpProtocol_Terminate(), ITSProtocol_Abort(), ITSProtocol_LockRequest(), ITSProtocol_Terminate(), IUnknown_AddOptions(), LoadSettings(), MimeFilterProtocol_Abort(), MimeFilterProtocol_LockRequest(), MimeFilterProtocol_Terminate(), MimeHtmlProtocol_Abort(), MimeHtmlProtocol_LockRequest(), MimeHtmlProtocol_Terminate(), MimeProtocol_LockRequest(), MimeProtocol_Terminate(), MkProtocol_Abort(), MkProtocol_LockRequest(), MkProtocol_Terminate(), MsiAdvertiseProductExA(), MsiAdvertiseProductExW(), MsiGetFileHashA(), MsiGetFileHashW(), MsiOpenPackageExA(), MsiOpenPackageExW(), MsiSourceListAddMediaDiskA(), MsiSourceListAddMediaDiskW(), MsiSourceListAddSourceExA(), MsiSourceListAddSourceExW(), MsiSourceListClearAllExA(), MsiSourceListClearAllExW(), MsiSourceListClearSourceA(), MsiSourceListClearSourceW(), MsiSourceListEnumMediaDisksA(), MsiSourceListEnumMediaDisksW(), MsiSourceListEnumSourcesA(), MsiSourceListEnumSourcesW(), MsiSourceListGetInfoA(), MsiSourceListGetInfoW(), MsiSourceListSetInfoA(), MsiSourceListSetInfoW(), NewGame(), OpenSourceKey(), OptionsDlgProc(), PileRemoveProc(), Protocol_Abort(), Protocol_Terminate(), ProtocolEmul_LockRequest(), ProtocolEmul_Terminate(), ProtocolHandler_Abort(), ProtocolHandler_LockRequest(), ProtocolHandler_Terminate(), RefreshPolicyEx(), RegCreateKeyExA(), RegCreateKeyExW(), RegOpenUserClassesRoot(), ResProtocol_Abort(), ResProtocol_LockRequest(), ResProtocol_Terminate(), SaveSettings(), SetPlayTimer(), SHMapHandle(), ShowGameOptionsDlg(), SuitStackAddProc(), test_CopyBindInfo(), test_pack_INTERNET_AUTH_NOTIFY_DATA(), test_pack_RemBINDINFO(), TUIDisplayStatusMessage(), UpdateStatusBar(), WlxDisplayStatusMessage(), and WndProc().

◆ dwPrevMode

DWORD dwPrevMode

Definition at line 29 of file solitaire.cpp.

Referenced by _tWinMain(), and NewGame().

◆ dwTime

◆ dwWasteCount

DWORD dwWasteCount

Definition at line 27 of file solitaire.cpp.

Referenced by DeckClickProc(), and NewGame().

◆ dwWasteTreshold

DWORD dwWasteTreshold

Definition at line 28 of file solitaire.cpp.

Referenced by DeckClickProc(), and NewGame().

◆ fGameStarted

bool fGameStarted

Definition at line 15 of file solgame.cpp.

◆ hwndMain

HWND hwndMain

Definition at line 12 of file solitaire.cpp.

◆ lScore

◆ pDeck

CardRegion* pDeck

Definition at line 3 of file solcreate.cpp.

Referenced by CreateSol(), CreateSpider(), DeckClickProc(), NewGame(), and Undo().

◆ PlayTimer

UINT_PTR PlayTimer

Definition at line 31 of file solitaire.cpp.

Referenced by SetPlayTimer(), SuitStackAddProc(), and WndProc().

◆ pPile

CardRegion* pPile

Definition at line 4 of file solcreate.cpp.

Referenced by CreateSol(), DeckClickProc(), FixIfOneCardLeft(), NewGame(), and Undo().

◆ pRowStack

CardRegion* pRowStack[]

Definition at line 6 of file solcreate.cpp.

Referenced by CreateSol(), NewGame(), and Undo().

◆ pSuitStack

CardRegion* pSuitStack[]

Definition at line 5 of file solcreate.cpp.

Referenced by CreateSol(), FindSuitStackFromCard(), SuitStackAddProc(), and Undo().

◆ SolWnd

◆ szAppName

TCHAR szAppName[]

Definition at line 17 of file solitaire.cpp.

◆ VisiblePileCards

int VisiblePileCards

◆ yRowStackCardOffset

int yRowStackCardOffset

Definition at line 10 of file solcreate.cpp.