summaryrefslogtreecommitdiff
path: root/noncore/games
Unidiff
Diffstat (limited to 'noncore/games') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/moveengine.cpp6
-rw-r--r--noncore/games/kbill/UI.cpp31
-rw-r--r--noncore/games/kcheckers/echeckers.cpp12
-rw-r--r--noncore/games/kcheckers/rcheckers.cpp36
4 files changed, 49 insertions, 36 deletions
diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp
index a4145cc..b102258 100644
--- a/noncore/games/backgammon/moveengine.cpp
+++ b/noncore/games/backgammon/moveengine.cpp
@@ -32,92 +32,94 @@ MoveEngine::MoveEngine()
32 y_fin[a]=225-a*5; 32 y_fin[a]=225-a*5;
33 } 33 }
34 z_fin=1; 34 z_fin=1;
35 35
36 reset(); 36 reset();
37} 37}
38 38
39MoveEngine::~MoveEngine() 39MoveEngine::~MoveEngine()
40{} 40{}
41 41
42void MoveEngine::position(Pieces& pieces,bool non_qte) 42void MoveEngine::position(Pieces& pieces,bool non_qte)
43{ 43{
44 int player1_counter=0; 44 int player1_counter=0;
45 int player2_counter=0; 45 int player2_counter=0;
46 46
47 //non qte styles are smaller !! 47 //non qte styles are smaller !!
48 int offset=(non_qte) ? 5 : 0; 48 int offset=(non_qte) ? 5 : 0;
49 49
50 for(int a=0;a<28;a++) 50 for(int a=0;a<28;a++)
51 { 51 {
52 for(int b=0;b<abs(population[a].total);b++) 52 for(int b=0;b<abs(population[a].total);b++)
53 { 53 {
54 if(population[a].total>0) //player 1 pieces 54 if(population[a].total>0) //player 1 pieces
55 { 55 {
56 pieces.player1[player1_counter].x=x_coord[a]-offset; 56 if (a < 26)
57 pieces.player1[player1_counter].x=x_coord[a]-offset;
57 if(a>=0 && a<13) 58 if(a>=0 && a<13)
58 { 59 {
59 pieces.player1[player1_counter].y=yup_coord[b]-offset; 60 pieces.player1[player1_counter].y=yup_coord[b]-offset;
60 pieces.player1[player1_counter].z=z_coord[b]; 61 pieces.player1[player1_counter].z=z_coord[b];
61 pieces.player1[player1_counter].side=false; 62 pieces.player1[player1_counter].side=false;
62 player1_counter++; 63 player1_counter++;
63 } 64 }
64 else if(a>12 && a<26) 65 else if(a>12 && a<26)
65 { 66 {
66 pieces.player1[player1_counter].y=ylow_coord[b]-offset; 67 pieces.player1[player1_counter].y=ylow_coord[b]-offset;
67 pieces.player1[player1_counter].z=z_coord[b]; 68 pieces.player1[player1_counter].z=z_coord[b];
68 pieces.player1[player1_counter].side=false; 69 pieces.player1[player1_counter].side=false;
69 player1_counter++; 70 player1_counter++;
70 } 71 }
71 else if(a==26) 72 else if(a==26)
72 { 73 {
73 if(b<5) 74 if(b<5)
74 { 75 {
75 pieces.player1[player1_counter].x=x_fin1[0]-offset; 76 pieces.player1[player1_counter].x=x_fin1[0]-offset;
76 pieces.player1[player1_counter].y=y_fin[b]-offset; 77 pieces.player1[player1_counter].y=y_fin[b]-offset;
77 pieces.player1[player1_counter].z=z_fin; 78 pieces.player1[player1_counter].z=z_fin;
78 } 79 }
79 else if(b>=5 && b<10) 80 else if(b>=5 && b<10)
80 { 81 {
81 pieces.player1[player1_counter].x=x_fin1[1]-offset; 82 pieces.player1[player1_counter].x=x_fin1[1]-offset;
82 pieces.player1[player1_counter].y=y_fin[b-5]-offset; 83 pieces.player1[player1_counter].y=y_fin[b-5]-offset;
83 pieces.player1[player1_counter].z=z_fin; 84 pieces.player1[player1_counter].z=z_fin;
84 } 85 }
85 else 86 else
86 { 87 {
87 pieces.player1[player1_counter].x=x_fin1[2]-offset; 88 pieces.player1[player1_counter].x=x_fin1[2]-offset;
88 pieces.player1[player1_counter].y=y_fin[b-10]-offset; 89 pieces.player1[player1_counter].y=y_fin[b-10]-offset;
89 pieces.player1[player1_counter].z=z_fin; 90 pieces.player1[player1_counter].z=z_fin;
90 } 91 }
91 pieces.player1[player1_counter].side=true; 92 pieces.player1[player1_counter].side=true;
92 player1_counter++; 93 player1_counter++;
93 94
94 } 95 }
95 } 96 }
96 97
97 else if(population[a].total<0) //player 2 pieces 98 else if(population[a].total<0) //player 2 pieces
98 { 99 {
99 pieces.player2[player2_counter].x=x_coord[a]-offset; 100 if (a < 26)
101 pieces.player2[player2_counter].x=x_coord[a]-offset;
100 if(a>=0 && a<13) 102 if(a>=0 && a<13)
101 { 103 {
102 pieces.player2[player2_counter].y=yup_coord[b]-offset; 104 pieces.player2[player2_counter].y=yup_coord[b]-offset;
103 pieces.player2[player2_counter].z=z_coord[b]; 105 pieces.player2[player2_counter].z=z_coord[b];
104 pieces.player2[player2_counter].side=false; 106 pieces.player2[player2_counter].side=false;
105 player2_counter++; 107 player2_counter++;
106 } 108 }
107 else if(a>12 && a<26) 109 else if(a>12 && a<26)
108 { 110 {
109 pieces.player2[player2_counter].y=ylow_coord[b]-offset; 111 pieces.player2[player2_counter].y=ylow_coord[b]-offset;
110 pieces.player2[player2_counter].z=z_coord[b]; 112 pieces.player2[player2_counter].z=z_coord[b];
111 pieces.player2[player2_counter].side=false; 113 pieces.player2[player2_counter].side=false;
112 player2_counter++; 114 player2_counter++;
113 } 115 }
114 else if(a==27) 116 else if(a==27)
115 { 117 {
116 if(b<5) 118 if(b<5)
117 { 119 {
118 pieces.player2[player2_counter].x=x_fin2[0]-offset; 120 pieces.player2[player2_counter].x=x_fin2[0]-offset;
119 pieces.player2[player2_counter].y=y_fin[b]-offset; 121 pieces.player2[player2_counter].y=y_fin[b]-offset;
120 pieces.player2[player2_counter].z=z_fin; 122 pieces.player2[player2_counter].z=z_fin;
121 } 123 }
122 else if(b>=5 && b<10) 124 else if(b>=5 && b<10)
123 { 125 {
diff --git a/noncore/games/kbill/UI.cpp b/noncore/games/kbill/UI.cpp
index 611cebf..a49c3c1 100644
--- a/noncore/games/kbill/UI.cpp
+++ b/noncore/games/kbill/UI.cpp
@@ -47,70 +47,69 @@ void UI::kill_timer() {
47void UI::initialize(int *argc, char **argv) { 47void UI::initialize(int *argc, char **argv) {
48 #ifdef KDEVER 48 #ifdef KDEVER
49 app = new KApplication(*argc, argv, "kbill"); 49 app = new KApplication(*argc, argv, "kbill");
50 #endif 50 #endif
51 app = new QPEApplication(*argc, argv); 51 app = new QPEApplication(*argc, argv);
52} 52}
53 53
54void UI::graph_init() { 54void UI::graph_init() {
55 pix = new QPixmap(Game::scrwidth, Game::scrheight); 55 pix = new QPixmap(Game::scrwidth, Game::scrheight);
56 paint.begin(pix, field); 56 paint.begin(pix, field);
57 paint.setPen(QPen(Qt::black, 3)); 57 paint.setPen(QPen(Qt::black, 3));
58} 58}
59 59
60void UI::make_mainwin() { 60void UI::make_mainwin() {
61 main = new KBill(); 61 main = new KBill();
62 app->showMainWidget(main,true); 62 app->showMainWidget(main,true);
63 main->showMaximized(); 63 main->showMaximized();
64 field = main->getField(); 64 field = main->getField();
65} 65}
66 66
67void UI::popup_dialog (int dialog) { 67void UI::popup_dialog (int dialog) {
68 kill_timer(); 68 kill_timer();
69 switch (dialog) { 69 switch (dialog) {
70 case Game::ENDGAME: 70 case Game::ENDGAME:
71 QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr)); 71 QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr));
72 break; 72 break;
73 case Game::HIGHSCORE: 73 case Game::HIGHSCORE:
74 //QMessageBox::message(("HighScore"), highscorestr); 74 break;
75 break; 75 case Game::ENTERNAME:
76 case Game::ENTERNAME: { 76 {
77 InputBox b(main, 0, ("Enter Name"), QT_TR_NOOP(enternamestr)); 77 InputBox b(main, 0, ("Enter Name"), QT_TR_NOOP(enternamestr));
78 bool state = b.exec() == 2; 78 bool state = b.exec() == 2;
79 char str[20], *nl; 79 char str[20], *nl;
80 strcpy(str, b.getText()); 80 strncpy(str, b.getText(), 19);
81 if (!str[0] || state) 81 if (!str[0] || state)
82 strcpy(str, "Anonymous"); 82 strcpy(str, "Anonymous");
83 else if ((nl = strchr(str, '\n'))) 83 else if ((nl = strchr(str, '\n')))
84 *nl = '\0'; 84 *nl = '\0';
85 if (strlen(str) > 20) 85 if (strlen(str) > 19)
86 str[20] = 0; /* truncate string if too long */ 86 str[19] = '\0'; /* truncate/terminate the string if it is too long */
87 // scores.recalc(str); 87 }
88 } 88 break;
89 break;
90 case Game::SCORE: 89 case Game::SCORE:
91 QMessageBox::message(("Score"), scorestr); 90 QMessageBox::message(("Score"), scorestr);
92 break; 91 break;
93 } 92 }
94 restart_timer(); 93 restart_timer();
95} 94}
96 95
97/*********************/ 96/*********************/
98/* Graphics routines */ 97/* Graphics routines */
99/*********************/ 98/*********************/
100 99
101void UI::set_cursor(int cursor) { 100void UI::set_cursor(int cursor) {
102 QCursor *cur; 101 QCursor *cur;
103 switch (cursor) { 102 switch (cursor) {
104 case Game::BUCKETC: 103 case Game::BUCKETC:
105 cur = bucket.cursor.cursor; 104 cur = bucket.cursor.cursor;
106 break; 105 break;
107 case Game::DOWNC: 106 case Game::DOWNC:
108 cur = downcursor.cursor; 107 cur = downcursor.cursor;
109 break; 108 break;
110 case Game::DEFAULTC: 109 case Game::DEFAULTC:
111 cur = defaultcursor.cursor; 110 cur = defaultcursor.cursor;
112 break; 111 break;
113 default: 112 default:
114 cur = OS.cursor[cursor].cursor; 113 cur = OS.cursor[cursor].cursor;
115 } 114 }
116 field->setCursor(*cur); 115 field->setCursor(*cur);
diff --git a/noncore/games/kcheckers/echeckers.cpp b/noncore/games/kcheckers/echeckers.cpp
index 1146059..afe62eb 100644
--- a/noncore/games/kcheckers/echeckers.cpp
+++ b/noncore/games/kcheckers/echeckers.cpp
@@ -58,51 +58,51 @@ bool ECheckers::go1(int from,int field)
58 } 58 }
59 } 59 }
60 return false; 60 return false;
61} 61}
62 62
63 63
64bool ECheckers::checkCapture1() 64bool ECheckers::checkCapture1()
65{ 65{
66 for(int i=6;i<48;i++) 66 for(int i=6;i<48;i++)
67 { 67 {
68 switch(board[i]) 68 switch(board[i])
69 { 69 {
70 case MAN1: 70 case MAN1:
71 if(board[i-6]==MAN2 || board[i-6]==KING2) 71 if(board[i-6]==MAN2 || board[i-6]==KING2)
72 if(board[i-12]==FREE) return true; 72 if(board[i-12]==FREE) return true;
73 if(board[i-5]==MAN2 || board[i-5]==KING2) 73 if(board[i-5]==MAN2 || board[i-5]==KING2)
74 if(board[i-10]==FREE) return true; 74 if(board[i-10]==FREE) return true;
75 break; 75 break;
76 case KING1: 76 case KING1:
77 if(board[i-6]==MAN2 || board[i-6]==KING2) 77 if(board[i-6]==MAN2 || board[i-6]==KING2)
78 if(board[i-12]==FREE) return true; 78 if(board[i-12]==FREE) return true;
79 if(board[i-5]==MAN2 || board[i-5]==KING2) 79 if(board[i-5]==MAN2 || board[i-5]==KING2)
80 if(board[i-10]==FREE) return true; 80 if(board[i-10]==FREE) return true;
81 if(board[i+5]==MAN2 || board[i+5]==KING2) 81 if(board[i+5]==MAN2 || board[i+5]==KING2)
82 if(board[i+10]==FREE) return true; 82 if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
83 if(board[i+6]==MAN2 || board[i+6]==KING2) 83 if(board[i+6]==MAN2 || board[i+6]==KING2)
84 if(board[i+12]==FREE) return true; 84 if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
85 } 85 }
86 } 86 }
87 return false; 87 return false;
88} 88}
89 89
90 90
91// Return TRUE if a course of the user true 91// Return TRUE if a course of the user true
92// Return FALSE if a course of the user incorrect 92// Return FALSE if a course of the user incorrect
93 93
94bool ECheckers::manCapture1(int from,int direction,bool &capture) 94bool ECheckers::manCapture1(int from,int direction,bool &capture)
95{ 95{
96 int i=from+direction; 96 int i=from+direction;
97 if(board[i]==MAN2 || board[i]==KING2) 97 if(board[i]==MAN2 || board[i]==KING2)
98 { 98 {
99 int k=i+direction; 99 int k=i+direction;
100 if(board[k]==FREE) 100 if(board[k]==FREE)
101 { 101 {
102 bool next=false; 102 bool next=false;
103 int save=board[i]; 103 int save=board[i];
104 board[from]=FREE; 104 board[from]=FREE;
105 board[i]=NONE; 105 board[i]=NONE;
106 106
107 if(k<10) 107 if(k<10)
108 { 108 {
@@ -200,61 +200,61 @@ void ECheckers::kingMove2(int from,int &resMax)
200 turn(resMax); 200 turn(resMax);
201 board[i]=FREE; 201 board[i]=FREE;
202 } 202 }
203 203
204 i=from+6; 204 i=from+6;
205 if(board[i]==FREE) 205 if(board[i]==FREE)
206 { 206 {
207 board[i]=KING2; 207 board[i]=KING2;
208 turn(resMax); 208 turn(resMax);
209 board[i]=FREE; 209 board[i]=FREE;
210 } 210 }
211 211
212 board[from]=KING2; 212 board[from]=KING2;
213} 213}
214 214
215 215
216bool ECheckers::checkCapture2() 216bool ECheckers::checkCapture2()
217{ 217{
218 for(int i=6;i<48;i++) 218 for(int i=6;i<48;i++)
219 { 219 {
220 switch(board[i]) 220 switch(board[i])
221 { 221 {
222 case MAN2: 222 case MAN2:
223 if(board[i+5]==MAN1 || board[i+5]==KING1) 223 if(board[i+5]==MAN1 || board[i+5]==KING1)
224 if(board[i+10]==FREE) return true; 224 if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
225 if(board[i+6]==MAN1 || board[i+6]==KING1) 225 if(board[i+6]==MAN1 || board[i+6]==KING1)
226 if(board[i+12]==FREE) return true; 226 if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
227 break; 227 break;
228 case KING2: 228 case KING2:
229 if(board[i-6]==MAN1 || board[i-6]==KING1) 229 if(board[i-6]==MAN1 || board[i-6]==KING1)
230 if(board[i-12]==FREE) return true; 230 if(board[i-12]==FREE) return true;
231 if(board[i-5]==MAN1 || board[i-5]==KING1) 231 if(board[i-5]==MAN1 || board[i-5]==KING1)
232 if(board[i-10]==FREE) return true; 232 if(board[i-10]==FREE) return true;
233 if(board[i+5]==MAN1 || board[i+5]==KING1) 233 if(board[i+5]==MAN1 || board[i+5]==KING1)
234 if(board[i+10]==FREE) return true; 234 if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
235 if(board[i+6]==MAN1 || board[i+6]==KING1) 235 if(board[i+6]==MAN1 || board[i+6]==KING1)
236 if(board[i+12]==FREE) return true; 236 if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
237 } 237 }
238 } 238 }
239 return false; 239 return false;
240} 240}
241 241
242 242
243// Return TRUE if it is possible to capture 243// Return TRUE if it is possible to capture
244// Return FALSE if it is impossible to capture 244// Return FALSE if it is impossible to capture
245 245
246bool ECheckers::manCapture2(int from,int &resMax) 246bool ECheckers::manCapture2(int from,int &resMax)
247{ 247{
248 bool capture=false; 248 bool capture=false;
249 249
250 int i=from+5; 250 int i=from+5;
251 if(board[i]==MAN1 || board[i]==KING1) 251 if(board[i]==MAN1 || board[i]==KING1)
252 { 252 {
253 int k=from+10; 253 int k=from+10;
254 if(board[k]==FREE) 254 if(board[k]==FREE)
255 { 255 {
256 int save=board[i]; 256 int save=board[i];
257 board[from]=FREE; 257 board[from]=FREE;
258 board[i]=NONE; 258 board[i]=NONE;
259 resMax--; 259 resMax--;
260 if(from>32) 260 if(from>32)
diff --git a/noncore/games/kcheckers/rcheckers.cpp b/noncore/games/kcheckers/rcheckers.cpp
index a1c7afa..d808780 100644
--- a/noncore/games/kcheckers/rcheckers.cpp
+++ b/noncore/games/kcheckers/rcheckers.cpp
@@ -91,69 +91,75 @@ bool RCheckers::go1(int from,int field)
91 return true; 91 return true;
92 } 92 }
93 else if(board[i]==FREE) continue; 93 else if(board[i]==FREE) continue;
94 else break; 94 else break;
95 } 95 }
96 return false; 96 return false;
97 } 97 }
98 } 98 }
99 return false; 99 return false;
100} 100}
101 101
102 102
103bool RCheckers::checkCapture1() 103bool RCheckers::checkCapture1()
104{ 104{
105 for(int i=6;i<48;i++) 105 for(int i=6;i<48;i++)
106 { 106 {
107 switch(board[i]) 107 switch(board[i])
108 { 108 {
109 case MAN1: 109 case MAN1:
110 if(board[i-6]==MAN2 || board[i-6]==KING2) 110 if(board[i-6]==MAN2 || board[i-6]==KING2)
111 if(board[i-12]==FREE) return true; 111 if(board[i-12]==FREE) return true;
112 if(board[i-5]==MAN2 || board[i-5]==KING2) 112 if(board[i-5]==MAN2 || board[i-5]==KING2)
113 if(board[i-10]==FREE) return true; 113 if(board[i-10]==FREE) return true;
114 if(board[i+5]==MAN2 || board[i+5]==KING2) 114 if(board[i+5]==MAN2 || board[i+5]==KING2)
115 if(board[i+10]==FREE) return true; 115 if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
116 if(board[i+6]==MAN2 || board[i+6]==KING2) 116 if(board[i+6]==MAN2 || board[i+6]==KING2)
117 if(board[i+12]==FREE) return true; 117 if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
118 break; 118 break;
119 case KING1: 119 case KING1:
120 int k; 120 int k;
121 for(k=i-6;board[k]==FREE;k-=6); 121 for(k=i-6;board[k]==FREE;k-=6);
122 if(board[k]==MAN2 || board[k]==KING2) 122 if(board[k]==MAN2 || board[k]==KING2)
123 if(board[k-6]==FREE) return true; 123 if(board[k-6]==FREE) return true;
124 124
125 for(k=i-5;board[k]==FREE;k-=5); 125 for(k=i-5;board[k]==FREE;k-=5);
126 if(board[k]==MAN2 || board[k]==KING2) 126 if(board[k]==MAN2 || board[k]==KING2)
127 if(board[k-5]==FREE) return true; 127 if(board[k-5]==FREE) return true;
128 128
129 for(k=i+5;board[k]==FREE;k+=5); 129 for(k=i+5;board[k]==FREE;k+=5) {
130 if (k >= 49)
131 break;
132 }
130 if(board[k]==MAN2 || board[k]==KING2) 133 if(board[k]==MAN2 || board[k]==KING2)
131 if(board[k+5]==FREE) return true; 134 if(board[((k+5) < 54) ? k+5 : 53]==FREE) return true;
132 135
133 for(k=i+6;board[k]==FREE;k+=6); 136 for(k=i+6;board[k]==FREE;k+=6) {
137 if (k >=48)
138 break;
139 }
134 if(board[k]==MAN2 || board[k]==KING2) 140 if(board[k]==MAN2 || board[k]==KING2)
135 if(board[k+6]==FREE) return true; 141 if(board[((k+6) < 54) ? k+6 : 53]==FREE) return true;
136 } 142 }
137 } 143 }
138 return false; 144 return false;
139} 145}
140 146
141 147
142// Return TRUE if a course of the user true 148// Return TRUE if a course of the user true
143// Return FALSE if a course of the user incorrect 149// Return FALSE if a course of the user incorrect
144 150
145bool RCheckers::manCapture1(int from,int direction,bool &capture) 151bool RCheckers::manCapture1(int from,int direction,bool &capture)
146{ 152{
147 int i=from+direction; 153 int i=from+direction;
148 if(board[i]==MAN2 || board[i]==KING2) 154 if(board[i]==MAN2 || board[i]==KING2)
149 { 155 {
150 int k=i+direction; 156 int k=i+direction;
151 if(board[k]==FREE) 157 if(board[k]==FREE)
152 { 158 {
153 bool next=false; 159 bool next=false;
154 int save=board[i]; 160 int save=board[i];
155 board[from]=FREE; 161 board[from]=FREE;
156 board[i]=NONE; 162 board[i]=NONE;
157 163
158 if(k<10) 164 if(k<10)
159 { 165 {
@@ -265,69 +271,75 @@ void RCheckers::kingMove2(int from,int &resMax)
265 board[i]=FREE; 271 board[i]=FREE;
266 } 272 }
267 for(int i=from+6;board[i]==FREE;i+=6) 273 for(int i=from+6;board[i]==FREE;i+=6)
268 { 274 {
269 board[i]=KING2; 275 board[i]=KING2;
270 turn(resMax); 276 turn(resMax);
271 board[i]=FREE; 277 board[i]=FREE;
272 } 278 }
273 board[from]=KING2; 279 board[from]=KING2;
274} 280}
275 281
276 282
277bool RCheckers::checkCapture2() 283bool RCheckers::checkCapture2()
278{ 284{
279 for(int i=6;i<48;i++) 285 for(int i=6;i<48;i++)
280 { 286 {
281 switch(board[i]) 287 switch(board[i])
282 { 288 {
283 case MAN2: 289 case MAN2:
284 if(board[i-6]==MAN1 || board[i-6]==KING1) 290 if(board[i-6]==MAN1 || board[i-6]==KING1)
285 if(board[i-12]==FREE) return true; 291 if(board[i-12]==FREE) return true;
286 if(board[i-5]==MAN1 || board[i-5]==KING1) 292 if(board[i-5]==MAN1 || board[i-5]==KING1)
287 if(board[i-10]==FREE) return true; 293 if(board[i-10]==FREE) return true;
288 if(board[i+5]==MAN1 || board[i+5]==KING1) 294 if(board[i+5]==MAN1 || board[i+5]==KING1)
289 if(board[i+10]==FREE) return true; 295 if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
290 if(board[i+6]==MAN1 || board[i+6]==KING1) 296 if(board[i+6]==MAN1 || board[i+6]==KING1)
291 if(board[i+12]==FREE) return true; 297 if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
292 break; 298 break;
293 case KING2: 299 case KING2:
294 int k; 300 int k;
295 for(k=i-6;board[k]==FREE;k-=6); 301 for(k=i-6;board[k]==FREE;k-=6);
296 if(board[k]==MAN1 || board[k]==KING1) 302 if(board[k]==MAN1 || board[k]==KING1)
297 if(board[k-6]==FREE) return true; 303 if(board[k-6]==FREE) return true;
298 304
299 for(k=i-5;board[k]==FREE;k-=5); 305 for(k=i-5;board[k]==FREE;k-=5);
300 if(board[k]==MAN1 || board[k]==KING1) 306 if(board[k]==MAN1 || board[k]==KING1)
301 if(board[k-5]==FREE) return true; 307 if(board[k-5]==FREE) return true;
302 308
303 for(k=i+5;board[k]==FREE;k+=5); 309 for(k=i+5;board[k]==FREE;k+=5) {
310 if (k>=49)
311 break;
312 }
304 if(board[k]==MAN1 || board[k]==KING1) 313 if(board[k]==MAN1 || board[k]==KING1)
305 if(board[k+5]==FREE) return true; 314 if(board[((k+5) < 54) ? k+5 : 53]==FREE) return true;
306 315
307 for(k=i+6;board[k]==FREE;k+=6); 316 for(k=i+6;board[k]==FREE;k+=6) {
317 if (k>=48)
318 break;
319 }
308 if(board[k]==MAN1 || board[k]==KING1) 320 if(board[k]==MAN1 || board[k]==KING1)
309 if(board[k+6]==FREE) return true; 321 if(board[((k+6) < 54) ? k+6 : 53]==FREE) return true;
310 } 322 }
311 } 323 }
312 return false; 324 return false;
313} 325}
314 326
315 327
316// Return TRUE if it is possible to capture 328// Return TRUE if it is possible to capture
317// Return FALSE if it is impossible to capture 329// Return FALSE if it is impossible to capture
318 330
319bool RCheckers::manCapture2(int from,int &resMax) 331bool RCheckers::manCapture2(int from,int &resMax)
320{ 332{
321 bool capture=false; 333 bool capture=false;
322 334
323 int i=from-6; 335 int i=from-6;
324 if(board[i]==MAN1 || board[i]==KING1) 336 if(board[i]==MAN1 || board[i]==KING1)
325 { 337 {
326 int k=from-12; 338 int k=from-12;
327 if(board[k]==FREE) 339 if(board[k]==FREE)
328 { 340 {
329 int save=board[i]; 341 int save=board[i];
330 board[from]=FREE; 342 board[from]=FREE;
331 board[i]=NONE; 343 board[i]=NONE;
332 board[k]=MAN2; 344 board[k]=MAN2;
333 resMax--; 345 resMax--;