Debian Codegraph @

src/game_interfaces/qgoboard.cpp

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2009 by The qGo Project *
3 * *
4 * This file is part of qGo. *
5 * *
6 * qGo is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, see <http://www.gnu.org/licenses/> *
18 * or write to the Free Software Foundation, Inc., *
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 ***************************************************************************/
21
22
23 #include "qgoboard.h"cxx . . $ `<file>/src/game_interfaces/qgoboard.h`/
24 #include "boardwindow.h"cxx . . $ `<file>/src/board/boardwindow.h`/
25 #include "tree.h"cxx . . $ `<file>/src/game_tree/tree.h`/
26 #include "move.h"cxx . . $ `<file>/src/game_tree/move.h`/
27 #include "defines.h"cxx . . $ `<file>/src/defines.h`/
28 #include "audio.h"cxx . . $ `<file>/src/audio/audio.h`/
29 #include "boarddispatch.h"cxx . . $ `<file>/src/network/boarddispatch.h`/
30 #include "messages.h"cxx . . $ `<file>/src/network/messages.h`/
31 #include "resultdialog.h"cxx . . $ `<file>/src/game_interfaces/resultdialog.h`/
32 #include "clockdisplay.h"cxx . . $ `<file>/src/board/clockdisplay.h`/
33 #include "gamedata.h"cxx . . $ `<file>/src/gamedata.h`/
34 #include "matrix.h"cxx . . $ `<file>/src/game_tree/matrix.h`/
35
36 qGoBoardcxx . . $ qGoBoard#::qGoBoardcxx . . $ qGoBoard#qGoBoard(29a441517101e16e).(BoardWindowcxx . . $ BoardWindow# *bw, Treecxx . . $ Tree# * t, GameDatacxx . . $ GameData# *gd) : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(bw)
37 {
38 isModifiedcxx . . $ qGoBoard#isModified. = false;
39 treecxx . . $ qGoBoard#tree. = t;
40 boardwindowcxx . . $ qGoBoard#boardwindow. = bw;
41
42 //data used for observing games, when getting the already played moves
43 stated_mv_countcxx . . $ qGoBoard#stated_mv_count. = -1;
44 lastMoveInGamecxx . . $ qGoBoard#lastMoveInGame. = 0;
45
46 gameDatacxx . . $ qGoBoard#gameData. = gd;
47
48 clickSoundcxx . . $ qGoBoard#clickSound. = new Soundcxx . . $ Sound#Sound(6caa6e6871ecf3b).("stone.wav"cxx . . $ QString#QString(85c52e162fed56f9).);
49
50 dontCheckValiditycxx . . $ qGoBoard#dontCheckValidity. = false;
51 }
52
53 qGoBoardcxx . . $ qGoBoard#::~cxx . . $ qGoBoard#`~qGoBoard`(ced63f7c635d850d).qGoBoardcxx . . $ qGoBoard#()
54 {
55 delete clickSoundcxx . . $ qGoBoard#clickSound.;
56 }
57
58 /* FIXME: Make sure this isn't called from places it shouldn't be. Like
59 * subclass interfaces. */
60 void qGoBoardcxx . . $ qGoBoard#::setHandicapcxx . . $ qGoBoard#setHandicap(d4f767463ce0a6b3).(int handicap)
61 {
62 GamePhasecxx . . $ GamePhase# store = boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).();
63 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("setHandicap called\n");
64
65 /* Move should already be set to 0 by board handler and the placement
66 * of handicap stones won't change that */
67 boardwindowcxx . . $ qGoBoard#boardwindow.->setGamePhasecxx . . $ BoardWindow#setGamePhase(6ad67d8601499648).(phaseEditcxx . . $ phaseEdit.);
68 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setMoveNumbercxx . . $ Move#setMoveNumber(d4f767463ce0a6b3).(0);
69 if (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->addHandicapStonescxx . . $ Matrix#addHandicapStones(83c267b20bac841a).(handicap))
70 {
71 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setHandicapMovecxx . . $ Move#setHandicapMove(b45ddcbc8423892c).(true);
72 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setXcxx . . $ Move#setX(d4f767463ce0a6b3).(-1);//-1
73 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setYcxx . . $ Move#setY(d4f767463ce0a6b3).(-1);//-1
74 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setColorcxx . . $ Move#setColor(42096433316d3db3).(stoneBlackcxx . . $ stoneBlack.);
75 gameDatacxx . . $ qGoBoard#gameData.->handicapcxx . . $ GameData#handicap. = handicap;
76 }
77 boardwindowcxx . . $ qGoBoard#boardwindow.->updateMovecxx . . $ BoardWindow#updateMove(490cd2a4f5caa810).(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()); // Toggles window refresh
78
79 boardwindowcxx . . $ qGoBoard#boardwindow.->setGamePhasecxx . . $ BoardWindow#setGamePhase(6ad67d8601499648).(store);
80 }
81
82 /*
83 * adds a mark to the current move's matrix
84 * This is used in edit phase to add mark on the board
85 */
86 void qGoBoardcxx . . $ qGoBoard#::addMarkcxx . . $ qGoBoard#addMark(2fb52c50f1893bf2).( int x, int y, MarkTypecxx . . $ MarkType# t )
87 {
88 Matrixcxx . . $ Matrix# * mat = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).();
89 if (mat->getMarkAtcxx . . $ Matrix#getMarkAt(cd452d1956ab952a).(x,y) != markNonecxx . . $ markNone.)
90 mat->removeMarkcxx . . $ Matrix#removeMark(3e454b8ccf442868).(x,y);
91
92 if (t == markTextcxx . . $ markText. || t == markNumbercxx . . $ markNumber.)
93 {
94 QStringcxx . . $ QString# txt = mat->getFirstTextAvailablecxx . . $ Matrix#getFirstTextAvailable(86e5271f0d39a332).(t);
95 mat->setMarkTextcxx . . $ Matrix#setMarkText(c89d651b24440698).(x,y,txt);
96 }
97
98 mat->insertMarkcxx . . $ Matrix#insertMark(2fb52c50f1893bf2).(x,y,t);
99 /* FIXME this is a bit awkward here, but markTerr does not
100 * mark dead and they aren't ghosted immediately for some
101 * reason unless they're dead. Assuming this generally
102 * comes through qgoboard network code, we'll mark them
103 * dead here for now.
104 * I'm also still not certain if this is necessary, there
105 * was another bug elsewhere, but it can't hurt. */
106 if(t == markTerrBlackcxx . . $ markTerrBlack. && mat->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x,y) == stoneWhitecxx . . $ stoneWhite.)
107 mat->markStoneDeadcxx . . $ Matrix#markStoneDead(3e454b8ccf442868).(x,y);
108 else if(t == markTerrWhitecxx . . $ markTerrWhite. && mat->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x,y) == stoneBlackcxx . . $ stoneBlack.)
109 mat->markStoneDeadcxx . . $ Matrix#markStoneDead(3e454b8ccf442868).(x,y);
110
111 boardwindowcxx . . $ qGoBoard#boardwindow.->updateMovecxx . . $ BoardWindow#updateMove(490cd2a4f5caa810).(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).());
112 setModifiedcxx . . $ qGoBoard#setModified(b45ddcbc8423892c).();
113 }
114
115 /*
116 * removes a mark to the current move's matrix
117 * This is used in edit phase to remove a mark on the board
118 */
119 void qGoBoardcxx . . $ qGoBoard#::removeMarkcxx . . $ qGoBoard#removeMark(3e454b8ccf442868).( int x, int y)
120 {
121 if (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getMarkAtcxx . . $ Matrix#getMarkAt(cd452d1956ab952a).(x,y) != markNonecxx . . $ markNone.)
122 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->removeMarkcxx . . $ Matrix#removeMark(3e454b8ccf442868).(x,y);
123
124 boardwindowcxx . . $ qGoBoard#boardwindow.->updateMovecxx . . $ BoardWindow#updateMove(490cd2a4f5caa810).(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).());
125 setModifiedcxx . . $ qGoBoard#setModified(b45ddcbc8423892c).();
126 }
127
128 /*
129 * adds a stone to the current move's matrix
130 * This is used in edit phase to add stones (and not moves) on the board
131 */
132 void qGoBoardcxx . . $ qGoBoard#::addStonecxx . . $ qGoBoard#addStone(e6b2860cd25699f2).(StoneColorcxx . . $ StoneColor# c, int x, int y)
133 {
134 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->addStonecxx . . $ Move#addStone(e6b2860cd25699f2).(c, x, y);
135 boardwindowcxx . . $ qGoBoard#boardwindow.->updateMovecxx . . $ BoardWindow#updateMove(490cd2a4f5caa810).(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).());
136 setModifiedcxx . . $ qGoBoard#setModified(b45ddcbc8423892c).();
137 }
138
139 int qGoBoardcxx . . $ qGoBoard#::getMoveNumbercxx . . $ qGoBoard#getMoveNumber(b126dc7c1de90089).(void)
140 {
141 return treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).();
142 }
143
144 /*
145 * 'Pass' button pressed
146 */
147 void qGoBoardcxx . . $ qGoBoard#::passRequestcxx . . $ qGoBoard#passRequest(49f6e7a06ebc5aa8).()
148 {
149 if((getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsBlackcxx . . $ BoardWindow#getMyColorIsBlack(c9857a73d68e59ba).()) ||
150 (!getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsWhitecxx . . $ BoardWindow#getMyColorIsWhite(c9857a73d68e59ba).()))
151 doPasscxx . . $ qGoBoard#doPass(42096433316d3db3).();
152 }
153
154 /*
155 * 'Score' button toggled
156 */
157 void qGoBoardcxx . . $ qGoBoard#::slotScoreToggledcxx . . $ qGoBoard#slotScoreToggled(b45ddcbc8423892c).(bool pressed)
158 {
159 if (pressed)
160 enterScoreModecxx . . $ qGoBoard#enterScoreMode(49f6e7a06ebc5aa8).();
161 else
162 leaveScoreModecxx . . $ qGoBoard#leaveScoreMode(49f6e7a06ebc5aa8).();
163 }
164
165 void qGoBoardcxx . . $ qGoBoard#::setResultcxx . . $ qGoBoard#setResult(cbc950be3aaaa49b).(GameResultcxx . . $ GameResult# & r)
166 {
167 if (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).() == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) //how can this happen???
168 {
169 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("How can this possibly happen???");
170 return;
171 }
172 if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseEndedcxx . . $ phaseEnded.)
173 {
174 /* FIXME This is only okay if this is the only function
175 * setting the gamePhase to phaseEnded */
176 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Already received result");
177 return;
178 }
179 lastMoveInGamecxx . . $ qGoBoard#lastMoveInGame. = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).();
180 if(r.resultcxx . . $ GameResult#result. != GameResultcxx . . $ GameResult#::NOGAMEcxx . . $ GameResult#NOGAME.)
181 kibitzReceivedcxx . . $ qGoBoard#kibitzReceived(3520e46b33348bf6).("\n" +cxx . . $ operator+(c75c3ae4eb9af1a8). r.shortMessagecxx . . $ GameResult#shortMessage(4365c3963150523e).());
182 boardwindowcxx . . $ qGoBoard#boardwindow.->getGameDatacxx . . $ BoardWindow#getGameData(f917540193955ea7).()->resultcxx . . $ GameData#result. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). r.shortMessagecxx . . $ GameResult#shortMessage(4365c3963150523e).();
183 /* This is all a little ugly. FIXME. The problem is that the
184 * QString result is used by the sgf loader, its sort of
185 * an easy way to store and load results through sgf files.
186 * The problem is that these aren't necessarily anything
187 * more than a string which means either we have to interpret
188 * them and allow partial GameResult records or this,
189 * which is to have two different results on the game data. And then
190 * all of this is just basically so the network code
191 * can get the margin when the client calulates it for
192 * a protocol. So yeah, find a better way. FIXME
193 * Really, I'd like to make the gamedata be one, single
194 * stand alone object instead of something we copy to different
195 * places, and then I'd like to do the same with the result
196 * as an add on to it. Just add whatever interpretation of
197 * SGF files is necessary.*/
198 boardwindowcxx . . $ qGoBoard#boardwindow.->getGameDatacxx . . $ BoardWindow#getGameData(f917540193955ea7).()->fullresultcxx . . $ GameData#fullresult. = new GameResultcxx . . $ GameResult#(r);
199 //just one gamedata now, FIXME delete comment
200 BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = boardwindowcxx . . $ qGoBoard#boardwindow.->getBoardDispatchcxx . . $ BoardWindow#getBoardDispatch(2c265f6a5bbd0ea7).();
201 /*if(!boarddispatch)
202 {
203 qDebug("No board dispatch for game result");
204 return;
205 }
206 GameData * gr = boarddispatch->getGameData();
207 gr->fullresult = new GameResult(r);*/
208 /* This should be parent window modal, otherwise its annoying.
209 * I'm going to make it its own dialog so it could be extended
210 * later */
211 if(boarddispatch && r.resultcxx . . $ GameResult#result. != GameResultcxx . . $ GameResult#::NOGAMEcxx . . $ GameResult#NOGAME.)
212 {
213 ResultDialogcxx . . $ ResultDialog# * rd = new ResultDialogcxx . . $ ResultDialog#ResultDialog(8247bc9e6e961c84).(boardwindowcxx . . $ qGoBoard#boardwindow., boarddispatch, boardwindowcxx . . $ qGoBoard#boardwindow.->getIdcxx . . $ BoardWindow#getId(b126dc7c1de90089).(), &r);
214 boarddispatch->setRematchDialogcxx . . $ BoardDispatch#setRematchDialog(916b84551040fc84).(rd); //necessary right?
215 rd->setWindowModalitycxx . . $ QWidget#setWindowModality(3df99ed04a148acc).(Qtcxx . . $ Qt/::WindowModalcxx . . $ Qt/WindowModal.);
216 rd->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
217 }
218 QSettingscxx . . $ QSettings# settingscxx . . $ QSettings#QSettings(749de1b6ae65bddd).;
219 if( settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("AUTOSAVE"cxx . . $ QString#QString(85c52e162fed56f9).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).())
220 boardwindowcxx . . $ qGoBoard#boardwindow.->doSavecxx . . $ BoardWindow#doSave(fb5d32962602ae86).(boardwindowcxx . . $ qGoBoard#boardwindow.->getCandidateFileNamecxx . . $ BoardWindow#getCandidateFileName(4365c3963150523e).(),true);
221
222 boardwindowcxx . . $ qGoBoard#boardwindow.->setGamePhasecxx . . $ BoardWindow#setGamePhase(6ad67d8601499648).(phaseEndedcxx . . $ phaseEnded.);
223 /* FIXME: getting the result doesn't set the result
224 * in the toolbar for some reason. Like it doesn't
225 * show score or captures or anything else.
226 * this was an enterScoreMode thing, but there's more
227 * issues there*/
228 }
229
230 /*
231 * This handles the main envent with qGo : something has been clicked on the board
232 */
233 void qGoBoardcxx . . $ qGoBoard#::slotBoardClickedcxx . . $ qGoBoard#slotBoardClicked(916cfd9b6aad83bf).(bool , int x, int y , Qtcxx . . $ Qt/::MouseButtoncxx . . $ Qt/MouseButton# mouseState)
234 {
235 bool blackToPlay = getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).();
236
237 switch (boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).())
238 {
239 case phaseInitcxx . . $ phaseInit.:
240 //should not happen
241 return ;
242
243 case phaseNavTocxx . . $ phaseNavTo.:
244 {
245 treecxx . . $ qGoBoard#tree.->findMoveByPoscxx . . $ Tree#findMoveByPos(3e454b8ccf442868).(x, y);
246 boardwindowcxx . . $ qGoBoard#boardwindow.->setGamePhasecxx . . $ BoardWindow#setGamePhase(6ad67d8601499648). ( phaseOngoingcxx . . $ phaseOngoing. );
247 return;
248 }
249
250 case phaseEditcxx . . $ phaseEdit.:
251 {
252 switch (boardwindowcxx . . $ qGoBoard#boardwindow.->getEditMarkcxx . . $ BoardWindow#getEditMark(37e5b5ce603f447).())
253 {
254 case markNonecxx . . $ markNone.:
255 {
256 if(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x,y) == stoneNonecxx . . $ stoneNone.)
257 addStonecxx . . $ qGoBoard#addStone(e6b2860cd25699f2).(mouseState == Qtcxx . . $ Qt/::LeftButtoncxx . . $ Qt/LeftButton. ? stoneBlackcxx . . $ stoneBlack. : stoneWhitecxx . . $ stoneWhite., x, y);
258 else
259 addStonecxx . . $ qGoBoard#addStone(e6b2860cd25699f2).(stoneErasecxx . . $ stoneErase., x, y);
260 setModifiedcxx . . $ qGoBoard#setModified(b45ddcbc8423892c).(true);
261 return;
262 }
263 default:
264 {
265 if (mouseState == Qtcxx . . $ Qt/::LeftButtoncxx . . $ Qt/LeftButton.)
266 addMarkcxx . . $ qGoBoard#addMark(2fb52c50f1893bf2).(x,y, boardwindowcxx . . $ qGoBoard#boardwindow.->getEditMarkcxx . . $ BoardWindow#getEditMark(37e5b5ce603f447).());
267 else
268 removeMarkcxx . . $ qGoBoard#removeMark(3e454b8ccf442868).(x,y);
269 setModifiedcxx . . $ qGoBoard#setModified(b45ddcbc8423892c).(true);
270 return;
271 }
272
273 }
274 return;
275 }
276
277 case phaseEndedcxx . . $ phaseEnded.:
278 return;
279
280 case phaseScorecxx . . $ phaseScore.:
281 {
282 localMarkDeadRequestcxx . . $ qGoBoard#localMarkDeadRequest(3e454b8ccf442868).(x,y);
283 return;
284 }
285
286 case phaseOngoingcxx . . $ phaseOngoing.:
287 if (blackToPlay && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsBlackcxx . . $ BoardWindow#getMyColorIsBlack(c9857a73d68e59ba).())
288 localMoveRequestcxx . . $ qGoBoard#localMoveRequest(e6b2860cd25699f2).(stoneBlackcxx . . $ stoneBlack.,x,y);
289
290 if (!blackToPlay && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsWhitecxx . . $ BoardWindow#getMyColorIsWhite(c9857a73d68e59ba).())
291 localMoveRequestcxx . . $ qGoBoard#localMoveRequest(e6b2860cd25699f2).(stoneWhitecxx . . $ stoneWhite.,x,y);
292 return;
293 }
294 }
295
296 /*
297 * This functions gets the request (from a board click)
298 * to mark a stone as dead/undead (score mode). All local but 'match'
299 */
300 void qGoBoardcxx . . $ qGoBoard#::localMarkDeadRequestcxx . . $ qGoBoard#localMarkDeadRequest(3e454b8ccf442868).(int x, int y)
301 {
302 toggleGroupAtcxx . . $ qGoBoard#toggleGroupAt(3e454b8ccf442868).(x,y);
303 /* FIXME maybe should be markDeadArea()? Maybe as option? */
304 }
305
306 /* We need to combine the below perhaps with the above sendPassToInterface */
307 /*
308 * This function adds a pass move to a game. there is no need to return anything
309 */
310 void qGoBoardcxx . . $ qGoBoard#::doPasscxx . . $ qGoBoard#doPass(42096433316d3db3).(StoneColorcxx . . $ StoneColor# c)
311 {
312 if (c == stoneNonecxx . . $ stoneNone.)
313 c = (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getColorcxx . . $ Move#getColor(6680c74b05d375a4).() == stoneWhitecxx . . $ stoneWhite.) ? stoneBlackcxx . . $ stoneBlack. : stoneWhitecxx . . $ stoneWhite.;
314 treecxx . . $ qGoBoard#tree.->lastMoveInMainBranchcxx . . $ Tree#lastMoveInMainBranch. = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->makeMovecxx . . $ Move#makeMove(b73c42e1a544db20).(c,PASS_XYcxx . . $ `src/defines.h:38:9`!,PASS_XYcxx . . $ `src/defines.h:38:9`!,true);
315 treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(treecxx . . $ qGoBoard#tree.->lastMoveInMainBranchcxx . . $ Tree#lastMoveInMainBranch.);
316 setModifiedcxx . . $ qGoBoard#setModified(b45ddcbc8423892c).(true);
317 }
318
319
320 /*
321 * Returns true if black is to play
322 * FIXME shouldn't this be in board.cpp or some place?
323 * maybe not...
324 */
325 bool qGoBoardcxx . . $ qGoBoard#::getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).(bool time)
326 {
327 if (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getPLinfocxx . . $ Move#getPLinfo(c9857a73d68e59ba).())
328 // color of next stone is same as current
329 return treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getPLnextMovecxx . . $ Move#getPLnextMove(5202307a42d70465).() == stoneBlackcxx . . $ stoneBlack.;
330
331 //if (tree->getCurrent() == tree->getRoot())
332 // return true;
333
334 // the first handicap move bears number 0 as well
335 if (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).() == 0)
336 {
337 // Handicap, so white starts
338 if (gameDatacxx . . $ qGoBoard#gameData.->handicapcxx . . $ GameData#handicap. >= 2)
339 return false;
340
341 return true;
342 }
343
344 // Normal mode
345 /* if (tree->getCurrent()->getGameMode() == modeNormal ||
346 tree->getCurrent()->getGameMode() == modeObserve ||
347 tree->getCurrent()->getGameMode() == modeMatch ||
348 tree->getCurrent()->getGameMode() == modeTeach ||
349 tree->getCurrent()->getGameMode() == modeComputer)
350 */
351 if (boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() != phaseEditcxx . . $ phaseEdit.)
352 {
353 // change color
354 /* This is to prevent clock ticking for wrong player
355 * when looking back over moves in an observed game,
356 * for instance */
357 if(time)
358 return (treecxx . . $ qGoBoard#tree.->findLastMoveInMainBranchcxx . . $ Tree#findLastMoveInMainBranch(81447a345d48a217).()->getColorcxx . . $ Move#getColor(6680c74b05d375a4).() == stoneWhitecxx . . $ stoneWhite.);
359 else
360 return (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getColorcxx . . $ Move#getColor(6680c74b05d375a4).() == stoneWhitecxx . . $ stoneWhite.);
361 }
362 // Edit mode. Return color of parent move.
363 else if (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->parentcxx . . $ Move#parent. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
364 return treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->parentcxx . . $ Move#parent.->getColorcxx . . $ Move#getColor(6680c74b05d375a4).() == stoneWhitecxx . . $ stoneWhite.;
365
366 // Crap happened. 50% chance this is correct .)
367 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("Oops, crap happened in BoardHandler::getBlackTurn() !");
368 return true;
369 }
370
371 /*
372 * This functions initialises the scoring mode
373 */
374 void qGoBoardcxx . . $ qGoBoard#::enterScoreModecxx . . $ qGoBoard#enterScoreMode(49f6e7a06ebc5aa8).()
375 {
376 if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseScorecxx . . $ phaseScore.)
377 return;
378 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("qgb::enterScoreMode()");
379 boardwindowcxx . . $ qGoBoard#boardwindow.->setGamePhasecxx . . $ BoardWindow#setGamePhase(6ad67d8601499648). (phaseScorecxx . . $ phaseScore.);
380 treecxx . . $ qGoBoard#tree.->countScorecxx . . $ Tree#countScore(49f6e7a06ebc5aa8).();
381 }
382
383 /*
384 * This functions leaves the scoring mode
385 */
386 void qGoBoardcxx . . $ qGoBoard#::leaveScoreModecxx . . $ qGoBoard#leaveScoreMode(49f6e7a06ebc5aa8).()
387 {
388 if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() != phaseScorecxx . . $ phaseScore.)
389 return;
390 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("leaving score mode");
391 boardwindowcxx . . $ qGoBoard#boardwindow.->setGamePhasecxx . . $ BoardWindow#setGamePhase(6ad67d8601499648). ( phaseOngoingcxx . . $ phaseOngoing. );
392 treecxx . . $ qGoBoard#tree.->exitScorecxx . . $ Tree#exitScore(49f6e7a06ebc5aa8).();
393 }
394
395 void qGoBoardcxx . . $ qGoBoard#::toggleGroupAtcxx . . $ qGoBoard#toggleGroupAt(3e454b8ccf442868).(int x, int y)
396 {
397 // is the click on a stone ?
398 if ( treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x, y) == stoneNonecxx . . $ stoneNone. )
399 return;
400
401 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->toggleGroupAtcxx . . $ Matrix#toggleGroupAt(3e454b8ccf442868).(x, y);
402 treecxx . . $ qGoBoard#tree.->countScorecxx . . $ Tree#countScore(49f6e7a06ebc5aa8).();
403 }
404
405 /*
406 * This functions is called in scoring phase when clicking on a dead group
407 */
408 void qGoBoardcxx . . $ qGoBoard#::markDeadStonecxx . . $ qGoBoard#markDeadStone(3e454b8ccf442868).(int x, int y)
409 {
410 // is the click on a stone ?
411 if ( treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x, y) == stoneNonecxx . . $ stoneNone. )
412 return;
413
414 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->markGroupDeadcxx . . $ Matrix#markGroupDead(3e454b8ccf442868).(x, y);
415 treecxx . . $ qGoBoard#tree.->countScorecxx . . $ Tree#countScore(49f6e7a06ebc5aa8).();
416 }
417
418 void qGoBoardcxx . . $ qGoBoard#::markLiveStonecxx . . $ qGoBoard#markLiveStone(3e454b8ccf442868).(int x, int y)
419 {
420 // is the click on a stone ?
421 if ( treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x, y) == stoneNonecxx . . $ stoneNone. )
422 return;
423
424 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->markGroupAlivecxx . . $ Matrix#markGroupAlive(3e454b8ccf442868).(x, y);
425 treecxx . . $ qGoBoard#tree.->countScorecxx . . $ Tree#countScore(49f6e7a06ebc5aa8).();
426 }
427
428 void qGoBoardcxx . . $ qGoBoard#::markDeadAreacxx . . $ qGoBoard#markDeadArea(3e454b8ccf442868).(int x, int y)
429 {
430 // is the click on a stone ?
431 if ( treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x, y) == stoneNonecxx . . $ stoneNone. )
432 return;
433
434 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->markAreaDeadcxx . . $ Matrix#markAreaDead(3e454b8ccf442868).(x, y);
435 treecxx . . $ qGoBoard#tree.->countScorecxx . . $ Tree#countScore(49f6e7a06ebc5aa8).();
436 }
437
438 void qGoBoardcxx . . $ qGoBoard#::markLiveAreacxx . . $ qGoBoard#markLiveArea(3e454b8ccf442868).(int x, int y)
439 {
440 // is the click on a stone ?
441 if ( treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x, y) == stoneNonecxx . . $ stoneNone. )
442 return;
443
444 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->markAreaAlivecxx . . $ Matrix#markAreaAlive(3e454b8ccf442868).(x, y);
445 treecxx . . $ qGoBoard#tree.->countScorecxx . . $ Tree#countScore(49f6e7a06ebc5aa8).();
446 }
447
448 void qGoBoardcxx . . $ qGoBoard#::slotUndoPressedcxx . . $ qGoBoard#slotUndoPressed(49f6e7a06ebc5aa8).(void)
449 {
450 /* Are we supposed to make a brother node or something ??? FIXME */
451 treecxx . . $ qGoBoard#tree.->deleteNodecxx . . $ Tree#deleteNode(49f6e7a06ebc5aa8).();
452 }
453
454 void qGoBoardcxx . . $ qGoBoard#::slotResignPressedcxx . . $ qGoBoard#slotResignPressed(49f6e7a06ebc5aa8).(void)
455 {
456 GameResultcxx . . $ GameResult# gcxx . . $ GameResult#GameResult(8260daab7d234241).((getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() ? stoneWhitecxx . . $ stoneWhite. : stoneBlackcxx . . $ stoneBlack.), GameResultcxx . . $ GameResult#::RESIGNcxx . . $ GameResult#RESIGN.);
457 setResultcxx . . $ qGoBoard#setResult(cbc950be3aaaa49b).(g);
458 }
459
460 void qGoBoardcxx . . $ qGoBoard#::slotDonePressedcxx . . $ qGoBoard#slotDonePressed(49f6e7a06ebc5aa8).(void)
461 {
462 GameResultcxx . . $ GameResult# g = treecxx . . $ qGoBoard#tree.->retrieveScorecxx . . $ Tree#retrieveScore(ba5abcee0082dfc2).();
463 setResultcxx . . $ qGoBoard#setResult(cbc950be3aaaa49b).(g);
464 }
465
466 /*
467 * kibitz was received. Tranfer it to move and comment window
468 */
469 void qGoBoardcxx . . $ qGoBoard#::kibitzReceivedcxx . . $ qGoBoard#kibitzReceived(3520e46b33348bf6).(const QStringcxx . . $ QString#& text)
470 {
471
472 QStringcxx . . $ QString# k = textcxx . . $ QString#QString(132dd6869045752b).;
473 // be nice to do this in bold or something
474 if(stated_mv_countcxx . . $ qGoBoard#stated_mv_count. != treecxx . . $ qGoBoard#tree.->findLastMoveInMainBranchcxx . . $ Tree#findLastMoveInMainBranch(81447a345d48a217).()->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).())
475 {
476 stated_mv_countcxx . . $ qGoBoard#stated_mv_count. = treecxx . . $ qGoBoard#tree.->findLastMoveInMainBranchcxx . . $ Tree#findLastMoveInMainBranch(81447a345d48a217).()->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).();
477 k.prependcxx . . $ QString#prepend(6a89d0b7f4d2681c).( "(" +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(stated_mv_countcxx . . $ qGoBoard#stated_mv_count.) +cxx . . $ operator+(3d22f08efddf8107). ") ");
478 }
479
480 boardwindowcxx . . $ qGoBoard#boardwindow.->displayCommentcxx . . $ BoardWindow#displayComment(7df51288a9ebd664).(kcxx . . $ QString#QString(132dd6869045752b).);
481 }
482
483 // send regular time Info
484 void qGoBoardcxx . . $ qGoBoard#::timerEventcxx . . $ qGoBoard#timerEvent(b9e57d1150f23bf5).(QTimerEventcxx . . $ QTimerEvent#*)
485 {
486 // wait until first move
487 // if (mv_counter < 0 || id < 0 || game_paused)
488 if (boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() != phaseOngoingcxx . . $ phaseOngoing.)
489 return;
490
491 boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->setTimeStepcxx . . $ ClockDisplay#setTimeStep(b45ddcbc8423892c).(getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).(true));
492 /*
493 // warn if I am within the last 10 seconds
494 if (gameMode == modeMatch)
495 {
496 if (myColorIsBlack && bt_i <= BY_timer && bt_i > -1 && mv_counter % 2) // ||
497 {
498 // each second we alternate button background color
499 if (bt_i %2)
500 win->getInterfaceHandler()->normalTools->pb_timeBlack->setPaletteBackgroundColor(Qt::red);
501 else
502 win->getInterfaceHandler()->normalTools->pb_timeBlack->setPaletteBackgroundColor(win->getInterfaceHandler()->normalTools->palette().color(QPalette::Active,QColorGroup::Button)) ;//setPaletteBackgroundColor(Qt::PaletteBase);
503 qgo->playTimeSound();
504 }
505
506 else if ( !myColorIsBlack && wt_i <= BY_timer && wt_i > -1 && (mv_counter % 2) == 0)
507 {
508 if (wt_i %2)
509 win->getInterfaceHandler()->normalTools->pb_timeWhite->setPaletteBackgroundColor(Qt::red);
510 else
511 win->getInterfaceHandler()->normalTools->pb_timeWhite->setPaletteBackgroundColor(win->getInterfaceHandler()->normalTools->palette().color(QPalette::Active,QColorGroup::Button)) ;//setPaletteBackgroundColor(Qt::PaletteBase);
512 qgo->playTimeSound();
513 }
514
515 //we have to reset the color when not anymore in warning period)
516 else if (win->getInterfaceHandler()->normalTools->pb_timeBlack->paletteBackgroundColor() == Qt::red)
517 win->getInterfaceHandler()->normalTools->pb_timeBlack->setPaletteBackgroundColor(win->getInterfaceHandler()->normalTools->palette().color(QPalette::Active,QColorGroup::Button)) ;
518
519
520 else if (win->getInterfaceHandler()->normalTools->pb_timeWhite->paletteBackgroundColor() == Qt::red)
521 win->getInterfaceHandler()->normalTools->pb_timeWhite->setPaletteBackgroundColor(win->getInterfaceHandler()->normalTools->palette().color(QPalette::Active,QColorGroup::Button)) ;
522
523
524
525 }
526 */
527 }
528
529 /* No pointer? Just an object?? FIXME */
530 TimeRecordcxx . . $ TimeRecord# qGoBoardcxx . . $ qGoBoard#::getOurTimeRecordcxx . . $ qGoBoard#getOurTimeRecord(3d89b73610291578).(void)
531 {
532 return boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->getTimeRecordcxx . . $ ClockDisplay#getTimeRecord(1da1f30878cd15cd).(boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsBlackcxx . . $ BoardWindow#getMyColorIsBlack(c9857a73d68e59ba).());
533 }
534
535 TimeRecordcxx . . $ TimeRecord# qGoBoardcxx . . $ qGoBoard#::getTheirTimeRecordcxx . . $ qGoBoard#getTheirTimeRecord(3d89b73610291578).(void)
536 {
537 return boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->getTimeRecordcxx . . $ ClockDisplay#getTimeRecord(1da1f30878cd15cd).(!boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsBlackcxx . . $ BoardWindow#getMyColorIsBlack(c9857a73d68e59ba).());
538 }