| 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 | /*************************************************************************** |
| 24 | * |
| 25 | * This class is the most important |
| 26 | * It deals with distributing the move (and other commands) requests |
| 27 | * It is subclassed in the different proxies that can be used : local game, |
| 28 | * server game, and computer game |
| 29 | * Its the only class (apart from 'sgf parser') to modify the game tree |
| 30 | * |
| 31 | ***************************************************************************/ |
| 32 | |
| 33 | #ifndef QGOBOARD_H |
| 34 | #define QGOBOARD_Hcxx . . $ `src/game_interfaces/qgoboard.h:34:9`! |
| 35 | |
| 36 | #include "defines.h"cxx . . $ `<file>/src/defines.h`/ |
| 37 | |
| 38 | class BoardWindowcxx . . $ BoardWindow#; |
| 39 | class Treecxx . . $ Tree#; |
| 40 | class GameDatacxx . . $ GameData#; |
| 41 | class Movecxx . . $ Move#; |
| 42 | class QGtpcxx . . $ QGtp#; |
| 43 | class Soundcxx . . $ Sound#; |
| 44 | |
| 45 | /* I think its easier to have the computer and normal modes override a few functions to |
| 46 | * null then have review and match provide the same complicated net functionality */ |
| 47 | |
| 48 | |
| 49 | class qGoBoardcxx . . $ qGoBoard# : public QObjectcxx . . $ QObject# //, public Misc<QString> |
| 50 | { |
| 51 | Q_OBJECTcxx . . $ qGoBoard#staticMetaObject. |
| 52 | |
| 53 | public: |
| 54 | qGoBoardcxx . . $ qGoBoard#qGoBoard(29a441517101e16e).(BoardWindowcxx . . $ BoardWindow# *bw, Treecxx . . $ Tree# * t, GameDatacxx . . $ GameData# *gd); |
| 55 | ~cxx . . $ qGoBoard#`~qGoBoard`(ced63f7c635d850d).qGoBoardcxx . . $ qGoBoard#(); |
| 56 | virtual void setHandicapcxx . . $ qGoBoard#setHandicap(d4f767463ce0a6b3).(int handicap); |
| 57 | virtual void addStonecxx . . $ qGoBoard#addStone(e6b2860cd25699f2).(StoneColorcxx . . $ StoneColor# c, int x, int y); |
| 58 | |
| 59 | virtual void addMarkcxx . . $ qGoBoard#addMark(2fb52c50f1893bf2).( int x, int y, MarkTypecxx . . $ MarkType# t ); |
| 60 | virtual void removeMarkcxx . . $ qGoBoard#removeMark(3e454b8ccf442868).( int x, int y); |
| 61 | |
| 62 | // virtual void localMoveRequest(int x, int y)=0; |
| 63 | virtual bool getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).(bool time = false); |
| 64 | virtual void startGamecxx . . $ qGoBoard#startGame(49f6e7a06ebc5aa8).() {} |
| 65 | virtual void stopTimecxx . . $ qGoBoard#stopTime(49f6e7a06ebc5aa8).() {} |
| 66 | virtual void handleMovecxx . . $ qGoBoard#handleMove(d174a3d9cfb0dd75).(class MoveRecordcxx . . $ MoveRecord# *) {} |
| 67 | virtual void moveControlcxx . . $ qGoBoard#moveControl(4c89b026053e4d32).(QStringcxx . . $ QString# &) {} |
| 68 | int getMoveNumbercxx . . $ qGoBoard#getMoveNumber(b126dc7c1de90089).(void); |
| 69 | //virtual void set_havegd(bool b) { have_gameData = b; } |
| 70 | virtual void setModifiedcxx . . $ qGoBoard#setModified(b45ddcbc8423892c).(bool b= true) { isModifiedcxx . . $ qGoBoard#isModified. = b;} |
| 71 | virtual bool getModifiedcxx . . $ qGoBoard#getModified(c9857a73d68e59ba).() { return isModifiedcxx . . $ qGoBoard#isModified.; } |
| 72 | virtual bool getPlaySoundcxx . . $ qGoBoard#getPlaySound(c9857a73d68e59ba).() { return playSoundcxx . . $ qGoBoard#playSound.;} |
| 73 | |
| 74 | virtual void setResultcxx . . $ qGoBoard#setResult(cbc950be3aaaa49b).(class GameResultcxx . . $ GameResult# & ); |
| 75 | virtual void kibitzReceivedcxx . . $ qGoBoard#kibitzReceived(3520e46b33348bf6).(const QStringcxx . . $ QString#& txt); |
| 76 | virtual void setTimerInfocxx . . $ qGoBoard#setTimerInfo(6d8ce341bc76c5ea).(const QStringcxx . . $ QString#&, const QStringcxx . . $ QString#&, const QStringcxx . . $ QString#&, const QStringcxx . . $ QString#&) {} |
| 77 | virtual void timerEventcxx . . $ qGoBoard#timerEvent(b9e57d1150f23bf5).(QTimerEventcxx . . $ QTimerEvent#*); |
| 78 | class TimeRecordcxx . . $ TimeRecord# getOurTimeRecordcxx . . $ qGoBoard#getOurTimeRecord(3d89b73610291578).(void); //awkward |
| 79 | class TimeRecordcxx . . $ TimeRecord# getTheirTimeRecordcxx . . $ qGoBoard#getTheirTimeRecord(3d89b73610291578).(void); |
| 80 | virtual void enterScoreModecxx . . $ qGoBoard#enterScoreMode(49f6e7a06ebc5aa8).(); |
| 81 | virtual void leaveScoreModecxx . . $ qGoBoard#leaveScoreMode(49f6e7a06ebc5aa8).(); |
| 82 | void toggleGroupAtcxx . . $ qGoBoard#toggleGroupAt(3e454b8ccf442868).(int x, int y); |
| 83 | virtual void markDeadStonecxx . . $ qGoBoard#markDeadStone(3e454b8ccf442868).(int x, int y); |
| 84 | virtual void markLiveStonecxx . . $ qGoBoard#markLiveStone(3e454b8ccf442868).(int x, int y); |
| 85 | virtual void markDeadAreacxx . . $ qGoBoard#markDeadArea(3e454b8ccf442868).(int x, int y); |
| 86 | virtual void markLiveAreacxx . . $ qGoBoard#markLiveArea(3e454b8ccf442868).(int x, int y); |
| 87 | |
| 88 | virtual void setNodecxx . . $ qGoBoard#setNode(c8bda843d37178ce).(int , StoneColorcxx . . $ StoneColor# , int , int ) {} |
| 89 | virtual void requestAdjournDialogcxx . . $ qGoBoard#requestAdjournDialog(49f6e7a06ebc5aa8).(void) {} |
| 90 | virtual void requestCountDialogcxx . . $ qGoBoard#requestCountDialog(49f6e7a06ebc5aa8).(void) {} |
| 91 | virtual void requestMatchModeDialogcxx . . $ qGoBoard#requestMatchModeDialog(49f6e7a06ebc5aa8).(void) {} |
| 92 | virtual void requestDrawDialogcxx . . $ qGoBoard#requestDrawDialog(49f6e7a06ebc5aa8).(void) {} |
| 93 | virtual void adjournGamecxx . . $ qGoBoard#adjournGame(49f6e7a06ebc5aa8).(void) {} |
| 94 | virtual void recvRefuseAdjourncxx . . $ qGoBoard#recvRefuseAdjourn(49f6e7a06ebc5aa8).(void) {} |
| 95 | virtual void recvRefuseCountcxx . . $ qGoBoard#recvRefuseCount(49f6e7a06ebc5aa8).(void) {} |
| 96 | virtual void recvRefuseMatchModecxx . . $ qGoBoard#recvRefuseMatchMode(49f6e7a06ebc5aa8).(void) {} |
| 97 | virtual void recvRefuseDrawcxx . . $ qGoBoard#recvRefuseDraw(49f6e7a06ebc5aa8).(void) {} |
| 98 | |
| 99 | // Board |
| 100 | virtual void slotBoardClickedcxx . . $ qGoBoard#slotBoardClicked(916cfd9b6aad83bf).(bool, int, int , Qtcxx . . $ Qt/::MouseButtoncxx . . $ Qt/MouseButton# ); |
| 101 | virtual void passRequestcxx . . $ qGoBoard#passRequest(49f6e7a06ebc5aa8).(); |
| 102 | virtual void slotDonePressedcxx . . $ qGoBoard#slotDonePressed(49f6e7a06ebc5aa8).(); |
| 103 | virtual void slotResignPressedcxx . . $ qGoBoard#slotResignPressed(49f6e7a06ebc5aa8).(); |
| 104 | virtual void slotReviewPressedcxx . . $ qGoBoard#slotReviewPressed(49f6e7a06ebc5aa8).() {} |
| 105 | virtual void slotDrawPressedcxx . . $ qGoBoard#slotDrawPressed(49f6e7a06ebc5aa8).() {} |
| 106 | virtual void slotCountPressedcxx . . $ qGoBoard#slotCountPressed(49f6e7a06ebc5aa8).() {} |
| 107 | virtual void slotUndoPressedcxx . . $ qGoBoard#slotUndoPressed(49f6e7a06ebc5aa8).(); |
| 108 | virtual void slotScoreToggledcxx . . $ qGoBoard#slotScoreToggled(b45ddcbc8423892c).(bool); |
| 109 | virtual void setPlaySoundcxx . . $ qGoBoard#setPlaySound(b45ddcbc8423892c).(bool b) { playSoundcxx . . $ qGoBoard#playSound. = b; } |
| 110 | |
| 111 | protected: |
| 112 | BoardWindowcxx . . $ BoardWindow# *boardwindowcxx . . $ qGoBoard#boardwindow.; |
| 113 | Treecxx . . $ Tree# *treecxx . . $ qGoBoard#tree.; |
| 114 | GameDatacxx . . $ GameData# *gameDatacxx . . $ qGoBoard#gameData.; |
| 115 | Soundcxx . . $ Sound# *clickSoundcxx . . $ qGoBoard#clickSound.; |
| 116 | int boardTimerIdcxx . . $ qGoBoard#boardTimerId.; |
| 117 | |
| 118 | bool isModifiedcxx . . $ qGoBoard#isModified.; |
| 119 | int idcxx . . $ qGoBoard#id.; |
| 120 | int stated_mv_countcxx . . $ qGoBoard#stated_mv_count.; |
| 121 | Movecxx . . $ Move# * lastMoveInGamecxx . . $ qGoBoard#lastMoveInGame.; |
| 122 | bool playSoundcxx . . $ qGoBoard#playSound.; |
| 123 | |
| 124 | /* |
| 125 | * This functions gets the move request (from a board click) |
| 126 | * and displays the resulting stone (if valid) |
| 127 | * The base class implementation is empty because network and local games need completely different hadling. |
| 128 | */ |
| 129 | virtual void localMoveRequestcxx . . $ qGoBoard#localMoveRequest(e6b2860cd25699f2).(StoneColorcxx . . $ StoneColor#, int, int) {} |
| 130 | virtual void localMarkDeadRequestcxx . . $ qGoBoard#localMarkDeadRequest(3e454b8ccf442868).(int x, int y); |
| 131 | virtual void sendMoveToInterfacecxx . . $ qGoBoard#sendMoveToInterface(e6b2860cd25699f2).(StoneColorcxx . . $ StoneColor# ,int, int) {} |
| 132 | virtual Movecxx . . $ Move# *doMovecxx . . $ qGoBoard#doMove(1b9ccd6dde28afc7).(StoneColorcxx . . $ StoneColor#, int, int) { return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; } |
| 133 | virtual void doPasscxx . . $ qGoBoard#doPass(42096433316d3db3).(StoneColorcxx . . $ StoneColor# c = stoneNonecxx . . $ stoneNone.); // By default the player who is on turn will pass |
| 134 | protected: |
| 135 | bool dontCheckValiditycxx . . $ qGoBoard#dontCheckValidity.; |
| 136 | }; |
| 137 | #endif |