| 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 | #ifndef GAMEDATA_H |
| 24 | #define GAMEDATA_H |
| 25 | |
| 26 | #include <QString> |
| 27 | #include "defines.h" |
| 28 | class GameResult; |
| 29 | |
| 30 | class GameData |
| 31 | { |
| 32 | public: |
| 33 | GameData() : |
| 34 | white_name(QObject::tr("White")), |
| 35 | black_name(QObject::tr("Black")), |
| 36 | white_rank(""), |
| 37 | black_rank(""), |
| 38 | number(0), |
| 39 | moves(0), |
| 40 | board_size(19), |
| 41 | handicap(0), |
| 42 | komi(5.5), |
| 43 | timeSystem(canadian), |
| 44 | timelimit(0), |
| 45 | maintime(0), |
| 46 | periodtime(0), |
| 47 | stones_periods(0), |
| 48 | white_prisoners(0), |
| 49 | black_prisoners(0), |
| 50 | result(""), |
| 51 | fullresult(0), |
| 52 | gameMode(modeUndefined), |
| 53 | game_code(0), |
| 54 | nigiriToBeSettled(false), |
| 55 | undoAllowed(false), |
| 56 | oneColorGo(false), |
| 57 | style(1), |
| 58 | date(""), |
| 59 | place(""), |
| 60 | copyright(""), |
| 61 | codec(""), |
| 62 | gameName(""), |
| 63 | fileName(""), |
| 64 | overtime(""), |
| 65 | free_rated(noREQ), |
| 66 | move_list_received(false), |
| 67 | white_first_flag(false), |
| 68 | our_invitation(false), |
| 69 | opponentdropcount(0), |
| 70 | record_sgf("") {}; |
| 71 | GameData(GameData *d) |
| 72 | { |
| 73 | if (d) |
| 74 | { |
| 75 | white_name = d->white_name; |
| 76 | black_name = d->black_name; |
| 77 | white_rank = d->white_rank; |
| 78 | black_rank = d->black_rank; |
| 79 | moves = d->moves; |
| 80 | result = d->result; |
| 81 | fullresult = d->fullresult; |
| 82 | date = d->date; |
| 83 | place = d->place; |
| 84 | copyright = d->copyright; |
| 85 | codec = d->codec; |
| 86 | gameName = d->gameName; |
| 87 | fileName = d->fileName; |
| 88 | overtime = d->overtime; |
| 89 | board_size = d->board_size; |
| 90 | handicap = d->handicap; |
| 91 | number = d->number; |
| 92 | timelimit = d->timelimit; |
| 93 | style = d->style; |
| 94 | komi = d->komi; |
| 95 | free_rated = d->free_rated; |
| 96 | timeSystem = d->timeSystem; |
| 97 | oneColorGo = d->oneColorGo; |
| 98 | maintime = d->maintime; |
| 99 | stones_periods = d->stones_periods; |
| 100 | periodtime = d->periodtime; |
| 101 | white_prisoners = d->white_prisoners; |
| 102 | black_prisoners = d->black_prisoners; |
| 103 | nigiriToBeSettled = d->nigiriToBeSettled; |
| 104 | undoAllowed = d->undoAllowed; |
| 105 | move_list_received = d->move_list_received; |
| 106 | white_first_flag = d->white_first_flag; |
| 107 | our_invitation = d->our_invitation; |
| 108 | opponentdropcount = d->opponentdropcount; |
| 109 | game_code = d->game_code; |
| 110 | gameMode = d->gameMode; |
| 111 | record_sgf = d->record_sgf; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | ~GameData() {}; |
| 116 | |
| 117 | QString white_name; |
| 118 | QString black_name; |
| 119 | QString white_rank; |
| 120 | QString black_rank; |
| 121 | |
| 122 | bool running; |
| 123 | unsigned int number; |
| 124 | unsigned int moves; |
| 125 | unsigned int board_size; |
| 126 | unsigned int handicap; |
| 127 | float komi; |
| 128 | |
| 129 | unsigned int observers; |
| 130 | |
| 131 | TimeSystem timeSystem; |
| 132 | int timelimit; //what is this? |
| 133 | int maintime, periodtime, stones_periods; |
| 134 | unsigned int white_prisoners; |
| 135 | unsigned int white_stones; |
| 136 | QString white_time; |
| 137 | unsigned int black_prisoners; |
| 138 | unsigned int black_stones; |
| 139 | QString black_time; |
| 140 | |
| 141 | QString result; |
| 142 | GameResult * fullresult; |
| 143 | //enum GameType { UNKNOWN, TEACHING, FREE, RANKED, DEMONSTRATION } gameType; |
| 144 | QString By; //these two need to be changed somehow |
| 145 | QString FR; |
| 146 | GameMode gameMode; |
| 147 | |
| 148 | unsigned short game_code; |
| 149 | unsigned short opponent_id; |
| 150 | |
| 151 | bool nigiriToBeSettled; |
| 152 | bool undoAllowed; |
| 153 | bool oneColorGo; |
| 154 | int style; |
| 155 | QString date, place, copyright, codec, gameName, fileName, overtime; |
| 156 | assessType free_rated; |
| 157 | /* We can receive moves in an observed IGS game before receiving |
| 158 | * the board state. But there's another issue with observing |
| 159 | * multiple games that might suggest some other kind of fix */ |
| 160 | bool move_list_received; |
| 161 | //for tygem, I would love to remove but I think we need it |
| 162 | //for time messages and I don't want to pick it off |
| 163 | //the listing since that's possibly less reliable: |
| 164 | bool white_first_flag; |
| 165 | // apparently we also need this, we might later try to simplify this |
| 166 | // or take the one off... |
| 167 | bool our_invitation; |
| 168 | unsigned int opponentdropcount; |
| 169 | QString record_sgf; |
| 170 | }; |
| 171 | |
| 172 | |
| 173 | #endif //GAMEDATA_H |