| 1 | /*********************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2010-2017 Innocent De Marchi <[email protected]> |
| 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 3 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, see <http://www.gnu.org/licenses/>. |
| 17 | * |
| 18 | ***********************************************************************/ |
| 19 | #ifndef MOVIMENT_H |
| 20 | #define MOVIMENT_H |
| 21 | |
| 22 | #include <QUndoCommand> |
| 23 | |
| 24 | class Tauler; |
| 25 | class Fitxa; |
| 26 | |
| 27 | class Moviment : public QUndoCommand |
| 28 | { |
| 29 | Q_GADGET |
| 30 | public: |
| 31 | Moviment(int fitxaInicial, int fitxaBotada, int fitxaFinal, int direccioMoviment, Tauler *taulerJoc); |
| 32 | |
| 33 | |
| 34 | virtual void redo();// moviment Endevant; |
| 35 | virtual void undo(); //moviment Enrrera; |
| 36 | |
| 37 | void fesMoviment(int primera, int segona, int tercera); |
| 38 | |
| 39 | void eliminaFitxesVermelles(); |
| 40 | |
| 41 | /* Quan es fan moviments enrrera/envant |
| 42 | * cal assegurar-se que no hi ha cap moviment |
| 43 | * "marcat" |
| 44 | */ |
| 45 | void eliminaMovimentMarcat(); |
| 46 | |
| 47 | |
| 48 | QString movimentACoordenades(); |
| 49 | /*És per poder seguir el joc amb una solució carregada |
| 50 | * Es pot marcar les fitxes, etc...*/ |
| 51 | void marcaSituacioJoc(); |
| 52 | |
| 53 | private: |
| 54 | int p_fitxaInicial; |
| 55 | int p_fitxaBotada; |
| 56 | int p_fitxaFinal; |
| 57 | int p_direccioMoviment; |
| 58 | Tauler *p_taulerJoc; |
| 59 | }; |
| 60 | |
| 61 | #endif // MOVIMENT_H |