Debian Codegraph @

src/game_interfaces/qgoboard_review.cpp

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2006 by EB *
3 * *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21
22 #include "qgoboard_net.h"cxx . . $ `<file>/src/game_interfaces/qgoboard_net.h`/
23 #include "tree.h"cxx . . $ `<file>/src/game_tree/tree.h`/
24 #include "move.h"cxx . . $ `<file>/src/game_tree/move.h`/
25 #include "gamedata.h"cxx . . $ `<file>/src/gamedata.h`/
26 #include "boardwindow.h"cxx . . $ `<file>/src/board/boardwindow.h`/
27 #include "board.h"cxx . . $ `<file>/src/board/board.h`/
28
29 #include <QMessageBox>
30
31 qGoBoardReviewInterfacecxx . . $ qGoBoardReviewInterface#::qGoBoardReviewInterfacecxx . . $ qGoBoardReviewInterface#qGoBoardReviewInterface(29a441517101e16e).(BoardWindowcxx . . $ BoardWindow# *bw, Treecxx . . $ Tree# * t, GameDatacxx . . $ GameData# *gd) : qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#(bw, t, gd) //, QObject(bw)
32 {
33 game_Idcxx . . $ qGoBoardNetworkInterface#game_Id. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(gd->numbercxx . . $ GameData#number.);
34
35 boardwindowcxx . . $ qGoBoard#boardwindow.->clearDatacxx . . $ BoardWindow#clearData(49f6e7a06ebc5aa8).();
36
37 QSettingscxx . . $ QSettings# settingscxx . . $ QSettings#QSettings(749de1b6ae65bddd).;
38 // value 1 = no sound, 0 all games, 2 my games
39 playSoundcxx . . $ qGoBoard#playSound. = (settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("SOUND"cxx . . $ QString#QString(85c52e162fed56f9).) !=cxx . . $ QVariant#`operator!=`(d03696648ee9d662). 1cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).);
40
41 treecxx . . $ qGoBoard#tree.->slotNavFirstcxx . . $ Tree#slotNavFirst(49f6e7a06ebc5aa8).();
42 }
43
44
45 /*
46 * local move request to be sent to the server
47 */
48 void qGoBoardReviewInterfacecxx . . $ qGoBoardReviewInterface#::localMoveRequestcxx . . $ qGoBoardReviewInterface#localMoveRequest(e6b2860cd25699f2).(StoneColorcxx . . $ StoneColor# c, int x, int y)
49 {
50 // if (doMove(c,x,y))
51 // FIXME : this should be made in a better way : wait for the interface to acknowledge before adding the move to the tree
52 // {
53 // boardwindow->getBoardHandler()->updateMove(tree->getCurrent());
54 sendMoveToInterfacecxx . . $ qGoBoardNetworkInterface#sendMoveToInterface(e6b2860cd25699f2).(c,x,y);
55 // }
56
57 }
58
59 /* This is like a special set_move and should be more clear */
60 /*
61 * A node is incoming from the interface (server)
62 */
63 void qGoBoardReviewInterfacecxx . . $ qGoBoardReviewInterface#::setNodecxx . . $ qGoBoardReviewInterface#setNode(c8bda843d37178ce).(int node_nr, StoneColorcxx . . $ StoneColor# sc, int x, int y)
64 {
65 Movecxx . . $ Move# *m = treecxx . . $ qGoBoard#tree.->findNodecxx . . $ Tree#findNode(602c32861683a004).(treecxx . . $ qGoBoard#tree.->getRootcxx . . $ Tree#getRoot(8db4894deadf6b2c).(), node_nr);
66
67 if (m)
68 //node found, we go there
69 treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(m);
70 else
71 // no node found, we create one from the current move
72 {
73 if (doMovecxx . . $ qGoBoardNetworkInterface#doMove(1b9ccd6dde28afc7).(sc, x,y))
74 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->setNodeIndexcxx . . $ Move#setNodeIndex(d4f767463ce0a6b3).(node_nr);
75 else
76 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardReviewInterface#tr(75d9f1c324b4579d).("Invalid Move"), trcxx . . $ qGoBoardReviewInterface#tr(75d9f1c324b4579d).("The incoming move %1,%2 seems to be invalid").argcxx . . $ QString#arg(64ab2ed17cc11715).(x).argcxx . . $ QString#arg(64ab2ed17cc11715).(y));
77 }
78 }
79
80
81
82 #ifdef OLD
83 /*
84 * A move string is incoming from the interface (server)
85 * TODO : code duplicate : make sure we can't send this to qgoboard
86 */
87 void qGoBoardReviewInterface::set_move(StoneColor sc, QString pt, QString mv_nr)
88 {
89
90 }
91
92 /*
93 * sends a "pass" move to the server
94 */
95 void qGoBoardReviewInterface::sendPassToInterface(StoneColor /*c*/)
96 {
97 /* What really is this doing in the review interface ??? */
98 emit signal_sendCommandFromBoard("pass", false);
99 boardwindow->getBoardDispatch()->sendMove(new MoveRecord(MoveRecord::PASS));
100 }
101 #endif //OLD
102
103 /*
104 * sends a move to the server
105 */
106 #ifdef OLD
107 void qGoBoardReviewInterface::sendMoveToInterface(StoneColor c, int x, int y)
108 {
109
110 if (x > 8)
111 x++;
112
113 char c1 = x - 1 + 'A';
114 //int c2 = gd.size + 1 - y;
115 int c2 = boardwindow->getBoardSize() + 1 - y;
116
117 // if (ExtendedTeachingGame && IamPupil)
118 // emit signal_sendcommand("kibitz " + QString::number(id) + " " + QString(c1) + QString::number(c2), false);
119 QString id = "";
120
121 // if (gsName == IGS)
122 id = game_Id;
123 /* Where and why would we get the number here, is 0 okay for now ??? FIXME */
124
125 boardwindow->getBoardDispatch()->sendMove(new MoveRecord(0, x, y, c));
126
127 emit signal_sendCommandFromBoard(QString(c1) + QString::number(c2) + " " + id, false);
128
129
130
131 }
132 #endif //OLD
133
134 /*
135 * 'undo' button pressed
136 */
137 void qGoBoardReviewInterfacecxx . . $ qGoBoardReviewInterface#::slotUndoPressedcxx . . $ qGoBoardReviewInterface#slotUndoPressed(49f6e7a06ebc5aa8).()
138 {
139
140 }