| 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_net.h"cxx . . $ `<file>/src/game_interfaces/qgoboard_net.h`/ |
| 24 | #include "tree.h"cxx . . $ `<file>/src/game_tree/tree.h`/ |
| 25 | #include "move.h"cxx . . $ `<file>/src/game_tree/move.h`/ |
| 26 | #include "../network/boarddispatch.h"cxx . . $ `<file>/src/network/boarddispatch.h`/ |
| 27 | #include "../network/messages.h"cxx . . $ `<file>/src/network/messages.h`/ |
| 28 | #include "undoprompt.h"cxx . . $ `<file>/src/game_interfaces/undoprompt.h`/ |
| 29 | #include "clockdisplay.h"cxx . . $ `<file>/src/board/clockdisplay.h`/ |
| 30 | #include "gamedata.h"cxx . . $ `<file>/src/gamedata.h`/ |
| 31 | #include "boardwindow.h"cxx . . $ `<file>/src/board/boardwindow.h`/ |
| 32 | #include "matrix.h"cxx . . $ `<file>/src/game_tree/matrix.h`/ |
| 33 | #include <QMessageBox> |
| 34 | #include "networkconnection.h"cxx . . $ `<file>/src/network/networkconnection.h`/ |
| 35 | #include "audio.h"cxx . . $ `<file>/src/audio/audio.h`/ |
| 36 | |
| 37 | qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#::qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#qGoBoardNetworkInterface(29a441517101e16e).(BoardWindowcxx . . $ BoardWindow# *bw, Treecxx . . $ Tree# * t, GameDatacxx . . $ GameData# *gd) : qGoBoardcxx . . $ qGoBoard#(bw, t, gd) |
| 38 | { |
| 39 | game_Idcxx . . $ qGoBoardNetworkInterface#game_Id. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(gd->numbercxx . . $ GameData#number.); |
| 40 | bw->clearDatacxx . . $ BoardWindow#clearData(49f6e7a06ebc5aa8).(); |
| 41 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch. = boardwindowcxx . . $ qGoBoard#boardwindow.->getBoardDispatchcxx . . $ BoardWindow#getBoardDispatch(2c265f6a5bbd0ea7).(); |
| 42 | connectioncxx . . $ qGoBoardNetworkInterface#connection. = dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->connectioncxx . . $ BoardDispatch#connection.; |
| 43 | |
| 44 | QSettingscxx . . $ QSettings# settingscxx . . $ QSettings#QSettings(749de1b6ae65bddd).; |
| 45 | playSoundcxx . . $ qGoBoard#playSound. = (settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("SOUND_MYGAMES"cxx . . $ QString#QString(85c52e162fed56f9).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).() || settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("SOUND_OTHERGAMES"cxx . . $ QString#QString(85c52e162fed56f9).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()); |
| 46 | |
| 47 | if (gd->handicapcxx . . $ GameData#handicap.) |
| 48 | { |
| 49 | setHandicapcxx . . $ qGoBoard#setHandicap(d4f767463ce0a6b3).(gd->handicapcxx . . $ GameData#handicap.); |
| 50 | } |
| 51 | dontsendcxx . . $ qGoBoardNetworkInterface#dontsend. = false; |
| 52 | boardTimerIdcxx . . $ qGoBoard#boardTimerId. = 0; |
| 53 | controlling_playercxx . . $ qGoBoardNetworkInterface#controlling_player. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 54 | reviewCurrentcxx . . $ qGoBoardNetworkInterface#reviewCurrent. = 0; |
| 55 | // what about review games? games without timers ?? |
| 56 | } |
| 57 | |
| 58 | /* |
| 59 | * This functions adds a move to a game. returns the new Move* if move was valid, 0 if not) |
| 60 | */ |
| 61 | Movecxx . . $ Move# *qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#::doMovecxx . . $ qGoBoardNetworkInterface#doMove(1b9ccd6dde28afc7).(StoneColorcxx . . $ StoneColor# c, int x, int y) |
| 62 | { |
| 63 | bool validMove = (dontCheckValiditycxx . . $ qGoBoard#dontCheckValidity. || treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->checkMoveIsValidcxx . . $ Move#checkMoveIsValid(d30022d4f7f7716f).(c, x, y)); |
| 64 | dontCheckValiditycxx . . $ qGoBoard#dontCheckValidity. = false; |
| 65 | if (!validMove) |
| 66 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 67 | |
| 68 | Movecxx . . $ Move# *result = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->makeMovecxx . . $ Move#makeMove(b73c42e1a544db20).(c,x,y,true); |
| 69 | treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(result); |
| 70 | treecxx . . $ qGoBoard#tree.->lastMoveInMainBranchcxx . . $ Tree#lastMoveInMainBranch. = result; |
| 71 | setModifiedcxx . . $ qGoBoard#setModified(b45ddcbc8423892c).(true); |
| 72 | |
| 73 | |
| 74 | /* Not a great place for this, but maybe okay: */ |
| 75 | TimeRecordcxx . . $ TimeRecord# t = boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->getTimeRecordcxx . . $ ClockDisplay#getTimeRecord(1da1f30878cd15cd).(!getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).()); |
| 76 | if(t.timecxx . . $ TimeRecord#time. != 0 || t.stones_periodscxx . . $ TimeRecord#stones_periods. != -1) |
| 77 | { |
| 78 | result->setTimeinfocxx . . $ Move#setTimeinfo(b45ddcbc8423892c).(true); |
| 79 | result->setTimeLeftcxx . . $ Move#setTimeLeft(9364e6e7bff7660).(t.timecxx . . $ TimeRecord#time.); |
| 80 | result->setOpenMovescxx . . $ Move#setOpenMoves(d4f767463ce0a6b3).(t.stones_periodscxx . . $ TimeRecord#stones_periods.); |
| 81 | } |
| 82 | |
| 83 | /* Non trivial here. We don't want to play a sound as we get all |
| 84 | * the moves from an observed game. But there's no clean way |
| 85 | * to tell when the board has stopped loading, particularly for IGS. |
| 86 | * so we only play a sound every 250 msecs... |
| 87 | * Also, maybe it should play even if we aren't looking at last move, yeah not sure on that FIXME */ |
| 88 | if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseOngoingcxx . . $ phaseOngoing. && playSoundcxx . . $ qGoBoard#playSound.) |
| 89 | { |
| 90 | clickSoundcxx . . $ qGoBoard#clickSound.->playcxx . . $ Sound#play(49f6e7a06ebc5aa8).(); |
| 91 | } |
| 92 | |
| 93 | return result; |
| 94 | } |
| 95 | |
| 96 | |
| 97 | void qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#::sendMoveToInterfacecxx . . $ qGoBoardNetworkInterface#sendMoveToInterface(e6b2860cd25699f2).(StoneColorcxx . . $ StoneColor# c, int x, int y) |
| 98 | { |
| 99 | if(controlling_playercxx . . $ qGoBoardNetworkInterface#controlling_player. !=cxx . . $ `operator!=`(5bc2975d2d751687). QStringcxx . . $ QString#QString(ced63f7c635d850d).() && controlling_playercxx . . $ qGoBoardNetworkInterface#controlling_player. !=cxx . . $ `operator!=`(5bc2975d2d751687). dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getUsernamecxx . . $ BoardDispatch#getUsername(4365c3963150523e).()) |
| 100 | return; |
| 101 | if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGameDatacxx . . $ BoardWindow#getGameData(f917540193955ea7).()->nigiriToBeSettledcxx . . $ GameData#nigiriToBeSettled.) |
| 102 | { |
| 103 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Nigiri unsettled"); |
| 104 | //return; |
| 105 | } |
| 106 | if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseScorecxx . . $ phaseScore. && !dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->canMarkStonesDeadinScorecxx . . $ BoardDispatch#canMarkStonesDeadinScore(c9857a73d68e59ba).()) |
| 107 | return; |
| 108 | if(dontsendcxx . . $ qGoBoardNetworkInterface#dontsend.) |
| 109 | return; |
| 110 | // to prevent double clicking and upsetting servers... |
| 111 | dontsendcxx . . $ qGoBoardNetworkInterface#dontsend. = true; |
| 112 | if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseScorecxx . . $ phaseScore.) |
| 113 | { |
| 114 | /* A little awkward... FIXME, why is there no getMyColor() |
| 115 | * function ?!?! */ |
| 116 | //also "c" refers most likely to player color, not the stone clicked on |
| 117 | if(((treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x, y) == stoneBlackcxx . . $ stoneBlack. && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsWhitecxx . . $ BoardWindow#getMyColorIsWhite(c9857a73d68e59ba).()) || |
| 118 | (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x, y) == stoneWhitecxx . . $ stoneWhite. && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsBlackcxx . . $ BoardWindow#getMyColorIsBlack(c9857a73d68e59ba).())) |
| 119 | && connectioncxx . . $ qGoBoardNetworkInterface#connection.->cantMarkOppStonesDeadcxx . . $ NetworkConnection#cantMarkOppStonesDead(c9857a73d68e59ba).()) |
| 120 | { |
| 121 | dontsendcxx . . $ qGoBoardNetworkInterface#dontsend. = false; //ready to send again |
| 122 | return; |
| 123 | } |
| 124 | MoveRecordcxx . . $ MoveRecord# * m = new MoveRecordcxx . . $ MoveRecord#MoveRecord(49f6e7a06ebc5aa8).(); |
| 125 | if(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->isStoneDeadcxx . . $ Matrix#isStoneDead(cf9ef193275fa6d8).(x, y)) |
| 126 | { |
| 127 | if(connectioncxx . . $ qGoBoardNetworkInterface#connection.->unmarkUnmarksAllDeadStonescxx . . $ NetworkConnection#unmarkUnmarksAllDeadStones(c9857a73d68e59ba).()) |
| 128 | { |
| 129 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow.,trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Unmark All?"), |
| 130 | QStringcxx . . $ QString#(trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Unmark all your dead stones?\n"))) |
| 131 | == QMessageBoxcxx . . $ QMessageBox#::Nocxx . . $ QMessageBox#No.) |
| 132 | { |
| 133 | dontsendcxx . . $ qGoBoardNetworkInterface#dontsend. = false; //ready to send again |
| 134 | delete m; |
| 135 | return; |
| 136 | } |
| 137 | } |
| 138 | m->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::UNREMOVEcxx . . $ MoveRecord#UNREMOVE.; |
| 139 | } |
| 140 | else |
| 141 | m->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::REMOVEcxx . . $ MoveRecord#REMOVE.; |
| 142 | m->xcxx . . $ MoveRecord#x. = x; |
| 143 | m->ycxx . . $ MoveRecord#y. = y; |
| 144 | //move number shouldn't matter |
| 145 | m->colorcxx . . $ MoveRecord#color. = c; |
| 146 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendMovecxx . . $ BoardDispatch#sendMove(d174a3d9cfb0dd75).(m); |
| 147 | delete m; |
| 148 | return; |
| 149 | } |
| 150 | else |
| 151 | { |
| 152 | /* Check validity of move before sending */ |
| 153 | if(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->checkMoveIsValidcxx . . $ Move#checkMoveIsValid(d30022d4f7f7716f).(c, x, y)) |
| 154 | dontCheckValiditycxx . . $ qGoBoard#dontCheckValidity. = true; |
| 155 | else |
| 156 | { |
| 157 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Invalid Move"), trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Move %1 %2 is invalid").argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(x), QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(y))); |
| 158 | dontsendcxx . . $ qGoBoardNetworkInterface#dontsend. = false; //okay to send again |
| 159 | return; |
| 160 | } |
| 161 | /* Rerack time before sending our move */ |
| 162 | boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->makeMovecxx . . $ ClockDisplay#makeMove(b45ddcbc8423892c).(getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).()); |
| 163 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendMovecxx . . $ BoardDispatch#sendMove(d174a3d9cfb0dd75).(new MoveRecordcxx . . $ MoveRecord#MoveRecord(7031fb2d6587000a).( |
| 164 | treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).(), x, y, c)); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | void qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#::handleMovecxx . . $ qGoBoardNetworkInterface#handleMove(d174a3d9cfb0dd75).(MoveRecordcxx . . $ MoveRecord# * m) |
| 169 | { |
| 170 | Movecxx . . $ Move# * const remember = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).(); |
| 171 | Movecxx . . $ Move# * last = treecxx . . $ qGoBoard#tree.->findLastMoveInMainBranchcxx . . $ Tree#findLastMoveInMainBranch(81447a345d48a217).(); |
| 172 | // This handles territory marks provided by the server. |
| 173 | /* Separate handling is needed because we want to |
| 174 | * avoid GUI updates until the full information is available. |
| 175 | * The remaining part of the function should in principle also be rewritten in such a way that |
| 176 | * GUI updates are only made when needed. */ |
| 177 | if (m->flagscxx . . $ MoveRecord#flags. == MoveRecordcxx . . $ MoveRecord#::TERRITORYcxx . . $ MoveRecord#TERRITORY.) |
| 178 | { |
| 179 | last->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->insertMarkcxx . . $ Matrix#insertMark(2fb52c50f1893bf2).(m->xcxx . . $ MoveRecord#x.,m->ycxx . . $ MoveRecord#y.,m->colorcxx . . $ MoveRecord#color. == stoneBlackcxx . . $ stoneBlack. ? markTerrBlackcxx . . $ markTerrBlack. : markTerrWhitecxx . . $ markTerrWhite.); |
| 180 | return; |
| 181 | } else if (m->flagscxx . . $ MoveRecord#flags. == MoveRecordcxx . . $ MoveRecord#::DONE_SCORINGcxx . . $ MoveRecord#DONE_SCORING.) |
| 182 | { |
| 183 | treecxx . . $ qGoBoard#tree.->countMarkedcxx . . $ Tree#countMarked(490cd2a4f5caa810).(last); |
| 184 | boardwindowcxx . . $ qGoBoard#boardwindow.->updateMovecxx . . $ BoardWindow#updateMove(490cd2a4f5caa810).(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()); // Updates GUI |
| 185 | return; |
| 186 | } |
| 187 | |
| 188 | int move_number, move_counter; |
| 189 | Movecxx . . $ Move# * goto_move; |
| 190 | //static bool offset_1 = false; |
| 191 | int i; |
| 192 | |
| 193 | dontsendcxx . . $ qGoBoardNetworkInterface#dontsend. = false; //clear the dontsend bit |
| 194 | |
| 195 | /* In case we join in score phase */ |
| 196 | if(m->flagscxx . . $ MoveRecord#flags. == MoveRecordcxx . . $ MoveRecord#::NONEcxx . . $ MoveRecord#NONE. && boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseScorecxx . . $ phaseScore.) |
| 197 | m->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::REMOVEcxx . . $ MoveRecord#REMOVE.; |
| 198 | |
| 199 | if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGameDatacxx . . $ BoardWindow#getGameData(f917540193955ea7).()->gameModecxx . . $ GameData#gameMode. == modeReviewcxx . . $ modeReview.) |
| 200 | { |
| 201 | if(!reviewCurrentcxx . . $ qGoBoardNetworkInterface#reviewCurrent.) |
| 202 | reviewCurrentcxx . . $ qGoBoardNetworkInterface#reviewCurrent. = last; |
| 203 | } |
| 204 | treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(last); |
| 205 | |
| 206 | move_number = m->numbercxx . . $ MoveRecord#number.; |
| 207 | //bool hcp_move = tree->getCurrent()->isHandicapMove(); |
| 208 | move_counter = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).(); |
| 209 | if(move_number == NOMOVENUMBERcxx . . $ `src/network/messages.h:51:9`!) //not all services number |
| 210 | move_number = move_counter + 1; //since we add one to move counter later |
| 211 | |
| 212 | //qDebug("MN: %d MC: %d", move_number, move_counter); |
| 213 | |
| 214 | move_counter++; |
| 215 | |
| 216 | switch(m->flagscxx . . $ MoveRecord#flags.) |
| 217 | { |
| 218 | case MoveRecordcxx . . $ MoveRecord#::UNDO_TERRITORYcxx . . $ MoveRecord#UNDO_TERRITORY.: |
| 219 | { |
| 220 | int boardsize = last->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getSizecxx . . $ Matrix#getSize(455f465bc33b4cdf).(); |
| 221 | for(int i = 1; i <= boardsize; i++) |
| 222 | { |
| 223 | for(int j = 1; j <= boardsize; j++) |
| 224 | { |
| 225 | if(last->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->isStoneDeadcxx . . $ Matrix#isStoneDead(cf9ef193275fa6d8).(i, j)) |
| 226 | markLiveStonecxx . . $ qGoBoard#markLiveStone(3e454b8ccf442868).(i, j); |
| 227 | } |
| 228 | } |
| 229 | break; |
| 230 | } |
| 231 | case MoveRecordcxx . . $ MoveRecord#::REQUESTUNDOcxx . . $ MoveRecord#REQUESTUNDO.: |
| 232 | { |
| 233 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Got undo message in network interface!!\n"); |
| 234 | //move_number = mv_counter - 1; |
| 235 | QStringcxx . . $ QString# opp = dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).(); |
| 236 | UndoPromptcxx . . $ UndoPrompt# * up = new UndoPromptcxx . . $ UndoPrompt#(&opp, |
| 237 | connectioncxx . . $ qGoBoardNetworkInterface#connection.->supportsMultipleUndocxx . . $ NetworkConnection#supportsMultipleUndo(c9857a73d68e59ba).(), |
| 238 | m->numbercxx . . $ MoveRecord#number.); |
| 239 | |
| 240 | int up_return = up->execcxx . . $ QDialog#exec(b126dc7c1de90089).(); |
| 241 | if (up_return != -1) |
| 242 | { |
| 243 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendMovecxx . . $ BoardDispatch#sendMove(d174a3d9cfb0dd75).(new MoveRecordcxx . . $ MoveRecord#MoveRecord(fef2be7f4dcde0db).(m->numbercxx . . $ MoveRecord#number., MoveRecordcxx . . $ MoveRecord#::UNDOcxx . . $ MoveRecord#UNDO.)); |
| 244 | } |
| 245 | else |
| 246 | { |
| 247 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendMovecxx . . $ BoardDispatch#sendMove(d174a3d9cfb0dd75).(new MoveRecordcxx . . $ MoveRecord#MoveRecord(fef2be7f4dcde0db).(m->numbercxx . . $ MoveRecord#number., MoveRecordcxx . . $ MoveRecord#::REFUSEUNDOcxx . . $ MoveRecord#REFUSEUNDO.)); |
| 248 | } |
| 249 | } |
| 250 | break; |
| 251 | case MoveRecordcxx . . $ MoveRecord#::UNDOcxx . . $ MoveRecord#UNDO.: |
| 252 | { |
| 253 | /* Are we supposed to make a brother node or something ??? FIXME |
| 254 | * qgoboard.cpp also does this.*/ |
| 255 | if(connectioncxx . . $ qGoBoardNetworkInterface#connection.->supportsMultipleUndocxx . . $ NetworkConnection#supportsMultipleUndo(c9857a73d68e59ba).()) |
| 256 | { |
| 257 | while(move_counter > move_number + 1) //move_numbe r+ 1 if our turn? |
| 258 | { |
| 259 | treecxx . . $ qGoBoard#tree.->deleteNodecxx . . $ Tree#deleteNode(49f6e7a06ebc5aa8).(); |
| 260 | move_counter--; |
| 261 | } |
| 262 | } |
| 263 | else |
| 264 | { |
| 265 | treecxx . . $ qGoBoard#tree.->deleteNodecxx . . $ Tree#deleteNode(49f6e7a06ebc5aa8).(); |
| 266 | if ((getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() && m->colorcxx . . $ MoveRecord#color. == stoneBlackcxx . . $ stoneBlack.) || |
| 267 | ((!getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).()) && m->colorcxx . . $ MoveRecord#color. == stoneWhitecxx . . $ stoneWhite.)) |
| 268 | { |
| 269 | treecxx . . $ qGoBoard#tree.->deleteNodecxx . . $ Tree#deleteNode(49f6e7a06ebc5aa8).(); |
| 270 | } |
| 271 | } |
| 272 | /* I've turned off multiple undo for tygem, just for now... |
| 273 | * since NOMOVENUMBER FIXME, actually I'm not sure if tygem |
| 274 | * has a normal multiple undo, though it might for review games */ |
| 275 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Undoing move %d = %d - 1", move_number, move_counter); |
| 276 | /* FIXME This can get screwy especially around the scoreMode |
| 277 | * stuff.... apparently we can only undo our own passes |
| 278 | * unlike other WING moves and it only takes 2 undos, not |
| 279 | * 3... as if the first undo just gets you out of the |
| 280 | * score place. */ |
| 281 | if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseScorecxx . . $ phaseScore.) |
| 282 | { |
| 283 | /* Not sure if this is always true, but it appears |
| 284 | * that the last pass doesn't count as a move or |
| 285 | * something, meaning that we should delete twice |
| 286 | * for it. This is going to be a problem later |
| 287 | * FIXME FIXME FIXME*/ |
| 288 | /* IGS does not leave score mode, ever !!! |
| 289 | * nor should anything else do to what scoremode |
| 290 | * does. Simply clears some of the dead marks*/ |
| 291 | /* Actually, I'm not sure, its possible that the |
| 292 | * glGo client we've been using to test this |
| 293 | * doesn't handle undo from score very well. I've |
| 294 | * seen some bugs in it before. */ |
| 295 | treecxx . . $ qGoBoard#tree.->deleteNodecxx . . $ Tree#deleteNode(49f6e7a06ebc5aa8).(); |
| 296 | leaveScoreModecxx . . $ qGoBoard#leaveScoreMode(49f6e7a06ebc5aa8).(); |
| 297 | } |
| 298 | } |
| 299 | break; |
| 300 | case MoveRecordcxx . . $ MoveRecord#::PASScxx . . $ MoveRecord#PASS.: |
| 301 | /* FIXME what about a kibitz here saying opponent name |
| 302 | * has passed. I think IGS needs it, not sure about |
| 303 | * other protocols which may have it, but if they do, |
| 304 | * it should be moved here. Otherwise easy to miss. */ |
| 305 | /* If there's three passes, we should stop the clock, |
| 306 | * although some servers might have two pass models |
| 307 | * and we need a flag for that */ |
| 308 | //if(!boardwindow->getMyColorIsBlack()) //if we're white |
| 309 | if(!connectioncxx . . $ qGoBoardNetworkInterface#connection.->netWillEnterScoreModecxx . . $ NetworkConnection#netWillEnterScoreMode(c9857a73d68e59ba).()) //ugly for oro FIXME |
| 310 | { |
| 311 | if(connectioncxx . . $ qGoBoardNetworkInterface#connection.->twoPassesEndsGamecxx . . $ NetworkConnection#twoPassesEndsGame(c9857a73d68e59ba).()) |
| 312 | { |
| 313 | if(last->isPassMovecxx . . $ Move#isPassMove(c9857a73d68e59ba).()) |
| 314 | enterScoreModecxx . . $ qGoBoard#enterScoreMode(49f6e7a06ebc5aa8).(); |
| 315 | } |
| 316 | else |
| 317 | { |
| 318 | if(last->parentcxx . . $ Move#parent. && |
| 319 | last->isPassMovecxx . . $ Move#isPassMove(c9857a73d68e59ba).() && |
| 320 | last->parentcxx . . $ Move#parent.->isPassMovecxx . . $ Move#isPassMove(c9857a73d68e59ba).()) |
| 321 | enterScoreModecxx . . $ qGoBoard#enterScoreMode(49f6e7a06ebc5aa8).(); |
| 322 | //boardwindow->setGamePhase ( phaseScore ); //okay? |
| 323 | } |
| 324 | } |
| 325 | //FIXME potentially white/black here should come from color from network which is unreliable now |
| 326 | kibitzReceivedcxx . . $ qGoBoard#kibitzReceived(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).(getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() ? "Black" : "White") +cxx . . $ operator+(3d22f08efddf8107). " passes."); |
| 327 | doPasscxx . . $ qGoBoard#doPass(42096433316d3db3).(); |
| 328 | break; |
| 329 | case MoveRecordcxx . . $ MoveRecord#::HANDICAPcxx . . $ MoveRecord#HANDICAP.: |
| 330 | setHandicapcxx . . $ qGoBoard#setHandicap(d4f767463ce0a6b3).(m->xcxx . . $ MoveRecord#x.); |
| 331 | break; |
| 332 | case MoveRecordcxx . . $ MoveRecord#::REMOVEcxx . . $ MoveRecord#REMOVE.: |
| 333 | //qDebug("md!! toggling life of %d %d", m->x, m->y); |
| 334 | markDeadStonecxx . . $ qGoBoard#markDeadStone(3e454b8ccf442868).(m->xcxx . . $ MoveRecord#x., m->ycxx . . $ MoveRecord#y.); |
| 335 | //tree->getCurrent()->getMatrix()->toggleGroupAt(m->x, m->y); |
| 336 | //boardwindow->qgoboard->kibitzReceived("removing @ " + pt); |
| 337 | break; |
| 338 | case MoveRecordcxx . . $ MoveRecord#::REMOVE_AREAcxx . . $ MoveRecord#REMOVE_AREA.: |
| 339 | //FIXME |
| 340 | markDeadAreacxx . . $ qGoBoard#markDeadArea(3e454b8ccf442868).(m->xcxx . . $ MoveRecord#x., m->ycxx . . $ MoveRecord#y.); |
| 341 | break; |
| 342 | case MoveRecordcxx . . $ MoveRecord#::UNREMOVE_AREAcxx . . $ MoveRecord#UNREMOVE_AREA.: |
| 343 | //FIXME |
| 344 | if(connectioncxx . . $ qGoBoardNetworkInterface#connection.->unmarkUnmarksAllDeadStonescxx . . $ NetworkConnection#unmarkUnmarksAllDeadStones(c9857a73d68e59ba).()) |
| 345 | { |
| 346 | /* Not sure where we get the dead groups from, FIXME |
| 347 | * okay, really, we should have a list of dead groups |
| 348 | * for each player that can be checked on here. |
| 349 | * The thing is, ORO also has such a list that it tracks |
| 350 | * and I don't want duplication of that code but right |
| 351 | * now I have other things on my mind and I just want to |
| 352 | * get this done, so I'm going to do something really |
| 353 | * quick, dirty, and awkward here and I'll fix it in |
| 354 | * a later version... ignoring the stitch in time |
| 355 | * thing. So cut this out soon. Note also that it |
| 356 | * might make sense to have an evaluation function |
| 357 | * in the board code, to do something to every |
| 358 | * stone of a type... maybe not.*/ |
| 359 | int boardsize = last->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getSizecxx . . $ Matrix#getSize(455f465bc33b4cdf).(); |
| 360 | for(int i = 1; i <= boardsize; i++) |
| 361 | { |
| 362 | for(int j = 1; j <= boardsize; j++) |
| 363 | { |
| 364 | if(last->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->isStoneDeadcxx . . $ Matrix#isStoneDead(cf9ef193275fa6d8).(i, j)) |
| 365 | { |
| 366 | if(last->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(i, j) == m->colorcxx . . $ MoveRecord#color.) |
| 367 | { |
| 368 | markLiveAreacxx . . $ qGoBoard#markLiveArea(3e454b8ccf442868).(i, j); |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | } |
| 375 | else |
| 376 | markLiveAreacxx . . $ qGoBoard#markLiveArea(3e454b8ccf442868).(m->xcxx . . $ MoveRecord#x., m->ycxx . . $ MoveRecord#y.); |
| 377 | break; |
| 378 | case MoveRecordcxx . . $ MoveRecord#::REFUSEUNDOcxx . . $ MoveRecord#REFUSEUNDO.: |
| 379 | //handled by protocol as a recvKibitz for whatever reason |
| 380 | break; |
| 381 | case MoveRecordcxx . . $ MoveRecord#::FORWARDcxx . . $ MoveRecord#FORWARD.: |
| 382 | if(!dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getReviewInVariationcxx . . $ BoardDispatch#getReviewInVariation(c9857a73d68e59ba).() && last->isInMainBranchcxx . . $ Move#isInMainBranch(50ce9a9e25b4a850).()) |
| 383 | { |
| 384 | /* In case it was in a variation previously to remove the marker. |
| 385 | * this should be elsewhere like on the setReviewInVariation(); FIXME */ |
| 386 | last->markercxx . . $ Move#marker. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 387 | } |
| 388 | for(i = 0; i < move_number; i++) |
| 389 | { |
| 390 | /*if(dispatch->getReviewInVariation() && tree->isInMainBranch(tree->getCurrent())) |
| 391 | { |
| 392 | boardwindow->getBoardHandler()->gotoMove(inVariationBranch); |
| 393 | } |
| 394 | else*/ |
| 395 | treecxx . . $ qGoBoard#tree.->slotNavForwardcxx . . $ Tree#slotNavForward(49f6e7a06ebc5aa8).(); |
| 396 | } |
| 397 | break; |
| 398 | case MoveRecordcxx . . $ MoveRecord#::BACKWARDcxx . . $ MoveRecord#BACKWARD.: |
| 399 | for(i = 0; i < move_number; i++) |
| 400 | { |
| 401 | if(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getReviewInVariationcxx . . $ BoardDispatch#getReviewInVariation(c9857a73d68e59ba).() && last && last->isInMainBranchcxx . . $ Move#isInMainBranch(50ce9a9e25b4a850).()) |
| 402 | break; |
| 403 | treecxx . . $ qGoBoard#tree.->slotNavBackwardcxx . . $ Tree#slotNavBackward(49f6e7a06ebc5aa8).(); |
| 404 | } |
| 405 | break; |
| 406 | case MoveRecordcxx . . $ MoveRecord#::RESETBRANCHcxx . . $ MoveRecord#RESETBRANCH.: |
| 407 | case MoveRecordcxx . . $ MoveRecord#::DELETEBRANCHcxx . . $ MoveRecord#DELETEBRANCH.: |
| 408 | goto_move = last; |
| 409 | if(goto_move->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).() > lastMoveInGamecxx . . $ qGoBoard#lastMoveInGame.->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).()) |
| 410 | goto_move = lastMoveInGamecxx . . $ qGoBoard#lastMoveInGame.; |
| 411 | else |
| 412 | { |
| 413 | while(!(goto_move->isInMainBranchcxx . . $ Move#isInMainBranch(50ce9a9e25b4a850).())) |
| 414 | goto_move = goto_move->parentcxx . . $ Move#parent.; |
| 415 | } |
| 416 | treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(goto_move); |
| 417 | if(m->flagscxx . . $ MoveRecord#flags. == MoveRecordcxx . . $ MoveRecord#::DELETEBRANCHcxx . . $ MoveRecord#DELETEBRANCH.) {} |
| 418 | |
| 419 | break; |
| 420 | case MoveRecordcxx . . $ MoveRecord#::RESETGAMEcxx . . $ MoveRecord#RESETGAME.: |
| 421 | goto_move = treecxx . . $ qGoBoard#tree.->getRootcxx . . $ Tree#getRoot(8db4894deadf6b2c).(); |
| 422 | treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(goto_move); |
| 423 | break; |
| 424 | case MoveRecordcxx . . $ MoveRecord#::TOENDcxx . . $ MoveRecord#TOEND.: |
| 425 | if(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getReviewInVariationcxx . . $ BoardDispatch#getReviewInVariation(c9857a73d68e59ba).()) |
| 426 | goto_move = treecxx . . $ qGoBoard#tree.->findLastMoveInCurrentBranchcxx . . $ Tree#findLastMoveInCurrentBranch(81447a345d48a217).(); |
| 427 | else |
| 428 | goto_move = lastMoveInGamecxx . . $ qGoBoard#lastMoveInGame.; |
| 429 | treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(goto_move); |
| 430 | break; |
| 431 | case MoveRecordcxx . . $ MoveRecord#::SETMOVEcxx . . $ MoveRecord#SETMOVE.: |
| 432 | /* Might later want to record this |
| 433 | * also we should have already set the game to the last move and disabled nav*/ |
| 434 | goto_move = treecxx . . $ qGoBoard#tree.->findNodecxx . . $ Tree#findNode(602c32861683a004).(treecxx . . $ qGoBoard#tree.->getRootcxx . . $ Tree#getRoot(8db4894deadf6b2c).(), m->numbercxx . . $ MoveRecord#number.); |
| 435 | |
| 436 | if (goto_move) |
| 437 | treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(goto_move); |
| 438 | else |
| 439 | { |
| 440 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Invalid Move"), trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Cannot set move to move number %1").argcxx . . $ QString#arg(173a29139b43af1f).(m->numbercxx . . $ MoveRecord#number.)); |
| 441 | } |
| 442 | break; |
| 443 | default: |
| 444 | case MoveRecordcxx . . $ MoveRecord#::NONEcxx . . $ MoveRecord#NONE.: |
| 445 | |
| 446 | if(move_number == move_counter) |
| 447 | { |
| 448 | /* FIXME Can we guess at the color here ? */ |
| 449 | if(m->colorcxx . . $ MoveRecord#color. == stoneNonecxx . . $ stoneNone.) |
| 450 | m->colorcxx . . $ MoveRecord#color. = (getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() ? stoneBlackcxx . . $ stoneBlack. : stoneWhitecxx . . $ stoneWhite.); |
| 451 | if (doMovecxx . . $ qGoBoardNetworkInterface#doMove(1b9ccd6dde28afc7).(m->colorcxx . . $ MoveRecord#color., m->xcxx . . $ MoveRecord#x., m->ycxx . . $ MoveRecord#y.) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 452 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Invalid Move"), trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("The incoming move %1 %2 seems to be invalid").argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(m->xcxx . . $ MoveRecord#x.), QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(m->ycxx . . $ MoveRecord#y.))); |
| 453 | else if(m->colorcxx . . $ MoveRecord#color. == stoneWhitecxx . . $ stoneWhite. && !boardTimerIdcxx . . $ qGoBoard#boardTimerId.) //awkward ? FIXME for always move 1? |
| 454 | { |
| 455 | onFirstMovecxx . . $ qGoBoardNetworkInterface#onFirstMove(49f6e7a06ebc5aa8).(); |
| 456 | } |
| 457 | } |
| 458 | else if(move_number < move_counter) |
| 459 | { |
| 460 | /* FIXME, this prevents the next if statement |
| 461 | * partly, this whole thing is screwy */ |
| 462 | /* IGS, certain games have this remove a legit first |
| 463 | * move */ |
| 464 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Repeat move after undo?? %d %d", move_number, move_counter); |
| 465 | } |
| 466 | /* This is for resetting the stones for canadian |
| 467 | * timesystems, its awkward for it to be here... but |
| 468 | * I guess I'm getting lazy. FIXME */ |
| 469 | /* I don't think this matters for ORO because time |
| 470 | * comes in right after move. It might matter for IGS */ |
| 471 | /* For stones, this should be called before the move is sent or here |
| 472 | * but with getBlackTurn() negated. Otherwise, its like our move |
| 473 | * gets decremented possibly when they play. It looks weird... double |
| 474 | * check with other time style though. */ |
| 475 | boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->rerackTimecxx . . $ ClockDisplay#rerackTime(b45ddcbc8423892c).(getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).()); |
| 476 | break; |
| 477 | } |
| 478 | |
| 479 | if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGameDatacxx . . $ BoardWindow#getGameData(f917540193955ea7).()->gameModecxx . . $ GameData#gameMode. == modeReviewcxx . . $ modeReview.) //for now review mode means no navigation, see interfacehandler comment |
| 480 | reviewCurrentcxx . . $ qGoBoardNetworkInterface#reviewCurrent. = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).(); |
| 481 | else |
| 482 | { |
| 483 | if (remember != last) |
| 484 | { |
| 485 | treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(remember); |
| 486 | } |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | void qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#::passRequestcxx . . $ qGoBoardNetworkInterface#passRequest(49f6e7a06ebc5aa8).() |
| 491 | { |
| 492 | /* doPass is called when we receive the move from the server, |
| 493 | * as with moves */ |
| 494 | /* FIXME, we need to make sure the move is valid before we send it!!!!! |
| 495 | * but without playing it since we get that from server. */ |
| 496 | if((getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() && !(boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsBlackcxx . . $ BoardWindow#getMyColorIsBlack(c9857a73d68e59ba).())) || |
| 497 | (!getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() && !(boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsWhitecxx . . $ BoardWindow#getMyColorIsWhite(c9857a73d68e59ba).()))) |
| 498 | { |
| 499 | return; // It is not our move |
| 500 | } |
| 501 | |
| 502 | /* Rerack time before sending our move |
| 503 | * Is this okay here? Do we need to rerack for passes or what ? FIXME*/ |
| 504 | boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->makeMovecxx . . $ ClockDisplay#makeMove(b45ddcbc8423892c).(getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).()); |
| 505 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendMovecxx . . $ BoardDispatch#sendMove(d174a3d9cfb0dd75).(new MoveRecordcxx . . $ MoveRecord#MoveRecord(fef2be7f4dcde0db).(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).(), MoveRecordcxx . . $ MoveRecord#::PASScxx . . $ MoveRecord#PASS.)); |
| 506 | } |
| 507 | |
| 508 | void qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#::slotUndoPressedcxx . . $ qGoBoardNetworkInterface#slotUndoPressed(49f6e7a06ebc5aa8).() |
| 509 | { |
| 510 | if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseScorecxx . . $ phaseScore.) |
| 511 | { |
| 512 | if(connectioncxx . . $ qGoBoardNetworkInterface#connection.->supportsRequestMatchModecxx . . $ NetworkConnection#supportsRequestMatchMode(c9857a73d68e59ba).()) |
| 513 | { |
| 514 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(a9e3742e6f7b4147).(0,trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Return to game?"), |
| 515 | QStringcxx . . $ QString#(trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Ask opponent to return to game?\n"))) |
| 516 | == QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.) |
| 517 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendRequestMatchModecxx . . $ BoardDispatch#sendRequestMatchMode(49f6e7a06ebc5aa8).(); |
| 518 | return; |
| 519 | } |
| 520 | else if(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->undoResetsScorecxx . . $ BoardDispatch#undoResetsScore(c9857a73d68e59ba).()) |
| 521 | { |
| 522 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendMovecxx . . $ BoardDispatch#sendMove(d174a3d9cfb0dd75).(new MoveRecordcxx . . $ MoveRecord#MoveRecord(fef2be7f4dcde0db).(-1, MoveRecordcxx . . $ MoveRecord#::UNDOcxx . . $ MoveRecord#UNDO.)); |
| 523 | return; |
| 524 | } |
| 525 | } |
| 526 | int moves = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).(); |
| 527 | //if its our turn - 2? |
| 528 | if ((getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsBlackcxx . . $ BoardWindow#getMyColorIsBlack(c9857a73d68e59ba).()) || |
| 529 | ((!getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).()) && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsWhitecxx . . $ BoardWindow#getMyColorIsWhite(c9857a73d68e59ba).())) |
| 530 | moves -= 2; |
| 531 | else |
| 532 | moves--; |
| 533 | // might want to prompt anyway FIXME ? |
| 534 | if(connectioncxx . . $ qGoBoardNetworkInterface#connection.->supportsMultipleUndocxx . . $ NetworkConnection#supportsMultipleUndo(c9857a73d68e59ba).()) |
| 535 | { |
| 536 | UndoPromptcxx . . $ UndoPrompt# * up = new UndoPromptcxx . . $ UndoPrompt#(0, true, moves); |
| 537 | int up_return = up->execcxx . . $ QDialog#exec(b126dc7c1de90089).(); |
| 538 | if(up_return == -1) |
| 539 | return; |
| 540 | else |
| 541 | moves = up_return; |
| 542 | } |
| 543 | |
| 544 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendMovecxx . . $ BoardDispatch#sendMove(d174a3d9cfb0dd75).(new MoveRecordcxx . . $ MoveRecord#MoveRecord(fef2be7f4dcde0db).(moves, MoveRecordcxx . . $ MoveRecord#::REQUESTUNDOcxx . . $ MoveRecord#REQUESTUNDO.)); |
| 545 | } |
| 546 | /* Note that these all crash if we disconnect from server first, but server should handle that anyway FIXME */ |
| 547 | |
| 548 | /* Really the ui button disables should be on some gamePhase code FIXME */ |
| 549 | void qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#::slotDonePressedcxx . . $ qGoBoardNetworkInterface#slotDonePressed(49f6e7a06ebc5aa8).() |
| 550 | { |
| 551 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendMovecxx . . $ BoardDispatch#sendMove(d174a3d9cfb0dd75).(new MoveRecordcxx . . $ MoveRecord#MoveRecord(77cfb45eb7fd8341).(MoveRecordcxx . . $ MoveRecord#::DONE_SCORINGcxx . . $ MoveRecord#DONE_SCORING.)); |
| 552 | boardwindowcxx . . $ qGoBoard#boardwindow.->setDoneEnabledcxx . . $ BoardWindow#setDoneEnabled(b45ddcbc8423892c).(false); //FIXME okay? don't want to send done twice |
| 553 | } |
| 554 | |
| 555 | void qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#::slotResignPressedcxx . . $ qGoBoardNetworkInterface#slotResignPressed(49f6e7a06ebc5aa8).() |
| 556 | { |
| 557 | if(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).() ==cxx . . $ `operator==`(5bc2975d2d751687). QStringcxx . . $ QString#QString(ced63f7c635d850d).()) |
| 558 | { |
| 559 | boardwindowcxx . . $ qGoBoard#boardwindow.->getGameDatacxx . . $ BoardWindow#getGameData(f917540193955ea7).()->fullresultcxx . . $ GameData#fullresult. = new GameResultcxx . . $ GameResult#GameResult(49f6e7a06ebc5aa8).(); //temporary for bugs FIXME |
| 560 | return; |
| 561 | } |
| 562 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow.,trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Resign?"), |
| 563 | QStringcxx . . $ QString#(trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Resign game with %1\n")).argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())) |
| 564 | == QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.) |
| 565 | { |
| 566 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendMovecxx . . $ BoardDispatch#sendMove(d174a3d9cfb0dd75).(new MoveRecordcxx . . $ MoveRecord#MoveRecord(fef2be7f4dcde0db).(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).(), MoveRecordcxx . . $ MoveRecord#::RESIGNcxx . . $ MoveRecord#RESIGN.)); |
| 567 | boardwindowcxx . . $ qGoBoard#boardwindow.->setResignEnabledcxx . . $ BoardWindow#setResignEnabled(b45ddcbc8423892c).(false); //FIXME okay? don't want to send resign twice |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | void qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#::adjournGamecxx . . $ qGoBoardNetworkInterface#adjournGame(49f6e7a06ebc5aa8).(void) |
| 572 | { |
| 573 | QStringcxx . . $ QString# opp_name = dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).(); |
| 574 | boardwindowcxx . . $ qGoBoard#boardwindow.->setGamePhasecxx . . $ BoardWindow#setGamePhase(6ad67d8601499648).(phaseEndedcxx . . $ phaseEnded.); |
| 575 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("qgBNI::adjournGame"); |
| 576 | if(opp_name ==cxx . . $ `operator==`(5bc2975d2d751687). QStringcxx . . $ QString#QString(ced63f7c635d850d).()) |
| 577 | { |
| 578 | GameDatacxx . . $ GameData# * r = dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).(); |
| 579 | if(!r) |
| 580 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No game record on adjourned game"); |
| 581 | else |
| 582 | QMessageBoxcxx . . $ QMessageBox#::informationcxx . . $ QMessageBox#information(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow. , trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Game Adjourned"), trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("%1 vs. %2 has been adjourned.").argcxx . . $ QString#arg(bc823072288cbbb5).(r->white_namecxx . . $ GameData#white_name.).argcxx . . $ QString#arg(bc823072288cbbb5).(r->black_namecxx . . $ GameData#black_name.)); |
| 583 | |
| 584 | } |
| 585 | else |
| 586 | QMessageBoxcxx . . $ QMessageBox#::informationcxx . . $ QMessageBox#information(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow. , trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Game Adjourned"), trcxx . . $ qGoBoardNetworkInterface#tr(75d9f1c324b4579d).("Game with %1 has been adjourned.").argcxx . . $ QString#arg(bc823072288cbbb5).(opp_name)); |
| 587 | boardwindowcxx . . $ qGoBoard#boardwindow.->getGameDatacxx . . $ BoardWindow#getGameData(f917540193955ea7).()->fullresultcxx . . $ GameData#fullresult. = new GameResultcxx . . $ GameResult#GameResult(8260daab7d234241).(stoneNonecxx . . $ stoneNone., GameResultcxx . . $ GameResult#::ADJOURNEDcxx . . $ GameResult#ADJOURNED.); |
| 588 | boardwindowcxx . . $ qGoBoard#boardwindow.->setAdjournEnabledcxx . . $ BoardWindow#setAdjournEnabled(b45ddcbc8423892c).(false); //FIXME okay? don't want to send adjourn after adjourn |
| 589 | } |
| 590 | |
| 591 | /* Might look nicer if we just set the game phase to ended or |
| 592 | * something, I'll though we might just have lost connection so... */ |
| 593 | void qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#::stopTimecxx . . $ qGoBoardNetworkInterface#stopTime(49f6e7a06ebc5aa8).(void) |
| 594 | { |
| 595 | if(boardTimerIdcxx . . $ qGoBoard#boardTimerId.) |
| 596 | killTimercxx . . $ QObject#killTimer(d4f767463ce0a6b3).(boardTimerIdcxx . . $ qGoBoard#boardTimerId.); |
| 597 | } |