Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/games/CaribbeanStud/files/patch-Hands.cpp
16461 views
1
--- ./Hands.cpp.orig 2013-10-29 15:12:13.000000000 -0200
2
+++ ./Hands.cpp 2013-10-29 15:12:13.000000000 -0200
3
@@ -46,7 +46,7 @@
4
_next = 0;
5
}
6
7
-Hand Hands::HandValue() const
8
+enum Hands::Hand Hands::HandValue() const
9
{
10
return _hand;
11
}
12
@@ -93,7 +93,7 @@
13
14
Card** Hands::Cards() const
15
{
16
- return _cards;
17
+ return (Card**)_cards;
18
}
19
20
void Hands::SortCards() const
21
@@ -106,7 +106,7 @@
22
ranks[i] = _cards[i]->Rank();
23
24
for(int j=0; j < 4; j++) // sorting based on rank
25
- for( i=0; i < 4-j; i++)
26
+ for(int i=0; i < 4-j; i++)
27
{
28
if( ranks[i] < ranks[i+1] )
29
{
30
@@ -121,10 +121,10 @@
31
32
char r = ranks[0];
33
char board[4];
34
- for( i =0; i<4; i++) board[i] = '\0';
35
+ for(int i =0; i<4; i++) board[i] = '\0';
36
37
int s=1;
38
- for ( i=1; i< 6; i++)
39
+ for (int i=1; i< 6; i++)
40
{
41
if( r == ranks[i] ) s++;
42
else{
43
@@ -162,7 +162,8 @@
44
}
45
else{
46
if(ranks[0] == (char) '\14') ranks[5] = '\1';
47
- for( i =0; i < 4; i++)
48
+ int i;
49
+ for(i =0; i < 4; i++)
50
if(_cards[i]->Suit() != _cards[i+1]->Suit())
51
{
52
i = 8;
53
@@ -199,9 +200,9 @@
54
// rearrange cards order
55
56
Card* tmpcards[5];
57
- for(i = 0; i < 5; i++) tmpcards[i] = _cards[i];
58
- for(i = 0; i < 5; i++)
59
- for(j=0; j<5; j++)
60
+ for(int i = 0; i < 5; i++) tmpcards[i] = _cards[i];
61
+ for(int i = 0; i < 5; i++)
62
+ for(int j=0; j<5; j++)
63
if(tmpcards[j] && ranks[i]==tmpcards[j]->Rank())
64
{
65
((Hands*)this) ->_cards[i] = tmpcards[j];
66
@@ -210,7 +211,7 @@
67
}
68
69
#ifdef DEBUG
70
- for(i = 0; i < 5; i++)
71
+ for(int i = 0; i < 5; i++)
72
cout << _cards[i]->Suit() << (int) _cards[i]->Rank() << " ";
73
cout << endl;
74
#endif
75
@@ -219,9 +220,9 @@
76
77
void Hands::ReArrange(char* ranks , int nel,char* board, Hand score)
78
{
79
- int j=0 , k = 0;
80
+ int i, j=0 , k = 0;
81
char tmprank[10];
82
- for( int i = 0; i < nel; i++) // copy all the cards to the tmprank
83
+ for( i = 0; i < nel; i++) // copy all the cards to the tmprank
84
tmprank[i] = *(ranks+i);
85
tmprank[nel] = '\0';
86
87
88